diff --git a/custom_components/battery_notes/__pycache__/discovery.cpython-313.pyc b/custom_components/battery_notes/__pycache__/discovery.cpython-313.pyc index ae9d2b8f..b2c09210 100644 Binary files a/custom_components/battery_notes/__pycache__/discovery.cpython-313.pyc and b/custom_components/battery_notes/__pycache__/discovery.cpython-313.pyc differ diff --git a/custom_components/battery_notes/__pycache__/library.cpython-313.pyc b/custom_components/battery_notes/__pycache__/library.cpython-313.pyc index 2e2047da..fe455ef0 100644 Binary files a/custom_components/battery_notes/__pycache__/library.cpython-313.pyc and b/custom_components/battery_notes/__pycache__/library.cpython-313.pyc differ diff --git a/custom_components/battery_notes/__pycache__/repairs.cpython-313.pyc b/custom_components/battery_notes/__pycache__/repairs.cpython-313.pyc index 043edd74..fac67e51 100644 Binary files a/custom_components/battery_notes/__pycache__/repairs.cpython-313.pyc and b/custom_components/battery_notes/__pycache__/repairs.cpython-313.pyc differ diff --git a/custom_components/battery_notes/__pycache__/store.cpython-313.pyc b/custom_components/battery_notes/__pycache__/store.cpython-313.pyc index e0d6f5e7..e14307c8 100644 Binary files a/custom_components/battery_notes/__pycache__/store.cpython-313.pyc and b/custom_components/battery_notes/__pycache__/store.cpython-313.pyc differ diff --git a/custom_components/battery_notes/data/library.json b/custom_components/battery_notes/data/library.json index d4ce2676..c2afa885 100644 --- a/custom_components/battery_notes/data/library.json +++ b/custom_components/battery_notes/data/library.json @@ -913,11 +913,23 @@ "model_id": "ZNJLBL01LM", "battery_type": "Rechargeable" }, + { + "manufacturer": "Aqara", + "model": "Roller shade driver E1 (ZNJLBL01LM)", + "battery_type": "Rechargeable" + }, { "manufacturer": "Aqara", "model": "RTCGQ11LM", "battery_type": "CR2450" }, + { + "manufacturer": "Aqara", + "model": "SDL-D01", + "hw_version": "1.0.0", + "battery_type": "AA", + "battery_quantity": 4 + }, { "manufacturer": "Aqara", "model": "Smart radiator thermostat E1 (SRTS-A01)", @@ -966,6 +978,11 @@ "model": "Wireless mini switch (WXKG11LM)", "battery_type": "CR2032" }, + { + "manufacturer": "Aqara", + "model": "Wireless mini switch T1 (WXKG13LM)", + "battery_type": "CR2032" + }, { "manufacturer": "Aqara", "model": "Wireless remote switch (double rocker), 2018 model (WXKG02LM_rev2)", @@ -976,6 +993,11 @@ "model": "Wireless remote switch (single rocker), 2018 model (WXKG03LM_rev2)", "battery_type": "CR2032" }, + { + "manufacturer": "Aqara", + "model": "Wireless remote switch D1 (double rocker) (WXKG07LM)", + "battery_type": "CR2032" + }, { "manufacturer": "Aqara", "model": "Wireless remote switch H1 (double rocker) (WXKG15LM)", @@ -1255,6 +1277,11 @@ "battery_type": "AA", "battery_quantity": 4 }, + { + "manufacturer": "BOSCH", + "model": "MD", + "battery_type": "CR123A" + }, { "manufacturer": "Bosch", "model": "Motion sensor (ISW-ZPR1-WP13)", @@ -1281,6 +1308,13 @@ "battery_type": "AA", "battery_quantity": 2 }, + { + "manufacturer": "Bosch", + "model": "Room thermostat II", + "model_id": "RBSH-RTH0-BAT-ZB-EU", + "battery_type": "AAA", + "battery_quantity": 4 + }, { "manufacturer": "Bosch", "model": "Smoke alarm detector (BSD-2)", @@ -1310,6 +1344,11 @@ "battery_type": "AA", "battery_quantity": 2 }, + { + "manufacturer": "by Philio Technology Corp", + "model": "PSP05", + "battery_type": "CR123A" + }, { "manufacturer": "Centralite", "model": "3157100", @@ -1521,6 +1560,12 @@ "model": "MT2756", "battery_type": "CR123A" }, + { + "manufacturer": "Dome", + "model": "Siren", + "battery_type": "CR123A", + "battery_quantity": 2 + }, { "manufacturer": "Doogee", "model": "S98 Pro", @@ -2383,6 +2428,12 @@ "battery_type": "AA", "battery_quantity": 2 }, + { + "manufacturer": "First Alert", + "model": "Smoke Alarm", + "battery_type": "AA", + "battery_quantity": 2 + }, { "manufacturer": "First Alert (BRK Brands Inc)", "model": "ZCOMBO", @@ -2494,6 +2545,12 @@ "battery_type": "AA", "battery_quantity": 4 }, + { + "manufacturer": "GiEX", + "model": "Water valve (GX02)", + "battery_type": "AA", + "battery_quantity": 4 + }, { "manufacturer": "Google", "model": "A12", @@ -2505,6 +2562,12 @@ "model": "KR1", "battery_type": "CR2" }, + { + "manufacturer": "Google", + "model": "Nest Protect", + "battery_type": "AA", + "battery_quantity": 6 + }, { "manufacturer": "Google", "model": "Pixel 2", @@ -2693,6 +2756,11 @@ "model": "Smoke detector (HS3SA/HS1SA)", "battery_type": "CR123A" }, + { + "manufacturer": "Heiman", + "model": "SmokeSensor-EF-3.0", + "battery_type": "CR123A" + }, { "manufacturer": "HEIMAN", "model": "Water leakage sensor (HS1WL/HS3WL)", @@ -2814,6 +2882,12 @@ "battery_type": "AA", "battery_quantity": 12 }, + { + "manufacturer": "Hunter Douglas", + "model": "Designer Roller", + "battery_type": "AA", + "battery_quantity": 12 + }, { "manufacturer": "Hunter Douglas", "model": "Duette", @@ -2825,6 +2899,11 @@ "model": "Duette by Hunter Douglas", "battery_type": "Rechargeable" }, + { + "manufacturer": "Hunter Douglas", + "model": "Silhouette", + "battery_type": "MANUAL" + }, { "manufacturer": "Hunter Douglas", "model": "Vertical Slats, Left Stack", @@ -2924,6 +3003,13 @@ "battery_type": "AAA", "battery_quantity": 2 }, + { + "manufacturer": "IKEA", + "model": "SYMFONISK sound remote, gen 1", + "model_id": "E1744", + "hw_version": "24.4.5", + "battery_type": "CR2032" + }, { "manufacturer": "Ikea", "model": "SYMFONISK Sound remote, gen 2", @@ -2967,13 +3053,19 @@ { "manufacturer": "IKEA", "model": "TRADFRI shortcut button (E1812)", - "battery_type": "CR2450" + "battery_type": "CR2032" }, { "manufacturer": "IKEA", "model": "TRADFRI wireless dimmer (ICTC-G-1)", "battery_type": "CR2032" }, + { + "manufacturer": "IKEA", + "model": "TREDANSEN", + "model_id": "E2103", + "battery_type": "BRAUNIT" + }, { "manufacturer": "Ikea", "model": "TREDANSEN cellular blind (E2103)", @@ -3205,6 +3297,12 @@ "battery_type": "AA", "battery_quantity": 4 }, + { + "manufacturer": "Kwikset", + "model": "910 SmartCode traditional electronic deadbolt (99100-006)", + "battery_type": "AA", + "battery_quantity": 4 + }, { "manufacturer": "Kwikset", "model": "912", @@ -3310,6 +3408,12 @@ "battery_type": "AAA", "battery_quantity": 2 }, + { + "manufacturer": "Lidl", + "model": "Parkside smart watering timer (PSBZS A1)", + "battery_type": "AA", + "battery_quantity": 2 + }, { "manufacturer": "Lidl", "model": "Silvercrest radiator valve with thermostat (368308_2010)", @@ -3326,6 +3430,12 @@ "model": "Silvercrest smart motion sensor (HG06335/HG07310)", "battery_type": "MANUAL" }, + { + "manufacturer": "Lidl", + "model": "Silvercrest smart window and door sensor (HG06336)", + "battery_type": "AAA", + "battery_quantity": 2 + }, { "manufacturer": "LifeControl", "model": "Door sensor (MCLH-04)", @@ -3585,6 +3695,11 @@ "model": "ms100", "battery_type": "CR2477" }, + { + "manufacturer": "Mi", + "model": "MS009", + "battery_type": "CR2540" + }, { "manufacturer": "Mi light sensor", "model": "GZCGQ01LM", @@ -4447,6 +4562,30 @@ "model": "RuuviTag", "battery_type": "CR2477" }, + { + "manufacturer": "SAF Tehnika", + "model": "ARANET2", + "battery_type": "AA", + "battery_quantity": 2 + }, + { + "manufacturer": "SAF Tehnika", + "model": "ARANET4", + "battery_type": "AA", + "battery_quantity": 2 + }, + { + "manufacturer": "SAF Tehnika", + "model": "ARANET_RADIATION", + "battery_type": "AA", + "battery_quantity": 2 + }, + { + "manufacturer": "SAF Tehnika", + "model": "ARANET_RADON", + "battery_type": "AA", + "battery_quantity": 2 + }, { "manufacturer": "Samjin", "model": "button", @@ -5261,6 +5400,12 @@ "battery_quantity": 4, "model_match_method": "startswith" }, + { + "manufacturer": "switchbot", + "model": "Leak Detector", + "battery_type": "AAA", + "battery_quantity": 2 + }, { "manufacturer": "SwitchBot", "model": "Meter", @@ -5422,6 +5567,11 @@ "model": "TP357", "battery_type": "AAA" }, + { + "manufacturer": "ThermoPro", + "model": "TP357S", + "battery_type": "AAA" + }, { "manufacturer": "Third Reality", "model": "3RSB015BZ", @@ -5471,6 +5621,12 @@ "battery_type": "AAA", "battery_quantity": 2 }, + { + "manufacturer": "Third Reality", + "model": "Temperature and humidity sensor lite (3RTHS0224Z)", + "battery_type": "AAA", + "battery_quantity": 2 + }, { "manufacturer": "Third Reality", "model": "Water sensor (3RWS18BZ)", @@ -5575,6 +5731,12 @@ "model": "SmokeSensor-EM", "battery_type": "CR123A" }, + { + "manufacturer": "Trust", + "model": "Wireless contact sensor", + "model_id": "ZCTS-808", + "battery_type": "CR2032" + }, { "manufacturer": "Trust", "model": "ZYCT-202", @@ -6113,6 +6275,12 @@ "model": "TS0044_1", "battery_type": "CR2430" }, + { + "manufacturer": "Tuya", + "model": "TS0044_1", + "battery_type": "AAA", + "battery_quantity": 2 + }, { "manufacturer": "TuYa", "model": "TS0201_1", @@ -6249,6 +6417,13 @@ "battery_type": "AA", "battery_quantity": 2 }, + { + "manufacturer": "Tuya", + "model": "Zigbee 4 button remote - 12 scene (TS0044_1) by Tuya", + "model_id": "TS0044_1", + "battery_type": "AAA", + "battery_quantity": 2 + }, { "manufacturer": "TuYa", "model": "Zigbee fingerbot plus (TS0001_fingerbot)", @@ -6475,6 +6650,12 @@ "battery_type": "CR123A", "battery_quantity": 2 }, + { + "manufacturer": "Withings", + "model": "Smart Body Analyzer", + "battery_type": "AAA", + "battery_quantity": 4 + }, { "manufacturer": "Woox", "model": "Smart garden irrigation control (R7060)", @@ -6722,6 +6903,11 @@ "model": "BTHome sensor", "battery_type": "MANUAL" }, + { + "manufacturer": "Xiaomi", + "model": "CGDK2", + "battery_type": "CR2430" + }, { "manufacturer": "Xiaomi", "model": "DJT11LM", @@ -6877,6 +7063,11 @@ "model": "RTCGQ01LM", "battery_type": "CR2450" }, + { + "manufacturer": "Xiaomi", + "model": "SJWS01LM", + "battery_type": "CR2032" + }, { "manufacturer": "Xiaomi", "model": "SRTS-A01", diff --git a/custom_components/bodymiscale/__pycache__/__init__.cpython-312.pyc b/custom_components/bodymiscale/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 88fecb5b..00000000 Binary files a/custom_components/bodymiscale/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/__pycache__/config_flow.cpython-312.pyc b/custom_components/bodymiscale/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 5137af82..00000000 Binary files a/custom_components/bodymiscale/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/__pycache__/config_flow.cpython-313.pyc b/custom_components/bodymiscale/__pycache__/config_flow.cpython-313.pyc index 24f99378..c73c69a9 100644 Binary files a/custom_components/bodymiscale/__pycache__/config_flow.cpython-313.pyc and b/custom_components/bodymiscale/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/bodymiscale/__pycache__/const.cpython-312.pyc b/custom_components/bodymiscale/__pycache__/const.cpython-312.pyc deleted file mode 100644 index d221ed01..00000000 Binary files a/custom_components/bodymiscale/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/__pycache__/entity.cpython-312.pyc b/custom_components/bodymiscale/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index d270c485..00000000 Binary files a/custom_components/bodymiscale/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/__pycache__/models.cpython-312.pyc b/custom_components/bodymiscale/__pycache__/models.cpython-312.pyc deleted file mode 100644 index 0efe4f57..00000000 Binary files a/custom_components/bodymiscale/__pycache__/models.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/__pycache__/sensor.cpython-312.pyc b/custom_components/bodymiscale/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index d94a5bda..00000000 Binary files a/custom_components/bodymiscale/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/__pycache__/util.cpython-312.pyc b/custom_components/bodymiscale/__pycache__/util.cpython-312.pyc deleted file mode 100644 index 86456203..00000000 Binary files a/custom_components/bodymiscale/__pycache__/util.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/metrics/__pycache__/__init__.cpython-312.pyc b/custom_components/bodymiscale/metrics/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index e2567190..00000000 Binary files a/custom_components/bodymiscale/metrics/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/metrics/__pycache__/__init__.cpython-313.pyc b/custom_components/bodymiscale/metrics/__pycache__/__init__.cpython-313.pyc index c72f9134..ab66cbfc 100644 Binary files a/custom_components/bodymiscale/metrics/__pycache__/__init__.cpython-313.pyc and b/custom_components/bodymiscale/metrics/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/bodymiscale/metrics/__pycache__/body_score.cpython-312.pyc b/custom_components/bodymiscale/metrics/__pycache__/body_score.cpython-312.pyc deleted file mode 100644 index bf0a604e..00000000 Binary files a/custom_components/bodymiscale/metrics/__pycache__/body_score.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/metrics/__pycache__/impedance.cpython-312.pyc b/custom_components/bodymiscale/metrics/__pycache__/impedance.cpython-312.pyc deleted file mode 100644 index 0ffdda87..00000000 Binary files a/custom_components/bodymiscale/metrics/__pycache__/impedance.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/metrics/__pycache__/scale.cpython-312.pyc b/custom_components/bodymiscale/metrics/__pycache__/scale.cpython-312.pyc deleted file mode 100644 index 76b5ce21..00000000 Binary files a/custom_components/bodymiscale/metrics/__pycache__/scale.cpython-312.pyc and /dev/null differ diff --git a/custom_components/bodymiscale/metrics/__pycache__/weight.cpython-312.pyc b/custom_components/bodymiscale/metrics/__pycache__/weight.cpython-312.pyc deleted file mode 100644 index 6b7de7e6..00000000 Binary files a/custom_components/bodymiscale/metrics/__pycache__/weight.cpython-312.pyc and /dev/null differ diff --git a/custom_components/delete/__pycache__/__init__.cpython-312.pyc b/custom_components/delete/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index fa92b3bc..00000000 Binary files a/custom_components/delete/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/elkbledom/__init__.py b/custom_components/elkbledom/__init__.py index 8faa6bf8..4be1220d 100644 --- a/custom_components/elkbledom/__init__.py +++ b/custom_components/elkbledom/__init__.py @@ -35,8 +35,9 @@ async def _async_stop(event: Event) -> None: entry.async_on_unload( hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_stop) ) + return True - + async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) diff --git a/custom_components/elkbledom/__pycache__/__init__.cpython-312.pyc b/custom_components/elkbledom/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 27e88e7d..00000000 Binary files a/custom_components/elkbledom/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/elkbledom/__pycache__/__init__.cpython-313.pyc b/custom_components/elkbledom/__pycache__/__init__.cpython-313.pyc index 880a54a9..80986ee8 100644 Binary files a/custom_components/elkbledom/__pycache__/__init__.cpython-313.pyc and b/custom_components/elkbledom/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/elkbledom/__pycache__/config_flow.cpython-312.pyc b/custom_components/elkbledom/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 8db664b9..00000000 Binary files a/custom_components/elkbledom/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/elkbledom/__pycache__/config_flow.cpython-313.pyc b/custom_components/elkbledom/__pycache__/config_flow.cpython-313.pyc index 002e2723..7046c79c 100644 Binary files a/custom_components/elkbledom/__pycache__/config_flow.cpython-313.pyc and b/custom_components/elkbledom/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/elkbledom/__pycache__/const.cpython-312.pyc b/custom_components/elkbledom/__pycache__/const.cpython-312.pyc deleted file mode 100644 index db39dd6d..00000000 Binary files a/custom_components/elkbledom/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/elkbledom/__pycache__/const.cpython-313.pyc b/custom_components/elkbledom/__pycache__/const.cpython-313.pyc index 4aaaa46d..db5ba8fb 100644 Binary files a/custom_components/elkbledom/__pycache__/const.cpython-313.pyc and b/custom_components/elkbledom/__pycache__/const.cpython-313.pyc differ diff --git a/custom_components/elkbledom/__pycache__/elkbledom.cpython-312.pyc b/custom_components/elkbledom/__pycache__/elkbledom.cpython-312.pyc deleted file mode 100644 index 71d123ed..00000000 Binary files a/custom_components/elkbledom/__pycache__/elkbledom.cpython-312.pyc and /dev/null differ diff --git a/custom_components/elkbledom/__pycache__/elkbledom.cpython-313.pyc b/custom_components/elkbledom/__pycache__/elkbledom.cpython-313.pyc index 29b389a4..69d6db10 100644 Binary files a/custom_components/elkbledom/__pycache__/elkbledom.cpython-313.pyc and b/custom_components/elkbledom/__pycache__/elkbledom.cpython-313.pyc differ diff --git a/custom_components/elkbledom/__pycache__/light.cpython-312.pyc b/custom_components/elkbledom/__pycache__/light.cpython-312.pyc deleted file mode 100644 index 6d653535..00000000 Binary files a/custom_components/elkbledom/__pycache__/light.cpython-312.pyc and /dev/null differ diff --git a/custom_components/elkbledom/__pycache__/light.cpython-313.pyc b/custom_components/elkbledom/__pycache__/light.cpython-313.pyc index 0b8610e6..7b1cca51 100644 Binary files a/custom_components/elkbledom/__pycache__/light.cpython-313.pyc and b/custom_components/elkbledom/__pycache__/light.cpython-313.pyc differ diff --git a/custom_components/elkbledom/__pycache__/number.cpython-312.pyc b/custom_components/elkbledom/__pycache__/number.cpython-312.pyc deleted file mode 100644 index aaaa8d6c..00000000 Binary files a/custom_components/elkbledom/__pycache__/number.cpython-312.pyc and /dev/null differ diff --git a/custom_components/elkbledom/__pycache__/number.cpython-313.pyc b/custom_components/elkbledom/__pycache__/number.cpython-313.pyc index 04d77f00..1bfee568 100644 Binary files a/custom_components/elkbledom/__pycache__/number.cpython-313.pyc and b/custom_components/elkbledom/__pycache__/number.cpython-313.pyc differ diff --git a/custom_components/elkbledom/elkbledom.py b/custom_components/elkbledom/elkbledom.py index 39993205..d0320aad 100644 --- a/custom_components/elkbledom/elkbledom.py +++ b/custom_components/elkbledom/elkbledom.py @@ -1,6 +1,5 @@ import asyncio from datetime import datetime -from homeassistant.components import bluetooth from homeassistant.exceptions import ConfigEntryNotReady from bleak.backends.device import BLEDevice @@ -67,25 +66,31 @@ NAME_ARRAY = ["ELK-BLE", "LEDBLE", "MELK", - "ELK-BULB"] + "ELK-BULB", + "ELK-LAMPL"] WRITE_CHARACTERISTIC_UUIDS = ["0000fff3-0000-1000-8000-00805f9b34fb", "0000ffe1-0000-1000-8000-00805f9b34fb", "0000fff3-0000-1000-8000-00805f9b34fb", + "0000fff3-0000-1000-8000-00805f9b34fb", "0000fff3-0000-1000-8000-00805f9b34fb"] READ_CHARACTERISTIC_UUIDS = ["0000fff4-0000-1000-8000-00805f9b34fb", "0000ffe2-0000-1000-8000-00805f9b34fb", "0000fff4-0000-1000-8000-00805f9b34fb", + "0000fff4-0000-1000-8000-00805f9b34fb", "0000fff4-0000-1000-8000-00805f9b34fb"] TURN_ON_CMD = [[0x7e, 0x00, 0x04, 0xf0, 0x00, 0x01, 0xff, 0x00, 0xef], + [0x7e, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0xef], [0x7e, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0xef], [0x7e, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0xef], [0x7e, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0xef]] TURN_OFF_CMD = [[0x7e, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef], + [0x7e, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef], [0x7e, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef], [0x7e, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef], [0x7e, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef]] -MIN_COLOR_TEMPS_K = [2700,2700,2700,2700] -MAX_COLOR_TEMPS_K = [6500,6500,6500,6500] + +MIN_COLOR_TEMPS_K = [2700,2700,2700,2700,2700] +MAX_COLOR_TEMPS_K = [6500,6500,6500,6500,6500] DEFAULT_ATTEMPTS = 3 #DISCONNECT_DELAY = 120 @@ -132,7 +137,7 @@ async def _async_wrap_retry_bluetooth_connection_error( class DeviceData(): def __init__(self, hass, discovery_info): self._discovery = discovery_info - self._supported = self._discovery.name.lower().startswith("elk-ble") or self._discovery.name.lower().startswith("elk-bulb") or self._discovery.name.lower().startswith("ledble") or self._discovery.name.lower().startswith("melk") + self._supported = any(self._discovery.name.lower().startswith(option.lower()) for option in NAME_ARRAY) self._address = self._discovery.address self._name = self._discovery.name self._rssi = self._discovery.rssi @@ -150,20 +155,6 @@ def __init__(self, hass, discovery_info): # if not self._bledevice: # raise ConfigEntryNotReady(f"You need to add bluetooth integration (https://www.home-assistant.io/integrations/bluetooth) or couldn't find a nearby device with address: {address}") - - # def __init__(self, *args): - # if isinstance(args[0], BluetoothServiceInfoBleak): - # self._discovery = args[0] - # self._supported = self._discovery.name.lower().startswith("elk-ble") or self._discovery.name.lower().startswith("elk-bulb") or self._discovery.name.lower().startswith("ledble") or self._discovery.name.lower().startswith("melk") - # self.address = self._discovery.address - # self.name = self._discovery.name - # self.rssi = self._discovery.rssi - # else: - # self._supported = args[0] - # self.address = args[1] - # self.name = args[2] - # self.rssi = args[3] - @property def is_supported(self) -> bool: return self._supported @@ -475,9 +466,12 @@ async def _ensure_connected(self) -> None: #login commands await self._login_command() - if not self._device.name.lower().startswith("melk"): - LOGGER.debug("%s: Subscribe to notifications; RSSI: %s", self.name, self.rssi) - await client.start_notify(self._read_uuid, self._notification_handler) + try: + if not self._device.name.lower().startswith("melk") and not self._device.name.lower().startswith("ledble"): + LOGGER.debug("%s: Subscribe to notifications; RSSI: %s", self.name, self.rssi) + await client.start_notify(self._read_uuid, self._notification_handler) + except Exception as e: + LOGGER.error("Error during connection: %s", e) async def _login_command(self): try: @@ -564,8 +558,6 @@ async def _execute_timed_disconnect(self) -> None: self._delay, ) await self._execute_disconnect() - - async def _execute_disconnect(self) -> None: """Execute disconnection.""" async with self._connect_lock: @@ -578,8 +570,8 @@ async def _execute_disconnect(self) -> None: self._read_uuid = None if client and client.is_connected: try: - if not self._device.name.lower().startswith("melk"): + if not self._device.name.lower().startswith("melk") and not self._device.name.lower().startswith("ledble"): await client.stop_notify(read_char) await client.disconnect() except Exception as e: - LOGGER.error("Error during disconnection: %s", e) + LOGGER.error("Error during disconnection: %s", e) \ No newline at end of file diff --git a/custom_components/elkbledom/light.py b/custom_components/elkbledom/light.py index 7e16c02b..b3e36f31 100644 --- a/custom_components/elkbledom/light.py +++ b/custom_components/elkbledom/light.py @@ -8,7 +8,7 @@ from .const import DOMAIN, EFFECTS, EFFECTS_list from homeassistant.const import CONF_MAC -import homeassistant.helpers.config_validation as cv +from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity import DeviceInfo from homeassistant.components.light import ( PLATFORM_SCHEMA, diff --git a/custom_components/elkbledom/manifest.json b/custom_components/elkbledom/manifest.json index 6854cb5e..9802ce9b 100644 --- a/custom_components/elkbledom/manifest.json +++ b/custom_components/elkbledom/manifest.json @@ -5,7 +5,8 @@ { "local_name": "ELK-BULB*" }, { "local_name": "ELK-BLE*" }, { "local_name": "MELK*" }, - { "local_name": "LEDBLE*" } + { "local_name": "LEDBLE*" }, + { "local_name": "ELK-LAMPL*" } ], "codeowners": ["@dave-code-ruiz"], "config_flow": true, @@ -13,6 +14,6 @@ "documentation": "https://github.com/dave-code-ruiz/elkbledom", "iot_class": "local_polling", "issue_tracker": "https://github.com/dave-code-ruiz/elkbledom/issues", - "requirements": ["bleak-retry-connector>=1.17.1","bleak>=0.17.0"], - "version": "1.0.2" + "requirements": ["bleak-retry-connector>=3.5.0","bleak>=0.22.2"], + "version": "1.2.2" } \ No newline at end of file diff --git a/custom_components/elkbledom/translations/en.json b/custom_components/elkbledom/translations/en.json index c12a5342..b1143ff2 100644 --- a/custom_components/elkbledom/translations/en.json +++ b/custom_components/elkbledom/translations/en.json @@ -28,7 +28,9 @@ }, "abort": { "cannot_validate": "Unable to validate Elkbledom light", - "cannot_connect": "Unable to connect to Elkbledom" + "cannot_connect": "Unable to connect to Elkbledom", + "not_supported": "Elkbledom light not supported", + "invalid_discovery_info": "Invalid discovery info in bluetooth device" } }, "options": { diff --git a/custom_components/elkbledom/translations/es.json b/custom_components/elkbledom/translations/es.json index 8cfe34a0..af044e0f 100644 --- a/custom_components/elkbledom/translations/es.json +++ b/custom_components/elkbledom/translations/es.json @@ -28,7 +28,9 @@ }, "abort": { "cannot_validate": "No se puede validar la conexión", - "cannot_connect": "No se puede conectar con la tira led" + "cannot_connect": "No se puede conectar con la tira led", + "not_supported": "Tira led no soportada", + "invalid_discovery_info": "No se encuentra información de la tira led" } }, "options": { diff --git a/custom_components/elkbledom/translations/fr.json b/custom_components/elkbledom/translations/fr.json index 5bd092de..bd871572 100644 --- a/custom_components/elkbledom/translations/fr.json +++ b/custom_components/elkbledom/translations/fr.json @@ -28,7 +28,9 @@ }, "abort": { "cannot_validate": "Echec de validation de la lumi?re Elkbledom", - "cannot_connect": "Echec de la connexion ? Elkbledom" + "cannot_connect": "Echec de la connexion ? Elkbledom", + "not_supported": "La lumi?re ElkBledom n'est pas prise en charge", + "invalid_discovery_info": "Informations de d?couverte non valides sur le p?riph?rique Bluetooth" } }, "options": { diff --git a/custom_components/elkbledom/translations/pl.json b/custom_components/elkbledom/translations/pl.json index f5a53922..3404013a 100644 --- a/custom_components/elkbledom/translations/pl.json +++ b/custom_components/elkbledom/translations/pl.json @@ -28,7 +28,9 @@ }, "abort": { "cannot_validate": "Nie można zweryfikować światła Elkbledom", - "cannot_connect": "Nie można połączyć się ze światłem Elkbledom" + "cannot_connect": "Nie można połączyć się ze światłem Elkbledom", + "not_supported": "wiato ElkBledom nie jest obsugiwane", + "invalid_discovery_info": "Nieprawidowe informacje o odkryciu w urzdzeniu Bluetooth" } }, "options": { diff --git a/custom_components/elkbledom/translations/sk.json b/custom_components/elkbledom/translations/sk.json index 02056bd6..5e76bb38 100644 --- a/custom_components/elkbledom/translations/sk.json +++ b/custom_components/elkbledom/translations/sk.json @@ -28,7 +28,9 @@ }, "abort": { "cannot_validate": "Nie je možné overiť Elkbledom light", - "cannot_connect": "Nedá sa pripojiť k Elbledom" + "cannot_connect": "Nedá sa pripojiť k Elbledom", + "not_supported": "Svetlo Elk Bledom nie je podporovane", + "invalid_discovery_info": "Neplatne informacie o objaveni v zariadeni bluetooth" } }, "options": { diff --git a/custom_components/elkbledom/translations/tr.json b/custom_components/elkbledom/translations/tr.json index f3554225..00948699 100644 --- a/custom_components/elkbledom/translations/tr.json +++ b/custom_components/elkbledom/translations/tr.json @@ -28,7 +28,9 @@ }, "abort": { "cannot_validate": "Elkbledom ışığı doğrulanamıyor", - "cannot_connect": "Elkbledom'a bağlanılamıyor" + "cannot_connect": "Elkbledom'a bağlanılamıyor", + "not_supported": "ElkBledom ???? desteklenmiyor", + "invalid_discovery_info": "Bluetooth aygtnda geersiz keif bilgisi" } }, "options": { diff --git a/custom_components/ember_mug/__init__.py b/custom_components/ember_mug/__init__.py deleted file mode 100644 index b9138cf6..00000000 --- a/custom_components/ember_mug/__init__.py +++ /dev/null @@ -1,179 +0,0 @@ -"""Ember Mug Custom Integration.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING - -from ember_mug import EmberMug -from ember_mug.consts import EMBER_BLE_SIG -from ember_mug.utils import get_model_info_from_advertiser_data -from homeassistant.components import bluetooth -from homeassistant.components.bluetooth import ( - BluetoothCallbackMatcher, - BluetoothScanningMode, -) -from homeassistant.const import ( - CONF_ADDRESS, - CONF_MAC, - CONF_NAME, - EVENT_HOMEASSISTANT_STOP, - Platform, -) -from homeassistant.exceptions import ConfigEntryNotReady - -from .const import CONF_DEBUG, CONFIG_VERSION, DOMAIN -from .coordinator import MugDataUpdateCoordinator - -if TYPE_CHECKING: - from home_assistant_bluetooth import BluetoothServiceInfoBleak - from homeassistant.config_entries import ConfigEntry - from homeassistant.core import Event, HomeAssistant - - -type EmberMugConfigEntry = ConfigEntry[MugDataUpdateCoordinator] - - -PLATFORMS = [ - Platform.BINARY_SENSOR, - Platform.LIGHT, - Platform.NUMBER, - Platform.SELECT, - Platform.SENSOR, - Platform.SWITCH, - Platform.TEXT, -] -_LOGGER = logging.getLogger(__name__) - - -async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: - """Set up Mug Platform.""" - address: str = entry.data[CONF_ADDRESS].upper() - service_info = bluetooth.async_last_service_info(hass, address, connectable=True) - - if service_info and not service_info.manufacturer_data: - _LOGGER.debug("Manufacturer data missing from latest advertisement, looking again.") - try: - service_info = await bluetooth.async_process_advertisements( - hass, - _process_more_advertisements, - {"address": address, "connectable": True}, - BluetoothScanningMode.ACTIVE, - 30, - ) - except TimeoutError as e: - raise ConfigEntryNotReady( - f"Could not find device with manufacturer data and address {address}. " - "If you have issues connecting, try putting the device in pairing mode.", - ) from e - - if not service_info: - raise ConfigEntryNotReady( - f"Could not find Ember device with address {entry.data[CONF_ADDRESS]}", - ) - - _LOGGER.debug( - "Integration setup. Last service info: Device: %s, Manufacturer Data: %s", - service_info.device, - service_info.manufacturer_data, - ) - - ember_mug = EmberMug( - service_info.device, - model_info=get_model_info_from_advertiser_data(service_info.advertisement), - debug=entry.options.get(CONF_DEBUG, False), - ) - mug_coordinator = MugDataUpdateCoordinator( - hass, - _LOGGER, - ember_mug, - entry.unique_id, - entry.data.get(CONF_NAME, entry.title), - ) - entry.async_on_unload( - bluetooth.async_register_callback( - hass, - mug_coordinator.handle_bluetooth_event, - BluetoothCallbackMatcher( - address=address, - connectable=True, - manufacturer_id=EMBER_BLE_SIG, - ), - BluetoothScanningMode.ACTIVE, - ), - ) - - await mug_coordinator.async_config_entry_first_refresh() - - entry.async_on_unload( - bluetooth.async_track_unavailable( - hass, - mug_coordinator.handle_unavailable, - address, - ), - ) - - entry.runtime_data = mug_coordinator - entry.async_on_unload(entry.add_update_listener(async_update_listener)) - await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) - - async def _async_stop(event: Event) -> None: - """Close the connection.""" - await mug_coordinator.mug.disconnect() - - entry.async_on_unload( - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _async_stop), - ) - - return True - - -def _process_more_advertisements( - service_info: BluetoothServiceInfoBleak, -) -> bool: - """Wait for an advertisement with Ember SIG in the manufacturer_data.""" - return EMBER_BLE_SIG in service_info.manufacturer_data - - -async def async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None: - """Handle options update.""" - await hass.config_entries.async_reload(entry.entry_id) - - -async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry): - """Migrate old entry.""" - _LOGGER.debug("Migrating from version %s", config_entry.version) - - if config_entry.version >= CONFIG_VERSION: - # No migrations to run - return False - - old_data = {**config_entry.data} - if config_entry.version == 1: - old_data[CONF_ADDRESS] = old_data[CONF_MAC] - - hass.config_entries.async_update_entry( - config_entry, - data={ - CONF_ADDRESS: old_data[CONF_ADDRESS], - CONF_NAME: old_data[CONF_NAME], - }, - options={ - CONF_DEBUG: old_data.get(CONF_DEBUG, False), - }, - version=3, - ) - _LOGGER.info("Migration to version %s successful", config_entry.version) - return True - - -async def async_unload_entry(hass: HomeAssistant, entry: EmberMugConfigEntry) -> bool: - """Unload a config entry.""" - unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) - if unload_ok: - mug_coordinator = entry.runtime_data - await mug_coordinator.mug.disconnect() - if not hass.config_entries.async_entries(DOMAIN): - hass.data.pop(DOMAIN) - - return unload_ok diff --git a/custom_components/ember_mug/__pycache__/__init__.cpython-313.pyc b/custom_components/ember_mug/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 83102afb..00000000 Binary files a/custom_components/ember_mug/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/custom_components/ember_mug/__pycache__/config_flow.cpython-313.pyc b/custom_components/ember_mug/__pycache__/config_flow.cpython-313.pyc deleted file mode 100644 index d523bf35..00000000 Binary files a/custom_components/ember_mug/__pycache__/config_flow.cpython-313.pyc and /dev/null differ diff --git a/custom_components/ember_mug/__pycache__/const.cpython-313.pyc b/custom_components/ember_mug/__pycache__/const.cpython-313.pyc deleted file mode 100644 index 6c5fba6b..00000000 Binary files a/custom_components/ember_mug/__pycache__/const.cpython-313.pyc and /dev/null differ diff --git a/custom_components/ember_mug/__pycache__/coordinator.cpython-313.pyc b/custom_components/ember_mug/__pycache__/coordinator.cpython-313.pyc deleted file mode 100644 index 38748fe3..00000000 Binary files a/custom_components/ember_mug/__pycache__/coordinator.cpython-313.pyc and /dev/null differ diff --git a/custom_components/ember_mug/binary_sensor.py b/custom_components/ember_mug/binary_sensor.py deleted file mode 100644 index a2e3d7f0..00000000 --- a/custom_components/ember_mug/binary_sensor.py +++ /dev/null @@ -1,95 +0,0 @@ -"""Binary Sensor Entity for Ember Mug.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING - -from ember_mug.consts import LiquidState -from homeassistant.components.binary_sensor import ( - BinarySensorDeviceClass, - BinarySensorEntity, - BinarySensorEntityDescription, -) -from homeassistant.const import EntityCategory - -from .entity import BaseMugEntity - -if TYPE_CHECKING: - from homeassistant.core import HomeAssistant - from homeassistant.helpers.entity_platform import AddEntitiesCallback - - from . import EmberMugConfigEntry - from .coordinator import MugDataUpdateCoordinator - - -_LOGGER = logging.getLogger(__name__) - -SENSOR_TYPES = { - "battery.on_charging_base": BinarySensorEntityDescription( - key="power", - device_class=BinarySensorDeviceClass.PLUG, - entity_category=EntityCategory.DIAGNOSTIC, - ), - "battery.percent": BinarySensorEntityDescription( - key="low_battery", - device_class=BinarySensorDeviceClass.BATTERY, - entity_category=EntityCategory.DIAGNOSTIC, - ), -} - - -class MugBinarySensor(BaseMugEntity, BinarySensorEntity): - """Base Entity for Mug Binary Sensors.""" - - _domain = "binary_sensor" - - def __init__( - self, - coordinator: MugDataUpdateCoordinator, - device_attr: str, - ) -> None: - """Initialize the Mug sensor.""" - self.entity_description = SENSOR_TYPES[device_attr] - super().__init__(coordinator, device_attr) - - @property - def is_on(self) -> bool | None: - """Return mug attribute as binary state.""" - return self.coordinator.get_device_attr(self._device_attr) - - -class MugLowBatteryBinarySensor(MugBinarySensor): - """Warn about low battery.""" - - @property - def is_on(self) -> bool | None: - """Return "on" if battery is low.""" - battery_percent = self.coordinator.get_device_attr(self._device_attr) - if battery_percent is None: - return None - if battery_percent > 25: - # Even if heating, it is not low yet. - return False - state = self.coordinator.get_device_attr("liquid_state") - # If heating or at target temperature the battery will discharge faster. - if state in (LiquidState.HEATING, LiquidState.TARGET_TEMPERATURE): - return True - return bool(battery_percent < 15) - - -async def async_setup_entry( - hass: HomeAssistant, - entry: EmberMugConfigEntry, - async_add_entities: AddEntitiesCallback, -) -> None: - """Set up Binary Sensor Entities.""" - if entry.entry_id is None: - raise ValueError("Missing Entry ID") - coordinator = entry.runtime_data - async_add_entities( - [ - MugBinarySensor(coordinator, "battery.on_charging_base"), - MugLowBatteryBinarySensor(coordinator, "battery.percent"), - ], - ) diff --git a/custom_components/ember_mug/config_flow.py b/custom_components/ember_mug/config_flow.py deleted file mode 100644 index b4b69ddb..00000000 --- a/custom_components/ember_mug/config_flow.py +++ /dev/null @@ -1,191 +0,0 @@ -"""Add Config Flow for Ember Mug.""" - -from __future__ import annotations - -import contextlib -from typing import TYPE_CHECKING, Any - -import voluptuous as vol -from bleak import BleakClient, BleakError -from ember_mug.consts import DEVICE_SERVICE_UUIDS -from homeassistant import config_entries -from homeassistant.components.bluetooth import async_discovered_service_info -from homeassistant.const import CONF_ADDRESS, CONF_NAME, UnitOfTemperature -from homeassistant.core import callback -from homeassistant.helpers import config_validation as cv -from homeassistant.helpers import selector -from homeassistant.util.unit_conversion import TemperatureConverter - -from . import _LOGGER -from .const import ( - CONF_DEBUG, - CONF_PRESETS, - CONF_PRESETS_UNIT, - CONFIG_VERSION, - DEFAULT_PRESETS, - DOMAIN, - MAX_TEMP_CELSIUS, - MIN_TEMP_CELSIUS, -) - -if TYPE_CHECKING: - from homeassistant.components.bluetooth import BluetoothServiceInfoBleak - from homeassistant.data_entry_flow import FlowResult - - -class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): - """Config Flow for Ember Mug.""" - - VERSION = CONFIG_VERSION - - def __init__(self) -> None: - """Initialize the config flow.""" - self._discovery_info: BluetoothServiceInfoBleak | None = None - - async def async_step_bluetooth( - self, - discovery_info: BluetoothServiceInfoBleak, - ) -> FlowResult: - """Handle the bluetooth discovery step.""" - _LOGGER.debug("Discovered bluetooth device: %s", discovery_info) - await self.async_set_unique_id(discovery_info.address.replace(":", "").lower()) - self._abort_if_unique_id_configured() - - self._discovery_info = discovery_info - self.context["title_placeholders"] = { - CONF_NAME: discovery_info.name, - CONF_ADDRESS: discovery_info.address, - } - return await self.async_step_user() - - async def async_step_user( - self, - user_input: dict[str, Any] | None = None, - ) -> FlowResult: - """First step for users.""" - errors: dict[str, str] = {} - if user_input: - address = user_input[CONF_ADDRESS] - await self.async_set_unique_id( - address.replace(":", "").lower(), - raise_on_progress=False, - ) - self._abort_if_unique_id_configured() - return self.async_create_entry(title=user_input[CONF_NAME], data=user_input) - - if not self._discovery_info: - current_addresses = self._async_current_ids() - for service_info in async_discovered_service_info(self.hass): - address = service_info.address - unique_id = address.replace(":", "").lower() - if unique_id in current_addresses: - _LOGGER.debug("Skipping device %s which is already setup", service_info.address) - continue - if not set(service_info.service_uuids).intersection(DEVICE_SERVICE_UUIDS) and ( - not service_info.name or not service_info.name.startswith("Ember") - ): - _LOGGER.debug( - "Skipping unrelated device %s with services: %s", - service_info.name, - service_info.service_uuids, - ) - continue - try: - async with BleakClient(service_info.device) as client: - await client.connect() - with contextlib.suppress(BleakError, EOFError): - # An error will be raised if already paired - await client.pair() - except BleakError: - self.async_abort(reason="cannot_connect") - self._discovery_info = service_info - break - else: - return self.async_abort(reason="no_new_devices") - - name = self._discovery_info.name - data_schema = vol.Schema( - { - vol.Required(CONF_ADDRESS): vol.In( - { - self._discovery_info.address: f"{name} ({self._discovery_info.address})", - }, - ), - vol.Required(CONF_NAME, default=name): str, - }, - ) - return self.async_show_form( - step_id="user", - data_schema=data_schema, - errors=errors, - ) - - @staticmethod - @callback - def async_get_options_flow( - config_entry: config_entries.ConfigEntry, - ) -> config_entries.OptionsFlow: - """Create the options flow.""" - return OptionsFlowHandler(config_entry) - - -class OptionsFlowHandler(config_entries.OptionsFlow): - """Allows users to configure integration after setup.""" - - def __init__(self, config_entry: config_entries.ConfigEntry) -> None: - """Initialize options flow.""" - self.config_entry = config_entry - - async def async_step_init( - self, - user_input: dict[str, Any] | None = None, - ) -> FlowResult: - """Manage the options.""" - errors: dict[str, str] = {} - presets_default = self.config_entry.options.get(CONF_PRESETS, DEFAULT_PRESETS) - - if user_input is not None: - min_temp, max_temp = MIN_TEMP_CELSIUS, MAX_TEMP_CELSIUS - if user_input[CONF_PRESETS_UNIT] == UnitOfTemperature.FAHRENHEIT: - min_temp, max_temp = ( - TemperatureConverter.convert(t, UnitOfTemperature.CELSIUS, UnitOfTemperature.FAHRENHEIT) - for t in [MIN_TEMP_CELSIUS, MAX_TEMP_CELSIUS] - ) - if presets := user_input[CONF_PRESETS]: - schema = vol.Schema( - { - str: vol.All( - vol.Union(float, int), - vol.Any(vol.Literal(0), vol.Range(min=min_temp, max=max_temp)), - ), - }, - ) - try: - schema(presets) - except (vol.Invalid, vol.MultipleInvalid) as e: - errors[CONF_PRESETS] = str(e) - # Use as default to avoid clearing the field on the user they can cancel if confused - presets_default = presets - else: - _LOGGER.debug("Got updated options: %s", user_input) - return self.async_create_entry(title="", data=user_input) - - return self.async_show_form( - step_id="init", - data_schema=vol.Schema( - { - vol.Required( - CONF_PRESETS_UNIT, - default=self.config_entry.options.get(CONF_PRESETS_UNIT, UnitOfTemperature.CELSIUS), - ): vol.In( - [UnitOfTemperature.CELSIUS, UnitOfTemperature.FAHRENHEIT], - ), - vol.Required( - CONF_PRESETS, - default=presets_default, - ): selector.ObjectSelector(), - vol.Optional(CONF_DEBUG, default=self.config_entry.options.get(CONF_DEBUG, False)): cv.boolean, - }, - ), - errors=errors, - ) diff --git a/custom_components/ember_mug/const.py b/custom_components/ember_mug/const.py deleted file mode 100644 index 5802c553..00000000 --- a/custom_components/ember_mug/const.py +++ /dev/null @@ -1,67 +0,0 @@ -"""Constants used for mug.""" - -from enum import StrEnum -from typing import Final - -from ember_mug.consts import LiquidState - -DOMAIN: Final[str] = "ember_mug" -MANUFACTURER: Final[str] = "Ember" -SUGGESTED_AREA: Final[str] = "Kitchen" -STORAGE_VERSION = 1 -CONFIG_VERSION = 3 - -ICON_DEFAULT = "mdi:coffee" -ICON_EMPTY = "mdi:coffee-outline" -ICON_UNAVAILABLE = "mdi:coffee-off-outline" - -ATTR_BATTERY_VOLTAGE = "battery_voltage" -CONF_DEBUG = "debug" -CONF_PRESETS = "presets" -CONF_PRESETS_UNIT = "presets_unit" - -MIN_TEMP_CELSIUS: Final[float] = 48.8 -MAX_TEMP_CELSIUS: Final[float] = 63 - -DEFAULT_PRESETS = { - "latte": 55, - "cappuccino": 56, - "coffee": 57, - "black-tea": 58.5, - "green-tea": 59, -} - - -class LiquidStateValue(StrEnum): - """Options for liquid state.""" - - STANDBY = "standby" - EMPTY = "empty" - FILLING = "filling" - COLD_NO_CONTROL = "cold_no_control" - COOLING = "cooling" - HEATING = "heating" - PERFECT = "perfect" - WARM_NO_CONTROL = "warm_no_control" - - -LIQUID_STATE_OPTIONS = list(LiquidStateValue) -LIQUID_STATE_TEMP_ICONS = { - None: "thermometer-off", - LiquidState.STANDBY: "thermometer-off", - LiquidState.COLD_NO_TEMP_CONTROL: "thermometer-low", - LiquidState.COOLING: "thermometer-chevron-down", - LiquidState.HEATING: "thermometer-chevron-up", - LiquidState.WARM_NO_TEMP_CONTROL: "thermometer-high", -} - -LIQUID_STATE_MAPPING = { - LiquidState.EMPTY: LiquidStateValue.EMPTY, - LiquidState.FILLING: LiquidStateValue.FILLING, - LiquidState.COLD_NO_TEMP_CONTROL: LiquidStateValue.COLD_NO_CONTROL, - LiquidState.COOLING: LiquidStateValue.COOLING, - LiquidState.HEATING: LiquidStateValue.HEATING, - LiquidState.STANDBY: LiquidStateValue.STANDBY, - LiquidState.TARGET_TEMPERATURE: LiquidStateValue.PERFECT, - LiquidState.WARM_NO_TEMP_CONTROL: LiquidStateValue.WARM_NO_CONTROL, -} diff --git a/custom_components/ember_mug/coordinator.py b/custom_components/ember_mug/coordinator.py deleted file mode 100644 index 58b83a39..00000000 --- a/custom_components/ember_mug/coordinator.py +++ /dev/null @@ -1,208 +0,0 @@ -"""Coordinator for all the sensors.""" - -from __future__ import annotations - -import logging -from datetime import timedelta -from typing import TYPE_CHECKING, Any, TypedDict - -from bleak import BleakError -from bleak_retry_connector import close_stale_connections -from ember_mug.data import Change, MugData -from homeassistant.core import HomeAssistant, callback -from homeassistant.helpers.device_registry import CONNECTION_BLUETOOTH -from homeassistant.helpers.entity import DeviceInfo -from homeassistant.helpers.storage import Store -from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed - -from .const import DOMAIN, MANUFACTURER, STORAGE_VERSION, SUGGESTED_AREA - -if TYPE_CHECKING: - from ember_mug import EmberMug - from home_assistant_bluetooth import BluetoothServiceInfoBleak - from homeassistant.components.bluetooth import BluetoothChange - - -_LOGGER = logging.getLogger(__name__) - - -class PersistentData(TypedDict): - """Data that should persist on disk.""" - - target_temp_bkp: float | None - - -class MugDataUpdateCoordinator(DataUpdateCoordinator[MugData]): - """Class to manage fetching Mug data.""" - - def __init__( - self, - hass: HomeAssistant, - logger: logging.Logger, - mug: EmberMug, - base_unique_id: str, - device_name: str, - ) -> None: - """Initialize global Mug data updater.""" - device_type = mug.data.model_info.device_type.value - super().__init__( - hass=hass, - logger=logger, - name=f"ember-{device_type.replace('_', '-')}-{base_unique_id}", - update_interval=timedelta(seconds=15), - always_update=False, - ) - self._store: Store[PersistentData] = Store(hass, STORAGE_VERSION, DOMAIN) - self.persistent_data: PersistentData = None # type: ignore[assignment] - self.device_name = device_name - self.device_type = device_type - self.base_unique_id = base_unique_id - self.mug = mug - self.data = self.mug.data - self.available = False - self._last_refresh_was_full = True - _LOGGER.info("%s %s Setup", self.mug.model_name, self.name) - - async def _async_setup(self) -> None: - """Initialize coordinator and fetch initial data.""" - # Setup storage - self.persistent_data = await self._store.async_load() - try: - await self.mug.update_initial() - await self.mug.update_all() - _LOGGER.debug("[Initial Update] values: %s", self.mug.data) - except (TimeoutError, BleakError) as e: - if isinstance(e, BleakError): - _LOGGER.debug("An error occurred trying to update the %s: %s", self.mug.model_name, e) - raise UpdateFailed( - f"An error occurred updating {self.mug.model_name}: {e=}", - ) from e - - self.mug.register_callback( - self._async_handle_callback, - ) - - async def _async_update_data(self) -> MugData: - """Poll the device.""" - _LOGGER.debug("Updating") - full_update = not self._last_refresh_was_full - changed: list[Change] | None = [] - try: - if self._last_refresh_was_full is False: - # Only fully poll all data every other call to limit time - changed += await self.mug.update_all() - else: - changed += await self.mug.update_queued_attributes() - self._last_refresh_was_full = not self._last_refresh_was_full - self.available = True - except (TimeoutError, BleakError) as e: - if isinstance(e, BleakError): - _LOGGER.debug("An error occurred trying to update the %s: %s", self.mug.model_name, e) - if self.available is True: - _LOGGER.debug("%s is not available: %s", self.mug.model_name, e) - self.available = False - changed = None - except Exception as e: - _LOGGER.error( - "An unexpected error occurred whilst updating the %s: %s", - self.mug.model_name, - e, - ) - self.available = False - raise UpdateFailed( - f"An error occurred updating {self.mug.model_name}: {e=}", - ) from e - - _LOGGER.debug( - "[%s Update] Changed: %s", - "Full" if full_update else "Partial", - changed, - ) - if changed: - self.async_update_listeners() - return self.mug.data - - def ensure_writable(self) -> None: - """Writable check for service methods.""" - if self.mug.can_write is False: - raise ValueError( - f"Unable to write to {self.mug.data.model_info.device_type.value}", - ) - - async def write_to_storage(self, target_temp: float | None) -> None: - """ - Write target temp to file storage. - - This is stored to disk, so it can be restored to the entity even if we restart Home Assistant. - """ - self.persistent_data = {"target_temp_bkp": target_temp} - await self._store.async_save(self.persistent_data) - - @property - def target_temp(self) -> float: - """Shortcut for getting target temp, but showing stored data if temp control is off.""" - if self.data.target_temp == 0 and (bkp_temp := self.persistent_data.get("target_temp_bkp")): - return bkp_temp - return self.data.target_temp - - @callback - def handle_unavailable( - self, - service_info: BluetoothServiceInfoBleak, - ) -> None: - """Handle the device going unavailable.""" - _LOGGER.debug("%s is unavailable", self.mug.model_name) - self.available = False - self.async_update_listeners() - - @callback - def handle_bluetooth_event( - self, - service_info: BluetoothServiceInfoBleak, - change: BluetoothChange, - ) -> None: - """Handle a Bluetooth event.""" - _LOGGER.debug( - "Bluetooth event. Service Info: %s, change: %s", - service_info, - change, - ) - self.mug.ble_event_callback(service_info.device, service_info.advertisement) - self.hass.loop.create_task(close_stale_connections(service_info.device)) - - @callback - def _async_handle_callback(self, mug_data: MugData) -> None: - """Handle a Bluetooth event.""" - _LOGGER.debug("Callback called in Home Assistant") - self.async_set_updated_data(mug_data) - - def refresh_from_mug(self) -> None: - """Update stored data from mug data and trigger entities.""" - self.async_set_updated_data(self.mug.data) - - def get_device_attr(self, device_attr: str) -> Any: - """Get a device attribute by name (recursively) or return None.""" - value = self.data - for attr in device_attr.split("."): - try: - value = getattr(value, attr) - except AttributeError: - return None - return value - - @property - def device_info(self) -> DeviceInfo: - """Return information about the mug.""" - firmware = self.data.firmware - return DeviceInfo( - connections={(CONNECTION_BLUETOOTH, self.mug.device.address)}, - identifiers={(DOMAIN, self.mug.device.address)}, - name=name if (name := self.data.name) and name != "Ember Device" else self.device_name, - model=self.data.model_info.name, - model_id=self.data.model_info.model.value if self.data.model_info.model else None, - serial_number=self.data.meta.serial_number if self.data.meta else None, - suggested_area=SUGGESTED_AREA, - hw_version=str(firmware.hardware) if firmware else None, - sw_version=str(firmware.version) if firmware else None, - manufacturer=MANUFACTURER, - ) diff --git a/custom_components/ember_mug/diagnostics.py b/custom_components/ember_mug/diagnostics.py deleted file mode 100644 index 63093d89..00000000 --- a/custom_components/ember_mug/diagnostics.py +++ /dev/null @@ -1,46 +0,0 @@ -"""Diagnostics support for Mug.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING, Any - -from bleak import BleakError - -if TYPE_CHECKING: - from homeassistant.core import HomeAssistant - - from . import EmberMugConfigEntry - - -logger = logging.getLogger(__name__) - - -async def async_get_config_entry_diagnostics( - hass: HomeAssistant, - entry: EmberMugConfigEntry, -) -> dict[str, Any]: - """Return diagnostics for a config entry.""" - coordinator = entry.runtime_data - data: dict[str, Any] = { - "info": coordinator.data, - "state": coordinator.data.liquid_state_display, - "address": coordinator.mug.device.address, - } - if coordinator.mug.debug is True: - services: dict[str, Any] | None = None - try: - services = await coordinator.mug.discover_services() - except BleakError as e: - logger.error("Failed to log services, %s", e) - if services is not None: - # Ensure bytes are converted into strings for serialization - for service in services.values(): - for char in service["characteristics"].values(): - if (value := char["value"]) is not None: - char["value"] = str(value) - for desc in char["descriptors"]: - if (value := desc["value"]) is not None: - desc["value"] = str(value) - data["services"] = services - return data diff --git a/custom_components/ember_mug/entity.py b/custom_components/ember_mug/entity.py deleted file mode 100644 index d58c5995..00000000 --- a/custom_components/ember_mug/entity.py +++ /dev/null @@ -1,89 +0,0 @@ -"""Generic Entity Logic for multiple platforms.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING, Any - -from homeassistant.core import callback -from homeassistant.helpers.update_coordinator import CoordinatorEntity -from homeassistant.util.unit_conversion import TemperatureConverter, UnitOfTemperature - -if TYPE_CHECKING: - from collections.abc import Mapping - - from ember_mug.consts import TemperatureUnit - - from .coordinator import MugDataUpdateCoordinator - - -_LOGGER = logging.getLogger(__name__) - - -def ensure_celsius( - value: float | None, - source_unit: UnitOfTemperature | TemperatureUnit, -) -> float | None: - """Convert unit back to Celsius for a base and round.""" - if value is None: - return None - if source_unit != UnitOfTemperature.CELSIUS: - value = TemperatureConverter.convert( - value, - source_unit, - UnitOfTemperature.CELSIUS, - ) - return value - - -class BaseMugEntity(CoordinatorEntity): - """Generic entity encapsulating common features of an Ember Mug.""" - - coordinator: MugDataUpdateCoordinator - - _domain: str = None # type: ignore[assignment] - _attr_has_entity_name = True - - def __init__( - self, - coordinator: MugDataUpdateCoordinator, - device_attr: str, - ) -> None: - """Initialize the entity.""" - super().__init__(coordinator) - entity_key = self.entity_description.key - self._device_attr = device_attr - self._address = coordinator.mug.device.address - self._attr_translation_key = entity_key - self._attr_device_info = coordinator.device_info - self._attr_unique_id = f"ember_{coordinator.device_type}_{coordinator.base_unique_id}_{entity_key}" - self.entity_id = f"{self._domain}.{self._attr_unique_id}" - - @property - def available(self) -> bool: - """Return if entity is available.""" - return self.coordinator.available - - @property - def extra_state_attributes(self) -> Mapping[str, Any] | None: - """Return empty dict by default.""" - return {} - - @callback - def _async_update_attrs(self) -> None: - """Update the entity attributes.""" - - @callback - def _handle_coordinator_update(self) -> None: - """Handle data update.""" - self._async_update_attrs() - self.async_write_ha_state() - - -class BaseMugValueEntity(BaseMugEntity): - """Base Entity that returns a mug attribute as its `native_value`.""" - - @property - def native_value(self) -> Any: - """Return a mug attribute as the state for the sensor.""" - return self.coordinator.get_device_attr(self._device_attr) diff --git a/custom_components/ember_mug/light.py b/custom_components/ember_mug/light.py deleted file mode 100644 index 17f067f4..00000000 --- a/custom_components/ember_mug/light.py +++ /dev/null @@ -1,91 +0,0 @@ -"""Expose the Mug's LEDs as a light entity.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING, Any - -from ember_mug.data import Colour -from homeassistant.components.light import ( - ATTR_BRIGHTNESS, - ATTR_RGB_COLOR, - ColorMode, - LightEntity, - LightEntityDescription, -) -from homeassistant.core import callback -from homeassistant.helpers.entity import EntityCategory - -from .entity import BaseMugEntity - -if TYPE_CHECKING: - from homeassistant.core import HomeAssistant - from homeassistant.helpers.entity_platform import AddEntitiesCallback - - from . import EmberMugConfigEntry - -_LOGGER = logging.getLogger(__name__) - - -class MugLightEntity(BaseMugEntity, LightEntity): - """Light entity for Nug LED.""" - - _domain = "light" - _attr_color_mode = ColorMode.RGB - _attr_supported_color_modes = {ColorMode.RGB} - - entity_description = LightEntityDescription( - key="led", - entity_category=EntityCategory.CONFIG, - ) - - @property - def is_on(self) -> bool | None: - """The light is always on if it is available.""" - return self.coordinator.available or None - - @callback - def _async_update_attrs(self) -> None: - """Handle updating _attr values.""" - colour = self.coordinator.data.led_colour - self._attr_brightness = colour.brightness - self._attr_rgb_color = tuple(colour[:3]) if colour else (255, 255, 255) - - async def async_turn_on(self, **kwargs: Any) -> None: - """Change the LED colour if defined.""" - _LOGGER.debug("Received turn on with %s", kwargs) - self.coordinator.ensure_writable() - current_colour = self.coordinator.mug.data.led_colour - rgb: tuple[int, int, int] - rgb, brightness = current_colour[:3], current_colour[3] - if (rgb := kwargs.get(ATTR_RGB_COLOR, rgb)) or (brightness := kwargs.get(ATTR_BRIGHTNESS)): - if brightness is None: - brightness = current_colour[3] - if not rgb: - rgb = current_colour[:3] - await self.coordinator.mug.set_led_colour(Colour(*rgb, brightness)) - self._attr_rgb_color = tuple(rgb) - self._attr_brightness = brightness - self.coordinator.refresh_from_mug() - - def turn_off(self, **kwargs: Any) -> None: - """Do nothing, since these lights can't be turned off.""" - _LOGGER.warning( - "%s LED cannot be turned off; doing nothing.", - self.coordinator.mug.model_name, - ) - - -async def async_setup_entry( - hass: HomeAssistant, - entry: EmberMugConfigEntry, - async_add_entities: AddEntitiesCallback, -) -> None: - """Set up the mug light.""" - if entry.entry_id is None: - raise ValueError("Missing config entry ID") - coordinator = entry.runtime_data - entities = [] - if coordinator.mug.has_attribute("led_colour"): - entities = [MugLightEntity(coordinator, "led_colour")] - async_add_entities(entities) diff --git a/custom_components/ember_mug/manifest.json b/custom_components/ember_mug/manifest.json deleted file mode 100644 index de3b74af..00000000 --- a/custom_components/ember_mug/manifest.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "domain": "ember_mug", - "name": "Ember Mug", - "bluetooth": [ - { - "local_name": "Ember C*", - "manufacturer_id": 961 - }, - { - "local_name": "Ember T*", - "manufacturer_id": 961 - }, - { - "service_uuid": "fc543621-236c-4c94-8fa9-944a3e5353fa", - "manufacturer_id": 961 - }, - { - "service_uuid": "fc543622-236c-4c94-8fa9-944a3e5353fa", - "manufacturer_id": 961 - } - ], - "codeowners": [ - "@sopelj" - ], - "config_flow": true, - "dependencies": [ - "bluetooth_adapters" - ], - "documentation": "https://github.com/sopelj/hass_ember_mug", - "iot_class": "local_polling", - "issue_tracker": "https://github.com/sopelj/hass_ember_mug/issues", - "loggers": [ - "bleak", - "bleak_retry_connector", - "ember_mug" - ], - "requirements": [ - "python-ember-mug==1.1.0" - ], - "version": "1.2.1" -} diff --git a/custom_components/ember_mug/number.py b/custom_components/ember_mug/number.py deleted file mode 100644 index c93f03af..00000000 --- a/custom_components/ember_mug/number.py +++ /dev/null @@ -1,87 +0,0 @@ -"""Binary Sensor Entity for Ember Mug.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING - -from homeassistant.components.number import ( - NumberDeviceClass, - NumberEntity, - NumberEntityDescription, - NumberMode, -) -from homeassistant.const import UnitOfTemperature -from homeassistant.helpers.entity import EntityCategory - -from .const import MAX_TEMP_CELSIUS, MIN_TEMP_CELSIUS -from .entity import BaseMugValueEntity - -if TYPE_CHECKING: - from homeassistant.core import HomeAssistant - from homeassistant.helpers.entity_platform import AddEntitiesCallback - - from . import EmberMugConfigEntry - from .coordinator import MugDataUpdateCoordinator - - -_LOGGER = logging.getLogger(__name__) - -NUMBER_TYPES = { - "target_temp": NumberEntityDescription( - key="target_temp", - native_min_value=MIN_TEMP_CELSIUS, - native_max_value=MAX_TEMP_CELSIUS, - native_step=0.1, - native_unit_of_measurement=UnitOfTemperature.CELSIUS, - device_class=NumberDeviceClass.TEMPERATURE, - entity_category=EntityCategory.CONFIG, - ), -} - - -class MugNumberEntity(BaseMugValueEntity, NumberEntity): - """Configurable NumberEntity for a mug attribute.""" - - _domain = "number" - _attr_mode = NumberMode.BOX - - def __init__( - self, - coordinator: MugDataUpdateCoordinator, - device_attr: str, - ) -> None: - """Initialize the Mug Number.""" - self.entity_description = NUMBER_TYPES[device_attr] - super().__init__(coordinator, device_attr) - - -class MugTargetTempNumberEntity(MugNumberEntity): - """Configurable NumerEntity for the Mug's target temp.""" - - @property - def native_value(self) -> float | None: - """Return a mug attribute as the state for the sensor.""" - return self.coordinator.target_temp - - async def async_set_native_value(self, value: float) -> None: - """Set the mug target temp.""" - self.coordinator.ensure_writable() - await self.coordinator.mug.set_target_temp(value) - self.coordinator.refresh_from_mug() - - -async def async_setup_entry( - hass: HomeAssistant, - entry: EmberMugConfigEntry, - async_add_entities: AddEntitiesCallback, -) -> None: - """Set up Number Entities.""" - if entry.entry_id is None: - raise ValueError("Missing config entry ID") - coordinator = entry.runtime_data - async_add_entities( - [ - MugTargetTempNumberEntity(coordinator, "target_temp"), - ], - ) diff --git a/custom_components/ember_mug/select.py b/custom_components/ember_mug/select.py deleted file mode 100644 index 45391876..00000000 --- a/custom_components/ember_mug/select.py +++ /dev/null @@ -1,170 +0,0 @@ -"""Select Entity for Ember Mug.""" - -from __future__ import annotations - -import logging -from enum import Enum -from typing import TYPE_CHECKING, Literal - -from ember_mug.consts import VolumeLevel -from homeassistant.components.select import SelectEntity, SelectEntityDescription -from homeassistant.const import UnitOfTemperature -from homeassistant.helpers.entity import EntityCategory -from homeassistant.util.unit_conversion import TemperatureConverter - -from .const import CONF_PRESETS, CONF_PRESETS_UNIT, DEFAULT_PRESETS -from .entity import BaseMugEntity - -if TYPE_CHECKING: - from homeassistant.core import HomeAssistant - from homeassistant.helpers.entity_platform import AddEntitiesCallback - - from . import EmberMugConfigEntry - from .coordinator import MugDataUpdateCoordinator - - -_LOGGER = logging.getLogger(__name__) - -TEMPERATURE_UNITS = [t.value for t in (UnitOfTemperature.CELSIUS, UnitOfTemperature.FAHRENHEIT)] -VOLUME_LEVELS = [v.value for v in VolumeLevel] -SELECT_TYPES = { - "temperature_unit": SelectEntityDescription( - key="temperature_unit", - options=TEMPERATURE_UNITS, - entity_category=EntityCategory.CONFIG, - ), - "temperature_preset": SelectEntityDescription( - key="temperature_preset", - entity_category=EntityCategory.CONFIG, - ), - "volume_level": SelectEntityDescription( - key="volume_level", - options=VOLUME_LEVELS, - entity_category=EntityCategory.CONFIG, - ), -} - - -class MugSelectEntity(BaseMugEntity, SelectEntity): - """Configurable SelectEntity for a mug attribute.""" - - _domain = "select" - - def __init__( - self, - coordinator: MugDataUpdateCoordinator, - device_attr: str, - ) -> None: - """Initialize the Device select entity.""" - self.entity_description = SELECT_TYPES[device_attr] - super().__init__(coordinator, device_attr) - - @property - def current_option(self) -> str | None: - """Return a mug attribute as the state for the current option.""" - option = self.coordinator.get_device_attr(self._device_attr) - return option.value if isinstance(option, Enum) else option - - -class MugTempUnitSelectEntity(MugSelectEntity): - """Configurable SelectEntity for a mug temp unit.""" - - @property - def icon(self) -> str: - """Change icon based on current option.""" - if current := self.current_option: - unit = "fahrenheit" if current == UnitOfTemperature.FAHRENHEIT else "celsius" - return f"mdi:temperature-{unit}" - return "mdi:help-rhombus-outline" - - async def async_select_option( - self, - option: Literal["°C", "°F"] | UnitOfTemperature, - ) -> None: - """Change the selected option.""" - await self.coordinator.mug.set_temperature_unit(option) - self.coordinator.refresh_from_mug() - - -class MugVolumeLevelSelectEntity(MugSelectEntity): - """Configurable SelectEntity for the travel mug volume level.""" - - @property - def icon(self) -> str: - """Change icon based on current option.""" - if current := self.current_option: - return f"mdi:volume-{current}" - return "mdi:volume-off" - - async def async_select_option( - self, - option: Literal["high", "medium", "low"] | VolumeLevel, - ) -> None: - """Change the selected option.""" - self.coordinator.ensure_writable() - if isinstance(option, str): - option = VolumeLevel(option) - await self.coordinator.mug.set_volume_level(option) - self.coordinator.refresh_from_mug() - - -class MugTemperaturePresetSelectEntity(MugSelectEntity): - """Configurable SelectEntity to set the mug temperature from a list of presets.""" - - _attr_icon = "mdi:format-list-bulleted" - - def __init__( - self, - presets: dict[str, float], - presets_unit: UnitOfTemperature, - coordinator: MugDataUpdateCoordinator, - device_attr: str, - ) -> None: - """Set temperature presets and select options base on configs.""" - super().__init__(coordinator, device_attr) - if presets_unit != UnitOfTemperature.CELSIUS and coordinator.mug.data.use_metric: - presets = { - label: TemperatureConverter.convert( - temp, - presets_unit, - UnitOfTemperature.CELSIUS, - ) - for label, temp in presets.items() - } - self._presets = presets - self._temp_to_labels: dict[float, str] = {v: k for k, v in presets.items()} - self._attr_options = list(presets) - - @property - def current_option(self) -> str | None: - """Return selected option if found current temp is one of the presets.""" - return self._temp_to_labels.get(self.coordinator.target_temp, None) - - async def async_select_option(self, option: str) -> None: - """Change the target temp of the mug based on preset.""" - if not (target_temp := self._presets.get(option)): - raise ValueError("Invalid Option") - await self.coordinator.mug.set_target_temp(target_temp) - self.coordinator.refresh_from_mug() - - -async def async_setup_entry( - hass: HomeAssistant, - entry: EmberMugConfigEntry, - async_add_entities: AddEntitiesCallback, -) -> None: - """Set up Select Entities.""" - if entry.entry_id is None: - raise ValueError("Missing config entry ID") - coordinator = entry.runtime_data - preset_unit = entry.options.get(CONF_PRESETS_UNIT, UnitOfTemperature.CELSIUS) - temp_presets = entry.options.get(CONF_PRESETS, DEFAULT_PRESETS) - entities = [ - MugTemperaturePresetSelectEntity(temp_presets, preset_unit, coordinator, "temperature_preset"), - MugTempUnitSelectEntity(coordinator, "temperature_unit"), - ] - if coordinator.mug.has_attribute("volume_level"): - entities.append( - MugVolumeLevelSelectEntity(coordinator, "volume_level"), - ) - async_add_entities(entities) diff --git a/custom_components/ember_mug/sensor.py b/custom_components/ember_mug/sensor.py deleted file mode 100644 index b96f756c..00000000 --- a/custom_components/ember_mug/sensor.py +++ /dev/null @@ -1,209 +0,0 @@ -"""Sensor Entity for Ember Mug.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING, Any - -from ember_mug.consts import DeviceType -from homeassistant.components.sensor import ( - SensorDeviceClass, - SensorEntity, - SensorEntityDescription, - SensorStateClass, -) -from homeassistant.const import ATTR_BATTERY_CHARGING, PERCENTAGE, UnitOfTemperature -from homeassistant.helpers.entity import EntityCategory - -from .const import ( - ATTR_BATTERY_VOLTAGE, - ICON_DEFAULT, - ICON_EMPTY, - ICON_UNAVAILABLE, - LIQUID_STATE_MAPPING, - LIQUID_STATE_OPTIONS, - LIQUID_STATE_TEMP_ICONS, - LiquidStateValue, -) -from .entity import BaseMugValueEntity - -if TYPE_CHECKING: - from homeassistant.config_entries import ConfigEntry - from homeassistant.core import HomeAssistant - from homeassistant.helpers.entity_platform import AddEntitiesCallback - - from .coordinator import MugDataUpdateCoordinator - - -SENSOR_TYPES = { - "liquid_state": SensorEntityDescription( - key="state", - device_class=SensorDeviceClass.ENUM, - options=LIQUID_STATE_OPTIONS, - ), - "liquid_level": SensorEntityDescription( - key="liquid_level", - icon="mdi:cup-water", - suggested_display_precision=0, - native_unit_of_measurement=PERCENTAGE, - ), - "current_temp": SensorEntityDescription( - key="current_temp", - suggested_display_precision=1, - native_unit_of_measurement=UnitOfTemperature.CELSIUS, - state_class=SensorStateClass.MEASUREMENT, - device_class=SensorDeviceClass.TEMPERATURE, - ), - "battery.percent": SensorEntityDescription( - key="battery_percent", - suggested_display_precision=1, - native_unit_of_measurement=PERCENTAGE, - device_class=SensorDeviceClass.BATTERY, - state_class=SensorStateClass.MEASUREMENT, - entity_category=EntityCategory.DIAGNOSTIC, - ), -} - - -class EmberMugSensor(BaseMugValueEntity, SensorEntity): - """Representation of a Mug sensor.""" - - _domain = "sensor" - - def __init__( - self, - coordinator: MugDataUpdateCoordinator, - device_attr: str, - ) -> None: - """Initialize the Mug sensor.""" - self.entity_description = SENSOR_TYPES[device_attr] - super().__init__(coordinator, device_attr) - - -class EmberMugStateSensor(EmberMugSensor): - """Base Mug State Sensor.""" - - @property - def icon(self) -> str: - """Change icon based on state.""" - state = self.state - if state is None or self.coordinator.available is False: - return ICON_UNAVAILABLE - if state == LiquidStateValue.EMPTY: - return ICON_EMPTY - return ICON_DEFAULT - - @property - def native_value(self) -> str | None: - """Return liquid state key.""" - raw_value = super().native_value - if raw_value in LIQUID_STATE_MAPPING: - return LIQUID_STATE_MAPPING[raw_value].value - if raw_value is not None: - logging.debug('Value "%s" was not found in mapping: %s', raw_value, LIQUID_STATE_MAPPING) - return None - - @property - def extra_state_attributes(self) -> dict[str, Any]: - """Return device specific state attributes.""" - data = self.coordinator.data - colour = data.model_info.colour - attrs = { - "firmware_info": data.firmware, - "raw_state": data.liquid_state, - "colour": colour.value.lower().replace(" ", "-") if colour else "unknown", - } - if data.debug: - attrs |= { - "date_time_zone": data.date_time_zone, - "udsk": data.udsk, - "dsk": data.dsk, - } - return attrs | super().extra_state_attributes - - -class EmberMugLiquidLevelSensor(EmberMugSensor): - """Liquid Level Sensor.""" - - @property - def max_level(self) -> int: - """Max level is different for travel mug.""" - if self.coordinator.mug.data.model_info.device_type == DeviceType.TRAVEL_MUG: - return 100 - return 30 - - @property - def native_value(self) -> float | int: - """Return information about the liquid level.""" - liquid_level: float | None = super().native_value - if liquid_level: - # 30 -> Full (100 for Travel Mug) - # 5, 6 -> Low - # 0 -> Empty - return liquid_level / self.max_level * 100 - return 0 - - @property - def extra_state_attributes(self) -> dict[str, Any]: - """Return device specific state attributes.""" - return { - "raw_liquid_level": self.coordinator.data.liquid_level, - "capacity": self.coordinator.data.model_info.capacity, - **super().extra_state_attributes, - } - - -class EmberMugTemperatureSensor(EmberMugSensor): - """Mug Temperature sensor.""" - - @property - def icon(self) -> str | None: - """Set icon based on temperature.""" - if self._device_attr != "current_temp": - return "mdi:thermometer" - icon = LIQUID_STATE_TEMP_ICONS.get( - self.coordinator.data.liquid_state, - "thermometer", - ) - return f"mdi:{icon}" - - @property - def extra_state_attributes(self) -> dict[str, Any]: - """Return device specific state attributes.""" - return { - "native_value": self.coordinator.data.current_temp, - **super().extra_state_attributes, - } - - -class EmberMugBatterySensor(EmberMugSensor): - """Mug Battery Sensor.""" - - @property - def extra_state_attributes(self) -> dict[str, Any]: - """Return device specific state attributes.""" - data = self.coordinator.data - attrs = { - ATTR_BATTERY_CHARGING: data.battery.on_charging_base if data.battery else None, - } - if self.coordinator.mug.has_attribute("battery_voltage"): - attrs[ATTR_BATTERY_VOLTAGE] = data.battery_voltage - return attrs | super().extra_state_attributes - - -async def async_setup_entry( - hass: HomeAssistant, - entry: ConfigEntry, - async_add_entities: AddEntitiesCallback, -) -> None: - """Set up Entities.""" - if entry.entry_id is None: - raise ValueError("Missing config entry ID") - coordinator = entry.runtime_data - entities: list[EmberMugSensor] = [ - EmberMugStateSensor(coordinator, "liquid_state"), - EmberMugLiquidLevelSensor(coordinator, "liquid_level"), - EmberMugTemperatureSensor(coordinator, "current_temp"), - EmberMugBatterySensor(coordinator, "battery.percent"), - ] - async_add_entities(entities) diff --git a/custom_components/ember_mug/strings.json b/custom_components/ember_mug/strings.json deleted file mode 100644 index 3b798a7f..00000000 --- a/custom_components/ember_mug/strings.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "config": { - "step": { - "user": { - "title": "Add an Ember Mug, Cup or Travel Mug", - "data": { - "address": "Device (MAC Address)", - "name": "Name", - "temperature_unit": "Temperature Unit" - } - } - }, - "abort": { - "unknown": "Unknown error occurred", - "cannot_connect": "Unable to connect to the device.", - "no_new_devices": "No new Ember devices were found. Please ensure it is in pairing mode." - } - }, - "options": { - "step": { - "init": { - "title": "Manage Options", - "data": { - "debug": "Enable debug mode to log extra attributes and values for debugging.", - "presets": "A key/value mapping of preset names to target temperatures (in above unit)", - "presets_unit": "Temperature unit used for the below presets (!important: if you change this you need to update the numbers in the presets accordingly)" - } - } - } - }, - "entity": { - "binary_sensor": { - "low_battery": { "name": "Low battery" }, - "power": { "name": "Power" } - }, - "light": { - "led": { "name": "LED" } - }, - "number": { - "target_temp": { "name": "Target temperature" } - }, - "select": { - "temperature_preset": { - "name": "Temperature preset", - "state": { - "latte": "Latte", - "cappuccino": "Cappuccino", - "coffee": "Coffee", - "black-tea": "Black Tea", - "green-tea": "Green Tea" - } - }, - "temperature_unit": { "name": "Temperature unit" }, - "volume_level": { - "name": "Volume Level", - "state": { - "low": "Low", - "medium": "Medium", - "high": "High" - } - } - }, - "sensor": { - "battery_percent": { - "name": "Battery", - "state_attributes": { - "battery_voltage": { "name": "Battery voltage" } - } - }, - "current_temp": { "name": "Current temperature" }, - "liquid_level": { - "name": "Liquid level", - "state_attributes": { - "raw_liquid_level": { "name": "Raw liquid level" }, - "capacity": { "name": "Capacity (ml)" } - } - }, - "state": { - "name": "State", - "state": { - "empty": "Empty", - "filling": "Filling", - "cold_no_control": "Cold (No control)", - "cooling": "Cooling", - "heating": "Heating", - "perfect": "Perfect", - "standby": "Standby", - "warm_no_control": "Warm (No control)" - }, - "state_attributes": { - "colour": { - "name": "Colour", - "state": { - "black": "Black", - "blue": "Blue", - "copper": "Copper", - "gold": "Gold", - "grey": "Grey", - "red": "Red", - "sage-green": "Sage Green", - "sandstone": "Sandstone", - "rose-gold": "Rose Gold", - "stainless-steel": "Stainless-Steel", - "unknown": "Unknown", - "white": "White" - } - }, - "date_time_zone": { "name": "Date and Timezone" }, - "dsk": { "name": "DSK" }, - "firmware_info": { "name": "Firmware info"}, - "raw_state": { "name": "Raw state" }, - "udsk": { "name": "UDSK" } - } - } - }, - "switch": { - "temperature_control": {"name": "Temperature Control"} - }, - "text": { - "name": { "name": "Name" } - } - } -} diff --git a/custom_components/ember_mug/switch.py b/custom_components/ember_mug/switch.py deleted file mode 100644 index 609818e2..00000000 --- a/custom_components/ember_mug/switch.py +++ /dev/null @@ -1,91 +0,0 @@ -"""Switch entities.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING, Any - -from homeassistant.components.switch import ( - SwitchDeviceClass, - SwitchEntity, - SwitchEntityDescription, -) -from homeassistant.const import EntityCategory - -from .entity import BaseMugEntity - -if TYPE_CHECKING: - from homeassistant.core import HomeAssistant - from homeassistant.helpers.entity_platform import AddEntitiesCallback - - from . import EmberMugConfigEntry - from .coordinator import MugDataUpdateCoordinator - - -_LOGGER = logging.getLogger(__name__) - -SWITCH_TYPES = { - "target_temp": SwitchEntityDescription( - key="temperature_control", - device_class=SwitchDeviceClass.SWITCH, - entity_category=EntityCategory.CONFIG, - ), -} - - -class MugSwitchEntity(BaseMugEntity, SwitchEntity): - """Configurable SelectEntity for a mug attribute.""" - - _domain = "switch" - - def __init__( - self, - coordinator: MugDataUpdateCoordinator, - device_attr: str, - ) -> None: - """Initialize the Device select entity.""" - self.entity_description = SWITCH_TYPES[device_attr] - super().__init__(coordinator, device_attr) - - -class MugTemperatureControlEntity(MugSwitchEntity): - """Switch entity for controlling temperature control.""" - - @property - def icon(self) -> str: - """Set icon based on device state.""" - return "mdi:sun-snowflake" if self.is_on else "mdi:sun-snowflake-variant" - - @property - def is_on(self) -> bool: - """It is on if the target temp is not zero.""" - return bool(self.coordinator.mug.data.target_temp) - - async def async_turn_on(self, **kwargs: Any) -> None: - """Turn heating/cooling on if there is a stored target temp.""" - self.coordinator.ensure_writable() - if not self.coordinator.mug.data.target_temp and ( - stored_temp := self.coordinator.persistent_data.get("target_temp_bkp") - ): - await self.coordinator.mug.set_target_temp(stored_temp) - self.coordinator.refresh_from_mug() - - async def async_turn_off(self, **kwargs: Any) -> None: - """Turn heating/cooling off if it is not already.""" - self.coordinator.ensure_writable() - if target_temp := self.coordinator.mug.data.target_temp: - await self.coordinator.write_to_storage(target_temp) - await self.coordinator.mug.set_target_temp(0) - self.coordinator.refresh_from_mug() - - -async def async_setup_entry( - hass: HomeAssistant, - entry: EmberMugConfigEntry, - async_add_entities: AddEntitiesCallback, -) -> None: - """Set up Switch Entities.""" - if entry.entry_id is None: - raise ValueError("Missing config entry ID") - coordinator = entry.runtime_data - async_add_entities([MugTemperatureControlEntity(coordinator, "target_temp")]) diff --git a/custom_components/ember_mug/text.py b/custom_components/ember_mug/text.py deleted file mode 100644 index b68dca4e..00000000 --- a/custom_components/ember_mug/text.py +++ /dev/null @@ -1,72 +0,0 @@ -"""Text Entity for Ember Mug.""" - -from __future__ import annotations - -import logging -from typing import TYPE_CHECKING - -from ember_mug.consts import MUG_NAME_PATTERN -from homeassistant.components.text import TextEntity, TextEntityDescription -from homeassistant.helpers.entity import EntityCategory - -from .entity import BaseMugValueEntity - -if TYPE_CHECKING: - from homeassistant.config_entries import ConfigEntry - from homeassistant.core import HomeAssistant - from homeassistant.helpers.entity_platform import AddEntitiesCallback - - from .coordinator import MugDataUpdateCoordinator - - -_LOGGER = logging.getLogger(__name__) - -TEXT_TYPES = { - "name": TextEntityDescription( - key="name", - native_min=1, - native_max=16, - pattern=MUG_NAME_PATTERN, - entity_category=EntityCategory.CONFIG, - ), -} - - -class MugTextEntity(BaseMugValueEntity, TextEntity): - """Configurable Text Entity for text mug attribute.""" - - _domain = "text" - - def __init__( - self, - coordinator: MugDataUpdateCoordinator, - device_attr: str, - ) -> None: - """Initialize the Mug sensor.""" - self.entity_description = TEXT_TYPES[device_attr] - super().__init__(coordinator, device_attr) - - @property - def native_value(self) -> str: - """Return a mug attribute as the state for the sensor.""" - return super().native_value or "EMBER" - - async def async_set_value(self, value: str) -> None: - """Set the mug name.""" - self.coordinator.ensure_writable() - await self.coordinator.mug.set_name(value) - - -async def async_setup_entry( - hass: HomeAssistant, - entry: ConfigEntry, - async_add_entities: AddEntitiesCallback, -) -> None: - """Set up Text Entities.""" - if entry.entry_id is None: - raise ValueError("Missing config entry ID") - coordinator = entry.runtime_data - entities = [] - if coordinator.mug.has_attribute("name"): - entities = [MugTextEntity(coordinator, attr) for attr in TEXT_TYPES] - async_add_entities(entities) diff --git a/custom_components/ember_mug/translations/en.json b/custom_components/ember_mug/translations/en.json deleted file mode 100644 index 3b798a7f..00000000 --- a/custom_components/ember_mug/translations/en.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "config": { - "step": { - "user": { - "title": "Add an Ember Mug, Cup or Travel Mug", - "data": { - "address": "Device (MAC Address)", - "name": "Name", - "temperature_unit": "Temperature Unit" - } - } - }, - "abort": { - "unknown": "Unknown error occurred", - "cannot_connect": "Unable to connect to the device.", - "no_new_devices": "No new Ember devices were found. Please ensure it is in pairing mode." - } - }, - "options": { - "step": { - "init": { - "title": "Manage Options", - "data": { - "debug": "Enable debug mode to log extra attributes and values for debugging.", - "presets": "A key/value mapping of preset names to target temperatures (in above unit)", - "presets_unit": "Temperature unit used for the below presets (!important: if you change this you need to update the numbers in the presets accordingly)" - } - } - } - }, - "entity": { - "binary_sensor": { - "low_battery": { "name": "Low battery" }, - "power": { "name": "Power" } - }, - "light": { - "led": { "name": "LED" } - }, - "number": { - "target_temp": { "name": "Target temperature" } - }, - "select": { - "temperature_preset": { - "name": "Temperature preset", - "state": { - "latte": "Latte", - "cappuccino": "Cappuccino", - "coffee": "Coffee", - "black-tea": "Black Tea", - "green-tea": "Green Tea" - } - }, - "temperature_unit": { "name": "Temperature unit" }, - "volume_level": { - "name": "Volume Level", - "state": { - "low": "Low", - "medium": "Medium", - "high": "High" - } - } - }, - "sensor": { - "battery_percent": { - "name": "Battery", - "state_attributes": { - "battery_voltage": { "name": "Battery voltage" } - } - }, - "current_temp": { "name": "Current temperature" }, - "liquid_level": { - "name": "Liquid level", - "state_attributes": { - "raw_liquid_level": { "name": "Raw liquid level" }, - "capacity": { "name": "Capacity (ml)" } - } - }, - "state": { - "name": "State", - "state": { - "empty": "Empty", - "filling": "Filling", - "cold_no_control": "Cold (No control)", - "cooling": "Cooling", - "heating": "Heating", - "perfect": "Perfect", - "standby": "Standby", - "warm_no_control": "Warm (No control)" - }, - "state_attributes": { - "colour": { - "name": "Colour", - "state": { - "black": "Black", - "blue": "Blue", - "copper": "Copper", - "gold": "Gold", - "grey": "Grey", - "red": "Red", - "sage-green": "Sage Green", - "sandstone": "Sandstone", - "rose-gold": "Rose Gold", - "stainless-steel": "Stainless-Steel", - "unknown": "Unknown", - "white": "White" - } - }, - "date_time_zone": { "name": "Date and Timezone" }, - "dsk": { "name": "DSK" }, - "firmware_info": { "name": "Firmware info"}, - "raw_state": { "name": "Raw state" }, - "udsk": { "name": "UDSK" } - } - } - }, - "switch": { - "temperature_control": {"name": "Temperature Control"} - }, - "text": { - "name": { "name": "Name" } - } - } -} diff --git a/custom_components/ember_mug/translations/es.json b/custom_components/ember_mug/translations/es.json deleted file mode 100644 index 8928c6ed..00000000 --- a/custom_components/ember_mug/translations/es.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "config": { - "step": { - "user": { - "title": "Agregue una taza, copa o taza de viaje Ember", - "data": { - "address": "Dispositivo (Dirección MAC)", - "name": "Nombre", - "temperature_unit": "Unidad de temperatura" - } - } - }, - "abort": { - "unknown": "Un error desconocido ocurrió", - "cannot_connect": "No se puede conectar a el dispositivo", - "no_new_devices": "No se encontraron dispositivo Ember nuevos. Asegúrese de que esté en modo de emparejamiento." - } - }, - "options": { - "step": { - "init": { - "title": "Administrar opciones", - "data": { - "debug": "Registro de servicios y características para el desarrollo al conectarse", - "presets": "Una asignación de clave/valor de nombres preestablecidos a temperaturas objetivo (en la unidad anterior)", - "presets_unit": "Unidades de temperatura utilizadas para los siguientes ajustes preestablecidos (!Importante: si cambia esto, deberá actualizar los números en los ajustes preestablecidos en consecuencia)" - } - } - } - }, - "entity": { - "binary_sensor": { - "low_battery": { "name": "Batería baja" }, - "power": { "name": "Energía" } - }, - "light": { - "led": { "name": "LED" } - }, - "number": { - "target_temp": { "name": "Temperatura deseada" } - }, - "select": { - "temperature_preset": { - "name": "Temperature preset", - "state": { - "latte": "Latté", - "cappuccino": "Capuchino", - "coffee": "Café", - "black-tea": "Té negro", - "green-tea": "Té negro" - } - }, - "temperature_unit": { "name": "Unidad de temperatura" }, - "volume_level": { - "name": "Nivel de volumen", - "state": { - "low": "Bajo", - "medium": "Medio", - "high": "Alto" - } - } - }, - "sensor": { - "battery_percent": { - "name": "Batería", - "state_attributes": { - "battery_voltage": { "name": "Voltaje de la batería" } - } - }, - "current_temp": { "name": "Temperatura actual" }, - "liquid_level": { - "name": "Nivel de liquido", - "state_attributes": { - "raw_liquid_level": { "name": "Nivel de líquido bruto" }, - "capacity": { "name": "Capacidad (ml)" } - } - }, - "state": { - "name": "Estado", - "state": { - "empty": "Vacío", - "filling": "Llenando", - "cold_no_control": "Frío (Sin control)", - "cooling": "Enfriando", - "heating": "Calentamiento", - "perfect": "Perfecto", - "standby": "De espera", - "warm_no_control": "Cálido (sin control)" - }, - "state_attributes": { - "colour": { - "name": "Color", - "state": { - "black": "Negro", - "blue": "Azul", - "copper": "Cobre", - "gold": "Oro", - "grey": "Gris", - "red": "Rojo", - "sage-green": "Verde", - "sandstone": "Arenisca", - "rose-gold": "Oro rosa", - "stainless-steel": "Acero-inoxidable", - "unknown": "Desconocido", - "white": "Blanco" - } - }, - "date_time_zone": { "name": "Fecha y Zona Horaria" }, - "dsk": { "name": "DSK" }, - "firmware_info": { "name": "Información de firmware"}, - "raw_state": { "name": "Estado bruto" }, - "udsk": { "name": "UDSK" } - } - } - }, - "switch": { - "temperature_control": {"name": "Control de temperatura"} - }, - "text": { - "name": { "name": "Nombre" } - } - } -} diff --git a/custom_components/ember_mug/translations/fr.json b/custom_components/ember_mug/translations/fr.json deleted file mode 100644 index afd2733a..00000000 --- a/custom_components/ember_mug/translations/fr.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "config": { - "step": { - "user": { - "title": "Ajouter une tasse, coupe ou tasse de voyage Ember", - "data": { - "address": "Appareil (adresse MAC)", - "name": "Nom", - "temperature_unit": "Unité de température" - } - } - }, - "abort": { - "unknown": "Une erreur inconnue est survenue", - "cannot_connect": "Impossible de se connecter à l'appareil.", - "no_new_devices": "Aucune nouvelle appareil Ember a été trouvé. Veuillez assurer qu'il est en mode de jumelage." - } - }, - "options": { - "step": { - "init": { - "title": "Gérer les options", - "data": { - "debug": "Lister les services et caractéristiques pour développement au connexion", - "presets": "Mappage du nom de préréglage à la température cible (dans unités ci-dessus)", - "presets_unit": "Unité de température utilisée pour les préréglages ci-dessous (!important: si vous modifiez ceci, vous devez également mettre à jour les chiffres dans les préréglages en conséquence)" - } - } - } - }, - "entity": { - "binary_sensor": { - "low_battery": { "name": "Batterie faible" }, - "power": { "name": "Alimentation" } - }, - "light": { - "led": { "name": "DEL" } - }, - "number": { - "target_temp": { "name": "Température cible" } - }, - "select": { - "temperature_preset": { - "name": "Température prédéfini", - "state": { - "latte": "Latté", - "cappuccino": "Cappuccino", - "coffee": "Café", - "black-tea": "Thé noir", - "green-tea": "Thé vert" - } - }, - "temperature_unit": { "name": "Unité de température" }, - "volume_level": { - "name": "Niveau de volume", - "state": { - "low": "Faible", - "medium": "Moyen", - "high": "Élévé" - } - } - }, - "sensor": { - "battery_percent": { - "name": "Batterie", - "state_attributes": { - "battery_voltage": { "name": "Voltage de batterie" } - } - }, - "current_temp": { "name": "Température actuel" }, - "liquid_level": { - "name": "Niveau de liquide", - "state_attributes": { - "raw_liquid_level": { "name": "Niveau du liquide brute" }, - "capacity": { "name": "Capacitée (ml)" } - } - }, - "state": { - "name": "État", - "state": { - "empty": "Vide", - "filling": "Remplissage", - "cold_no_control": "Froid (sans contrôle)", - "cooling": "Refroidissement", - "heating": "Chauffage", - "perfect": "Parfait", - "standby": "En veille", - "warm_no_control": "Chaud (sans contrôle)" - }, - "state_attributes": { - "colour": { - "name": "Couleur", - "state": { - "black": "Noir", - "blue": "Bleu", - "copper": "Cuivre", - "gold": "Or", - "grey": "Grise", - "red": "Rouge", - "sage-green": "Vert", - "sandstone": "Sablé", - "rose-gold": "Or rose", - "stainless-steel": "Stainless-Steel", - "unknown": "Inconnu", - "white": "Blanche" - } - }, - "date_time_zone": { "name": "Date et fuseau horaire" }, - "dsk": { "name": "DSK" }, - "firmware_info": { "name": "Informations sur le micrologiciel"}, - "raw_state": { "name": "État brute" }, - "udsk": { "name": "UDSK" } - } - } - }, - "switch": { - "temperature_control": {"name": "Contrôle de la température"} - }, - "text": { - "name": { "name": "Nom" } - } - } -} diff --git a/custom_components/ember_mug/translations/ja.json b/custom_components/ember_mug/translations/ja.json deleted file mode 100644 index 67c2547d..00000000 --- a/custom_components/ember_mug/translations/ja.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "config": { - "step": { - "user": { - "title": "Ember マグ、カップ、トラベル マグを追加します", - "data": { - "address": "デバイス(MACアドレス)", - "name": "名", - "temperature_unit": "温度単位" - } - } - }, - "abort": { - "unknown": "未知数エラーが発生した。", - "cannot_connect": "デバイスに接続できません。", - "no_new_devices": "新しいEmberデバイスは見つかりませんでした。ペアリングモードにしてください。" - } - }, - "options": { - "step": { - "init": { - "title": "オプションの管理", - "data": { - "debug": "開発のためのログサービスと特徴", - "presets": "プリセット名のターゲット温度へのマッピング (上記のユニット内)", - "presets_unit": "次のプリセットに使用される温度単位 (!重要: これを変更した場合は、それに応じてプリセット内の数値を更新する必要があります)" - } - } - } - }, - "entity": { - "binary_sensor": { - "low_battery": { "name": "低バッテリー" }, - "power": { "name": "電源" } - }, - "light": { - "led": { "name": "LED" } - }, - "number": { - "target_temp": { "name": "目標温度" } - }, - "select": { - "temperature_preset": { - "name": "温度プリセット", - "state": { - "latte": "ラテ", - "cappuccino": "カプチーノ", - "coffee": "コーヒー", - "black-tea": "紅茶", - "green-tea": "緑茶" - } - }, - "temperature_unit": { "name": "温度単位" }, - "volume_level": { - "name": "音量", - "state": { - "low": "小音量", - "medium": "中音量", - "high": "大音量" - } - } - }, - "sensor": { - "battery_percent": { - "name": "電池", - "state_attributes": { - "battery_voltage": { "name": "電池電圧" } - } - }, - "current_temp": { "name": "現在の温度" }, - "liquid_level": { - "name": "液量", - "state_attributes": { - "raw_liquid_level": { "name": "液量" }, - "capacity": { "name": "容量 (ml)" } - } - }, - "state": { - "name": "状態", - "state": { - "empty": "空です", - "filling": "埋まっている", - "cold_no_control": "寒い(管理ない)", - "cooling": "冷めている", - "heating": "加熱している", - "perfect": "うってつけです", - "standby": "スタンバイ", - "warm_no_control": "暑い(管理ない)" - }, - "state_attributes": { - "colour": { - "name": "色", - "state": { - "black": "黒色", - "blue": "青色", - "copper": "銅色", - "gold": "金色", - "grey": "灰色", - "red": "赤色", - "sage-green": "緑色", - "sandstone": "砂岩色", - "rose-gold": "ローズゴールド色", - "stainless-steel": "ステンレス鋼色", - "unknown": "未知色", - "white": "白色" - } - }, - "date_time_zone": { "name": "日付と時間帯" }, - "dsk": { "name": "DSK" }, - "firmware_info": { "name": "ファームウェア"}, - "raw_state": { "name": "液体状態" }, - "udsk": { "name": "UDSK" } - } - } - }, - "switch": { - "temperature_control": {"name": "温度管理"} - }, - "text": { - "name": { "name": "名" } - } - } -} diff --git a/custom_components/ember_mug/translations/pl.json b/custom_components/ember_mug/translations/pl.json deleted file mode 100644 index 6a5f118b..00000000 --- a/custom_components/ember_mug/translations/pl.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "config": { - "step": { - "user": { - "title": "Dodaj kubek, filiżankę lub kubek podróżny Ember", - "data": { - "address": "Urządzenie (adres MAC)", - "name": "Nazwa", - "temperature_unit": "Jednostka temperatury" - } - } - }, - "abort": { - "unknown": "Wystąpił nieznany błąd", - "cannot_connect": "Nie można połączyć się z kubkiem", - "no_new_devices": "Nie znaleziono nowych kubków. Upewnij się, że jest w trybie parowania." - } - }, - "options": { - "step": { - "init": { - "title": "Zarządzaj opcjami", - "data": { - "debug": "Log usługi i cechy do rozwoju po połączeniu.", - "presets": "Mapowanie klucz/wartość nazw ustawień domyślnych na temperatury docelowe (w powyższych jednostkach)", - "presets_unit": "Jednostki temperatury używane w następujących ustawieniach wstępnych (!Ważne: jeśli to zmienisz, konieczna będzie odpowiednia aktualizacja liczb w ustawieniach wstępnych)" - } - } - } - }, - "entity": { - "binary_sensor": { - "low_battery": { "name": "Niski poziom baterii" }, - "power": { "name": "Energia" } - }, - "light": { - "led": { "name": "LED" } - }, - "number": { - "target_temperature": { "name": "Temperatura docelowa" } - }, - "select": { - "temperature_preset": { - "name": "Zadana temperatura", - "state": { - "latte": "Latte", - "cappuccino": "Cappuccino", - "coffee": "Kawa", - "black-tea": "Czarna herbata", - "green-tea": "Zielona herbata" - } - }, - "temperature_unit": { "name": "Jednostka temperatury" }, - "volume_level": { - "name": "Głośność dźwięku", - "state": { - "low": "Niski ", - "medium": "Średni", - "high": "Wysoki" - } - } - }, - "sensor": { - "battery_percent": { - "name": "Bateria", - "state_attributes": { - "battery_voltage": { "name": "Napięcie bateria" } - } - }, - "current_temp": { "name": "Obecna temperatura" }, - "liquid_level": { - "name": "Poziom cieczy", - "state_attributes": { - "raw_liquid_level": { "name": "Poziom surowej cieczy" }, - "capacity": { "name": "Pojemność (ml)" } - } - }, - "state": { - "name": "Stan", - "state": { - "empty": "Pussty", - "filling": "Napełniając", - "cold_no_control": "Zimno (bez kontroli)", - "cooling": "Chłodzić", - "heating": "Ogrzać", - "perfect": "Idealny", - "standby": "Czuwania", - "warm_no_control": "Ciepło (bez kontroli)" - }, - "state_attributes": { - "colour": { - "name": "Kolor", - "state": { - "black": "Czarny", - "blue": "Niebieski", - "copper": "Miedź", - "gold": "Złoto", - "grey": "Szary", - "red": "Czerwony", - "sage-green": "Zielony", - "sandstone": "Piaskowiec", - "rose-gold": "Różowe złoto", - "stainless-steel": "Stal nierdzewna", - "unknown": "Nieznany", - "white": "Biały" - } - }, - "date_time_zone": { "name": "Data i strefa czasowa" }, - "dsk": { "name": "DSK" }, - "firmware_info": { "name": "Oprogramowanie układowe" }, - "raw_state": { "name": "Stan surowy" }, - "udsk": { "name": "UDSK" } - } - } - }, - "switch": { - "temperature_control": {"name": "Kontrola temperatury"} - }, - "text": { - "mug_name": { "name": "Nazwa" } - } - } -} diff --git a/custom_components/fontawesome/__pycache__/__init__.cpython-312.pyc b/custom_components/fontawesome/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index ac924c92..00000000 Binary files a/custom_components/fontawesome/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/fontawesome/__pycache__/__init__.cpython-313.pyc b/custom_components/fontawesome/__pycache__/__init__.cpython-313.pyc index d5a87916..1a143102 100644 Binary files a/custom_components/fontawesome/__pycache__/__init__.cpython-313.pyc and b/custom_components/fontawesome/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/fontawesome/__pycache__/config_flow.cpython-312.pyc b/custom_components/fontawesome/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 029e7e8c..00000000 Binary files a/custom_components/fontawesome/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/__init__.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 89904b36..00000000 Binary files a/custom_components/formulaone_api/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/const.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 6af5df8a..00000000 Binary files a/custom_components/formulaone_api/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/constructorsensor.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/constructorsensor.cpython-312.pyc deleted file mode 100644 index b7f38bdc..00000000 Binary files a/custom_components/formulaone_api/__pycache__/constructorsensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/driverssensor.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/driverssensor.cpython-312.pyc deleted file mode 100644 index 71cda0a0..00000000 Binary files a/custom_components/formulaone_api/__pycache__/driverssensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/ergast.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/ergast.cpython-312.pyc deleted file mode 100644 index 3b1cdf08..00000000 Binary files a/custom_components/formulaone_api/__pycache__/ergast.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/f1.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/f1.cpython-312.pyc deleted file mode 100644 index 9a77bc55..00000000 Binary files a/custom_components/formulaone_api/__pycache__/f1.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/formulaonesensor.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/formulaonesensor.cpython-312.pyc deleted file mode 100644 index c4d07601..00000000 Binary files a/custom_components/formulaone_api/__pycache__/formulaonesensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/lastresultsensor.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/lastresultsensor.cpython-312.pyc deleted file mode 100644 index a496fba5..00000000 Binary files a/custom_components/formulaone_api/__pycache__/lastresultsensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/racessensor.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/racessensor.cpython-312.pyc deleted file mode 100644 index 6523ca54..00000000 Binary files a/custom_components/formulaone_api/__pycache__/racessensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/formulaone_api/__pycache__/sensor.cpython-312.pyc b/custom_components/formulaone_api/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index a7ce15a9..00000000 Binary files a/custom_components/formulaone_api/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/frigate/__init__.py b/custom_components/frigate/__init__.py index 4bd3381b..233ad9a5 100644 --- a/custom_components/frigate/__init__.py +++ b/custom_components/frigate/__init__.py @@ -25,7 +25,13 @@ ) from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ATTR_MODEL, CONF_HOST, CONF_URL +from homeassistant.const import ( + ATTR_MODEL, + CONF_HOST, + CONF_PASSWORD, + CONF_URL, + CONF_USERNAME, +) from homeassistant.core import HomeAssistant, callback, valid_entity_id from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers import device_registry as dr, entity_registry as er @@ -196,6 +202,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: client = FrigateApiClient( str(entry.data.get(CONF_URL)), async_get_clientsession(hass), + entry.data.get(CONF_USERNAME), + entry.data.get(CONF_PASSWORD), ) coordinator = FrigateDataUpdateCoordinator(hass, client=client) await coordinator.async_config_entry_first_refresh() diff --git a/custom_components/frigate/__pycache__/__init__.cpython-313.pyc b/custom_components/frigate/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index f2d13c79..00000000 Binary files a/custom_components/frigate/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/api.cpython-313.pyc b/custom_components/frigate/__pycache__/api.cpython-313.pyc deleted file mode 100644 index 87216690..00000000 Binary files a/custom_components/frigate/__pycache__/api.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/binary_sensor.cpython-313.pyc b/custom_components/frigate/__pycache__/binary_sensor.cpython-313.pyc deleted file mode 100644 index 851c4a66..00000000 Binary files a/custom_components/frigate/__pycache__/binary_sensor.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/camera.cpython-313.pyc b/custom_components/frigate/__pycache__/camera.cpython-313.pyc deleted file mode 100644 index 0f771d1b..00000000 Binary files a/custom_components/frigate/__pycache__/camera.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/config_flow.cpython-313.pyc b/custom_components/frigate/__pycache__/config_flow.cpython-313.pyc deleted file mode 100644 index 506837bb..00000000 Binary files a/custom_components/frigate/__pycache__/config_flow.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/const.cpython-313.pyc b/custom_components/frigate/__pycache__/const.cpython-313.pyc deleted file mode 100644 index a36bb28e..00000000 Binary files a/custom_components/frigate/__pycache__/const.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/diagnostics.cpython-313.pyc b/custom_components/frigate/__pycache__/diagnostics.cpython-313.pyc deleted file mode 100644 index 8dec6da9..00000000 Binary files a/custom_components/frigate/__pycache__/diagnostics.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/icons.cpython-313.pyc b/custom_components/frigate/__pycache__/icons.cpython-313.pyc deleted file mode 100644 index 65955198..00000000 Binary files a/custom_components/frigate/__pycache__/icons.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/image.cpython-313.pyc b/custom_components/frigate/__pycache__/image.cpython-313.pyc deleted file mode 100644 index 6558398f..00000000 Binary files a/custom_components/frigate/__pycache__/image.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/media_source.cpython-313.pyc b/custom_components/frigate/__pycache__/media_source.cpython-313.pyc deleted file mode 100644 index c34b9a3f..00000000 Binary files a/custom_components/frigate/__pycache__/media_source.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/number.cpython-313.pyc b/custom_components/frigate/__pycache__/number.cpython-313.pyc deleted file mode 100644 index 79222e56..00000000 Binary files a/custom_components/frigate/__pycache__/number.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/sensor.cpython-313.pyc b/custom_components/frigate/__pycache__/sensor.cpython-313.pyc deleted file mode 100644 index 5b084b5c..00000000 Binary files a/custom_components/frigate/__pycache__/sensor.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/switch.cpython-313.pyc b/custom_components/frigate/__pycache__/switch.cpython-313.pyc deleted file mode 100644 index 86196683..00000000 Binary files a/custom_components/frigate/__pycache__/switch.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/update.cpython-313.pyc b/custom_components/frigate/__pycache__/update.cpython-313.pyc deleted file mode 100644 index da5d1f9f..00000000 Binary files a/custom_components/frigate/__pycache__/update.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/views.cpython-313.pyc b/custom_components/frigate/__pycache__/views.cpython-313.pyc deleted file mode 100644 index ec238c99..00000000 Binary files a/custom_components/frigate/__pycache__/views.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/ws_api.cpython-313.pyc b/custom_components/frigate/__pycache__/ws_api.cpython-313.pyc deleted file mode 100644 index 12b57ff8..00000000 Binary files a/custom_components/frigate/__pycache__/ws_api.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/__pycache__/ws_event_proxy.cpython-313.pyc b/custom_components/frigate/__pycache__/ws_event_proxy.cpython-313.pyc deleted file mode 100644 index c1545b0e..00000000 Binary files a/custom_components/frigate/__pycache__/ws_event_proxy.cpython-313.pyc and /dev/null differ diff --git a/custom_components/frigate/api.py b/custom_components/frigate/api.py index a8763e0c..5609d5a0 100644 --- a/custom_components/frigate/api.py +++ b/custom_components/frigate/api.py @@ -3,6 +3,7 @@ from __future__ import annotations import asyncio +import datetime import logging import socket from typing import Any, cast @@ -11,6 +12,8 @@ import async_timeout from yarl import URL +from homeassistant.auth import jwt_wrapper + TIMEOUT = 10 _LOGGER: logging.Logger = logging.getLogger(__name__) @@ -31,10 +34,19 @@ class FrigateApiClientError(Exception): class FrigateApiClient: """Frigate API client.""" - def __init__(self, host: str, session: aiohttp.ClientSession) -> None: + def __init__( + self, + host: str, + session: aiohttp.ClientSession, + username: str | None = None, + password: str | None = None, + ) -> None: """Construct API Client.""" self._host = host self._session = session + self._username = username + self._password = password + self._token_data: dict[str, Any] = {} async def async_get_version(self) -> str: """Get data from the API.""" @@ -216,6 +228,70 @@ async def async_get_recordings( ) return cast(dict[str, Any], result) if decode_json else result + async def _get_token(self) -> None: + """ + Obtain a new JWT token using the provided username and password. + Sends a POST request to the login endpoint and extracts the token + and expiration date from the response headers. + """ + response = await self.api_wrapper( + method="post", + url=str(URL(self._host) / "api/login"), + data={"user": self._username, "password": self._password}, + decode_json=False, + is_login_request=True, + ) + + set_cookie_header = response.headers.get("Set-Cookie", "") + if not set_cookie_header: + raise KeyError("Missing Set-Cookie header in response") + + for cookie_prop in set_cookie_header.split(";"): + cookie_prop = cookie_prop.strip() + if cookie_prop.startswith("frigate_token="): + jwt_token = cookie_prop.split("=", 1)[1] + self._token_data["token"] = jwt_token + try: + decoded_token = jwt_wrapper.unverified_hs256_token_decode(jwt_token) + except Exception as e: + raise ValueError(f"Failed to decode JWT token: {e}") + exp_timestamp = decoded_token.get("exp") + if not exp_timestamp: + raise KeyError("JWT is missing 'exp' claim") + self._token_data["expires"] = datetime.datetime.fromtimestamp( + exp_timestamp, datetime.UTC + ) + break + else: + raise KeyError("Missing 'frigate_token' in Set-Cookie header") + + async def _refresh_token_if_needed(self) -> None: + """ + Refresh the JWT token if it is expired or about to expire. + """ + if "expires" not in self._token_data: + await self._get_token() + return + + current_time = datetime.datetime.now(datetime.UTC) + if current_time >= self._token_data["expires"]: # Compare UTC-aware datetimes + await self._get_token() + + async def _get_auth_headers(self) -> dict[str, str]: + """ + Get headers for API requests, including the JWT token if available. + Ensures that the token is refreshed if needed. + """ + headers = {} + + if self._username and self._password: + await self._refresh_token_if_needed() + + if "token" in self._token_data: + headers["Authorization"] = f"Bearer {self._token_data['token']}" + + return headers + async def api_wrapper( self, method: str, @@ -223,6 +299,7 @@ async def api_wrapper( data: dict | None = None, headers: dict | None = None, decode_json: bool = True, + is_login_request: bool = False, ) -> Any: """Get information from the API.""" if data is None: @@ -230,6 +307,9 @@ async def api_wrapper( if headers is None: headers = {} + if not is_login_request: + headers.update(await self._get_auth_headers()) + try: async with async_timeout.timeout(TIMEOUT): func = getattr(self._session, method) @@ -237,6 +317,9 @@ async def api_wrapper( response = await func( url, headers=headers, raise_for_status=True, json=data ) + response.raise_for_status() + if is_login_request: + return response if decode_json: return await response.json() return await response.text() @@ -249,6 +332,27 @@ async def api_wrapper( ) raise FrigateApiClientError from exc + except aiohttp.ClientResponseError as exc: + if exc.status == 401: + _LOGGER.error( + "Unauthorized (401) error for URL %s: %s", url, exc.message + ) + raise FrigateApiClientError( + "Unauthorized access - check credentials." + ) from exc + elif exc.status == 403: + _LOGGER.error("Forbidden (403) error for URL %s: %s", url, exc.message) + raise FrigateApiClientError( + "Forbidden - insufficient permissions." + ) from exc + else: + _LOGGER.error( + "Client response error (%d) for URL %s: %s", + exc.status, + url, + exc.message, + ) + raise FrigateApiClientError from exc except (KeyError, TypeError) as exc: _LOGGER.error( "Error parsing information from %s: %s", diff --git a/custom_components/frigate/camera.py b/custom_components/frigate/camera.py index 76d3bcf9..9d62252f 100644 --- a/custom_components/frigate/camera.py +++ b/custom_components/frigate/camera.py @@ -15,7 +15,6 @@ from homeassistant.components.camera import ( Camera, CameraEntityFeature, - StreamType, WebRTCAnswer, WebRTCSendMessage, ) @@ -437,13 +436,6 @@ async def stream_source(self) -> str | None: class FrigateCameraWebRTC(FrigateCamera): """A Frigate camera with WebRTC support.""" - # TODO: this property can be removed after this fix is released: - # https://github.com/home-assistant/core/pull/130932/files#diff-75655c0eec1c3e736cad1bdb5627100a4595ece9accc391b5c85343bb998594fR598-R603 - @property - def frontend_stream_type(self) -> StreamType | None: - """Return the type of stream supported by this camera.""" - return StreamType.WEB_RTC - async def async_handle_async_webrtc_offer( self, offer_sdp: str, session_id: str, send_message: WebRTCSendMessage ) -> None: @@ -463,13 +455,6 @@ async def async_on_webrtc_candidate(self, session_id: str, candidate: Any) -> No class BirdseyeCameraWebRTC(BirdseyeCamera): """A Frigate birdseye camera with WebRTC support.""" - # TODO: this property can be removed after this fix is released: - # https://github.com/home-assistant/core/pull/130932/files#diff-75655c0eec1c3e736cad1bdb5627100a4595ece9accc391b5c85343bb998594fR598-R603 - @property - def frontend_stream_type(self) -> StreamType | None: - """Return the type of stream supported by this camera.""" - return StreamType.WEB_RTC - async def async_handle_async_webrtc_offer( self, offer_sdp: str, session_id: str, send_message: WebRTCSendMessage ) -> None: diff --git a/custom_components/frigate/config_flow.py b/custom_components/frigate/config_flow.py index e5ebde10..39852f59 100644 --- a/custom_components/frigate/config_flow.py +++ b/custom_components/frigate/config_flow.py @@ -10,7 +10,7 @@ from yarl import URL from homeassistant import config_entries -from homeassistant.const import CONF_URL +from homeassistant.const import CONF_PASSWORD, CONF_URL, CONF_USERNAME from homeassistant.core import callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.aiohttp_client import async_create_clientsession @@ -48,32 +48,62 @@ async def async_step_user( self, user_input: dict[str, Any] | None = None ) -> config_entries.ConfigFlowResult: """Handle a flow initialized by the user.""" + return await self._handle_config_step(user_input) + + async def async_step_reconfigure( + self, user_input: dict[str, Any] | None = None + ) -> config_entries.ConfigFlowResult: + """Handle a flow initialized by a reconfiguration.""" + return await self._handle_config_step( + user_input, + default_form_input=dict(self._get_reconfigure_entry().data), + ) + + async def _handle_config_step( + self, + user_input: dict[str, Any] | None = None, + default_form_input: dict[str, Any] | None = None, + ) -> config_entries.ConfigFlowResult: + """Handle a config step.""" if user_input is None: - return self._show_config_form() + return self._show_config_form(user_input=default_form_input) try: - # Cannot use cv.url validation in the schema itself, so - # apply extra validation here. + # Cannot use cv.url validation in the schema itself, so apply extra + # validation here. cv.url(user_input[CONF_URL]) except vol.Invalid: return self._show_config_form(user_input, errors={"base": "invalid_url"}) try: session = async_create_clientsession(self.hass) - client = FrigateApiClient(user_input[CONF_URL], session) + client = FrigateApiClient( + user_input[CONF_URL], + session, + user_input.get(CONF_USERNAME), + user_input.get(CONF_PASSWORD), + ) await client.async_get_stats() except FrigateApiClientError: return self._show_config_form(user_input, errors={"base": "cannot_connect"}) # Search for duplicates with the same Frigate CONF_HOST value. - for existing_entry in self._async_current_entries(include_ignore=False): - if existing_entry.data.get(CONF_URL) == user_input[CONF_URL]: - return self.async_abort(reason="already_configured") - - return self.async_create_entry( - title=get_config_entry_title(user_input[CONF_URL]), data=user_input - ) + if self.source != config_entries.SOURCE_RECONFIGURE: + for existing_entry in self._async_current_entries(include_ignore=False): + if existing_entry.data.get(CONF_URL) == user_input[CONF_URL]: + return self.async_abort(reason="already_configured") + + if self.source == config_entries.SOURCE_RECONFIGURE: + return self.async_update_reload_and_abort( + self._get_reconfigure_entry(), + title=get_config_entry_title(user_input[CONF_URL]), + data=user_input, + ) + else: + return self.async_create_entry( + title=get_config_entry_title(user_input[CONF_URL]), data=user_input + ) def _show_config_form( self, @@ -90,7 +120,13 @@ def _show_config_form( { vol.Required( CONF_URL, default=user_input.get(CONF_URL, DEFAULT_HOST) - ): str + ): str, + vol.Optional( + CONF_USERNAME, default=user_input.get(CONF_USERNAME, "") + ): str, + vol.Optional( + CONF_PASSWORD, default=user_input.get(CONF_PASSWORD, "") + ): str, } ), errors=errors, diff --git a/custom_components/frigate/const.py b/custom_components/frigate/const.py index 1bfa78cb..9204d452 100644 --- a/custom_components/frigate/const.py +++ b/custom_components/frigate/const.py @@ -50,6 +50,7 @@ CONF_MEDIA_BROWSER_ENABLE = "media_browser_enable" CONF_NOTIFICATION_PROXY_ENABLE = "notification_proxy_enable" CONF_NOTIFICATION_PROXY_EXPIRE_AFTER_SECONDS = "notification_proxy_expire_after_seconds" +CONF_USERNAME = "username" CONF_PASSWORD = "password" CONF_PATH = "path" CONF_RTSP_URL_TEMPLATE = "rtsp_url_template" diff --git a/custom_components/frigate/manifest.json b/custom_components/frigate/manifest.json index c1e1bdf6..fdb9dde0 100644 --- a/custom_components/frigate/manifest.json +++ b/custom_components/frigate/manifest.json @@ -15,6 +15,6 @@ "documentation": "https://github.com/blakeblackshear/frigate", "iot_class": "local_push", "issue_tracker": "https://github.com/blakeblackshear/frigate-hass-integration/issues", - "requirements": ["hass-web-proxy-lib==0.0.7", "pytz"], - "version": "5.5.1" + "requirements": ["hass-web-proxy-lib==0.0.7"], + "version": "5.6.0" } diff --git a/custom_components/frigate/media_source.py b/custom_components/frigate/media_source.py index fdfbf6e8..6165dded 100644 --- a/custom_components/frigate/media_source.py +++ b/custom_components/frigate/media_source.py @@ -9,7 +9,6 @@ import attr from dateutil.relativedelta import relativedelta -import pytz from homeassistant.components.media_player.const import MediaClass, MediaType from homeassistant.components.media_source.error import MediaSourceError, Unresolvable @@ -22,7 +21,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers import system_info from homeassistant.helpers.template import DATE_STR_FORMAT -from homeassistant.util.dt import DEFAULT_TIME_ZONE +from homeassistant.util.dt import DEFAULT_TIME_ZONE, async_get_time_zone from . import get_friendly_name from .api import FrigateApiClient, FrigateApiClientError @@ -118,7 +117,7 @@ def get_identifier_type(cls) -> str: """Get the identifier type.""" raise NotImplementedError - def get_integration_proxy_path(self, timezone: str) -> str: + def get_integration_proxy_path(self, tz_info: dt.tzinfo) -> str: """Get the proxy (Home Assistant view) path for this identifier.""" raise NotImplementedError @@ -240,7 +239,7 @@ def get_identifier_type(cls) -> str: """Get the identifier type.""" return "event" - def get_integration_proxy_path(self, timezone: str) -> str: + def get_integration_proxy_path(self, tz_info: dt.tzinfo) -> str: """Get the equivalent Frigate server path.""" if self.frigate_media_type == FrigateMediaType.CLIPS: return f"vod/event/{self.id}/index.{self.frigate_media_type.extension}" @@ -444,7 +443,7 @@ def get_identifier_type(cls) -> str: """Get the identifier type.""" return "recordings" - def get_integration_proxy_path(self, timezone: str) -> str: + def get_integration_proxy_path(self, tz_info: dt.tzinfo) -> str: """Get the integration path that will proxy this identifier.""" if ( @@ -460,8 +459,8 @@ def get_integration_proxy_path(self, timezone: str) -> str: int(month), int(day), int(self.hour), - tzinfo=dt.timezone.utc, - ) - (dt.datetime.now(pytz.timezone(timezone)).utcoffset() or dt.timedelta()) + tzinfo=dt.UTC, + ) - (dt.datetime.now(tz_info).utcoffset() or dt.timedelta()) parts = [ "vod", @@ -565,9 +564,14 @@ async def async_resolve_media(self, item: MediaSourceItem) -> PlayMedia: identifier.frigate_instance_id ): info = await system_info.async_get_system_info(self.hass) - server_path = identifier.get_integration_proxy_path( - info.get("timezone", "utc") - ) + tz_name = info.get("timezone", "utc") + tz_info = await async_get_time_zone(tz_name) + if not tz_info: + raise Unresolvable( + f"Could not get timezone object for timezone: {tz_name}" + ) + + server_path = identifier.get_integration_proxy_path(tz_info) return PlayMedia( f"/api/frigate/{identifier.frigate_instance_id}/{server_path}", identifier.mime_type, diff --git a/custom_components/frigate/translations/en.json b/custom_components/frigate/translations/en.json index 4d42f01c..669ed8b8 100644 --- a/custom_components/frigate/translations/en.json +++ b/custom_components/frigate/translations/en.json @@ -4,7 +4,9 @@ "user": { "description": "URL you use to access Frigate (ie. `http://frigate:5000/`)\n\nIf you are using HassOS with the addon, the URL should be `http://ccab4aaf-frigate:5000/`\n\nHome Assistant needs access to port 5000 (api) and 8554/8555 (rtsp, webrtc) for all features.\n\nThe integration will setup sensors, cameras, and media browser functionality.\n\nSensors:\n- Stats to monitor frigate performance\n- Object counts for all zones and cameras\n\nCameras:\n- Cameras for image of the last detected object for each camera\n- Camera entities with stream support\n\nMedia Browser:\n- Rich UI with thumbnails for browsing event clips\n- Rich UI for browsing 24/7 recordings by month, day, camera, time\n\nAPI:\n- Notification API with public facing endpoints for images in notifications", "data": { - "url": "URL" + "url": "URL", + "username": "Username (optional)", + "password": "Password (optional)" } } }, diff --git a/custom_components/frigate/translations/fr.json b/custom_components/frigate/translations/fr.json index 21c07aa2..8704d828 100644 --- a/custom_components/frigate/translations/fr.json +++ b/custom_components/frigate/translations/fr.json @@ -4,7 +4,9 @@ "user": { "description": "URL que vous utilisez pour accéder à Frigate (par exemple, `http://frigate:5000/`)\n\nSi vous utilisez HassOS avec l'addon, l'URL devrait être `http://ccab4aaf-frigate:5000/`\n\nHome Assistant a besoin d'accès au port 5000 (api) et 8554/8555 (rtsp, webrtc) pour toutes les fonctionnalités.\n\nL'intégration configurera des capteurs, des caméras et la fonctionnalité de navigateur multimédia.\n\nCapteurs :\n- Statistiques pour surveiller la performance de Frigate\n- Comptes d'objets pour toutes les zones et caméras\n\nCaméras :\n- Caméras pour l'image du dernier objet détecté pour chaque caméra\n- Entités de caméra avec support de flux\n\nNavigateur multimédia :\n- Interface riche avec miniatures pour parcourir les clips d'événements\n- Interface riche pour parcourir les enregistrements 24/7 par mois, jour, caméra, heure\n\nAPI :\n- API de notification avec des points de terminaison publics pour les images dans les notifications", "data": { - "url": "URL" + "url": "URL", + "username": "Nom d'utilisateur (facultatif)", + "password": "Mot de passe (facultatif)" } } }, @@ -31,4 +33,4 @@ "only_advanced_options": "Le mode avancé est désactivé et il n'y a que des options avancées" } } -} \ No newline at end of file +} diff --git a/custom_components/frigate/views.py b/custom_components/frigate/views.py index ba0628ec..f1e2c73e 100644 --- a/custom_components/frigate/views.py +++ b/custom_components/frigate/views.py @@ -245,6 +245,8 @@ def _get_proxied_url( url_path = f"api/events/{event_id}/snapshot.jpg" elif path.endswith("clip.mp4"): url_path = f"api/events/{event_id}/clip.mp4" + elif path.endswith("master.m3u8"): + url_path = f"vod/events/{event_id}/master.m3u8" elif path.endswith("event_preview.gif"): url_path = f"api/events/{event_id}/preview.gif" elif path.endswith("review_preview.gif"): diff --git a/custom_components/google_fit/__pycache__/__init__.cpython-312.pyc b/custom_components/google_fit/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 894f3f58..00000000 Binary files a/custom_components/google_fit/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/api.cpython-312.pyc b/custom_components/google_fit/__pycache__/api.cpython-312.pyc deleted file mode 100644 index 2bddb624..00000000 Binary files a/custom_components/google_fit/__pycache__/api.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/api_types.cpython-312.pyc b/custom_components/google_fit/__pycache__/api_types.cpython-312.pyc deleted file mode 100644 index 2e85ccb4..00000000 Binary files a/custom_components/google_fit/__pycache__/api_types.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/application_credentials.cpython-312.pyc b/custom_components/google_fit/__pycache__/application_credentials.cpython-312.pyc deleted file mode 100644 index d804b76e..00000000 Binary files a/custom_components/google_fit/__pycache__/application_credentials.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/config_flow.cpython-312.pyc b/custom_components/google_fit/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index baed7b2c..00000000 Binary files a/custom_components/google_fit/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/const.cpython-312.pyc b/custom_components/google_fit/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 93e35613..00000000 Binary files a/custom_components/google_fit/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/coordinator.cpython-312.pyc b/custom_components/google_fit/__pycache__/coordinator.cpython-312.pyc deleted file mode 100644 index 8a5e5745..00000000 Binary files a/custom_components/google_fit/__pycache__/coordinator.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/entity.cpython-312.pyc b/custom_components/google_fit/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index c8f09c37..00000000 Binary files a/custom_components/google_fit/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/sensor.cpython-312.pyc b/custom_components/google_fit/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index 8fd4dab7..00000000 Binary files a/custom_components/google_fit/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_fit/__pycache__/sensor.cpython-313.pyc b/custom_components/google_fit/__pycache__/sensor.cpython-313.pyc index 28752d9a..0df5b83b 100644 Binary files a/custom_components/google_fit/__pycache__/sensor.cpython-313.pyc and b/custom_components/google_fit/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/google_home/__pycache__/__init__.cpython-312.pyc b/custom_components/google_home/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 277256d1..00000000 Binary files a/custom_components/google_home/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/api.cpython-312.pyc b/custom_components/google_home/__pycache__/api.cpython-312.pyc deleted file mode 100644 index 3c77fe24..00000000 Binary files a/custom_components/google_home/__pycache__/api.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/api.cpython-313.pyc b/custom_components/google_home/__pycache__/api.cpython-313.pyc index e6623e9f..015a1766 100644 Binary files a/custom_components/google_home/__pycache__/api.cpython-313.pyc and b/custom_components/google_home/__pycache__/api.cpython-313.pyc differ diff --git a/custom_components/google_home/__pycache__/config_flow.cpython-312.pyc b/custom_components/google_home/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 017c3d79..00000000 Binary files a/custom_components/google_home/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/const.cpython-312.pyc b/custom_components/google_home/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 38ef6de5..00000000 Binary files a/custom_components/google_home/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/entity.cpython-312.pyc b/custom_components/google_home/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index fbddfed9..00000000 Binary files a/custom_components/google_home/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/entity.cpython-313.pyc b/custom_components/google_home/__pycache__/entity.cpython-313.pyc index 6e95c69d..37d93850 100644 Binary files a/custom_components/google_home/__pycache__/entity.cpython-313.pyc and b/custom_components/google_home/__pycache__/entity.cpython-313.pyc differ diff --git a/custom_components/google_home/__pycache__/exceptions.cpython-312.pyc b/custom_components/google_home/__pycache__/exceptions.cpython-312.pyc deleted file mode 100644 index a7fb2407..00000000 Binary files a/custom_components/google_home/__pycache__/exceptions.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/models.cpython-312.pyc b/custom_components/google_home/__pycache__/models.cpython-312.pyc deleted file mode 100644 index a61f791b..00000000 Binary files a/custom_components/google_home/__pycache__/models.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/models.cpython-313.pyc b/custom_components/google_home/__pycache__/models.cpython-313.pyc index c95bd8ed..f13ccf52 100644 Binary files a/custom_components/google_home/__pycache__/models.cpython-313.pyc and b/custom_components/google_home/__pycache__/models.cpython-313.pyc differ diff --git a/custom_components/google_home/__pycache__/number.cpython-312.pyc b/custom_components/google_home/__pycache__/number.cpython-312.pyc deleted file mode 100644 index abb77d94..00000000 Binary files a/custom_components/google_home/__pycache__/number.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/number.cpython-313.pyc b/custom_components/google_home/__pycache__/number.cpython-313.pyc index db7899e2..af172436 100644 Binary files a/custom_components/google_home/__pycache__/number.cpython-313.pyc and b/custom_components/google_home/__pycache__/number.cpython-313.pyc differ diff --git a/custom_components/google_home/__pycache__/sensor.cpython-312.pyc b/custom_components/google_home/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index d7baf3a7..00000000 Binary files a/custom_components/google_home/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/sensor.cpython-313.pyc b/custom_components/google_home/__pycache__/sensor.cpython-313.pyc index ee366f70..e2c3be79 100644 Binary files a/custom_components/google_home/__pycache__/sensor.cpython-313.pyc and b/custom_components/google_home/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/google_home/__pycache__/switch.cpython-312.pyc b/custom_components/google_home/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index 80068775..00000000 Binary files a/custom_components/google_home/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/google_home/__pycache__/switch.cpython-313.pyc b/custom_components/google_home/__pycache__/switch.cpython-313.pyc index 134cbb2f..a7944b62 100644 Binary files a/custom_components/google_home/__pycache__/switch.cpython-313.pyc and b/custom_components/google_home/__pycache__/switch.cpython-313.pyc differ diff --git a/custom_components/google_home/__pycache__/types.cpython-312.pyc b/custom_components/google_home/__pycache__/types.cpython-312.pyc deleted file mode 100644 index d215d4c0..00000000 Binary files a/custom_components/google_home/__pycache__/types.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/__init__.cpython-312.pyc b/custom_components/hacs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 837394b7..00000000 Binary files a/custom_components/hacs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/base.cpython-312.pyc b/custom_components/hacs/__pycache__/base.cpython-312.pyc deleted file mode 100644 index da5ecf21..00000000 Binary files a/custom_components/hacs/__pycache__/base.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/base.cpython-313.pyc b/custom_components/hacs/__pycache__/base.cpython-313.pyc index fac5e42e..ecd96cd0 100644 Binary files a/custom_components/hacs/__pycache__/base.cpython-313.pyc and b/custom_components/hacs/__pycache__/base.cpython-313.pyc differ diff --git a/custom_components/hacs/__pycache__/config_flow.cpython-312.pyc b/custom_components/hacs/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index e1ce6cbb..00000000 Binary files a/custom_components/hacs/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/config_flow.cpython-313.pyc b/custom_components/hacs/__pycache__/config_flow.cpython-313.pyc index cb684558..b4fcce17 100644 Binary files a/custom_components/hacs/__pycache__/config_flow.cpython-313.pyc and b/custom_components/hacs/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/hacs/__pycache__/const.cpython-312.pyc b/custom_components/hacs/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 39f477af..00000000 Binary files a/custom_components/hacs/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/coordinator.cpython-312.pyc b/custom_components/hacs/__pycache__/coordinator.cpython-312.pyc deleted file mode 100644 index 5caf3caa..00000000 Binary files a/custom_components/hacs/__pycache__/coordinator.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/data_client.cpython-312.pyc b/custom_components/hacs/__pycache__/data_client.cpython-312.pyc deleted file mode 100644 index 8996cae1..00000000 Binary files a/custom_components/hacs/__pycache__/data_client.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/data_client.cpython-313.pyc b/custom_components/hacs/__pycache__/data_client.cpython-313.pyc index 0041492e..60fa92d2 100644 Binary files a/custom_components/hacs/__pycache__/data_client.cpython-313.pyc and b/custom_components/hacs/__pycache__/data_client.cpython-313.pyc differ diff --git a/custom_components/hacs/__pycache__/diagnostics.cpython-312.pyc b/custom_components/hacs/__pycache__/diagnostics.cpython-312.pyc deleted file mode 100644 index 8e4775db..00000000 Binary files a/custom_components/hacs/__pycache__/diagnostics.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/diagnostics.cpython-313.pyc b/custom_components/hacs/__pycache__/diagnostics.cpython-313.pyc index 03729e99..ef653a6d 100644 Binary files a/custom_components/hacs/__pycache__/diagnostics.cpython-313.pyc and b/custom_components/hacs/__pycache__/diagnostics.cpython-313.pyc differ diff --git a/custom_components/hacs/__pycache__/entity.cpython-312.pyc b/custom_components/hacs/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index 6140b9bc..00000000 Binary files a/custom_components/hacs/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/entity.cpython-313.pyc b/custom_components/hacs/__pycache__/entity.cpython-313.pyc index 6a44ab47..2349d1b9 100644 Binary files a/custom_components/hacs/__pycache__/entity.cpython-313.pyc and b/custom_components/hacs/__pycache__/entity.cpython-313.pyc differ diff --git a/custom_components/hacs/__pycache__/enums.cpython-312.pyc b/custom_components/hacs/__pycache__/enums.cpython-312.pyc deleted file mode 100644 index e119429d..00000000 Binary files a/custom_components/hacs/__pycache__/enums.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/exceptions.cpython-312.pyc b/custom_components/hacs/__pycache__/exceptions.cpython-312.pyc deleted file mode 100644 index d169214d..00000000 Binary files a/custom_components/hacs/__pycache__/exceptions.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/frontend.cpython-312.pyc b/custom_components/hacs/__pycache__/frontend.cpython-312.pyc deleted file mode 100644 index a6f9288e..00000000 Binary files a/custom_components/hacs/__pycache__/frontend.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/repairs.cpython-312.pyc b/custom_components/hacs/__pycache__/repairs.cpython-312.pyc deleted file mode 100644 index 387d9e95..00000000 Binary files a/custom_components/hacs/__pycache__/repairs.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/switch.cpython-312.pyc b/custom_components/hacs/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index b24f4080..00000000 Binary files a/custom_components/hacs/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/switch.cpython-313.pyc b/custom_components/hacs/__pycache__/switch.cpython-313.pyc index 8afa043d..3ac71493 100644 Binary files a/custom_components/hacs/__pycache__/switch.cpython-313.pyc and b/custom_components/hacs/__pycache__/switch.cpython-313.pyc differ diff --git a/custom_components/hacs/__pycache__/system_health.cpython-312.pyc b/custom_components/hacs/__pycache__/system_health.cpython-312.pyc deleted file mode 100644 index 7cd13571..00000000 Binary files a/custom_components/hacs/__pycache__/system_health.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/types.cpython-312.pyc b/custom_components/hacs/__pycache__/types.cpython-312.pyc deleted file mode 100644 index 5045e952..00000000 Binary files a/custom_components/hacs/__pycache__/types.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/update.cpython-312.pyc b/custom_components/hacs/__pycache__/update.cpython-312.pyc deleted file mode 100644 index b4ebf804..00000000 Binary files a/custom_components/hacs/__pycache__/update.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/__pycache__/update.cpython-313.pyc b/custom_components/hacs/__pycache__/update.cpython-313.pyc index ff2b2ab6..794ac57b 100644 Binary files a/custom_components/hacs/__pycache__/update.cpython-313.pyc and b/custom_components/hacs/__pycache__/update.cpython-313.pyc differ diff --git a/custom_components/hacs/hacs_frontend/__pycache__/__init__.cpython-312.pyc b/custom_components/hacs/hacs_frontend/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 9032a881..00000000 Binary files a/custom_components/hacs/hacs_frontend/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/hacs_frontend/__pycache__/version.cpython-312.pyc b/custom_components/hacs/hacs_frontend/__pycache__/version.cpython-312.pyc deleted file mode 100644 index 9d762cb7..00000000 Binary files a/custom_components/hacs/hacs_frontend/__pycache__/version.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/repositories/__pycache__/__init__.cpython-312.pyc b/custom_components/hacs/repositories/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index f787024b..00000000 Binary files a/custom_components/hacs/repositories/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/repositories/__pycache__/appdaemon.cpython-312.pyc b/custom_components/hacs/repositories/__pycache__/appdaemon.cpython-312.pyc deleted file mode 100644 index 9604034e..00000000 Binary files a/custom_components/hacs/repositories/__pycache__/appdaemon.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/repositories/__pycache__/base.cpython-312.pyc b/custom_components/hacs/repositories/__pycache__/base.cpython-312.pyc deleted file mode 100644 index 2644395f..00000000 Binary files a/custom_components/hacs/repositories/__pycache__/base.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/repositories/__pycache__/base.cpython-313.pyc b/custom_components/hacs/repositories/__pycache__/base.cpython-313.pyc index b5fa712b..1ba3dc16 100644 Binary files a/custom_components/hacs/repositories/__pycache__/base.cpython-313.pyc and b/custom_components/hacs/repositories/__pycache__/base.cpython-313.pyc differ diff --git a/custom_components/hacs/repositories/__pycache__/integration.cpython-312.pyc b/custom_components/hacs/repositories/__pycache__/integration.cpython-312.pyc deleted file mode 100644 index 9a29fffd..00000000 Binary files a/custom_components/hacs/repositories/__pycache__/integration.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/repositories/__pycache__/integration.cpython-313.pyc b/custom_components/hacs/repositories/__pycache__/integration.cpython-313.pyc index 77fb584a..ccfc95e3 100644 Binary files a/custom_components/hacs/repositories/__pycache__/integration.cpython-313.pyc and b/custom_components/hacs/repositories/__pycache__/integration.cpython-313.pyc differ diff --git a/custom_components/hacs/repositories/__pycache__/plugin.cpython-312.pyc b/custom_components/hacs/repositories/__pycache__/plugin.cpython-312.pyc deleted file mode 100644 index 199b3460..00000000 Binary files a/custom_components/hacs/repositories/__pycache__/plugin.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/repositories/__pycache__/plugin.cpython-313.pyc b/custom_components/hacs/repositories/__pycache__/plugin.cpython-313.pyc index 127fabd3..0821ab63 100644 Binary files a/custom_components/hacs/repositories/__pycache__/plugin.cpython-313.pyc and b/custom_components/hacs/repositories/__pycache__/plugin.cpython-313.pyc differ diff --git a/custom_components/hacs/repositories/__pycache__/python_script.cpython-312.pyc b/custom_components/hacs/repositories/__pycache__/python_script.cpython-312.pyc deleted file mode 100644 index 71bf46e7..00000000 Binary files a/custom_components/hacs/repositories/__pycache__/python_script.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/repositories/__pycache__/template.cpython-312.pyc b/custom_components/hacs/repositories/__pycache__/template.cpython-312.pyc deleted file mode 100644 index 38e62c6f..00000000 Binary files a/custom_components/hacs/repositories/__pycache__/template.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/repositories/__pycache__/theme.cpython-312.pyc b/custom_components/hacs/repositories/__pycache__/theme.cpython-312.pyc deleted file mode 100644 index 967cbe32..00000000 Binary files a/custom_components/hacs/repositories/__pycache__/theme.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/__init__.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 6f9f79ec..00000000 Binary files a/custom_components/hacs/utils/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/backup.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/backup.cpython-312.pyc deleted file mode 100644 index 6cd2e0f4..00000000 Binary files a/custom_components/hacs/utils/__pycache__/backup.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/configuration_schema.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/configuration_schema.cpython-312.pyc deleted file mode 100644 index ab8b75e4..00000000 Binary files a/custom_components/hacs/utils/__pycache__/configuration_schema.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/data.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/data.cpython-312.pyc deleted file mode 100644 index 977a9538..00000000 Binary files a/custom_components/hacs/utils/__pycache__/data.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/data.cpython-313.pyc b/custom_components/hacs/utils/__pycache__/data.cpython-313.pyc index de48d020..b808e157 100644 Binary files a/custom_components/hacs/utils/__pycache__/data.cpython-313.pyc and b/custom_components/hacs/utils/__pycache__/data.cpython-313.pyc differ diff --git a/custom_components/hacs/utils/__pycache__/decode.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/decode.cpython-312.pyc deleted file mode 100644 index 1616f3b8..00000000 Binary files a/custom_components/hacs/utils/__pycache__/decode.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/decorator.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/decorator.cpython-312.pyc deleted file mode 100644 index 8cecacd0..00000000 Binary files a/custom_components/hacs/utils/__pycache__/decorator.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/file_system.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/file_system.cpython-312.pyc deleted file mode 100644 index 0d8c2055..00000000 Binary files a/custom_components/hacs/utils/__pycache__/file_system.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/filters.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/filters.cpython-312.pyc deleted file mode 100644 index 5381a04f..00000000 Binary files a/custom_components/hacs/utils/__pycache__/filters.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/github_graphql_query.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/github_graphql_query.cpython-312.pyc deleted file mode 100644 index 45b4fd4e..00000000 Binary files a/custom_components/hacs/utils/__pycache__/github_graphql_query.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/json.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/json.cpython-312.pyc deleted file mode 100644 index dd7c58d0..00000000 Binary files a/custom_components/hacs/utils/__pycache__/json.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/logger.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/logger.cpython-312.pyc deleted file mode 100644 index 81b48f63..00000000 Binary files a/custom_components/hacs/utils/__pycache__/logger.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/path.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/path.cpython-312.pyc deleted file mode 100644 index a72f5107..00000000 Binary files a/custom_components/hacs/utils/__pycache__/path.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/queue_manager.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/queue_manager.cpython-312.pyc deleted file mode 100644 index 5e2932f2..00000000 Binary files a/custom_components/hacs/utils/__pycache__/queue_manager.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/regex.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/regex.cpython-312.pyc deleted file mode 100644 index 810508f9..00000000 Binary files a/custom_components/hacs/utils/__pycache__/regex.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/store.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/store.cpython-312.pyc deleted file mode 100644 index b7a1c662..00000000 Binary files a/custom_components/hacs/utils/__pycache__/store.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/url.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/url.cpython-312.pyc deleted file mode 100644 index 1b6bd3af..00000000 Binary files a/custom_components/hacs/utils/__pycache__/url.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/validate.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/validate.cpython-312.pyc deleted file mode 100644 index c31c97b2..00000000 Binary files a/custom_components/hacs/utils/__pycache__/validate.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/validate.cpython-313.pyc b/custom_components/hacs/utils/__pycache__/validate.cpython-313.pyc index c2e4f6f1..4f787718 100644 Binary files a/custom_components/hacs/utils/__pycache__/validate.cpython-313.pyc and b/custom_components/hacs/utils/__pycache__/validate.cpython-313.pyc differ diff --git a/custom_components/hacs/utils/__pycache__/version.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/version.cpython-312.pyc deleted file mode 100644 index 1fc15af9..00000000 Binary files a/custom_components/hacs/utils/__pycache__/version.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/utils/__pycache__/workarounds.cpython-312.pyc b/custom_components/hacs/utils/__pycache__/workarounds.cpython-312.pyc deleted file mode 100644 index 5d736283..00000000 Binary files a/custom_components/hacs/utils/__pycache__/workarounds.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/websocket/__pycache__/__init__.cpython-312.pyc b/custom_components/hacs/websocket/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index e1b9c7c1..00000000 Binary files a/custom_components/hacs/websocket/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/websocket/__pycache__/critical.cpython-312.pyc b/custom_components/hacs/websocket/__pycache__/critical.cpython-312.pyc deleted file mode 100644 index b66b1416..00000000 Binary files a/custom_components/hacs/websocket/__pycache__/critical.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/websocket/__pycache__/repositories.cpython-312.pyc b/custom_components/hacs/websocket/__pycache__/repositories.cpython-312.pyc deleted file mode 100644 index 898101c4..00000000 Binary files a/custom_components/hacs/websocket/__pycache__/repositories.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/websocket/__pycache__/repositories.cpython-313.pyc b/custom_components/hacs/websocket/__pycache__/repositories.cpython-313.pyc index 9d5e02e2..4032610a 100644 Binary files a/custom_components/hacs/websocket/__pycache__/repositories.cpython-313.pyc and b/custom_components/hacs/websocket/__pycache__/repositories.cpython-313.pyc differ diff --git a/custom_components/hacs/websocket/__pycache__/repository.cpython-312.pyc b/custom_components/hacs/websocket/__pycache__/repository.cpython-312.pyc deleted file mode 100644 index d5d77ce5..00000000 Binary files a/custom_components/hacs/websocket/__pycache__/repository.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hacs/websocket/__pycache__/repository.cpython-313.pyc b/custom_components/hacs/websocket/__pycache__/repository.cpython-313.pyc index ecdf8e04..e6a9f0a2 100644 Binary files a/custom_components/hacs/websocket/__pycache__/repository.cpython-313.pyc and b/custom_components/hacs/websocket/__pycache__/repository.cpython-313.pyc differ diff --git a/custom_components/hass_agent/__pycache__/__init__.cpython-312.pyc b/custom_components/hass_agent/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index c1e14a41..00000000 Binary files a/custom_components/hass_agent/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hass_agent/__pycache__/__init__.cpython-313.pyc b/custom_components/hass_agent/__pycache__/__init__.cpython-313.pyc index 68d6a4ea..a46cfd04 100644 Binary files a/custom_components/hass_agent/__pycache__/__init__.cpython-313.pyc and b/custom_components/hass_agent/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/hass_agent/__pycache__/config_flow.cpython-312.pyc b/custom_components/hass_agent/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index e37ba5c4..00000000 Binary files a/custom_components/hass_agent/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hass_agent/__pycache__/config_flow.cpython-313.pyc b/custom_components/hass_agent/__pycache__/config_flow.cpython-313.pyc index 41d69368..a071a856 100644 Binary files a/custom_components/hass_agent/__pycache__/config_flow.cpython-313.pyc and b/custom_components/hass_agent/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/hass_agent/__pycache__/const.cpython-312.pyc b/custom_components/hass_agent/__pycache__/const.cpython-312.pyc deleted file mode 100644 index c297aadb..00000000 Binary files a/custom_components/hass_agent/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hass_agent/__pycache__/const.cpython-313.pyc b/custom_components/hass_agent/__pycache__/const.cpython-313.pyc index ba95bf9e..639e7b2f 100644 Binary files a/custom_components/hass_agent/__pycache__/const.cpython-313.pyc and b/custom_components/hass_agent/__pycache__/const.cpython-313.pyc differ diff --git a/custom_components/hass_agent/__pycache__/media_player.cpython-312.pyc b/custom_components/hass_agent/__pycache__/media_player.cpython-312.pyc deleted file mode 100644 index f1b36ad7..00000000 Binary files a/custom_components/hass_agent/__pycache__/media_player.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hass_agent/__pycache__/media_player.cpython-313.pyc b/custom_components/hass_agent/__pycache__/media_player.cpython-313.pyc index 83b462c5..0ca1d34a 100644 Binary files a/custom_components/hass_agent/__pycache__/media_player.cpython-313.pyc and b/custom_components/hass_agent/__pycache__/media_player.cpython-313.pyc differ diff --git a/custom_components/hass_agent/__pycache__/notify.cpython-312.pyc b/custom_components/hass_agent/__pycache__/notify.cpython-312.pyc deleted file mode 100644 index cf46b754..00000000 Binary files a/custom_components/hass_agent/__pycache__/notify.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hass_agent/__pycache__/notify.cpython-313.pyc b/custom_components/hass_agent/__pycache__/notify.cpython-313.pyc index 0f6aa125..52bef0cc 100644 Binary files a/custom_components/hass_agent/__pycache__/notify.cpython-313.pyc and b/custom_components/hass_agent/__pycache__/notify.cpython-313.pyc differ diff --git a/custom_components/hass_agent/__pycache__/views.cpython-312.pyc b/custom_components/hass_agent/__pycache__/views.cpython-312.pyc deleted file mode 100644 index a8d0184e..00000000 Binary files a/custom_components/hass_agent/__pycache__/views.cpython-312.pyc and /dev/null differ diff --git a/custom_components/hass_agent/__pycache__/views.cpython-313.pyc b/custom_components/hass_agent/__pycache__/views.cpython-313.pyc index 41ed5c3e..d411a067 100644 Binary files a/custom_components/hass_agent/__pycache__/views.cpython-313.pyc and b/custom_components/hass_agent/__pycache__/views.cpython-313.pyc differ diff --git a/custom_components/hass_agent/media_player.py b/custom_components/hass_agent/media_player.py index b4f4bb9b..e0938ded 100644 --- a/custom_components/hass_agent/media_player.py +++ b/custom_components/hass_agent/media_player.py @@ -25,7 +25,7 @@ MediaPlayerEntityFeature, ) -from homeassistant.components.media_player.const import MEDIA_TYPE_MUSIC +from homeassistant.components.media_player.const import MediaType from homeassistant.components.media_player.browse_media import ( BrowseMedia, @@ -232,7 +232,7 @@ def device_class(self): @property def media_content_type(self): """Content type of current playing media""" - return MEDIA_TYPE_MUSIC + return MediaType.MUSIC async def async_media_seek(self, position: float) -> None: self._attr_media_position = position @@ -249,7 +249,7 @@ async def async_volume_down(self): async def async_mute_volume(self, mute): """Mute the volume""" - await self._send_command("mute") + await self._send_command("mute", mute) async def async_media_play(self): """Send play command""" @@ -293,12 +293,12 @@ async def async_play_media(self, media_type: str, media_id: str, **kwargs: Any): _logger.error( "Invalid media type %r. Only %s is supported!", media_type, - MEDIA_TYPE_MUSIC, + MediaType.MUSIC, ) return if media_source.is_media_source_id(media_id): - play_item = await media_source.async_resolve_media(self.hass, media_id) + play_item = await media_source.async_resolve_media(self.hass, media_id, self.entity_id) # play_item returns a relative URL if it has to be resolved on the Home Assistant host # This call will turn it into a full URL diff --git a/custom_components/hassarr/__init__.py b/custom_components/hassarr/__init__.py new file mode 100644 index 00000000..213dffa1 --- /dev/null +++ b/custom_components/hassarr/__init__.py @@ -0,0 +1,105 @@ +import voluptuous as vol +from homeassistant.core import HomeAssistant, ServiceCall +from homeassistant.helpers.typing import ConfigType +from homeassistant.config_entries import ConfigEntry +import homeassistant.helpers.config_validation as cv +from .services import handle_add_media, handle_add_overseerr_media +from .const import DOMAIN, SERVICE_ADD_RADARR_MOVIE, SERVICE_ADD_SONARR_TV_SHOW, SERVICE_ADD_OVERSEERR_MOVIE, SERVICE_ADD_OVERSEERR_TV_SHOW + +ADD_RADARR_MOVIE_SCHEMA = vol.Schema({ + vol.Required("title"): cv.string, +}) + +ADD_SONARR_TV_SHOW_SCHEMA = vol.Schema({ + vol.Required("title"): cv.string, +}) + +ADD_OVERSEERR_MOVIE_SCHEMA = vol.Schema({ + vol.Required("title"): cv.string, +}) + +ADD_OVERSEERR_TV_SHOW_SCHEMA = vol.Schema({ + vol.Required("title"): cv.string, +}) + +def handle_add_movie(hass: HomeAssistant, call: ServiceCall) -> None: + """Handle the service action to add a movie to Radarr. + + Args: + hass (HomeAssistant): The Home Assistant instance. + call (ServiceCall): The service call object. + """ + handle_add_media(hass, call, "movie", "radarr") + +def handle_add_tv_show(hass: HomeAssistant, call: ServiceCall) -> None: + """Handle the service action to add a TV show to Sonarr. + + Args: + hass (HomeAssistant): The Home Assistant instance. + call (ServiceCall): The service call object. + """ + handle_add_media(hass, call, "series", "sonarr") + +def handle_add_overseerr_movie(hass: HomeAssistant, call: ServiceCall) -> None: + """Handle the service action to add a movie to Overseerr. + + Args: + hass (HomeAssistant): The Home Assistant instance. + call (ServiceCall): The service call object. + """ + handle_add_overseerr_media(hass, call, "movie") + +def handle_add_overseerr_tv_show(hass: HomeAssistant, call: ServiceCall) -> None: + """Handle the service action to add a TV show to Overseerr. + + Args: + hass (HomeAssistant): The Home Assistant instance. + call (ServiceCall): The service call object. + """ + handle_add_overseerr_media(hass, call, "tv") + +def setup(hass: HomeAssistant, config: ConfigType) -> bool: + """Set up the Hassarr integration. + + Args: + hass (HomeAssistant): The Home Assistant instance. + config (ConfigType): The configuration dictionary. + + Returns: + bool: True if setup was successful, False otherwise. + """ + hass.services.register(DOMAIN, SERVICE_ADD_RADARR_MOVIE, lambda call: handle_add_movie(hass, call), schema=ADD_RADARR_MOVIE_SCHEMA) + hass.services.register(DOMAIN, SERVICE_ADD_SONARR_TV_SHOW, lambda call: handle_add_tv_show(hass, call), schema=ADD_SONARR_TV_SHOW_SCHEMA) + hass.services.register(DOMAIN, SERVICE_ADD_OVERSEERR_MOVIE, lambda call: handle_add_overseerr_movie(hass, call), schema=ADD_OVERSEERR_MOVIE_SCHEMA) + hass.services.register(DOMAIN, SERVICE_ADD_OVERSEERR_TV_SHOW, lambda call: handle_add_overseerr_tv_show(hass, call), schema=ADD_OVERSEERR_TV_SHOW_SCHEMA) + + # Return boolean to indicate that initialization was successful. + return True + +async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: + """Set up Hassarr from a config entry. + + Args: + hass (HomeAssistant): The Home Assistant instance. + config_entry (ConfigEntry): The configuration entry. + + Returns: + bool: True if setup was successful, False otherwise. + """ + hass.data.setdefault(DOMAIN, {}) + hass.data[DOMAIN] = config_entry.data + + # Register services + hass.services.async_register(DOMAIN, SERVICE_ADD_RADARR_MOVIE, lambda call: handle_add_movie(hass, call), schema=ADD_RADARR_MOVIE_SCHEMA) + hass.services.async_register(DOMAIN, SERVICE_ADD_SONARR_TV_SHOW, lambda call: handle_add_tv_show(hass, call), schema=ADD_SONARR_TV_SHOW_SCHEMA) + hass.services.async_register(DOMAIN, SERVICE_ADD_OVERSEERR_MOVIE, lambda call: handle_add_overseerr_movie(hass, call), schema=ADD_OVERSEERR_MOVIE_SCHEMA) + hass.services.async_register(DOMAIN, SERVICE_ADD_OVERSEERR_TV_SHOW, lambda call: handle_add_overseerr_tv_show(hass, call), schema=ADD_OVERSEERR_TV_SHOW_SCHEMA) + + # Register update listener + config_entry.async_on_unload(config_entry.add_update_listener(update_listener)) + + return True + +async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> None: + """Handle options update.""" + hass.data[DOMAIN] = config_entry.data \ No newline at end of file diff --git a/custom_components/hassarr/__pycache__/__init__.cpython-313.pyc b/custom_components/hassarr/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..e50c99e2 Binary files /dev/null and b/custom_components/hassarr/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/hassarr/__pycache__/config_flow.cpython-313.pyc b/custom_components/hassarr/__pycache__/config_flow.cpython-313.pyc new file mode 100644 index 00000000..316b5199 Binary files /dev/null and b/custom_components/hassarr/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/hassarr/__pycache__/const.cpython-313.pyc b/custom_components/hassarr/__pycache__/const.cpython-313.pyc new file mode 100644 index 00000000..55c5e2a9 Binary files /dev/null and b/custom_components/hassarr/__pycache__/const.cpython-313.pyc differ diff --git a/custom_components/hassarr/__pycache__/services.cpython-313.pyc b/custom_components/hassarr/__pycache__/services.cpython-313.pyc new file mode 100644 index 00000000..f316f030 Binary files /dev/null and b/custom_components/hassarr/__pycache__/services.cpython-313.pyc differ diff --git a/custom_components/hassarr/config_flow.py b/custom_components/hassarr/config_flow.py new file mode 100644 index 00000000..5642c1c6 --- /dev/null +++ b/custom_components/hassarr/config_flow.py @@ -0,0 +1,279 @@ +from urllib.parse import urljoin +import voluptuous as vol +from homeassistant import config_entries +import aiohttp + +from .const import DOMAIN + +class HassarrConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): + VERSION = 1 + + async def async_step_user(self, user_input=None): + if user_input is None: + return self.async_show_form( + step_id="user", + data_schema=vol.Schema({ + vol.Required("integration_type"): vol.In(["Radarr & Sonarr", "Overseerr"]) + }) + ) + + self.integration_type = user_input["integration_type"] + if self.integration_type == "Radarr & Sonarr": + return await self.async_step_radarr_sonarr() + else: + return await self.async_step_overseerr() + + async def async_step_reconfigure(self, user_input=None): + """Handle reconfiguration of an existing entry.""" + if user_input is not None: + self.integration_type = user_input["integration_type"] + if self.integration_type == "Radarr & Sonarr": + return await self.async_step_reconfigure_radarr_sonarr() + else: + return await self.async_step_reconfigure_overseerr() + + # Get existing data to pre-fill the form + existing_data = self._get_reconfigure_entry().data + integration_type = existing_data.get("integration_type", "Radarr & Sonarr") + + return self.async_show_form( + step_id="reconfigure", + data_schema=vol.Schema({ + vol.Required("integration_type", default=integration_type): vol.In(["Radarr & Sonarr", "Overseerr"]), + }) + ) + + + async def async_step_reconfigure_overseerr(self, user_input=None): + """Handle reconfiguration for Overseerr.""" + if user_input is not None: + # Update the existing config entry + data = dict(self._get_reconfigure_entry().data) + data.update(user_input) + self.hass.config_entries.async_update_entry( + self._get_reconfigure_entry(), + data=data + ) + return await self.async_step_reconfigure_overseerr_user() + + # Get existing data to pre-fill the form + existing_data = self._get_reconfigure_entry().data + + return self.async_show_form( + step_id="reconfigure_overseerr", + data_schema=vol.Schema({ + vol.Optional("overseerr_url", default=existing_data.get("overseerr_url", "")): str, + vol.Optional("overseerr_api_key", default=existing_data.get("overseerr_api_key", "")): str, + }) + ) + + async def async_step_reconfigure_overseerr_user(self, user_input=None): + """Handle reconfiguration for Overseerr user selection.""" + if user_input is not None: + # Update the existing config entry + data = dict(self._get_reconfigure_entry().data) + data.update(user_input) + self.hass.config_entries.async_update_entry( + self._get_reconfigure_entry(), + data=data + ) + return self.async_update_reload_and_abort( + self._get_reconfigure_entry(), + data_updates=user_input, + ) + + # Get existing data to pre-fill the form + existing_data = self._get_reconfigure_entry().data + overseerr_url = existing_data.get("overseerr_url") + overseerr_api_key = existing_data.get("overseerr_api_key") + + # Fetch users from Overseerr API + users = await self._fetch_overseerr_users(overseerr_url, overseerr_api_key) + user_options = {user["id"]: user["username"] for user in users} + + return self.async_show_form( + step_id="reconfigure_overseerr_user", + data_schema=vol.Schema({ + vol.Required("overseerr_user_id"): vol.In(user_options), + }) + ) + + async def async_step_reconfigure_radarr_sonarr(self, user_input=None): + """Handle reconfiguration for Radarr & Sonarr.""" + if user_input is not None: + # Update the existing config entry + data = dict(self._get_reconfigure_entry().data) + data.update(user_input) + self.hass.config_entries.async_update_entry( + self._get_reconfigure_entry(), + data=data + ) + return await self.async_step_reconfigure_radarr_sonarr_quality_profiles() + + # Get existing data to pre-fill the form + existing_data = self._get_reconfigure_entry().data + + return self.async_show_form( + step_id="reconfigure_radarr_sonarr", + data_schema=vol.Schema({ + vol.Optional("radarr_url", default=existing_data.get("radarr_url", "")): str, + vol.Optional("sonarr_url", default=existing_data.get("sonarr_url", "")): str, + vol.Optional("radarr_api_key", default=existing_data.get("radarr_api_key", "")): str, + vol.Optional("sonarr_api_key", default=existing_data.get("sonarr_api_key", "")): str, + }) + ) + + async def async_step_reconfigure_radarr_sonarr_quality_profiles(self, user_input=None): + """Handle reconfiguration for Radarr & Sonarr quality profiles.""" + if user_input is not None: + # Update the existing config entry + data = dict(self._get_reconfigure_entry().data) + data.update(user_input) + self.hass.config_entries.async_update_entry( + self._get_reconfigure_entry(), + data=data + ) + return self.async_update_reload_and_abort( + self._get_reconfigure_entry(), + data_updates=user_input, + ) + + # Get existing data to pre-fill the form + existing_data = self._get_reconfigure_entry().data + radarr_url = existing_data.get("radarr_url") + radarr_api_key = existing_data.get("radarr_api_key") + sonarr_url = existing_data.get("sonarr_url") + sonarr_api_key = existing_data.get("sonarr_api_key") + + # Fetch quality profiles from Radarr and Sonarr APIs + radarr_profiles = await self._fetch_quality_profiles(radarr_url, radarr_api_key) + sonarr_profiles = await self._fetch_quality_profiles(sonarr_url, sonarr_api_key) + + radarr_options = {profile["id"]: profile["name"] for profile in radarr_profiles} + sonarr_options = {profile["id"]: profile["name"] for profile in sonarr_profiles} + + return self.async_show_form( + step_id="reconfigure_radarr_sonarr_quality_profiles", + data_schema=vol.Schema({ + vol.Required("radarr_quality_profile_id"): vol.In(radarr_options), + vol.Required("sonarr_quality_profile_id"): vol.In(sonarr_options), + }) + ) + + async def async_step_radarr_sonarr(self, user_input=None): + if user_input is None: + return self.async_show_form(step_id="radarr_sonarr", data_schema=self._get_radarr_sonarr_schema()) + + # Validate user input + errors = {} + if not user_input.get("radarr_url") or not user_input.get("radarr_api_key"): + errors["base"] = "missing_radarr_info" + if not user_input.get("sonarr_url") or not user_input.get("sonarr_api_key"): + errors["base"] = "missing_sonarr_info" + + if errors: + return self.async_show_form(step_id="radarr_sonarr", data_schema=self._get_radarr_sonarr_schema(), errors=errors) + + # Save the radarr_url and radarr_api_key and proceed to quality profile selection step + self.radarr_url = user_input["radarr_url"] + self.radarr_api_key = user_input["radarr_api_key"] + self.sonarr_url = user_input["sonarr_url"] + self.sonarr_api_key = user_input["sonarr_api_key"] + return await self.async_step_radarr_sonarr_quality_profiles() + + async def async_step_radarr_sonarr_quality_profiles(self, user_input=None): + if user_input is None: + # Fetch quality profiles from Radarr and Sonarr APIs + radarr_profiles = await self._fetch_quality_profiles(self.radarr_url, self.radarr_api_key) + sonarr_profiles = await self._fetch_quality_profiles(self.sonarr_url, self.sonarr_api_key) + + radarr_options = {profile["id"]: profile["name"] for profile in radarr_profiles} + sonarr_options = {profile["id"]: profile["name"] for profile in sonarr_profiles} + + return self.async_show_form( + step_id="radarr_sonarr_quality_profiles", + data_schema=vol.Schema({ + vol.Required("radarr_quality_profile_id"): vol.In(radarr_options), + vol.Required("sonarr_quality_profile_id"): vol.In(sonarr_options), + }) + ) + + # Create the entry with the selected quality profile IDs + user_input.update({ + "radarr_url": self.radarr_url, + "radarr_api_key": self.radarr_api_key, + "sonarr_url": self.sonarr_url, + "sonarr_api_key": self.sonarr_api_key + }) + return self.async_create_entry(title="Hassarr", data=user_input) + + async def async_step_overseerr(self, user_input=None): + if user_input is None: + return self.async_show_form(step_id="overseerr", data_schema=self._get_overseerr_schema()) + + # Validate user input + errors = {} + if not user_input.get("overseerr_url") or not user_input.get("overseerr_api_key"): + errors["base"] = "missing_overseerr_info" + + if errors: + return self.async_show_form(step_id="overseerr", data_schema=self._get_overseerr_schema(), errors=errors) + + # Save the overseerr_url and overseerr_api_key and proceed to user selection step + self.overseerr_url = user_input["overseerr_url"] + self.overseerr_api_key = user_input["overseerr_api_key"] + return await self.async_step_overseerr_user() + + async def async_step_overseerr_user(self, user_input=None): + if user_input is None: + # Fetch users from Overseerr API + users = await self._fetch_overseerr_users(self.overseerr_url, self.overseerr_api_key) + user_options = {user["id"]: user["username"] for user in users} + + return self.async_show_form( + step_id="overseerr_user", + data_schema=vol.Schema({ + vol.Required("overseerr_user_id"): vol.In(user_options), + }) + ) + + # Create the entry with the selected user ID + user_input.update({ + "overseerr_url": self.overseerr_url, + "overseerr_api_key": self.overseerr_api_key + }) + return self.async_create_entry(title="Hassarr", data=user_input) + + async def _fetch_overseerr_users(self, url, api_key): + """Fetch users from the Overseerr API.""" + async with aiohttp.ClientSession() as session: + url = urljoin(url, "api/v1/user") + async with session.get(url, headers={"X-Api-Key": api_key}) as response: + response.raise_for_status() + data = await response.json() + return data["results"] + + async def _fetch_quality_profiles(self, url, api_key): + """Fetch quality profiles from the Radarr/Sonarr API.""" + async with aiohttp.ClientSession() as session: + url = urljoin(url, "api/v3/qualityprofile") + async with session.get(url, headers={"X-Api-Key": api_key}) as response: + response.raise_for_status() + data = await response.json() + return data + + @staticmethod + def _get_radarr_sonarr_schema(): + return vol.Schema({ + vol.Required("radarr_url"): str, + vol.Required("radarr_api_key"): str, + vol.Required("sonarr_url"): str, + vol.Required("sonarr_api_key"): str, + }) + + @staticmethod + def _get_overseerr_schema(): + return vol.Schema({ + vol.Required("overseerr_url"): str, + vol.Required("overseerr_api_key"): str + }) \ No newline at end of file diff --git a/custom_components/hassarr/const.py b/custom_components/hassarr/const.py new file mode 100644 index 00000000..69393d73 --- /dev/null +++ b/custom_components/hassarr/const.py @@ -0,0 +1,6 @@ +DOMAIN = "hassarr" + +SERVICE_ADD_RADARR_MOVIE = "add_radarr_movie" +SERVICE_ADD_SONARR_TV_SHOW = "add_sonarr_tv_show" +SERVICE_ADD_OVERSEERR_MOVIE = "add_overseerr_movie" +SERVICE_ADD_OVERSEERR_TV_SHOW = "add_overseerr_tv_show" \ No newline at end of file diff --git a/custom_components/hassarr/manifest.json b/custom_components/hassarr/manifest.json new file mode 100644 index 00000000..3d90ed50 --- /dev/null +++ b/custom_components/hassarr/manifest.json @@ -0,0 +1,11 @@ +{ + "domain": "hassarr", + "name": "Hassarr", + "version": "0.2.0", + "documentation": "https://github.com/TegridyTate/Hassarr", + "issue_tracker": "https://github.com/TegridyTate/Hassarr/issues", + "requirements": [], + "dependencies": [], + "codeowners": ["@TegridyTate"], + "config_flow": true +} \ No newline at end of file diff --git a/custom_components/hassarr/services.py b/custom_components/hassarr/services.py new file mode 100644 index 00000000..421cdd4f --- /dev/null +++ b/custom_components/hassarr/services.py @@ -0,0 +1,197 @@ +import logging +import requests +from urllib.parse import urljoin, urlparse, urlunparse +from .const import DOMAIN +from homeassistant.core import HomeAssistant, ServiceCall + +_LOGGER = logging.getLogger(__name__) + +def fetch_data(url: str, headers: dict) -> dict | None: + """Fetch data from the given URL with headers. + + Args: + url (str): The URL to fetch data from. + headers (dict): The headers to include in the request. + + Returns: + dict | None: The JSON response if successful, None otherwise. + """ + response = requests.get(url, headers=headers) + if response.status_code == requests.codes.ok: + return response.json() + else: + _LOGGER.error(f"Failed to fetch data from {url}: {response.text}") + return None + +def get_root_folder_path(url: str, headers: dict) -> str | None: + """Get root folder path from the given URL. + + Args: + url (str): The URL to fetch the root folder path from. + headers (dict): The headers to include in the request. + + Returns: + str | None: The root folder path if successful, None otherwise. + """ + data = fetch_data(url, headers) + if data: + return data[0].get("path") + return None + +def handle_add_media(hass: HomeAssistant, call: ServiceCall, media_type: str, service_name: str) -> None: + """Handle the service action to add a media (movie or TV show). + + Args: + hass (HomeAssistant): The Home Assistant instance. + call (ServiceCall): The service call object. + media_type (str): The type of media to add (e.g., "movie" or "series"). + service_name (str): The name of the service (e.g., "radarr" or "sonarr"). + """ + _LOGGER.info(f"Received call data: {call.data}") + title = call.data.get("title") + + if not title: + _LOGGER.error("Title is missing in the service call data") + return + + _LOGGER.info(f"Title received: {title}") + + # Access stored configuration data + config_data = hass.data[DOMAIN] + + url = config_data.get(f"{service_name}_url") + api_key = config_data.get(f"{service_name}_api_key") + quality_profile_id = config_data.get(f"{service_name}_quality_profile_id") + + if not url or not api_key: + _LOGGER.error(f"{service_name.capitalize()} URL or API key is missing") + return + + headers = {'X-Api-Key': api_key} + + # Fetch media list + search_url = urljoin(url, f"api/v3/{media_type}/lookup?term={title}") + _LOGGER.info(f"Fetching media list from URL: {search_url}") + media_list = fetch_data(search_url, headers) + + if media_list: + media_data = media_list[0] + + # Get root folder path + root_folder_url = urljoin(url, "api/v3/rootfolder") + root_folder_path = get_root_folder_path(root_folder_url, headers) + if not root_folder_path: + return + + # Prepare payload + payload = { + 'title': media_data['title'], + 'titleSlug': media_data['titleSlug'], + 'images': media_data['images'], + 'year': media_data['year'], + 'rootFolderPath': root_folder_path, + 'addOptions': { + 'searchForMovie' if media_type == 'movie' else 'searchForMissingEpisodes': True + }, + 'qualityProfileId': quality_profile_id, + } + if media_type == 'movie': + payload['tmdbId'] = media_data['tmdbId'] + else: + payload['tvdbId'] = media_data['tvdbId'] + + # Add media + add_url = urljoin(url, f"api/v3/{media_type}") + _LOGGER.info(f"Adding media to URL: {add_url} with payload: {payload}") + add_response = requests.post(add_url, json=payload, headers=headers) + + if add_response.status_code == requests.codes.created: + _LOGGER.info(f"Successfully added {media_type} '{title}' to {service_name.capitalize()}") + else: + _LOGGER.error(f"Failed to add {media_type} '{title}' to {service_name.capitalize()}: {add_response.text}") + else: + _LOGGER.info(f"No results found for {media_type} '{title}'") + +def handle_add_overseerr_media(hass: HomeAssistant, call: ServiceCall, media_type: str) -> None: + """Handle the service action to add a media (movie or TV show) using Overseerr. + + Args: + hass (HomeAssistant): The Home Assistant instance. + call (ServiceCall): The service call object. + media_type (str): The type of media to add (e.g., "movie" or "tv"). + """ + _LOGGER.info(f"Received call data: {call.data}") + title = call.data.get("title") + + if not title: + _LOGGER.error("Title is missing in the service call data") + return + + _LOGGER.info(f"Title received: {title}") + + # Access stored configuration data + config_data = hass.data[DOMAIN] + + url = config_data.get("overseerr_url") + api_key = config_data.get("overseerr_api_key") + + if not url or not api_key: + _LOGGER.error("Overseerr URL or API key is missing") + return + + # Ensure the URL has a scheme + parsed_url = urlparse(url) + if not parsed_url.scheme: + url_https = f"https://{url}" + url_http = f"http://{url}" + else: + url_https = url + url_http = url + + headers = {'X-Api-Key': api_key} + + # Try https first + search_url = urljoin(url_https, f"api/v1/search?query={title}") + _LOGGER.info(f"Searching for media with URL: {search_url}") + search_results = fetch_data(search_url, headers) + + if not search_results or not search_results.get("results"): + # Try with http if https fails + search_url = urljoin(url_http, f"api/v1/search?query={title}") + _LOGGER.error(f"Retrying search for media with URL: {search_url}") + _LOGGER.info(f"Retrying search for media with URL: {search_url}") + search_results = fetch_data(search_url, headers) + + if search_results and search_results.get("results"): + media_data = search_results["results"][0] + _LOGGER.error(f"Media data: {media_data}") + + # Prepare payload + payload = { + "mediaType": media_type, + "mediaId": media_data["id"], + "is4k": False, + "serverId": 0, + "profileId": 0, + "rootFolder": "", + "languageProfileId": 0, + "userId": config_data.get("overseerr_user_id"), + "seasons": "all" if media_type == "tv" else [] + } + if media_type == "tv": + tvdb_id = media_data.get("tvdbId") + if tvdb_id is not None: + payload["tvdbId"] = tvdb_id + + # Create request + request_url = urljoin(url_https, "api/v1/request") + _LOGGER.info(f"Creating request with URL: {request_url} and payload: {payload}") + + request_response = requests.post(request_url, json=payload, headers=headers) + + if request_response.status_code == requests.codes.created: + _LOGGER.info(f"Successfully created request for {media_type} '{title}' in Overseerr") + else: + _LOGGER.error(f"Failed to create request for {media_type} '{title}' in Overseerr: {request_response.text}") + else: + _LOGGER.info(f"No results found for {media_type} '{title}'") \ No newline at end of file diff --git a/custom_components/hassarr/services.yaml b/custom_components/hassarr/services.yaml new file mode 100644 index 00000000..76db99d4 --- /dev/null +++ b/custom_components/hassarr/services.yaml @@ -0,0 +1,27 @@ +add_radarr_movie: + description: "Add a movie to Radarr" + fields: + title: + description: "Title of the movie" + example: "Gladiator" + +add_sonarr_tv_show: + description: "Add a TV show to Sonarr" + fields: + title: + description: "Title of the TV show" + example: "Breaking Bad" + +add_overseerr_movie: + description: "Add a movie to Overseerr" + fields: + title: + description: "Title of the movie" + example: "Gladiator" + +add_overseerr_tv_show: + description: "Add a TV show to Overseerr" + fields: + title: + description: "Title of the TV show" + example: "Breaking Bad" \ No newline at end of file diff --git a/custom_components/homewhiz/__init__.py b/custom_components/homewhiz/__init__.py index 35711cfb..722cdd44 100644 --- a/custom_components/homewhiz/__init__.py +++ b/custom_components/homewhiz/__init__.py @@ -47,9 +47,9 @@ async def setup_bluetooth( _LOGGER.info("No unique entry id") return False - coordinator = hass.data.setdefault(DOMAIN, {})[ - entry.entry_id - ] = HomewhizBluetoothUpdateCoordinator(hass, entry.unique_id) + coordinator = hass.data.setdefault(DOMAIN, {})[entry.entry_id] = ( + HomewhizBluetoothUpdateCoordinator(hass, entry.unique_id) + ) @callback def connect( @@ -96,9 +96,9 @@ async def setup_cloud(entry: ConfigEntry, hass: HomeAssistant) -> bool: ids = from_dict(IdExchangeResponse, entry.data["ids"]) cloud_config = from_dict(CloudConfig, entry.data["cloud_config"]) - coordinator = hass.data.setdefault(DOMAIN, {})[ - entry.entry_id - ] = HomewhizCloudUpdateCoordinator(hass, ids.appId, cloud_config, entry) + coordinator = hass.data.setdefault(DOMAIN, {})[entry.entry_id] = ( + HomewhizCloudUpdateCoordinator(hass, ids.appId, cloud_config, entry) + ) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) entry.async_create_task(hass, coordinator.connect()) _LOGGER.info("Setup cloud connection successfully") diff --git a/custom_components/homewhiz/__pycache__/__init__.cpython-312.pyc b/custom_components/homewhiz/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a3bd5bb5..00000000 Binary files a/custom_components/homewhiz/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/__init__.cpython-313.pyc b/custom_components/homewhiz/__pycache__/__init__.cpython-313.pyc index 53045a31..8ba77b94 100644 Binary files a/custom_components/homewhiz/__pycache__/__init__.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/api.cpython-312.pyc b/custom_components/homewhiz/__pycache__/api.cpython-312.pyc deleted file mode 100644 index 80b5019d..00000000 Binary files a/custom_components/homewhiz/__pycache__/api.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/api.cpython-313.pyc b/custom_components/homewhiz/__pycache__/api.cpython-313.pyc index 686aaed6..bbc3f85b 100644 Binary files a/custom_components/homewhiz/__pycache__/api.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/api.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/appliance_config.cpython-312.pyc b/custom_components/homewhiz/__pycache__/appliance_config.cpython-312.pyc deleted file mode 100644 index 0e1ade45..00000000 Binary files a/custom_components/homewhiz/__pycache__/appliance_config.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/appliance_config.cpython-313.pyc b/custom_components/homewhiz/__pycache__/appliance_config.cpython-313.pyc index 974e1378..078ff19d 100644 Binary files a/custom_components/homewhiz/__pycache__/appliance_config.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/appliance_config.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/appliance_controls.cpython-312.pyc b/custom_components/homewhiz/__pycache__/appliance_controls.cpython-312.pyc deleted file mode 100644 index 50eb5e67..00000000 Binary files a/custom_components/homewhiz/__pycache__/appliance_controls.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/appliance_controls.cpython-313.pyc b/custom_components/homewhiz/__pycache__/appliance_controls.cpython-313.pyc index b701dcfe..ad39cdb1 100644 Binary files a/custom_components/homewhiz/__pycache__/appliance_controls.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/appliance_controls.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/binary_sensor.cpython-312.pyc b/custom_components/homewhiz/__pycache__/binary_sensor.cpython-312.pyc deleted file mode 100644 index 2b2bd031..00000000 Binary files a/custom_components/homewhiz/__pycache__/binary_sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/binary_sensor.cpython-313.pyc b/custom_components/homewhiz/__pycache__/binary_sensor.cpython-313.pyc index 9f50bddb..ba67504d 100644 Binary files a/custom_components/homewhiz/__pycache__/binary_sensor.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/binary_sensor.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/bluetooth.cpython-312.pyc b/custom_components/homewhiz/__pycache__/bluetooth.cpython-312.pyc deleted file mode 100644 index 40ba46b9..00000000 Binary files a/custom_components/homewhiz/__pycache__/bluetooth.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/bluetooth.cpython-313.pyc b/custom_components/homewhiz/__pycache__/bluetooth.cpython-313.pyc index 8f98d72e..e3dd79bc 100644 Binary files a/custom_components/homewhiz/__pycache__/bluetooth.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/bluetooth.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/climate.cpython-312.pyc b/custom_components/homewhiz/__pycache__/climate.cpython-312.pyc deleted file mode 100644 index d2e3d3a8..00000000 Binary files a/custom_components/homewhiz/__pycache__/climate.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/climate.cpython-313.pyc b/custom_components/homewhiz/__pycache__/climate.cpython-313.pyc index 9746d201..ead6387f 100644 Binary files a/custom_components/homewhiz/__pycache__/climate.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/climate.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/cloud.cpython-312.pyc b/custom_components/homewhiz/__pycache__/cloud.cpython-312.pyc deleted file mode 100644 index fba85f96..00000000 Binary files a/custom_components/homewhiz/__pycache__/cloud.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/cloud.cpython-313.pyc b/custom_components/homewhiz/__pycache__/cloud.cpython-313.pyc index 557aabc1..69e89308 100644 Binary files a/custom_components/homewhiz/__pycache__/cloud.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/cloud.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/config_flow.cpython-312.pyc b/custom_components/homewhiz/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index a2ccf8bb..00000000 Binary files a/custom_components/homewhiz/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/config_flow.cpython-313.pyc b/custom_components/homewhiz/__pycache__/config_flow.cpython-313.pyc index b15a0260..fe2f0903 100644 Binary files a/custom_components/homewhiz/__pycache__/config_flow.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/const.cpython-312.pyc b/custom_components/homewhiz/__pycache__/const.cpython-312.pyc deleted file mode 100644 index c47487c5..00000000 Binary files a/custom_components/homewhiz/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/const.cpython-313.pyc b/custom_components/homewhiz/__pycache__/const.cpython-313.pyc index 0fc825d2..8ca1ea70 100644 Binary files a/custom_components/homewhiz/__pycache__/const.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/const.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/entity.cpython-312.pyc b/custom_components/homewhiz/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index 013e67c7..00000000 Binary files a/custom_components/homewhiz/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/entity.cpython-313.pyc b/custom_components/homewhiz/__pycache__/entity.cpython-313.pyc index c4495fdc..32fec763 100644 Binary files a/custom_components/homewhiz/__pycache__/entity.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/entity.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/helper.cpython-312.pyc b/custom_components/homewhiz/__pycache__/helper.cpython-312.pyc deleted file mode 100644 index 3e576a00..00000000 Binary files a/custom_components/homewhiz/__pycache__/helper.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/helper.cpython-313.pyc b/custom_components/homewhiz/__pycache__/helper.cpython-313.pyc index 78a08a73..23dab0ed 100644 Binary files a/custom_components/homewhiz/__pycache__/helper.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/helper.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/homewhiz.cpython-312.pyc b/custom_components/homewhiz/__pycache__/homewhiz.cpython-312.pyc deleted file mode 100644 index 8a30a90d..00000000 Binary files a/custom_components/homewhiz/__pycache__/homewhiz.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/homewhiz.cpython-313.pyc b/custom_components/homewhiz/__pycache__/homewhiz.cpython-313.pyc index 90217e60..2167d1a2 100644 Binary files a/custom_components/homewhiz/__pycache__/homewhiz.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/homewhiz.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/select.cpython-312.pyc b/custom_components/homewhiz/__pycache__/select.cpython-312.pyc deleted file mode 100644 index 9f1a27e9..00000000 Binary files a/custom_components/homewhiz/__pycache__/select.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/select.cpython-313.pyc b/custom_components/homewhiz/__pycache__/select.cpython-313.pyc index 502e6a7b..2b64e273 100644 Binary files a/custom_components/homewhiz/__pycache__/select.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/select.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/sensor.cpython-312.pyc b/custom_components/homewhiz/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index 50c249bf..00000000 Binary files a/custom_components/homewhiz/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/sensor.cpython-313.pyc b/custom_components/homewhiz/__pycache__/sensor.cpython-313.pyc index 98ffdd77..f821787a 100644 Binary files a/custom_components/homewhiz/__pycache__/sensor.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/homewhiz/__pycache__/switch.cpython-312.pyc b/custom_components/homewhiz/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index 7b5472c3..00000000 Binary files a/custom_components/homewhiz/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/homewhiz/__pycache__/switch.cpython-313.pyc b/custom_components/homewhiz/__pycache__/switch.cpython-313.pyc index e272fbcc..9c97d7b8 100644 Binary files a/custom_components/homewhiz/__pycache__/switch.cpython-313.pyc and b/custom_components/homewhiz/__pycache__/switch.cpython-313.pyc differ diff --git a/custom_components/homewhiz/binary_sensor.py b/custom_components/homewhiz/binary_sensor.py index b55bb893..fcb6e3ff 100644 --- a/custom_components/homewhiz/binary_sensor.py +++ b/custom_components/homewhiz/binary_sensor.py @@ -31,7 +31,7 @@ def __init__( self._control = control @property - def is_on(self) -> bool | None: + def is_on(self) -> bool | None: # type: ignore[override] if self.coordinator.data is None: return None return self._control.get_value(self.coordinator.data) diff --git a/custom_components/homewhiz/climate.py b/custom_components/homewhiz/climate.py index b48bd6c9..6615dded 100644 --- a/custom_components/homewhiz/climate.py +++ b/custom_components/homewhiz/climate.py @@ -38,7 +38,7 @@ def __init__( self._previous_hvac_mode: HVACMode | None = None @property - def supported_features(self) -> ClimateEntityFeature: + def supported_features(self) -> ClimateEntityFeature: # type: ignore[override] features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE @@ -50,11 +50,11 @@ def supported_features(self) -> ClimateEntityFeature: return features @property - def hvac_modes(self) -> list[HVACMode]: + def hvac_modes(self) -> list[HVACMode]: # type: ignore[override] return self._control.hvac_mode.options @property - def hvac_mode(self) -> HVACMode | None: + def hvac_mode(self) -> HVACMode | None: # type: ignore[override] data = self.coordinator.data if data is None: return None @@ -79,19 +79,19 @@ async def async_turn_on(self) -> None: ) @property - def target_temperature_step(self) -> float: + def target_temperature_step(self) -> float: # type: ignore[override] return self._control.target_temperature.bounds.step @property - def target_temperature_low(self) -> float: + def target_temperature_low(self) -> float: # type: ignore[override] return self._control.target_temperature.bounds.lowerLimit @property - def target_temperature_high(self) -> float: + def target_temperature_high(self) -> float: # type: ignore[override] return self._control.target_temperature.bounds.upperLimit @property - def target_temperature(self) -> float | None: + def target_temperature(self) -> float | None: # type: ignore[override] if self.coordinator.data is None: return None return self._control.target_temperature.get_value(self.coordinator.data) @@ -103,15 +103,15 @@ async def async_set_temperature(self, temperature: float, **kwargs: Any) -> None ) @property - def current_temperature(self) -> float | None: + def current_temperature(self) -> float | None: # type: ignore[override] return self._control.current_temperature.get_value(self.coordinator.data) @property - def fan_modes(self) -> list[str]: + def fan_modes(self) -> list[str]: # type: ignore[override] return list(self._control.fan_mode.options.values()) @property - def fan_mode(self) -> str | None: + def fan_mode(self) -> str | None: # type: ignore[override] return self._control.fan_mode.get_value(self.coordinator.data) async def async_set_fan_mode(self, fan_mode: str) -> None: @@ -119,11 +119,11 @@ async def async_set_fan_mode(self, fan_mode: str) -> None: await self.coordinator.send_command(self._control.fan_mode.set_value(fan_mode)) @property - def swing_modes(self) -> list[str] | None: + def swing_modes(self) -> list[str] | None: # type: ignore[override] return self._control.swing.options @property - def swing_mode(self) -> str | None: + def swing_mode(self) -> str | None: # type: ignore[override] if self.coordinator.data is None: return None return self._control.swing.get_value(self.coordinator.data) diff --git a/custom_components/homewhiz/const.py b/custom_components/homewhiz/const.py index 2daa3f31..c1dd468c 100644 --- a/custom_components/homewhiz/const.py +++ b/custom_components/homewhiz/const.py @@ -1,9 +1,7 @@ # Base component constants from homeassistant.const import Platform -NAME = "HomeWhiz" DOMAIN = "homewhiz" -DOMAIN_DATA = f"{DOMAIN}_data" PLATFORMS = [ Platform.SELECT, Platform.SENSOR, @@ -11,14 +9,3 @@ Platform.SWITCH, Platform.BINARY_SENSOR, ] -VERSION = "0.0.0" -CONF_TYPE = "type" -CONF_CLOUD = "could" -CONF_BLUETOOTH = "bt" -ISSUE_URL = "https://github.com/rowysock/home-assistant-HomeWhiz/issues" - -# Icons -ICON = "mdi:washing-machine" - -# Defaults -DEFAULT_NAME = DOMAIN diff --git a/custom_components/homewhiz/entity.py b/custom_components/homewhiz/entity.py index e32ac9aa..d4b6d833 100644 --- a/custom_components/homewhiz/entity.py +++ b/custom_components/homewhiz/entity.py @@ -56,11 +56,11 @@ async def async_added_to_hass(self) -> None: setattr(self._control, "my_entity_ids", {self.entity_id: self.name}) @property - def available(self) -> bool: + def available(self) -> bool: # type: ignore[override] return self.coordinator.is_connected @property - def translation_key(self) -> str: + def translation_key(self) -> str | None: # type: ignore[override] """Translation key for this entity.""" _LOGGER.debug("Retrieving translation_key %s", self.entity_key.lower()) diff --git a/custom_components/homewhiz/homewhiz.py b/custom_components/homewhiz/homewhiz.py index b55f2e9c..f26f4fc9 100644 --- a/custom_components/homewhiz/homewhiz.py +++ b/custom_components/homewhiz/homewhiz.py @@ -16,7 +16,8 @@ class Command: class HomewhizCoordinator( - ABC, DataUpdateCoordinator[bytearray | None] # type: ignore[type-arg] + ABC, + DataUpdateCoordinator[bytearray | None], # type: ignore[type-arg] ): @abc.abstractmethod async def connect(self) -> bool: diff --git a/custom_components/homewhiz/icons.json b/custom_components/homewhiz/icons.json new file mode 100644 index 00000000..962418e9 --- /dev/null +++ b/custom_components/homewhiz/icons.json @@ -0,0 +1,9 @@ +{ + "entity": { + "switch": { + "washer_steam": { + "default": "mdi:weather-fog" + } + } + } +} diff --git a/custom_components/homewhiz/manifest.json b/custom_components/homewhiz/manifest.json index a7c5c6da..3a94b5ba 100644 --- a/custom_components/homewhiz/manifest.json +++ b/custom_components/homewhiz/manifest.json @@ -26,5 +26,5 @@ "aiohttp", "bidict" ], - "version": "0.0.6" + "version": "v0.5.7" } diff --git a/custom_components/homewhiz/select.py b/custom_components/homewhiz/select.py index 8db0bb06..885e6cf6 100644 --- a/custom_components/homewhiz/select.py +++ b/custom_components/homewhiz/select.py @@ -52,7 +52,7 @@ def __init__( self._attr_options = list(self._control.options.values()) @property - def current_option(self) -> str | None: + def current_option(self) -> str | None: # type: ignore[override] if not self.available: return STATE_UNAVAILABLE if self.coordinator.data is None: diff --git a/custom_components/homewhiz/sensor.py b/custom_components/homewhiz/sensor.py index 000f56c1..2394e890 100644 --- a/custom_components/homewhiz/sensor.py +++ b/custom_components/homewhiz/sensor.py @@ -53,7 +53,7 @@ def __init__( self._attr_device_class = SensorDeviceClass.TIMESTAMP @property - def extra_state_attributes(self) -> Mapping[str, Any] | None: + def extra_state_attributes(self) -> Mapping[str, Any] | None: # type: ignore[override] """Attribute to identify the origin of the data used""" if isinstance(self._control, SummedTimestampControl): return { @@ -66,7 +66,9 @@ def extra_state_attributes(self) -> Mapping[str, Any] | None: return None @property - def native_value(self) -> float | int | str | datetime | None: + def native_value( # type: ignore[override] + self, + ) -> float | int | str | datetime | None: _LOGGER.debug( "Native value for entity %s, id: %s, info: %s, class:%s, is %s", self.entity_key, diff --git a/custom_components/homewhiz/switch.py b/custom_components/homewhiz/switch.py index 814f1a10..36b0b540 100644 --- a/custom_components/homewhiz/switch.py +++ b/custom_components/homewhiz/switch.py @@ -30,7 +30,7 @@ def __init__( self._control = control @property - def is_on(self) -> bool | None: + def is_on(self) -> bool | None: # type: ignore[override] if self.coordinator.data is None: return None return self._control.get_value(self.coordinator.data) diff --git a/custom_components/homewhiz/translations/cs.json b/custom_components/homewhiz/translations/cs.json index cf9f427d..c6167e92 100644 --- a/custom_components/homewhiz/translations/cs.json +++ b/custom_components/homewhiz/translations/cs.json @@ -21,7 +21,7 @@ "entity": { "select": { "state": { - "name": "St\u00e1t", + "name": "Stav", "state": { "device_state_on": "Zapnuto", "device_state_off": "Vypnuto", @@ -305,7 +305,7 @@ }, "sensor": { "state": { - "name": "St\u00e1t", + "name": "Stav", "state": { "device_state_on": "Zapnuto", "device_state_off": "Vypnuto", @@ -464,7 +464,7 @@ "name": "Doba trv\u00e1n\u00ed" }, "washer_remaining": { - "name": "Zb\u00fdvaj\u00edc\u00ed" + "name": "Zb\u00fdvaj\u00edc\u00ed \u010das" }, "remote_control": { "name": "D\u00e1lkov\u00e9 ovl\u00e1d\u00e1n\u00ed" diff --git a/custom_components/homewhiz/translations/pl.json b/custom_components/homewhiz/translations/pl.json index 0001a47a..8f9eba83 100644 --- a/custom_components/homewhiz/translations/pl.json +++ b/custom_components/homewhiz/translations/pl.json @@ -28,6 +28,7 @@ "device_state_running": "Uruchomiono", "device_state_paused": "Wstrzymano", "device_state_time_delay_active": "Op\u00f3\u017anienie aktywne", + "device_state_time_delay_paused": "Op\u00f3\u017anienie wstrzymane", "device_state_cancelling": "Anulowanie", "device_state_door_open": "Drzwi s\u0105 otwarte!", "device_state_settings": "Ustawienia" @@ -65,7 +66,17 @@ "program_dark_wash": "Ciemne", "program_outdoor": "Na zewn\u0105trz", "program_drum_clean_plus": "Czyszczenie b\u0119bna+", - "program_steam_refresh": "Od\u015bwie\u017cenie parowe" + "program_steam_refresh": "Od\u015bwie\u017cenie parowe", + "program_anti_allergy": "Antyalergiczny", + "program_quickwash_40": "Szybkie pranie 40\u00b0/40 min", + "program_woolprotect": "Ochrona we\u0142ny", + "program_machinecare": "Konserwacja pralki", + "program_multisense": " MultiSense", + "program_staincare": "Odplamianie StainCare", + "program_mini_14": "Mini 14 min", + "program_darkcare": "Ciemne ubrania", + "program_bedding": "Po\u015bciel", + "program_hand_wash": "Pranie r\u0119czne" } }, "washer_temperature": { @@ -75,7 +86,13 @@ "temperature_20": "20\u00b0C", "temperature_30": "30\u00b0C", "temperature_40": "40\u00b0C", + "20c": "20\u00b0C", + "30c": "30\u00b0C", + "40c": "40\u00b0C", + "50c": "50\u00b0C", "60c": "60\u00b0C", + "70c": "70\u00b0C", + "80c": "80\u00b0C", "90c": "90\u00b0C" } }, @@ -83,6 +100,7 @@ "name": "Wirowanie", "state": { "spin_no_spin": "Bez wirowania", + "400rpm": "400RPM", "600rpm": "600RPM", "800rpm": "800RPM", "1000rpm": "1000RPM", @@ -103,6 +121,51 @@ "fast_plus_on_fast_plus": "Fast+" } }, + "washer_dirt_level": { + "name": "Poziom zabrudze\u0144", + "state": { + "dirt_level_low": "Niski", + "dirt_level_medium": "\u015aredni", + "dirt_level_high": "Wysoki" + } + }, + "washer_dirt_type": { + "name": "Rodzaj plam", + "state": { + "dirt_level_high_sweat": "S\u0142odkie", + "dirt_level_collar_soil": "Zabrudzenie ko\u0142nierzyka", + "dirt_level_tea": "Herbata", + "dirt_level_coffee": "Kawa", + "dirt_level_meal": "Posi\u0142ek", + "dirt_level_ketchup": "Keczup", + "dirt_level_mayonnaise": "Majonez", + "dirt_level_salad_dressing": "Sos do sa\u0142atki", + "dirt_level_machine_oil": "Olej maszynowy", + "dirt_level_make_up": "Makija\u017c", + "dirt_level_blood": "Krew", + "dirt_level_red_wine": "Czerwone wino", + "dirt_level_fruit_juice": "Sok owocowy", + "dirt_level_chocolate": "Czekolada", + "dirt_level_pudding": "Deser", + "dirt_level_mud": "B\u0142oto", + "dirt_level_grass": "Trawa", + "dirt_level_baby_formula": "Formu\u0142a dzieci\u0119ca", + "dirt_level_egg": "Jajko", + "dirt_level_coke": "Cola", + "dirt_level_butter": "Mas\u0142o", + "dirt_level_jam": "D\u017cem", + "dirt_level_curry": "Curry", + "dirt_level_coal": "W\u0119giel" + } + }, + "washer_extra_rinsing": { + "name": "Dodatkowe p\u0142ukanie", + "state": { + "extra_rinsing_no": "Bez dodatkowego p\u0142ukania", + "extra_rinsing_one": "Jedno dodatkowe p\u0142ukanie", + "extra_rinsing_two": "Dwa dodatkowe p\u0142ukania" + } + }, "custom_duration_level": { "name": "Poziom dostosowanego czasu trwania", "state": { @@ -301,6 +364,92 @@ "left_right_vane_control_right": "W prawo", "left_right_vane_control_auto": "Automatyczny" } + }, + "dryer_program": { + "name": "Program", + "state": { + "program_cottons": "Bawe\u0142na", + "program_cottons_eco": "Bawe\u0142na Eco", + "program_synthetics": "Syntetyki", + "program_woolprotect": "We\u0142na", + "program_night": "Noc", + "program_duvet_downwear": "Ko\u0142dra / Puchowe", + "program_drying_rack_timer_programmes": "Programy czasowe", + "program_hygienic_refresh": "Od\u015bwie\u017cenie higieniczne", + "program_hygienic_drying": "Suszenie higieniczne", + "program_xpress_super_short": "Codzienne Szybkie", + "program_jeans": "Jeans", + "program_mix": "Mix / Codzienny", + "program_steam_refresh": "Od\u015bwie\u017cenie parowe", + "program_ready_to_wear": "Gotowe do noszenia (Koszule)", + "program_bedding": "Po\u015bciel", + "program_lingerie": "Bielizna", + "program_outdoor_sports": "Sport", + "program_fashion": "Moda", + "program_towel": "R\u0119czniki" + } + }, + "dryer_steam_mode_level": { + "name": "Poziom pary", + "state": { + "steam_mode_level_1": "Poziom 1", + "steam_mode_level_2": "Poziom 2", + "steam_mode_level_3": "Poziom 3" + } + }, + "dryer_drying_level": { + "name": "Poziom wysuszenia", + "state": { + "drying_level_iron_dry": "Suszenie do prasowania", + "drying_level_cupboard_dry": "Suszenie do przechowywania w szafie", + "drying_level_plus": "Suszenie do przechowywania w szafie+", + "drying_level_extra_dry": "Bardzo wysuszone" + } + }, + "dryer_anti_creasing": { + "name": "Ochrona przeciw zagnieceniom", + "state": { + "0": "Wy\u0142.", + "30": "30 min", + "60": "60 min", + "120": "120 min" + } + }, + "dryer_duration": { + "name": "Czas trwania programu czasowego", + "state": { + "10": "10 min", + "20": "20 min", + "30": "30 min", + "40": "40 min", + "50": "50 min", + "60": "1 h", + "70": "1h 10 min", + "80": "1h 20 min", + "90": "1h 30 min", + "100": "1h 40 min", + "110": "1h 50 min", + "120": "2h", + "130": "2h 10 min", + "140": "2h 20 min", + "150": "2h 30 min", + "160": "2h 40 min" + } + }, + "setting_volume": { + "name": "Sygna\u0142 d\u017awi\u0119kowy", + "state": { + "volume_close": "Wy\u0142.", + "volume_on": "W\u0142." + } + }, + "settings_language": { + "name": "J\u0119zyk", + "state": { + "language_turkish": "Turecki", + "language_english": "Angielski", + "language_german": "Niemiecki" + } } }, "sensor": { @@ -312,6 +461,7 @@ "device_state_running": "Uruchomiono", "device_state_paused": "Wstrzymano", "device_state_time_delay_active": "Op\u00f3\u017anienie aktywne", + "device_state_time_delay_paused": "Op\u00f3\u017anienie wstrzymane", "device_state_cancelling": "Anulowanie", "device_state_door_open": "Drzwi s\u0105 otwarte!", "device_state_settings": "Ustawienia" @@ -339,7 +489,7 @@ "program_curtain": "Zas\u0142ony", "program_lingerie": "Bielizna damska", "program_soft_toys": "Pluszowe zabawki", - "program_towel": "R\u0119cznik", + "program_towel": "R\u0119czniki", "program_cottons_eco": "Bawe\u0142na eko", "program_dryer_cotton": "Suszenie: bawe\u0142na", "program_dryer_synthetics": "Suszenie: syntetyki", @@ -349,7 +499,17 @@ "program_dark_wash": "Ciemne", "program_outdoor": "Na zewn\u0105trz", "program_drum_clean_plus": "Czyszczenie b\u0119bna+", - "program_steam_refresh": "Od\u015bwie\u017cenie parowe" + "program_steam_refresh": "Od\u015bwie\u017cenie parowe", + "program_anti_allergy": "Antyalergiczny", + "program_quickwash_40": "Szybkie pranie 40\u00b0/40 min", + "program_woolprotect": "Ochrona we\u0142ny", + "program_machinecare": "Konserwacja pralki", + "program_multisense": " MultiSense", + "program_staincare": "Odplamianie StainCare", + "program_mini_14": "Mini 14 min", + "program_darkcare": "Ciemne ubrania", + "program_bedding": "Po\u015bciel", + "program_hand_wash": "Pranie r\u0119czne" } }, "washer_temperature": { @@ -359,7 +519,13 @@ "temperature_20": "20\u00b0C", "temperature_30": "30\u00b0C", "temperature_40": "40\u00b0C", + "20c": "20\u00b0C", + "30c": "30\u00b0C", + "40c": "40\u00b0C", + "50c": "50\u00b0C", "60c": "60\u00b0C", + "70c": "70\u00b0C", + "80c": "80\u00b0C", "90c": "90\u00b0C" } }, @@ -367,6 +533,7 @@ "name": "Wirowanie", "state": { "spin_no_spin": "Bez wirowania", + "400rpm": "400RPM", "600rpm": "600RPM", "800rpm": "800RPM", "1000rpm": "1000RPM", @@ -387,6 +554,51 @@ "fast_plus_on_fast_plus": "Fast+" } }, + "washer_dirt_level": { + "name": "Poziom zabrudze\u0144", + "state": { + "dirt_level_low": "Niski", + "dirt_level_medium": "\u015aredni", + "dirt_level_high": "Wysoki" + } + }, + "washer_dirt_type": { + "name": "Rodzaj plam", + "state": { + "dirt_level_high_sweat": "S\u0142odkie", + "dirt_level_collar_soil": "Zabrudzenie ko\u0142nierzyka", + "dirt_level_tea": "Herbata", + "dirt_level_coffee": "Kawa", + "dirt_level_meal": "Posi\u0142ek", + "dirt_level_ketchup": "Keczup", + "dirt_level_mayonnaise": "Majonez", + "dirt_level_salad_dressing": "Sos do sa\u0142atki", + "dirt_level_machine_oil": "Olej maszynowy", + "dirt_level_make_up": "Makija\u017c", + "dirt_level_blood": "Krew", + "dirt_level_red_wine": "Czerwone wino", + "dirt_level_fruit_juice": "Sok owocowy", + "dirt_level_chocolate": "Czekolada", + "dirt_level_pudding": "Deser", + "dirt_level_mud": "B\u0142oto", + "dirt_level_grass": "Trawa", + "dirt_level_baby_formula": "Formu\u0142a dzieci\u0119ca", + "dirt_level_egg": "Jajko", + "dirt_level_coke": "Cola", + "dirt_level_butter": "Mas\u0142o", + "dirt_level_jam": "D\u017cem", + "dirt_level_curry": "Curry", + "dirt_level_coal": "W\u0119giel" + } + }, + "washer_extra_rinsing": { + "name": "Dodatkowe p\u0142ukanie", + "state": { + "extra_rinsing_no": "Bez dodatkowego p\u0142ukania", + "extra_rinsing_one": "Jedno dodatkowe p\u0142ukanie", + "extra_rinsing_two": "Dwa dodatkowe p\u0142ukania" + } + }, "custom_duration_level": { "name": "Poziom dostosowanego czasu trwania", "state": { @@ -454,7 +666,16 @@ "dishwasher_message_program_started": "Program uruchomiony", "dishwasher_message_washing": "Zmywanie", "dishwasher_message_rinsing": "P\u0142ukanie", - "dishwasher_message_drying": "Suszenie" + "dishwasher_message_drying": "Suszenie", + "dryer_message_program_finished": "Program zako\u0144czony", + "dryer_message_program_started": "Program uruchomiony", + "dryer_message_drying": "Suszenie", + "dryer_message_time_delay_active": "Op\u00f3\u017anienie aktywne", + "dryer_message_paused": "Program zosta\u0142 wstrzymany", + "dryer_message_cooling": "Ch\u0142odzenie", + "dryer_message_refreshing": "Od\u015bwie\u017canie", + "dryer_message_anti_creasing": "Ochrona przeciw zagnieceniom", + "dryer_message_drum_empty": "B\u0119ben pusty" } }, "washer_delay": { @@ -727,6 +948,92 @@ }, "air_conditioner_auto_switch_on": { "name": "Automatyczne w\u0142\u0105czanie" + }, + "dryer_program": { + "name": "Program", + "state": { + "program_cottons": "Bawe\u0142na", + "program_cottons_eco": "Bawe\u0142na Eco", + "program_synthetics": "Syntetyki", + "program_woolprotect": "We\u0142na", + "program_night": "Noc", + "program_duvet_downwear": "Ko\u0142dra / Puchowe", + "program_drying_rack_timer_programmes": "Programy czasowe", + "program_hygienic_refresh": "Od\u015bwie\u017cenie higieniczne", + "program_hygienic_drying": "Suszenie higieniczne", + "program_xpress_super_short": "Codzienne Szybkie", + "program_jeans": "Jeans", + "program_mix": "Mix / Codzienny", + "program_steam_refresh": "Od\u015bwie\u017cenie parowe", + "program_ready_to_wear": "Gotowe do noszenia (Koszule)", + "program_bedding": "Po\u015bciel", + "program_lingerie": "Bielizna", + "program_outdoor_sports": "Sport", + "program_fashion": "Moda", + "program_towel": "R\u0119czniki" + } + }, + "dryer_steam_mode_level": { + "name": "Poziom pary", + "state": { + "steam_mode_level_1": "Poziom 1", + "steam_mode_level_2": "Poziom 2", + "steam_mode_level_3": "Poziom 3" + } + }, + "dryer_drying_level": { + "name": "Poziom wysuszenia", + "state": { + "drying_level_iron_dry": "Suszenie do prasowania", + "drying_level_cupboard_dry": "Suszenie do przechowywania w szafie", + "drying_level_plus": "Suszenie do przechowywania w szafie+", + "drying_level_extra_dry": "Bardzo wysuszone" + } + }, + "dryer_anti_creasing": { + "name": "Ochrona przeciw zagnieceniom", + "state": { + "0": "Wy\u0142.", + "30": "30 min", + "60": "60 min", + "120": "120 min" + } + }, + "dryer_duration": { + "name": "Czas trwania programu czasowego", + "state": { + "10": "10 min", + "20": "20 min", + "30": "30 min", + "40": "40 min", + "50": "50 min", + "60": "1 h", + "70": "1h 10 min", + "80": "1h 20 min", + "90": "1h 30 min", + "100": "1h 40 min", + "110": "1h 50 min", + "120": "2h", + "130": "2h 10 min", + "140": "2h 20 min", + "150": "2h 30 min", + "160": "2h 40 min" + } + }, + "setting_volume": { + "name": "Sygna\u0142 d\u017awi\u0119kowy", + "state": { + "volume_close": "Wy\u0142.", + "volume_on": "W\u0142." + } + }, + "settings_language": { + "name": "J\u0119zyk", + "state": { + "language_turkish": "Turecki", + "language_english": "Angielski", + "language_german": "Niemiecki" + } } }, "binary_sensor": { @@ -771,6 +1078,33 @@ }, "dishwasher_liquid_detergent_low": { "name": "Niski poziom detergnetu w p\u0142ynie" + }, + "dryer_warning_door_is_open": { + "name": "Otwarte drzwi" + }, + "dryer_warning_tankfull": { + "name": "Pe\u0142en zbiornik na wod\u0119" + }, + "dryer_warning_check_the_filter": { + "name": "Sprawd\u017a filtr" + }, + "dryer_warning_check_the_condenser_filter": { + "name": "Sprawd\u017a filtr wymiennika" + }, + "dryer_warning_drum_empty": { + "name": "B\u0119ben pusty" + }, + "dryer_message_child_lock": { + "name": "Blokada przed dost\u0119pem dzieci" + }, + "dryer_message_end_program": { + "name": "Koniec programu" + }, + "dryer_message_anti_creasing": { + "name": "Ochrona przeciw zagnieceniom" + }, + "dryer_message_anti_creasing_finished": { + "name": "Ochrona przeciw zagnieceniom zako\u0144czona" } }, "climate": { @@ -806,6 +1140,15 @@ "washer_anticrease": { "name": "AntiCrease" }, + "washer_silent_mode": { + "name": "Tryb cichy" + }, + "washer_anti_crease": { + "name": "Zdalna ochrona przed zagniataniem" + }, + "washer_hidden_extra_water": { + "name": "Dodatkowa woda" + }, "oven_booster": { "name": "Szybkie nagrzewanie Booster" }, @@ -838,6 +1181,12 @@ }, "dishwasher_deepwash": { "name": "G\u0142\u0119bokie pranie" + }, + "dryer_steam_mode_onoff": { + "name": "Funkcja pary" + }, + "dryer_lowtemp_mode": { + "name": "Niska temperatura" } } } diff --git a/custom_components/homewhiz/translations/sv.json b/custom_components/homewhiz/translations/sv.json index c1f677a5..787a5097 100644 --- a/custom_components/homewhiz/translations/sv.json +++ b/custom_components/homewhiz/translations/sv.json @@ -75,8 +75,8 @@ "temperature_20": "20 \u00b0C", "temperature_30": "30 \u00b0C", "temperature_40": "40 \u00b0C", - "60c": "60C", - "90c": "90C" + "60c": "60 \u00b0C", + "90c": "90 \u00b0C" } }, "washer_spin": { @@ -359,8 +359,8 @@ "temperature_20": "20 \u00b0C", "temperature_30": "30 \u00b0C", "temperature_40": "40 \u00b0C", - "60c": "60C", - "90c": "90C" + "60c": "60 \u00b0C", + "90c": "90 \u00b0C" } }, "washer_spin": { diff --git a/custom_components/localtuya/__init__.py b/custom_components/localtuya/__init__.py index 35a2adbd..d3736511 100644 --- a/custom_components/localtuya/__init__.py +++ b/custom_components/localtuya/__init__.py @@ -1,55 +1,52 @@ """The LocalTuya integration.""" + import asyncio +from dataclasses import dataclass import logging import time from datetime import timedelta +from typing import Any, NamedTuple import homeassistant.helpers.config_validation as cv +import homeassistant.helpers.device_registry as dr import homeassistant.helpers.entity_registry as er import voluptuous as vol -from homeassistant.config_entries import ConfigEntry +from homeassistant.config_entries import ConfigEntry, ConfigEntryState from homeassistant.const import ( CONF_CLIENT_ID, CONF_CLIENT_SECRET, - CONF_DEVICE_ID, CONF_DEVICES, + CONF_DEVICE_ID, CONF_ENTITIES, CONF_HOST, CONF_ID, CONF_PLATFORM, CONF_REGION, - CONF_USERNAME, EVENT_HOMEASSISTANT_STOP, SERVICE_RELOAD, ) -from homeassistant.core import HomeAssistant +from homeassistant.core import Event, HomeAssistant, ServiceCall, callback from homeassistant.exceptions import HomeAssistantError -from homeassistant.helpers.device_registry import DeviceEntry from homeassistant.helpers.event import async_track_time_interval -from .cloud_api import TuyaCloudApi -from .common import TuyaDevice, async_config_entry_by_device_id -from .config_flow import ENTRIES_VERSION, config_schema +from .coordinator import TuyaDevice, HassLocalTuyaData, TuyaCloudApi +from .config_flow import ENTRIES_VERSION from .const import ( ATTR_UPDATED_AT, + CONF_GATEWAY_ID, + CONF_NODE_ID, CONF_NO_CLOUD, CONF_PRODUCT_KEY, CONF_USER_ID, - DATA_CLOUD, DATA_DISCOVERY, DOMAIN, - TUYA_DEVICES, + PLATFORMS, ) + from .discovery import TuyaDiscovery _LOGGER = logging.getLogger(__name__) -UNSUB_LISTENER = "unsub_listener" - -RECONNECT_INTERVAL = timedelta(seconds=60) - -CONFIG_SCHEMA = config_schema() - CONF_DP = "dp" CONF_VALUE = "value" @@ -57,7 +54,7 @@ SERVICE_SET_DP_SCHEMA = vol.Schema( { vol.Required(CONF_DEVICE_ID): cv.string, - vol.Required(CONF_DP): int, + vol.Optional(CONF_DP): int, vol.Required(CONF_VALUE): object, } ) @@ -66,11 +63,11 @@ async def async_setup(hass: HomeAssistant, config: dict): """Set up the LocalTuya integration component.""" hass.data.setdefault(DOMAIN, {}) - hass.data[DOMAIN][TUYA_DEVICES] = {} + current_entries = hass.config_entries.async_entries(DOMAIN) device_cache = {} - async def _handle_reload(service): + async def _handle_reload(service: ServiceCall): """Handle reload service call.""" _LOGGER.info("Service %s.reload called: reloading integration", DOMAIN) @@ -80,56 +77,81 @@ async def _handle_reload(service): hass.config_entries.async_reload(entry.entry_id) for entry in current_entries ] - await asyncio.gather(*reload_tasks) - async def _handle_set_dp(event): + async def _handle_set_dp(event: ServiceCall): """Handle set_dp service call.""" dev_id = event.data[CONF_DEVICE_ID] - if dev_id not in hass.data[DOMAIN][TUYA_DEVICES]: + entry: ConfigEntry = async_config_entry_by_device_id(hass, dev_id) + if not entry or not entry.entry_id: raise HomeAssistantError("unknown device id") - device = hass.data[DOMAIN][TUYA_DEVICES][dev_id] + host = entry.data[CONF_DEVICES][dev_id].get(CONF_HOST) + if node_id := entry.data[CONF_DEVICES][dev_id].get(CONF_NODE_ID): + host = f"{host}_{node_id}" + device: TuyaDevice = hass.data[DOMAIN][entry.entry_id].devices[host] if not device.connected: raise HomeAssistantError("not connected to device") + value = event.data[CONF_VALUE] + if isinstance(value, dict): + await device.set_dps(value) + else: + await device.set_dp(value, event.data[CONF_DP]) - await device.set_dp(event.data[CONF_VALUE], event.data[CONF_DP]) - - def _device_discovered(device): + def _device_discovered(device: dict): """Update address of device if it has changed.""" device_ip = device["ip"] device_id = device["gwId"] product_key = device["productKey"] - # If device is not in cache, check if a config entry exists - entry = async_config_entry_by_device_id(hass, device_id) + entry: ConfigEntry = async_config_entry_by_device_id(hass, device_id) + if entry is None: return - if device_id not in device_cache: + hass_data: HassLocalTuyaData = hass.data[DOMAIN][entry.entry_id] + + if device_id not in device_cache or device_id not in device_cache.get( + device_id, {} + ): if entry and device_id in entry.data[CONF_DEVICES]: # Save address from config entry in cache to trigger # potential update below host_ip = entry.data[CONF_DEVICES][device_id][CONF_HOST] - device_cache[device_id] = host_ip + device_cache[device_id] = {device_id: host_ip} + + for subdev_id, dev_config in entry.data[CONF_DEVICES].items(): + if dev_config.get(CONF_NODE_ID): + if gateway_id := dev_config.get(CONF_GATEWAY_ID): + if entry and device_id == gateway_id: + device_cache[device_id] = device_cache.get(device_id, {}) + device_cache[device_id].update( + {subdev_id: dev_config.get(CONF_HOST)} + ) if device_id not in device_cache: return + if not entry.state == ConfigEntryState.LOADED: + return - dev_entry = entry.data[CONF_DEVICES][device_id] + if device := hass_data.devices.get(device_ip): + ... + # hass.create_task(hass_data.cloud_data.async_get_devices_list()) new_data = entry.data.copy() updated = False - - if device_cache[device_id] != device_ip: - updated = True - new_data[CONF_DEVICES][device_id][CONF_HOST] = device_ip - device_cache[device_id] = device_ip - - if dev_entry.get(CONF_PRODUCT_KEY) != product_key: - updated = True - new_data[CONF_DEVICES][device_id][CONF_PRODUCT_KEY] = product_key - + for dev_id, host in device_cache[device_id].items(): + if dev_id not in entry.data[CONF_DEVICES]: + continue + dev_entry = entry.data[CONF_DEVICES][dev_id] + if host != device_ip: + updated = True + new_data[CONF_DEVICES][dev_id][CONF_HOST] = device_ip + device_cache[device_id][dev_id] = device_ip + + if (p_key := dev_entry.get(CONF_PRODUCT_KEY)) and p_key != product_key: + updated = True + new_data[CONF_DEVICES][dev_id][CONF_PRODUCT_KEY] = product_key # Update settings if something changed, otherwise try to connect. Updating # settings triggers a reload of the config entry, which tears down the device # so no need to connect in that case. @@ -140,33 +162,11 @@ def _device_discovered(device): new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) hass.config_entries.async_update_entry(entry, data=new_data) - elif device_id in hass.data[DOMAIN][TUYA_DEVICES]: - _LOGGER.debug("Device %s found with IP %s", device_id, device_ip) - - device = hass.data[DOMAIN][TUYA_DEVICES].get(device_id) - if not device: - _LOGGER.warning(f"Could not find device for device_id {device_id}") - elif not device.connected: - device.async_connect() - - def _shutdown(event): """Clean up resources when shutting down.""" discovery.close() - async def _async_reconnect(now): - """Try connecting to devices not already connected to.""" - for device_id, device in hass.data[DOMAIN][TUYA_DEVICES].items(): - if not device.connected: - device.async_connect() - - async_track_time_interval(hass, _async_reconnect, RECONNECT_INTERVAL) - - hass.helpers.service.async_register_admin_service( - DOMAIN, - SERVICE_RELOAD, - _handle_reload, - ) + hass.services.async_register(DOMAIN, SERVICE_RELOAD, _handle_reload) hass.services.async_register( DOMAIN, SERVICE_SET_DP, _handle_set_dp, schema=SERVICE_SET_DP_SCHEMA @@ -183,43 +183,105 @@ async def _async_reconnect(now): return True -async def async_migrate_entry(hass, config_entry: ConfigEntry): +async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry): """Migrate old entries merging all of them in one.""" new_version = ENTRIES_VERSION stored_entries = hass.config_entries.async_entries(DOMAIN) if config_entry.version == 1: + # This an old version of original integration no nned to put it here. + pass + # Update to version 3 + if config_entry.version == 2: + # Switch config flow to selectors convert DP IDs from int to str require HA 2022.4. _LOGGER.debug("Migrating config entry from version %s", config_entry.version) + new_data = config_entry.data.copy() + for device in new_data[CONF_DEVICES]: + i = 0 + for _ent in new_data[CONF_DEVICES][device][CONF_ENTITIES]: + ent_items = {} + for k, v in _ent.items(): + ent_items[k] = str(v) if type(v) is int else v + new_data[CONF_DEVICES][device][CONF_ENTITIES][i].update(ent_items) + i = i + 1 + hass.config_entries.async_update_entry(config_entry, data=new_data, version=3) + # Update to version 4 + if config_entry.version <= 3: + # Convert values and friendly name values to dict. + from .const import ( + Platform, + CONF_OPTIONS, + CONF_HVAC_MODE_SET, + CONF_HVAC_ACTION_SET, + CONF_PRESET_SET, + CONF_SCENE_VALUES, + # Deprecated + CONF_SCENE_VALUES_FRIENDLY, + CONF_OPTIONS_FRIENDLY, + CONF_HVAC_ADD_OFF, + ) + from .climate import ( + RENAME_HVAC_MODE_SETS, + RENAME_ACTION_SETS, + RENAME_PRESET_SETS, + HVAC_OFF, + ) - if config_entry.entry_id == stored_entries[0].entry_id: - _LOGGER.debug( - "Migrating the first config entry (%s)", config_entry.entry_id - ) - new_data = {} - new_data[CONF_REGION] = "eu" - new_data[CONF_CLIENT_ID] = "" - new_data[CONF_CLIENT_SECRET] = "" - new_data[CONF_USER_ID] = "" - new_data[CONF_USERNAME] = DOMAIN - new_data[CONF_NO_CLOUD] = True - new_data[CONF_DEVICES] = { - config_entry.data[CONF_DEVICE_ID]: config_entry.data.copy() - } - new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) - config_entry.version = new_version - hass.config_entries.async_update_entry( - config_entry, title=DOMAIN, data=new_data - ) - else: - _LOGGER.debug( - "Merging the config entry %s into the main one", config_entry.entry_id - ) - new_data = stored_entries[0].data.copy() - new_data[CONF_DEVICES].update( - {config_entry.data[CONF_DEVICE_ID]: config_entry.data.copy()} - ) - new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) - hass.config_entries.async_update_entry(stored_entries[0], data=new_data) - await hass.config_entries.async_remove(config_entry.entry_id) + def convert_str_to_dict(list1: str, list2: str = ""): + to_dict = {} + if not isinstance(list1, str): + return list1 + list1, list2 = list1.replace(";", ","), list2.replace(";", ",") + v, v_fn = list1.split(","), list2.split(",") + for k in range(len(v)): + to_dict[v[k]] = ( + v_fn[k] if k < len(v_fn) and v_fn[k] else v[k].capitalize() + ) + return to_dict + + new_data = config_entry.data.copy() + for device in new_data[CONF_DEVICES]: + current_entity = 0 + for entity in new_data[CONF_DEVICES][device][CONF_ENTITIES]: + new_entity_data = {} + if entity[CONF_PLATFORM] == Platform.SELECT: + # Merge 2 Lists Values and Values friendly names into dict. + v_fn = entity.get(CONF_OPTIONS_FRIENDLY, "") + if v := entity.get(CONF_OPTIONS): + new_entity_data[CONF_OPTIONS] = convert_str_to_dict(v, v_fn) + if entity[CONF_PLATFORM] == Platform.LIGHT: + v_fn = entity.get(CONF_SCENE_VALUES_FRIENDLY, "") + if v := entity.get(CONF_SCENE_VALUES): + new_entity_data[CONF_SCENE_VALUES] = convert_str_to_dict( + v, v_fn + ) + if entity[CONF_PLATFORM] == Platform.CLIMATE: + # Merge 2 Lists Values and Values friendly names into dict. + climate_to_dict = {} + for conf, new_values in ( + (CONF_HVAC_MODE_SET, RENAME_HVAC_MODE_SETS), + (CONF_HVAC_ACTION_SET, RENAME_ACTION_SETS), + (CONF_PRESET_SET, RENAME_PRESET_SETS), + ): + climate_to_dict[conf] = {} + if hvac_set := entity.get(conf, ""): + if entity.get(CONF_HVAC_ADD_OFF, False): + if conf == CONF_HVAC_MODE_SET: + climate_to_dict[conf].update(HVAC_OFF) + if not isinstance(conf, str): + continue + hvac_set = hvac_set.replace("/", ",") + for i in hvac_set.split(","): + for k, v in new_values.items(): + if i in k: + new_v = True if i == "True" else i + new_v = False if i == "False" else new_v + climate_to_dict[conf].update({v: new_v}) + new_entity_data = climate_to_dict + new_data[CONF_DEVICES][device][CONF_ENTITIES][current_entity].update( + new_entity_data + ) + current_entity += 1 + hass.config_entries.async_update_entry(config_entry, data=new_data, version=4) _LOGGER.info( "Entry %s successfully migrated to version %s.", @@ -245,86 +307,102 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): secret = entry.data[CONF_CLIENT_SECRET] user_id = entry.data[CONF_USER_ID] tuya_api = TuyaCloudApi(hass, region, client_id, secret, user_id) - no_cloud = True - if CONF_NO_CLOUD in entry.data: - no_cloud = entry.data.get(CONF_NO_CLOUD) + no_cloud = entry.data.get(CONF_NO_CLOUD, True) + if no_cloud: - _LOGGER.info("Cloud API account not configured.") - # wait 1 second to make sure possible migration has finished - await asyncio.sleep(1) + _LOGGER.info(f"Cloud API account not configured.") else: - res = await tuya_api.async_get_access_token() - if res != "ok": - _LOGGER.error("Cloud API connection failed: %s", res) - else: - _LOGGER.info("Cloud API connection succeeded.") - res = await tuya_api.async_get_devices_list() - hass.data[DOMAIN][DATA_CLOUD] = tuya_api - - async def setup_entities(device_ids): - platforms = set() - for dev_id in device_ids: - entities = entry.data[CONF_DEVICES][dev_id][CONF_ENTITIES] - platforms = platforms.union( - set(entity[CONF_PLATFORM] for entity in entities) + entry.async_create_background_task( + hass, tuya_api.async_connect(), "localtuya-cloudAPI" + ) + + hass_localtuya = HassLocalTuyaData(tuya_api, {}) + hass.data[DOMAIN][entry.entry_id] = hass_localtuya + + def _setup_devices(entry_devices: dict): + """Setup Localtuya devices object.""" + devices = hass_localtuya.devices + connect_to_devices = [] + + # Sort parent devices first then sub-devices. + sorted_devices = dict( + sorted( + entry_devices.items(), key=lambda k: 1 if k[1].get(CONF_NODE_ID) else 0 ) - hass.data[DOMAIN][TUYA_DEVICES][dev_id] = TuyaDevice(hass, entry, dev_id) + ) - # Setup all platforms at once, letting HA handling each platform and avoiding - # potential integration restarts while elements are still initialising. - await hass.config_entries.async_forward_entry_setups(entry, platforms) + for dev_id, config in sorted_devices.items(): + if check_if_device_disabled(hass, entry, dev_id): + continue - for dev_id in device_ids: - hass.data[DOMAIN][TUYA_DEVICES][dev_id].async_connect() + host = config.get(CONF_HOST) - await async_remove_orphan_entities(hass, entry) + # Parent Devices. + if not (node_id := config.get(CONF_NODE_ID)): + devices[host] = (dev := TuyaDevice(hass, entry, config)) + connect_to_devices.append(dev) + continue - hass.async_create_task(setup_entities(entry.data[CONF_DEVICES].keys())) + # Sub-Devices + if not (gateway := devices.get(host)): + # Setup sub-device as fake gateway if there is no a gateway exist. + devices[host] = (gateway := TuyaDevice(hass, entry, config, True)) + connect_to_devices.append(gateway) - unsub_listener = entry.add_update_listener(update_listener) - hass.data[DOMAIN][entry.entry_id] = {UNSUB_LISTENER: unsub_listener} + devices[f"{host}_{node_id}"] = (sub_dev := TuyaDevice(hass, entry, config)) + sub_dev.gateway = gateway + gateway.sub_devices[node_id] = sub_dev - return True + return connect_to_devices + connect_to_devices = _setup_devices(entry.data[CONF_DEVICES]) -async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry): - """Unload a config entry.""" - platforms = {} + await async_remove_orphan_entities(hass, entry) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS.values()) - for dev_id, dev_entry in entry.data[CONF_DEVICES].items(): - for entity in dev_entry[CONF_ENTITIES]: - platforms[entity[CONF_PLATFORM]] = True + # Note: entry.async_on_unload items are called in LIFO order! - unload_ok = all( - await asyncio.gather( - *[ - hass.config_entries.async_forward_entry_unload(entry, component) - for component in platforms - ] - ) + for dev in connect_to_devices: + asyncio.create_task(dev.async_connect()) + entry.async_on_unload(dev.close) + + entry.async_on_unload(entry.add_update_listener(update_listener)) + + async def _shutdown(event): + """Clean up resources when shutting down.""" + for dev in connect_to_devices: + await dev.close() + _LOGGER.info("Shutdown completed") + + entry.async_on_unload( + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _shutdown) ) - hass.data[DOMAIN][entry.entry_id][UNSUB_LISTENER]() - for dev_id, device in hass.data[DOMAIN][TUYA_DEVICES].items(): - if device.connected: - await device.close() + entry.async_on_unload(_run_async_listen(hass, entry)) + _LOGGER.info("Setup completed") + return True + - if unload_ok: - hass.data[DOMAIN][TUYA_DEVICES] = {} +async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: + """Unloading the Tuya platforms.""" + # Unload the platforms. + await hass.config_entries.async_unload_platforms(entry, PLATFORMS.values()) + hass.data[DOMAIN].pop(entry.entry_id) + _LOGGER.info("Unload completed") return True -async def update_listener(hass, config_entry): +async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry): """Update listener.""" await hass.config_entries.async_reload(config_entry.entry_id) async def async_remove_config_entry_device( - hass: HomeAssistant, config_entry: ConfigEntry, device_entry: DeviceEntry + hass: HomeAssistant, config_entry: ConfigEntry, device_entry: dr.DeviceEntry ) -> bool: """Remove a config entry from a device.""" - dev_id = list(device_entry.identifiers)[0][1].split("_")[-1] + dev_id = _device_id_by_identifiers(device_entry.identifiers) ent_reg = er.async_get(hass) entities = { @@ -341,7 +419,8 @@ async def async_remove_config_entry_device( ) return True - await hass.data[DOMAIN][TUYA_DEVICES][dev_id].close() + # host = config_entry.data[CONF_DEVICES][dev_id][CONF_HOST] + # await hass.data[DOMAIN][config_entry.entry_id].devices[host].close() new_data = config_entry.data.copy() new_data[CONF_DEVICES].pop(dev_id) @@ -374,3 +453,87 @@ async def async_remove_orphan_entities(hass, entry): for entity_id in entities.values(): ent_reg.async_remove(entity_id) + + +def _run_async_listen(hass: HomeAssistant, entry: ConfigEntry): + """Start the listing events""" + + @callback + def _event_filtter(data: dr.EventDeviceRegistryUpdatedData) -> bool: + device_reg = dr.async_get(hass).async_get(data["device_id"]) + is_entry = device_reg and entry.entry_id in device_reg.config_entries + return data["action"] == "update" and is_entry + + async def device_state_changed(event: Event[dr.EventDeviceRegistryUpdatedData]): + """Close connection if device disabled.""" + if not "disabled_by" in event.data["changes"]: + return + + device_registry = dr.async_get(hass).async_get(event.data["device_id"]) + + hass_localtuya: HassLocalTuyaData = hass.data[DOMAIN][entry.entry_id] + + dev_id = _device_id_by_identifiers(device_registry.identifiers) + host_ip = entry.data[CONF_DEVICES][dev_id][CONF_HOST] + + if cid := entry.data[CONF_DEVICES][dev_id].get(CONF_NODE_ID): + host_ip = f"{host_ip}_{cid}" + + device = hass_localtuya.devices.get(host_ip) + + if device and device_registry.disabled: + # If this is a gateway or fake gateway then reload entry to start using another device as GW. + if device.sub_devices or (device.gateway and device.gateway.id == dev_id): + await hass.config_entries.async_reload(entry.entry_id) + else: + await device.close() + + return hass.bus.async_listen( + dr.EVENT_DEVICE_REGISTRY_UPDATED, device_state_changed, _event_filtter + ) + + +def _device_id_by_identifiers(identifiers: set[tuple[str, str]]): + """Return localtuya device ID by device registry identifiers.""" + return list(identifiers)[0][1].split("_")[-1] + + +@callback +def async_config_entry_by_device_id(hass: HomeAssistant, device_id: str): + """Look up config entry by device id.""" + current_entries = hass.config_entries.async_entries(DOMAIN) + for entry in current_entries: + if device_id in entry.data[CONF_DEVICES]: + return entry + # Search for gateway_id + for dev_conf in entry.data[CONF_DEVICES].values(): + if (gw_id := dev_conf.get(CONF_GATEWAY_ID)) and gw_id == device_id: + return entry + return None + + +@callback +def async_device_id_by_entity_id(hass: HomeAssistant, entity_id: str): + """Look up config entry by device id.""" + ent_reg = er.async_get(hass) + dev_reg = dr.async_get(hass) + if device := dev_reg.async_get(ent_reg.async_get(entity_id).device_id): + return list(device.identifiers)[0][1].split("_")[-1] + + return None + + +@callback +def check_if_device_disabled(hass: HomeAssistant, entry: ConfigEntry, dev_id: str): + """Return whether if the device disabled or not.""" + ent_reg = er.async_get(hass) + entries = er.async_entries_for_config_entry(ent_reg, entry.entry_id) + ha_device_id: str = None + + for entitiy in entries: + if dev_id in entitiy.unique_id: + ha_device_id = entitiy.device_id + break + + if ha_device_id and (device := dr.async_get(hass).async_get(ha_device_id)): + return device.disabled diff --git a/custom_components/localtuya/__pycache__/__init__.cpython-312.pyc b/custom_components/localtuya/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a9037ee6..00000000 Binary files a/custom_components/localtuya/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/__init__.cpython-313.pyc b/custom_components/localtuya/__pycache__/__init__.cpython-313.pyc index e88ef714..69430f48 100644 Binary files a/custom_components/localtuya/__pycache__/__init__.cpython-313.pyc and b/custom_components/localtuya/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/alarm_control_panel.cpython-313.pyc b/custom_components/localtuya/__pycache__/alarm_control_panel.cpython-313.pyc new file mode 100644 index 00000000..b2de8b7b Binary files /dev/null and b/custom_components/localtuya/__pycache__/alarm_control_panel.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/binary_sensor.cpython-312.pyc b/custom_components/localtuya/__pycache__/binary_sensor.cpython-312.pyc deleted file mode 100644 index 4fd61961..00000000 Binary files a/custom_components/localtuya/__pycache__/binary_sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/binary_sensor.cpython-313.pyc b/custom_components/localtuya/__pycache__/binary_sensor.cpython-313.pyc index 510693a3..6bcc2639 100644 Binary files a/custom_components/localtuya/__pycache__/binary_sensor.cpython-313.pyc and b/custom_components/localtuya/__pycache__/binary_sensor.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/button.cpython-313.pyc b/custom_components/localtuya/__pycache__/button.cpython-313.pyc new file mode 100644 index 00000000..40a4218d Binary files /dev/null and b/custom_components/localtuya/__pycache__/button.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/climate.cpython-312.pyc b/custom_components/localtuya/__pycache__/climate.cpython-312.pyc deleted file mode 100644 index a545d629..00000000 Binary files a/custom_components/localtuya/__pycache__/climate.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/climate.cpython-313.pyc b/custom_components/localtuya/__pycache__/climate.cpython-313.pyc index 14b809f7..4ee0b164 100644 Binary files a/custom_components/localtuya/__pycache__/climate.cpython-313.pyc and b/custom_components/localtuya/__pycache__/climate.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/cloud_api.cpython-312.pyc b/custom_components/localtuya/__pycache__/cloud_api.cpython-312.pyc deleted file mode 100644 index a67f4ea1..00000000 Binary files a/custom_components/localtuya/__pycache__/cloud_api.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/cloud_api.cpython-313.pyc b/custom_components/localtuya/__pycache__/cloud_api.cpython-313.pyc deleted file mode 100644 index 42c73dfb..00000000 Binary files a/custom_components/localtuya/__pycache__/cloud_api.cpython-313.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/common.cpython-312.pyc b/custom_components/localtuya/__pycache__/common.cpython-312.pyc deleted file mode 100644 index 17257a93..00000000 Binary files a/custom_components/localtuya/__pycache__/common.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/common.cpython-313.pyc b/custom_components/localtuya/__pycache__/common.cpython-313.pyc deleted file mode 100644 index f31c1eb9..00000000 Binary files a/custom_components/localtuya/__pycache__/common.cpython-313.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/config_flow.cpython-312.pyc b/custom_components/localtuya/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index bf963082..00000000 Binary files a/custom_components/localtuya/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/config_flow.cpython-313.pyc b/custom_components/localtuya/__pycache__/config_flow.cpython-313.pyc index afb41fc1..83c84a7a 100644 Binary files a/custom_components/localtuya/__pycache__/config_flow.cpython-313.pyc and b/custom_components/localtuya/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/const.cpython-312.pyc b/custom_components/localtuya/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 9a6accaf..00000000 Binary files a/custom_components/localtuya/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/const.cpython-313.pyc b/custom_components/localtuya/__pycache__/const.cpython-313.pyc index 72fb6192..63930a08 100644 Binary files a/custom_components/localtuya/__pycache__/const.cpython-313.pyc and b/custom_components/localtuya/__pycache__/const.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/coordinator.cpython-313.pyc b/custom_components/localtuya/__pycache__/coordinator.cpython-313.pyc new file mode 100644 index 00000000..08a0637d Binary files /dev/null and b/custom_components/localtuya/__pycache__/coordinator.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/cover.cpython-312.pyc b/custom_components/localtuya/__pycache__/cover.cpython-312.pyc deleted file mode 100644 index 7392c903..00000000 Binary files a/custom_components/localtuya/__pycache__/cover.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/cover.cpython-313.pyc b/custom_components/localtuya/__pycache__/cover.cpython-313.pyc index ef213c35..76f651f3 100644 Binary files a/custom_components/localtuya/__pycache__/cover.cpython-313.pyc and b/custom_components/localtuya/__pycache__/cover.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/diagnostics.cpython-312.pyc b/custom_components/localtuya/__pycache__/diagnostics.cpython-312.pyc deleted file mode 100644 index a3b07dbe..00000000 Binary files a/custom_components/localtuya/__pycache__/diagnostics.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/diagnostics.cpython-313.pyc b/custom_components/localtuya/__pycache__/diagnostics.cpython-313.pyc index 3ee35142..69341676 100644 Binary files a/custom_components/localtuya/__pycache__/diagnostics.cpython-313.pyc and b/custom_components/localtuya/__pycache__/diagnostics.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/discovery.cpython-312.pyc b/custom_components/localtuya/__pycache__/discovery.cpython-312.pyc deleted file mode 100644 index b8344299..00000000 Binary files a/custom_components/localtuya/__pycache__/discovery.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/discovery.cpython-313.pyc b/custom_components/localtuya/__pycache__/discovery.cpython-313.pyc index 4dba754d..9e189adf 100644 Binary files a/custom_components/localtuya/__pycache__/discovery.cpython-313.pyc and b/custom_components/localtuya/__pycache__/discovery.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/entity.cpython-313.pyc b/custom_components/localtuya/__pycache__/entity.cpython-313.pyc new file mode 100644 index 00000000..b2e31f64 Binary files /dev/null and b/custom_components/localtuya/__pycache__/entity.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/fan.cpython-312.pyc b/custom_components/localtuya/__pycache__/fan.cpython-312.pyc deleted file mode 100644 index 579bcd0f..00000000 Binary files a/custom_components/localtuya/__pycache__/fan.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/fan.cpython-313.pyc b/custom_components/localtuya/__pycache__/fan.cpython-313.pyc index bd7be31c..0e0dbaf3 100644 Binary files a/custom_components/localtuya/__pycache__/fan.cpython-313.pyc and b/custom_components/localtuya/__pycache__/fan.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/humidifier.cpython-313.pyc b/custom_components/localtuya/__pycache__/humidifier.cpython-313.pyc new file mode 100644 index 00000000..177e9475 Binary files /dev/null and b/custom_components/localtuya/__pycache__/humidifier.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/light.cpython-312.pyc b/custom_components/localtuya/__pycache__/light.cpython-312.pyc deleted file mode 100644 index 43e7f6c1..00000000 Binary files a/custom_components/localtuya/__pycache__/light.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/light.cpython-313.pyc b/custom_components/localtuya/__pycache__/light.cpython-313.pyc index 066836c1..629f37c2 100644 Binary files a/custom_components/localtuya/__pycache__/light.cpython-313.pyc and b/custom_components/localtuya/__pycache__/light.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/lock.cpython-313.pyc b/custom_components/localtuya/__pycache__/lock.cpython-313.pyc new file mode 100644 index 00000000..f3d8f9eb Binary files /dev/null and b/custom_components/localtuya/__pycache__/lock.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/number.cpython-312.pyc b/custom_components/localtuya/__pycache__/number.cpython-312.pyc deleted file mode 100644 index 69888a11..00000000 Binary files a/custom_components/localtuya/__pycache__/number.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/number.cpython-313.pyc b/custom_components/localtuya/__pycache__/number.cpython-313.pyc index 1607ab22..7ba9d750 100644 Binary files a/custom_components/localtuya/__pycache__/number.cpython-313.pyc and b/custom_components/localtuya/__pycache__/number.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/remote.cpython-313.pyc b/custom_components/localtuya/__pycache__/remote.cpython-313.pyc new file mode 100644 index 00000000..9add15f2 Binary files /dev/null and b/custom_components/localtuya/__pycache__/remote.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/select.cpython-312.pyc b/custom_components/localtuya/__pycache__/select.cpython-312.pyc deleted file mode 100644 index e39cd7e5..00000000 Binary files a/custom_components/localtuya/__pycache__/select.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/select.cpython-313.pyc b/custom_components/localtuya/__pycache__/select.cpython-313.pyc index 4dcfe2a2..0014f543 100644 Binary files a/custom_components/localtuya/__pycache__/select.cpython-313.pyc and b/custom_components/localtuya/__pycache__/select.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/sensor.cpython-312.pyc b/custom_components/localtuya/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index 0138f988..00000000 Binary files a/custom_components/localtuya/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/sensor.cpython-313.pyc b/custom_components/localtuya/__pycache__/sensor.cpython-313.pyc index 7ad70d2d..d69e5974 100644 Binary files a/custom_components/localtuya/__pycache__/sensor.cpython-313.pyc and b/custom_components/localtuya/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/siren.cpython-313.pyc b/custom_components/localtuya/__pycache__/siren.cpython-313.pyc new file mode 100644 index 00000000..28678a18 Binary files /dev/null and b/custom_components/localtuya/__pycache__/siren.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/switch.cpython-312.pyc b/custom_components/localtuya/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index e1739b47..00000000 Binary files a/custom_components/localtuya/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/switch.cpython-313.pyc b/custom_components/localtuya/__pycache__/switch.cpython-313.pyc index e92cc4f0..ffa92a24 100644 Binary files a/custom_components/localtuya/__pycache__/switch.cpython-313.pyc and b/custom_components/localtuya/__pycache__/switch.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/vacuum.cpython-312.pyc b/custom_components/localtuya/__pycache__/vacuum.cpython-312.pyc deleted file mode 100644 index 68113513..00000000 Binary files a/custom_components/localtuya/__pycache__/vacuum.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/__pycache__/vacuum.cpython-313.pyc b/custom_components/localtuya/__pycache__/vacuum.cpython-313.pyc index b521d2e2..dd0d18ae 100644 Binary files a/custom_components/localtuya/__pycache__/vacuum.cpython-313.pyc and b/custom_components/localtuya/__pycache__/vacuum.cpython-313.pyc differ diff --git a/custom_components/localtuya/__pycache__/water_heater.cpython-313.pyc b/custom_components/localtuya/__pycache__/water_heater.cpython-313.pyc new file mode 100644 index 00000000..c799df4a Binary files /dev/null and b/custom_components/localtuya/__pycache__/water_heater.cpython-313.pyc differ diff --git a/custom_components/localtuya/alarm_control_panel.py b/custom_components/localtuya/alarm_control_panel.py new file mode 100644 index 00000000..e6151fe5 --- /dev/null +++ b/custom_components/localtuya/alarm_control_panel.py @@ -0,0 +1,134 @@ +"""Platform to present any Tuya DP as a Alarm.""" + +from enum import StrEnum +import logging +from functools import partial +from .config_flow import col_to_select + +import voluptuous as vol +from homeassistant.helpers import selector +from homeassistant.components.alarm_control_panel import ( + DOMAIN, + AlarmControlPanelEntity, + CodeFormat, + AlarmControlPanelEntityFeature, + AlarmControlPanelState, +) + +from .entity import LocalTuyaEntity, async_setup_entry +from .const import CONF_ALARM_SUPPORTED_STATES + +_LOGGER = logging.getLogger(__name__) + +DEFAULT_PRECISION = 2 + + +class TuyaMode(StrEnum): + DISARMED = "disarmed" + ARM = "arm" + HOME = "home" + SOS = "sos" + + +DEFAULT_SUPPORTED_MODES = { + AlarmControlPanelState.DISARMED: TuyaMode.DISARMED, + AlarmControlPanelState.ARMED_AWAY: TuyaMode.ARM, + AlarmControlPanelState.ARMED_HOME: TuyaMode.HOME, + AlarmControlPanelState.TRIGGERED: TuyaMode.SOS, +} + + +def flow_schema(dps): + """Return schema used in config flow.""" + return { + vol.Optional( + CONF_ALARM_SUPPORTED_STATES, default=DEFAULT_SUPPORTED_MODES + ): selector.ObjectSelector(), + } + + +class LocalTuyaAlarmControlPanel(LocalTuyaEntity, AlarmControlPanelEntity): + """Representation of a Tuya Alarm.""" + + _supported_modes = {} + + def __init__( + self, + device, + config_entry, + dpid, + **kwargs, + ): + """Initialize the Tuya Alarm.""" + super().__init__(device, config_entry, dpid, _LOGGER, **kwargs) + self._state = None + self._changed_by = None + + # supported modes + if supported_modes := self._config.get(CONF_ALARM_SUPPORTED_STATES, {}): + # Key is HA state and value is Tuya State. + if AlarmControlPanelState.ARMED_AWAY in supported_modes: + self._attr_supported_features |= AlarmControlPanelEntityFeature.ARM_HOME + if AlarmControlPanelState.ARMED_HOME in supported_modes: + self._attr_supported_features |= AlarmControlPanelEntityFeature.ARM_AWAY + if AlarmControlPanelState.TRIGGERED in supported_modes: + self._attr_supported_features |= AlarmControlPanelEntityFeature.TRIGGER + + self._state_ha_to_tuya: dict[str, str] = supported_modes + self._state_tuya_to_ha: dict[str, str] = { + v: k for k, v in supported_modes.items() + } + + @property + def state(self): + """Return Alarm state.""" + return self._state_tuya_to_ha.get(self._state, None) + + @property + def code_format(self) -> CodeFormat | None: + """Code format or None if no code is required.""" + return None # self._attr_code_format + + @property + def changed_by(self) -> str | None: + """Last change triggered by.""" + return None # self._attr_changed_by + + @property + def code_arm_required(self) -> bool: + """Whether the code is required for arm actions.""" + return True # self._attr_code_arm_required + + async def async_alarm_disarm(self, code: str | None = None) -> None: + """Send disarm command.""" + state = self._state_ha_to_tuya.get(AlarmControlPanelState.DISARMED) + await self._device.set_dp(state, self._dp_id) + + async def async_alarm_arm_home(self, code: str | None = None) -> None: + """Send arm home command.""" + state = self._state_ha_to_tuya.get(AlarmControlPanelState.ARMED_HOME) + await self._device.set_dp(state, self._dp_id) + + async def async_alarm_arm_away(self, code: str | None = None) -> None: + """Send arm away command.""" + state = self._state_ha_to_tuya.get(AlarmControlPanelState.ARMED_AWAY) + await self._device.set_dp(state, self._dp_id) + + async def async_alarm_trigger(self, code: str | None = None) -> None: + """Send alarm trigger command.""" + state = self._state_ha_to_tuya.get(AlarmControlPanelState.TRIGGERED) + await self._device.set_dp(state, self._dp_id) + + def status_updated(self): + """Device status was updated.""" + super().status_updated() + + # No need to restore state for a AlarmControlPanel + async def restore_state_when_connected(self): + """Do nothing for a AlarmControlPanel.""" + return + + +async_setup_entry = partial( + async_setup_entry, DOMAIN, LocalTuyaAlarmControlPanel, flow_schema +) diff --git a/custom_components/localtuya/binary_sensor.py b/custom_components/localtuya/binary_sensor.py index 273880ca..53fb4ad5 100644 --- a/custom_components/localtuya/binary_sensor.py +++ b/custom_components/localtuya/binary_sensor.py @@ -1,4 +1,5 @@ """Platform to present any Tuya DP as a binary sensor.""" + import logging from functools import partial @@ -10,11 +11,11 @@ ) from homeassistant.const import CONF_DEVICE_CLASS -from .common import LocalTuyaEntity, async_setup_entry +from .entity import LocalTuyaEntity, async_setup_entry +from .const import CONF_STATE_ON _LOGGER = logging.getLogger(__name__) -CONF_STATE_ON = "state_on" CONF_STATE_OFF = "state_off" @@ -22,12 +23,12 @@ def flow_schema(dps): """Return schema used in config flow.""" return { vol.Required(CONF_STATE_ON, default="True"): str, - vol.Required(CONF_STATE_OFF, default="False"): str, + # vol.Required(CONF_STATE_OFF, default="False"): str, vol.Optional(CONF_DEVICE_CLASS): DEVICE_CLASSES_SCHEMA, } -class LocaltuyaBinarySensor(LocalTuyaEntity, BinarySensorEntity): +class LocalTuyaBinarySensor(LocalTuyaEntity, BinarySensorEntity): """Representation of a Tuya binary sensor.""" def __init__( @@ -46,24 +47,17 @@ def is_on(self): """Return sensor state.""" return self._is_on - @property - def device_class(self): - """Return the class of this device.""" - return self._config.get(CONF_DEVICE_CLASS) - def status_updated(self): """Device status was updated.""" super().status_updated() - state = str(self.dps(self._dp_id)).lower() - if state == self._config[CONF_STATE_ON].lower(): + state = str(self.dp_value(self._dp_id)).lower() + # users may set wrong on states, But we assume that must devices use this on states. + possible_on_states = ["true", "1", "pir", "on"] + if state == self._config[CONF_STATE_ON].lower() or state in possible_on_states: self._is_on = True - elif state == self._config[CONF_STATE_OFF].lower(): - self._is_on = False else: - self.warning( - "State for entity %s did not match state patterns", self.entity_id - ) + self._is_on = False # No need to restore state for a sensor async def restore_state_when_connected(self): @@ -72,5 +66,5 @@ async def restore_state_when_connected(self): async_setup_entry = partial( - async_setup_entry, DOMAIN, LocaltuyaBinarySensor, flow_schema + async_setup_entry, DOMAIN, LocalTuyaBinarySensor, flow_schema ) diff --git a/custom_components/localtuya/button.py b/custom_components/localtuya/button.py new file mode 100644 index 00000000..1a210c07 --- /dev/null +++ b/custom_components/localtuya/button.py @@ -0,0 +1,41 @@ +"""Platform to locally control Tuya-based button devices.""" + +import logging +from functools import partial + +import voluptuous as vol +from homeassistant.components.button import DOMAIN, ButtonEntity + +from .entity import LocalTuyaEntity, async_setup_entry +from .const import CONF_PASSIVE_ENTITY + +_LOGGER = logging.getLogger(__name__) + + +def flow_schema(dps): + """Return schema used in config flow.""" + return { + # vol.Required(CONF_PASSIVE_ENTITY): bool, + } + + +class LocalTuyaButton(LocalTuyaEntity, ButtonEntity): + """Representation of a Tuya button.""" + + def __init__( + self, + device, + config_entry, + buttonid, + **kwargs, + ): + """Initialize the Tuya button.""" + super().__init__(device, config_entry, buttonid, _LOGGER, **kwargs) + self._state = None + + async def async_press(self): + """Press the button.""" + await self._device.set_dp(True, self._dp_id) + + +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaButton, flow_schema) diff --git a/custom_components/localtuya/climate.py b/custom_components/localtuya/climate.py index da23cfaf..e99ca3fe 100644 --- a/custom_components/localtuya/climate.py +++ b/custom_components/localtuya/climate.py @@ -1,7 +1,12 @@ -"""Platform to locally control Tuya-based climate devices.""" +"""Platform to locally control Tuya-based climate devices. + # PRESETS and HVAC_MODE Needs to be handle in better way. +""" + import asyncio import logging from functools import partial +from .config_flow import col_to_select +from homeassistant.helpers import selector import voluptuous as vol from homeassistant.components.climate import ( @@ -11,20 +16,13 @@ ClimateEntity, ) from homeassistant.components.climate.const import ( - HVACAction, HVACMode, + HVACAction, PRESET_AWAY, PRESET_ECO, PRESET_HOME, PRESET_NONE, ClimateEntityFeature, - FAN_AUTO, - FAN_LOW, - FAN_MEDIUM, - FAN_HIGH, - FAN_TOP, - SWING_ON, - SWING_OFF, ) from homeassistant.const import ( ATTR_TEMPERATURE, @@ -34,12 +32,10 @@ PRECISION_WHOLE, UnitOfTemperature, ) - -from .common import LocalTuyaEntity, async_setup_entry +from homeassistant.util.unit_system import US_CUSTOMARY_SYSTEM +from .entity import LocalTuyaEntity, async_setup_entry from .const import ( CONF_CURRENT_TEMPERATURE_DP, - CONF_TEMP_MAX, - CONF_TEMP_MIN, CONF_ECO_DP, CONF_ECO_VALUE, CONF_HEURISTIC_ACTION, @@ -47,142 +43,144 @@ CONF_HVAC_ACTION_SET, CONF_HVAC_MODE_DP, CONF_HVAC_MODE_SET, - CONF_MAX_TEMP_DP, - CONF_MIN_TEMP_DP, CONF_PRECISION, CONF_PRESET_DP, CONF_PRESET_SET, CONF_TARGET_PRECISION, CONF_TARGET_TEMPERATURE_DP, CONF_TEMPERATURE_STEP, - CONF_HVAC_FAN_MODE_DP, - CONF_HVAC_FAN_MODE_SET, - CONF_HVAC_SWING_MODE_DP, - CONF_HVAC_SWING_MODE_SET, + CONF_MIN_TEMP, + CONF_MAX_TEMP, + CONF_HVAC_ADD_OFF, + CONF_FAN_SPEED_DP, + CONF_FAN_SPEED_LIST, ) _LOGGER = logging.getLogger(__name__) -HVAC_MODE_SETS = { - "manual/auto": { - HVACMode.HEAT: "manual", - HVACMode.AUTO: "auto", - }, - "Manual/Auto": { - HVACMode.HEAT: "Manual", - HVACMode.AUTO: "Auto", - }, - "Manual/Program": { - HVACMode.HEAT: "Manual", - HVACMode.AUTO: "Program", - }, - "m/p": { - HVACMode.HEAT: "m", - HVACMode.AUTO: "p", - }, - "True/False": { - HVACMode.HEAT: True, - }, - "Auto/Cold/Dry/Wind/Hot": { - HVACMode.HEAT: "hot", - HVACMode.FAN_ONLY: "wind", - HVACMode.DRY: "wet", - HVACMode.COOL: "cold", - HVACMode.AUTO: "auto", - }, - "1/0": { - HVACMode.HEAT: "1", - HVACMode.AUTO: "0", - }, + +HVAC_OFF = {HVACMode.OFF.value: "off"} +RENAME_HVAC_MODE_SETS = { # Migrate to 3 + ("manual", "Manual", "hot", "m", "True"): HVACMode.HEAT.value, + ("auto", "0", "p", "Program"): HVACMode.AUTO.value, + ("freeze", "cold", "1"): HVACMode.COOL.value, + ("wet"): HVACMode.DRY.value, } -HVAC_ACTION_SETS = { - "True/False": { - HVACAction.HEATING: True, - HVACAction.IDLE: False, - }, - "open/close": { - HVACAction.HEATING: "open", - HVACAction.IDLE: "close", - }, - "heating/no_heating": { - HVACAction.HEATING: "heating", - HVACAction.IDLE: "no_heating", - }, - "Heat/Warming": { - HVACAction.HEATING: "Heat", - HVACAction.IDLE: "Warming", - }, +RENAME_ACTION_SETS = { # Migrate to 3 + ("open", "opened", "heating", "Heat", "True"): HVACAction.HEATING.value, + ("closed", "close", "no_heating"): HVACAction.IDLE.value, + ("Warming", "warming", "False"): HVACAction.IDLE.value, + ("cooling"): HVACAction.COOLING.value, + ("off"): HVACAction.OFF.value, } -HVAC_FAN_MODE_SETS = { - "Auto/Low/Middle/High/Strong": { - FAN_AUTO: "auto", - FAN_LOW: "low", - FAN_MEDIUM: "middle", - FAN_HIGH: "high", - FAN_TOP: "strong", - } +RENAME_PRESET_SETS = { + "Holiday": (PRESET_AWAY), + "Program": (PRESET_HOME), + "Manual": (PRESET_NONE, "manual"), + "Auto": "auto", + "Manual": "manual", + "Smart": "smart", + "Comfort": "comfortable", + "ECO": "eco", } -HVAC_SWING_MODE_SETS = { - "True/False": { - SWING_ON: True, - SWING_OFF: False, - } + + +HVAC_MODE_SETS = { + HVACMode.OFF: False, + HVACMode.AUTO: "auto", + HVACMode.COOL: "cold", + HVACMode.HEAT: "hot", + HVACMode.HEAT_COOL: "heat", + HVACMode.DRY: "wet", + HVACMode.FAN_ONLY: "wind", } -PRESET_SETS = { - "Manual/Holiday/Program": { - PRESET_AWAY: "Holiday", - PRESET_HOME: "Program", - PRESET_NONE: "Manual", - }, + +HVAC_ACTION_SETS = { + HVACAction.HEATING: "opened", + HVACAction.IDLE: "closed", } +from enum import StrEnum + -TEMPERATURE_CELSIUS = "celsius" -TEMPERATURE_FAHRENHEIT = "fahrenheit" -DEFAULT_TEMPERATURE_UNIT = TEMPERATURE_CELSIUS +class SupportedTemps(StrEnum): + C = "celsius" + F = "fahrenheit" + C_F = f"celsius/fahrenheit" + F_C = f"fahrenheit/celsius" + + +SUPPORTED_TEMPERATURES = { + UnitOfTemperature.CELSIUS: SupportedTemps.C, + UnitOfTemperature.FAHRENHEIT: SupportedTemps.F, + f"Target Temperature: {UnitOfTemperature.CELSIUS} | Current Temperature {UnitOfTemperature.FAHRENHEIT}": SupportedTemps.C_F, + f"Target Temperature: {UnitOfTemperature.FAHRENHEIT} | Current Temperature {UnitOfTemperature.CELSIUS}": SupportedTemps.F_C, +} + +DEFAULT_TEMPERATURE_UNIT = SupportedTemps.C DEFAULT_PRECISION = PRECISION_TENTHS DEFAULT_TEMPERATURE_STEP = PRECISION_HALVES # Empirically tested to work for AVATTO thermostat MODE_WAIT = 0.1 +FAN_SPEEDS_DEFAULT = "auto,low,middle,high" + def flow_schema(dps): """Return schema used in config flow.""" return { - vol.Optional(CONF_TARGET_TEMPERATURE_DP): vol.In(dps), - vol.Optional(CONF_CURRENT_TEMPERATURE_DP): vol.In(dps), - vol.Optional(CONF_TEMPERATURE_STEP, default=PRECISION_WHOLE): vol.In( + vol.Optional(CONF_TARGET_TEMPERATURE_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_CURRENT_TEMPERATURE_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_TEMPERATURE_STEP): col_to_select( [PRECISION_WHOLE, PRECISION_HALVES, PRECISION_TENTHS] ), - vol.Optional(CONF_TEMP_MIN, default=DEFAULT_MIN_TEMP): vol.Coerce(float), - vol.Optional(CONF_TEMP_MAX, default=DEFAULT_MAX_TEMP): vol.Coerce(float), - vol.Optional(CONF_MAX_TEMP_DP): vol.In(dps), - vol.Optional(CONF_MIN_TEMP_DP): vol.In(dps), - vol.Optional(CONF_PRECISION, default=PRECISION_WHOLE): vol.In( + vol.Optional(CONF_MIN_TEMP, default=DEFAULT_MIN_TEMP): vol.Coerce(float), + vol.Optional(CONF_MAX_TEMP, default=DEFAULT_MAX_TEMP): vol.Coerce(float), + vol.Optional(CONF_PRECISION, default=str(DEFAULT_PRECISION)): col_to_select( [PRECISION_WHOLE, PRECISION_HALVES, PRECISION_TENTHS] ), - vol.Optional(CONF_HVAC_MODE_DP): vol.In(dps), - vol.Optional(CONF_HVAC_MODE_SET): vol.In(list(HVAC_MODE_SETS.keys())), - vol.Optional(CONF_HVAC_FAN_MODE_DP): vol.In(dps), - vol.Optional(CONF_HVAC_FAN_MODE_SET): vol.In(list(HVAC_FAN_MODE_SETS.keys())), - vol.Optional(CONF_HVAC_ACTION_DP): vol.In(dps), - vol.Optional(CONF_HVAC_ACTION_SET): vol.In(list(HVAC_ACTION_SETS.keys())), - vol.Optional(CONF_ECO_DP): vol.In(dps), + vol.Optional( + CONF_TARGET_PRECISION, default=str(DEFAULT_PRECISION) + ): col_to_select([PRECISION_WHOLE, PRECISION_HALVES, PRECISION_TENTHS]), + vol.Optional(CONF_HVAC_MODE_DP): col_to_select(dps, is_dps=True), + vol.Optional( + CONF_HVAC_MODE_SET, default=HVAC_MODE_SETS + ): selector.ObjectSelector(), + vol.Optional(CONF_HVAC_ACTION_DP): col_to_select(dps, is_dps=True), + vol.Optional( + CONF_HVAC_ACTION_SET, default=HVAC_ACTION_SETS + ): selector.ObjectSelector(), + vol.Optional(CONF_ECO_DP): col_to_select(dps, is_dps=True), vol.Optional(CONF_ECO_VALUE): str, - vol.Optional(CONF_PRESET_DP): vol.In(dps), - vol.Optional(CONF_PRESET_SET): vol.In(list(PRESET_SETS.keys())), - vol.Optional(CONF_TEMPERATURE_UNIT): vol.In( - [TEMPERATURE_CELSIUS, TEMPERATURE_FAHRENHEIT] - ), - vol.Optional(CONF_TARGET_PRECISION, default=PRECISION_WHOLE): vol.In( - [PRECISION_WHOLE, PRECISION_HALVES, PRECISION_TENTHS] - ), + vol.Optional(CONF_PRESET_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_PRESET_SET, default={}): selector.ObjectSelector(), + vol.Optional(CONF_FAN_SPEED_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_FAN_SPEED_LIST, default=FAN_SPEEDS_DEFAULT): str, + vol.Optional(CONF_TEMPERATURE_UNIT): col_to_select(SUPPORTED_TEMPERATURES), vol.Optional(CONF_HEURISTIC_ACTION): bool, } -class LocaltuyaClimate(LocalTuyaEntity, ClimateEntity): +# Convertors +def f_to_c(num): + return (num - 32) * 5 / 9 if num else num + + +def c_to_f(num): + return (num * 1.8) + 32 if num else num + + +def config_unit(unit): + if unit == SupportedTemps.F: + return UnitOfTemperature.FAHRENHEIT + else: + return UnitOfTemperature.CELSIUS + + +class LocalTuyaClimate(LocalTuyaEntity, ClimateEntity): """Tuya climate device.""" + _enable_turn_on_off_backwards_compatibility = False + def __init__( self, device, @@ -190,59 +188,78 @@ def __init__( switchid, **kwargs, ): - """Initialize a new LocaltuyaClimate.""" + """Initialize a new LocalTuyaClimate.""" super().__init__(device, config_entry, switchid, _LOGGER, **kwargs) self._state = None self._target_temperature = None + self._target_temp_forced_to_celsius = False self._current_temperature = None self._hvac_mode = None - self._fan_mode = None - self._swing_mode = None self._preset_mode = None self._hvac_action = None - self._precision = self._config.get(CONF_PRECISION, DEFAULT_PRECISION) - self._target_precision = self._config.get( - CONF_TARGET_PRECISION, self._precision - ) - self._conf_hvac_mode_dp = self._config.get(CONF_HVAC_MODE_DP) - self._conf_hvac_mode_set = HVAC_MODE_SETS.get( - self._config.get(CONF_HVAC_MODE_SET), {} - ) - self._conf_hvac_fan_mode_dp = self._config.get(CONF_HVAC_FAN_MODE_DP) - self._conf_hvac_fan_mode_set = HVAC_FAN_MODE_SETS.get( - self._config.get(CONF_HVAC_FAN_MODE_SET), {} + self._precision = float(self._config.get(CONF_PRECISION, DEFAULT_PRECISION)) + self._precision_target = float( + self._config.get(CONF_TARGET_PRECISION, DEFAULT_PRECISION) ) - self._conf_hvac_swing_mode_dp = self._config.get(CONF_HVAC_SWING_MODE_DP) - self._conf_hvac_swing_mode_set = HVAC_SWING_MODE_SETS.get( - self._config.get(CONF_HVAC_SWING_MODE_SET), {} - ) - self._conf_preset_dp = self._config.get(CONF_PRESET_DP) - self._conf_preset_set = PRESET_SETS.get(self._config.get(CONF_PRESET_SET), {}) + + # HVAC Modes + self._hvac_mode_dp = self._config.get(CONF_HVAC_MODE_DP) + if modes_set := self._config.get(CONF_HVAC_MODE_SET, {}): + # HA HVAC Modes are all lower case. + modes_set = {k.lower(): v for k, v in modes_set.copy().items()} + self._hvac_mode_set = modes_set + + # Presets + self._preset_dp = self._config.get(CONF_PRESET_DP) + self._preset_set: dict = self._config.get(CONF_PRESET_SET, {}) + + # Sort Modes If the HVAC isn't supported by HA then we add it as preset. + if self._preset_dp == self._hvac_mode_dp or not self._preset_dp: + for k, v in self._hvac_mode_set.copy().items(): + if k not in HVACMode: + self._preset_dp = self._hvac_mode_dp + self._preset_set[k] = self._hvac_mode_set.pop(k) + + self._preset_name_to_value = {v: k for k, v in self._preset_set.items()} + + # HVAC Actions self._conf_hvac_action_dp = self._config.get(CONF_HVAC_ACTION_DP) - self._conf_hvac_action_set = HVAC_ACTION_SETS.get( - self._config.get(CONF_HVAC_ACTION_SET), {} - ) - self._conf_eco_dp = self._config.get(CONF_ECO_DP) - self._conf_eco_value = self._config.get(CONF_ECO_VALUE, "ECO") - self._has_presets = self.has_config(CONF_ECO_DP) or self.has_config( - CONF_PRESET_DP - ) - _LOGGER.debug("Initialized climate [%s]", self.name) + if actions_set := self._config.get(CONF_HVAC_ACTION_SET, {}): + actions_set = {k.lower(): v for k, v in actions_set.copy().items()} + self._conf_hvac_action_set = actions_set + + # Fan + self._fan_speed_dp = self._config.get(CONF_FAN_SPEED_DP) + if fan_speeds := self._config.get(CONF_FAN_SPEED_LIST, []): + fan_speeds = [v.lstrip() for v in fan_speeds.split(",")] + self._fan_supported_speeds = fan_speeds + self._has_fan_mode = self._fan_speed_dp and self._fan_supported_speeds + + # Eco!? + self._eco_dp = self._config.get(CONF_ECO_DP) + self._eco_value = self._config.get(CONF_ECO_VALUE, "ECO") + self._has_presets = self._eco_dp or (self._preset_dp and self._preset_set) + + self._min_temp = self._config.get(CONF_MIN_TEMP, DEFAULT_MIN_TEMP) + self._max_temp = self._config.get(CONF_MAX_TEMP, DEFAULT_MAX_TEMP) + + # Temperture unit + self._temperature_unit = UnitOfTemperature.CELSIUS @property def supported_features(self): """Flag supported features.""" - supported_features = ClimateEntityFeature.TURN_ON | ClimateEntityFeature.TURN_OFF + supported_features = ClimateEntityFeature(0) if self.has_config(CONF_TARGET_TEMPERATURE_DP): - supported_features = supported_features | ClimateEntityFeature.TARGET_TEMPERATURE - if self.has_config(CONF_MAX_TEMP_DP): - supported_features = supported_features | ClimateEntityFeature.TARGET_TEMPERATURE_RANGE - if self.has_config(CONF_PRESET_DP) or self.has_config(CONF_ECO_DP): - supported_features = supported_features | ClimateEntityFeature.PRESET_MODE - if self.has_config(CONF_HVAC_FAN_MODE_DP) and self.has_config(CONF_HVAC_FAN_MODE_SET): - supported_features = supported_features | ClimateEntityFeature.FAN_MODE - if self.has_config(CONF_HVAC_SWING_MODE_DP): - supported_features = supported_features | ClimateEntityFeature.SWING_MODE + supported_features |= ClimateEntityFeature.TARGET_TEMPERATURE + if self._has_presets: + supported_features |= ClimateEntityFeature.PRESET_MODE + if self._has_fan_mode: + supported_features |= ClimateEntityFeature.FAN_MODE + + supported_features |= ClimateEntityFeature.TURN_OFF + supported_features |= ClimateEntityFeature.TURN_ON + return supported_features @property @@ -250,50 +267,71 @@ def precision(self): """Return the precision of the system.""" return self._precision - @property - def target_precision(self): - """Return the precision of the target.""" - return self._target_precision - @property def temperature_unit(self): """Return the unit of measurement used by the platform.""" - if ( - self._config.get(CONF_TEMPERATURE_UNIT, DEFAULT_TEMPERATURE_UNIT) - == TEMPERATURE_FAHRENHEIT - ): - return UnitOfTemperature.FAHRENHEIT - return UnitOfTemperature.CELSIUS + return self._temperature_unit + + @property + def min_temp(self): + """Return the minimum temperature.""" + # DEFAULT_MIN_TEMP is in C + return self._min_temp + + @property + def max_temp(self): + """Return the maximum temperature.""" + # DEFAULT_MAX_TEMP is in C + return self._max_temp @property def hvac_mode(self): """Return current operation ie. heat, cool, idle.""" + if not self._state: + return HVACMode.OFF + if not self._hvac_mode_dp: + return HVACMode.HEAT + return self._hvac_mode @property def hvac_modes(self): """Return the list of available operation modes.""" if not self.has_config(CONF_HVAC_MODE_DP): - return None - return list(self._conf_hvac_mode_set) + [HVACMode.OFF] + return [HVACMode.OFF] + + modes = list(self._hvac_mode_set) + + if self._config.get(CONF_HVAC_ADD_OFF, True) and HVACMode.OFF not in modes: + modes.append(HVACMode.OFF) + return modes @property def hvac_action(self): - """Return the current running hvac operation if supported. + """Return the current running hvac operation if supported.""" + if not self._state: + return HVACAction.OFF - Need to be one of CURRENT_HVAC_*. - """ + if not self._conf_hvac_action_dp: + if self._hvac_mode == HVACMode.COOL: + self._hvac_action = HVACAction.COOLING + if self._hvac_mode == HVACMode.HEAT: + self._hvac_action = HVACAction.HEATING + if self._hvac_mode == HVACMode.DRY: + self._hvac_action = HVACAction.DRYING + + # This exists from upstream, not sure the use case of this. if self._config.get(CONF_HEURISTIC_ACTION, False): if self._hvac_mode == HVACMode.HEAT: if self._current_temperature < ( self._target_temperature - self._precision ): - self._hvac_action = HVACAction.HEATING + self._hvac_action = HVACMode.HEAT if self._current_temperature == ( self._target_temperature - self._precision ): - if self._hvac_action == HVACAction.HEATING: - self._hvac_action = HVACAction.HEATING + if self._hvac_action == HVACMode.HEAT: + self._hvac_action = HVACMode.HEAT if self._hvac_action == HVACAction.IDLE: self._hvac_action = HVACAction.IDLE if ( @@ -306,6 +344,10 @@ def hvac_action(self): @property def preset_mode(self): """Return current preset.""" + mode = self.dp_value(CONF_HVAC_MODE_DP) + if mode in list(self._hvac_mode_set.values()): + return None + return self._preset_mode @property @@ -313,8 +355,9 @@ def preset_modes(self): """Return the list of available presets modes.""" if not self._has_presets: return None - presets = list(self._conf_preset_set) - if self._conf_eco_dp: + + presets = list(self._preset_set.values()) + if self._eco_dp: presets.append(PRESET_ECO) return presets @@ -331,76 +374,54 @@ def target_temperature(self): @property def target_temperature_step(self): """Return the supported step of target temperature.""" - return self._config.get(CONF_TEMPERATURE_STEP, DEFAULT_TEMPERATURE_STEP) + target_step = self._config.get(CONF_TEMPERATURE_STEP, DEFAULT_TEMPERATURE_STEP) + return float(target_step) @property def fan_mode(self): """Return the fan setting.""" - return self._fan_mode - - @property - def fan_modes(self): - """Return the list of available fan modes.""" - if not self.has_config(CONF_HVAC_FAN_MODE_DP): + if not (fan_value := self.dp_value(self._fan_speed_dp)): return None - return list(self._conf_hvac_fan_mode_set) - - @property - def swing_mode(self): - """Return the swing setting.""" - return self._swing_mode + return fan_value @property - def swing_modes(self): - """Return the list of available swing modes.""" - if not self.has_config(CONF_HVAC_SWING_MODE_DP): - return None - return list(self._conf_hvac_swing_mode_set) + def fan_modes(self) -> list: + """Return the list of available fan modes.""" + return self._fan_supported_speeds async def async_set_temperature(self, **kwargs): """Set new target temperature.""" if ATTR_TEMPERATURE in kwargs and self.has_config(CONF_TARGET_TEMPERATURE_DP): - temperature = round(kwargs[ATTR_TEMPERATURE] / self._target_precision) + temperature = kwargs[ATTR_TEMPERATURE] + + if self._target_temp_forced_to_celsius: + # Revert temperture to Fahrenheit it was forced to celsius + temperature = round(c_to_f(temperature)) + + temperature = round(temperature / self._precision_target) await self._device.set_dp( temperature, self._config[CONF_TARGET_TEMPERATURE_DP] ) async def async_set_fan_mode(self, fan_mode): """Set new target fan mode.""" - if self._conf_hvac_fan_mode_dp is None: - _LOGGER.error("Fan speed unsupported (no DP)") - return - if fan_mode not in self._conf_hvac_fan_mode_set: - _LOGGER.error("Unsupported fan_mode: %s" % fan_mode) - return - await self._device.set_dp( - self._conf_hvac_fan_mode_set[fan_mode], self._conf_hvac_fan_mode_dp - ) + if not self._state: + await self._device.set_dp(True, self._dp_id) - async def async_set_hvac_mode(self, hvac_mode): + await self._device.set_dp(fan_mode, self._fan_speed_dp) + + async def async_set_hvac_mode(self, hvac_mode: HVACMode): """Set new target operation mode.""" - if hvac_mode == HVACMode.OFF: - await self._device.set_dp(False, self._dp_id) - return - if not self._state and self._conf_hvac_mode_dp != self._dp_id: - await self._device.set_dp(True, self._dp_id) - # Some thermostats need a small wait before sending another update - await asyncio.sleep(MODE_WAIT) - await self._device.set_dp( - self._conf_hvac_mode_set[hvac_mode], self._conf_hvac_mode_dp - ) + new_states = {} + if not self._state: + new_states[self._dp_id] = True + elif hvac_mode == HVACMode.OFF and HVACMode.OFF not in self._hvac_mode_set: + new_states[self._dp_id] = False - async def async_set_swing_mode(self, swing_mode): - """Set new target swing operation.""" - if self._conf_hvac_swing_mode_dp is None: - _LOGGER.error("Swing mode unsupported (no DP)") - return - if swing_mode not in self._conf_hvac_swing_mode_set: - _LOGGER.error("Unsupported swing_mode: %s" % swing_mode) - return - await self._device.set_dp( - self._conf_hvac_swing_mode_set[swing_mode], self._conf_hvac_swing_mode_dp - ) + if hvac_mode in self._hvac_mode_set: + new_states[self._hvac_mode_dp] = self._hvac_mode_set[hvac_mode] + + await self._device.set_dps(new_states) async def async_turn_on(self) -> None: """Turn the entity on.""" @@ -413,92 +434,75 @@ async def async_turn_off(self) -> None: async def async_set_preset_mode(self, preset_mode): """Set new target preset mode.""" if preset_mode == PRESET_ECO: - await self._device.set_dp(self._conf_eco_value, self._conf_eco_dp) + await self._device.set_dp(self._eco_value, self._eco_dp) return - await self._device.set_dp( - self._conf_preset_set[preset_mode], self._conf_preset_dp - ) - - @property - def min_temp(self): - """Return the minimum temperature.""" - if self.has_config(CONF_MIN_TEMP_DP): - return self.dps_conf(CONF_MIN_TEMP_DP) - return self._config[CONF_TEMP_MIN] - @property - def max_temp(self): - """Return the maximum temperature.""" - if self.has_config(CONF_MAX_TEMP_DP): - return self.dps_conf(CONF_MAX_TEMP_DP) - return self._config[CONF_TEMP_MAX] + preset_value = self._preset_name_to_value.get(preset_mode) + await self._device.set_dp(preset_value, self._preset_dp) def status_updated(self): """Device status was updated.""" - self._state = self.dps(self._dp_id) + self._state = self.dp_value(self._dp_id) - if self.has_config(CONF_TARGET_TEMPERATURE_DP): - self._target_temperature = ( - self.dps_conf(CONF_TARGET_TEMPERATURE_DP) * self._target_precision - ) + # Update target temperature + if self.has_config(CONF_TARGET_TEMPERATURE_DP) and ( + target_dp_value := self.dp_value(CONF_TARGET_TEMPERATURE_DP) + ): + self._target_temperature = target_dp_value * self._precision_target - if self.has_config(CONF_CURRENT_TEMPERATURE_DP): - self._current_temperature = ( - self.dps_conf(CONF_CURRENT_TEMPERATURE_DP) * self._precision - ) + # Update current temperature + if self.has_config(CONF_CURRENT_TEMPERATURE_DP) and ( + current_dp_temp := self.dp_value(CONF_CURRENT_TEMPERATURE_DP) + ): + self._current_temperature = current_dp_temp * self._precision + + # Force the Current temperature and Target temperature to matching the unit. + config_temp_unit = self._config.get(CONF_TEMPERATURE_UNIT, "") + target_unit, *current_unit = config_temp_unit.split("/") + + if current_unit: + set_temp_unit = UnitOfTemperature.CELSIUS + if target_unit == SupportedTemps.F: + self._target_temperature = f_to_c(self._target_temperature) + if not self._target_temp_forced_to_celsius: + self._target_temp_forced_to_celsius = True + self._min_temp = f_to_c(self._min_temp) + self._max_temp = f_to_c(self._max_temp) + else: + self._current_temperature = f_to_c(self._current_temperature) + else: + set_temp_unit = config_unit(config_temp_unit) + self._temperature_unit = set_temp_unit + # Update preset states if self._has_presets: - if ( - self.has_config(CONF_ECO_DP) - and self.dps_conf(CONF_ECO_DP) == self._conf_eco_value - ): + if self.dp_value(CONF_ECO_DP) == self._eco_value: self._preset_mode = PRESET_ECO else: - for preset, value in self._conf_preset_set.items(): # todo remove - if self.dps_conf(CONF_PRESET_DP) == value: - self._preset_mode = preset + for preset_value, preset_name in self._preset_set.items(): + if self.dp_value(CONF_PRESET_DP) == preset_value: + self._preset_mode = preset_name break else: self._preset_mode = PRESET_NONE - # Update the HVAC status + # If device is off there is no needs to check the states. + if not self._state: + return + + # Update the HVAC Mode if self.has_config(CONF_HVAC_MODE_DP): - if not self._state: - self._hvac_mode = HVACMode.OFF - else: - for mode, value in self._conf_hvac_mode_set.items(): - if self.dps_conf(CONF_HVAC_MODE_DP) == value: - self._hvac_mode = mode - break - else: - # in case hvac mode and preset share the same dp - self._hvac_mode = HVACMode.AUTO - - # Update the fan status - if self.has_config(CONF_HVAC_FAN_MODE_DP): - for mode, value in self._conf_hvac_fan_mode_set.items(): - if self.dps_conf(CONF_HVAC_FAN_MODE_DP) == value: - self._fan_mode = mode + for ha_hvac, tuya_value in self._hvac_mode_set.items(): + if self.dp_value(CONF_HVAC_MODE_DP) == tuya_value: + self._hvac_mode = ha_hvac break - else: - # in case fan mode and preset share the same dp - _LOGGER.debug("Unknown fan mode %s" % self.dps_conf(CONF_HVAC_FAN_MODE_DP)) - self._fan_mode = FAN_AUTO - - # Update the swing status - if self.has_config(CONF_HVAC_SWING_MODE_DP): - for mode, value in self._conf_hvac_swing_mode_set.items(): - if self.dps_conf(CONF_HVAC_SWING_MODE_DP) == value: - self._swing_mode = mode - break - else: - _LOGGER.debug("Unknown swing mode %s" % self.dps_conf(CONF_HVAC_SWING_MODE_DP)) - self._swing_mode = SWING_OFF # Update the current action - for action, value in self._conf_hvac_action_set.items(): - if self.dps_conf(CONF_HVAC_ACTION_DP) == value: - self._hvac_action = action + if self.has_config(CONF_HVAC_ACTION_DP): + for ha_action, tuya_value in self._conf_hvac_action_set.items(): + if self.dp_value(CONF_HVAC_ACTION_DP) == tuya_value: + self._hvac_action = ha_action + break -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaClimate, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaClimate, flow_schema) diff --git a/custom_components/localtuya/cloud_api.py b/custom_components/localtuya/cloud_api.py deleted file mode 100644 index a0c51285..00000000 --- a/custom_components/localtuya/cloud_api.py +++ /dev/null @@ -1,139 +0,0 @@ -"""Class to perform requests to Tuya Cloud APIs.""" -import functools -import hashlib -import hmac -import json -import logging -import time - -import requests - -_LOGGER = logging.getLogger(__name__) - - -# Signature algorithm. -def calc_sign(msg, key): - """Calculate signature for request.""" - sign = ( - hmac.new( - msg=bytes(msg, "latin-1"), - key=bytes(key, "latin-1"), - digestmod=hashlib.sha256, - ) - .hexdigest() - .upper() - ) - return sign - - -class TuyaCloudApi: - """Class to send API calls.""" - - def __init__(self, hass, region_code, client_id, secret, user_id): - """Initialize the class.""" - self._hass = hass - self._base_url = f"https://openapi.tuya{region_code}.com" - self._client_id = client_id - self._secret = secret - self._user_id = user_id - self._access_token = "" - self.device_list = {} - - def generate_payload(self, method, timestamp, url, headers, body=None): - """Generate signed payload for requests.""" - payload = self._client_id + self._access_token + timestamp - - payload += method + "\n" - # Content-SHA256 - payload += hashlib.sha256(bytes((body or "").encode("utf-8"))).hexdigest() - payload += ( - "\n" - + "".join( - [ - "%s:%s\n" % (key, headers[key]) # Headers - for key in headers.get("Signature-Headers", "").split(":") - if key in headers - ] - ) - + "\n/" - + url.split("//", 1)[-1].split("/", 1)[-1] # Url - ) - # _LOGGER.debug("PAYLOAD: %s", payload) - return payload - - async def async_make_request(self, method, url, body=None, headers={}): - """Perform requests.""" - timestamp = str(int(time.time() * 1000)) - payload = self.generate_payload(method, timestamp, url, headers, body) - default_par = { - "client_id": self._client_id, - "access_token": self._access_token, - "sign": calc_sign(payload, self._secret), - "t": timestamp, - "sign_method": "HMAC-SHA256", - } - full_url = self._base_url + url - # _LOGGER.debug("\n" + method + ": [%s]", full_url) - - if method == "GET": - func = functools.partial( - requests.get, full_url, headers=dict(default_par, **headers) - ) - elif method == "POST": - func = functools.partial( - requests.post, - full_url, - headers=dict(default_par, **headers), - data=json.dumps(body), - ) - # _LOGGER.debug("BODY: [%s]", body) - elif method == "PUT": - func = functools.partial( - requests.put, - full_url, - headers=dict(default_par, **headers), - data=json.dumps(body), - ) - - resp = await self._hass.async_add_executor_job(func) - # r = json.dumps(r.json(), indent=2, ensure_ascii=False) # Beautify the format - return resp - - async def async_get_access_token(self): - """Obtain a valid access token.""" - try: - resp = await self.async_make_request("GET", "/v1.0/token?grant_type=1") - except requests.exceptions.ConnectionError: - return "Request failed, status ConnectionError" - - if not resp.ok: - return "Request failed, status " + str(resp.status) - - r_json = resp.json() - if not r_json["success"]: - return f"Error {r_json['code']}: {r_json['msg']}" - - self._access_token = resp.json()["result"]["access_token"] - return "ok" - - async def async_get_devices_list(self): - """Obtain the list of devices associated to a user.""" - resp = await self.async_make_request( - "GET", url=f"/v1.0/users/{self._user_id}/devices" - ) - - if not resp.ok: - return "Request failed, status " + str(resp.status) - - r_json = resp.json() - if not r_json["success"]: - # _LOGGER.debug( - # "Request failed, reply is %s", - # json.dumps(r_json, indent=2, ensure_ascii=False) - # ) - return f"Error {r_json['code']}: {r_json['msg']}" - - self.device_list = {dev["id"]: dev for dev in r_json["result"]} - # _LOGGER.debug("DEV_LIST: %s", self.device_list) - - return "ok" diff --git a/custom_components/localtuya/common.py b/custom_components/localtuya/common.py deleted file mode 100644 index 30f5e74b..00000000 --- a/custom_components/localtuya/common.py +++ /dev/null @@ -1,607 +0,0 @@ -"""Code shared between all platforms.""" -import asyncio -import json.decoder -import logging -import time -from datetime import timedelta - -from homeassistant.const import ( - CONF_DEVICE_ID, - CONF_DEVICES, - CONF_ENTITIES, - CONF_FRIENDLY_NAME, - CONF_HOST, - CONF_ID, - CONF_PLATFORM, - CONF_SCAN_INTERVAL, - STATE_UNKNOWN, -) -from homeassistant.core import callback -from homeassistant.helpers.dispatcher import ( - async_dispatcher_connect, - async_dispatcher_send, -) -from homeassistant.helpers.event import async_track_time_interval -from homeassistant.helpers.restore_state import RestoreEntity - -from . import pytuya -from .const import ( - ATTR_STATE, - ATTR_UPDATED_AT, - CONF_DEFAULT_VALUE, - CONF_ENABLE_DEBUG, - CONF_LOCAL_KEY, - CONF_MODEL, - CONF_PASSIVE_ENTITY, - CONF_PROTOCOL_VERSION, - CONF_RESET_DPIDS, - CONF_RESTORE_ON_RECONNECT, - DATA_CLOUD, - DOMAIN, - TUYA_DEVICES, -) - -_LOGGER = logging.getLogger(__name__) - - -def prepare_setup_entities(hass, config_entry, platform): - """Prepare ro setup entities for a platform.""" - entities_to_setup = [ - entity - for entity in config_entry.data[CONF_ENTITIES] - if entity[CONF_PLATFORM] == platform - ] - if not entities_to_setup: - return None, None - - tuyainterface = [] - - return tuyainterface, entities_to_setup - - -async def async_setup_entry( - domain, entity_class, flow_schema, hass, config_entry, async_add_entities -): - """Set up a Tuya platform based on a config entry. - - This is a generic method and each platform should lock domain and - entity_class with functools.partial. - """ - entities = [] - - for dev_id in config_entry.data[CONF_DEVICES]: - # entities_to_setup = prepare_setup_entities( - # hass, config_entry.data[dev_id], domain - # ) - dev_entry = config_entry.data[CONF_DEVICES][dev_id] - entities_to_setup = [ - entity - for entity in dev_entry[CONF_ENTITIES] - if entity[CONF_PLATFORM] == domain - ] - - if entities_to_setup: - - tuyainterface = hass.data[DOMAIN][TUYA_DEVICES][dev_id] - - dps_config_fields = list(get_dps_for_platform(flow_schema)) - - for entity_config in entities_to_setup: - # Add DPS used by this platform to the request list - for dp_conf in dps_config_fields: - if dp_conf in entity_config: - tuyainterface.dps_to_request[entity_config[dp_conf]] = None - - entities.append( - entity_class( - tuyainterface, - dev_entry, - entity_config[CONF_ID], - ) - ) - # Once the entities have been created, add to the TuyaDevice instance - tuyainterface.add_entities(entities) - async_add_entities(entities) - - -def get_dps_for_platform(flow_schema): - """Return config keys for all platform keys that depends on a datapoint.""" - for key, value in flow_schema(None).items(): - if hasattr(value, "container") and value.container is None: - yield key.schema - - -def get_entity_config(config_entry, dp_id): - """Return entity config for a given DPS id.""" - for entity in config_entry[CONF_ENTITIES]: - if entity[CONF_ID] == dp_id: - return entity - raise Exception(f"missing entity config for id {dp_id}") - - -@callback -def async_config_entry_by_device_id(hass, device_id): - """Look up config entry by device id.""" - current_entries = hass.config_entries.async_entries(DOMAIN) - for entry in current_entries: - if device_id in entry.data.get(CONF_DEVICES, []): - return entry - # else: - # _LOGGER.warning(f"Missing device configuration for device_id {device_id}") - return None - - -class TuyaDevice(pytuya.TuyaListener, pytuya.ContextualLogger): - """Cache wrapper for pytuya.TuyaInterface.""" - - def __init__(self, hass, config_entry, dev_id): - """Initialize the cache.""" - super().__init__() - self._hass = hass - self._config_entry = config_entry - self._dev_config_entry = config_entry.data[CONF_DEVICES][dev_id].copy() - self._interface = None - self._status = {} - self.dps_to_request = {} - self._is_closing = False - self._connect_task = None - self._disconnect_task = None - self._unsub_interval = None - self._entities = [] - self._local_key = self._dev_config_entry[CONF_LOCAL_KEY] - self._default_reset_dpids = None - if CONF_RESET_DPIDS in self._dev_config_entry: - reset_ids_str = self._dev_config_entry[CONF_RESET_DPIDS].split(",") - - self._default_reset_dpids = [] - for reset_id in reset_ids_str: - self._default_reset_dpids.append(int(reset_id.strip())) - - self.set_logger(_LOGGER, self._dev_config_entry[CONF_DEVICE_ID]) - - # This has to be done in case the device type is type_0d - for entity in self._dev_config_entry[CONF_ENTITIES]: - self.dps_to_request[entity[CONF_ID]] = None - - def add_entities(self, entities): - """Set the entities associated with this device.""" - self._entities.extend(entities) - - @property - def is_connecting(self): - """Return whether device is currently connecting.""" - return self._connect_task is not None - - @property - def connected(self): - """Return if connected to device.""" - return self._interface is not None - - def async_connect(self): - """Connect to device if not already connected.""" - # self.info("async_connect: %d %r %r", self._is_closing, self._connect_task, self._interface) - if not self._is_closing and self._connect_task is None and not self._interface: - self._connect_task = asyncio.create_task(self._make_connection()) - - async def _make_connection(self): - """Subscribe localtuya entity events.""" - self.info("Trying to connect to %s...", self._dev_config_entry[CONF_HOST]) - - try: - self._interface = await pytuya.connect( - self._dev_config_entry[CONF_HOST], - self._dev_config_entry[CONF_DEVICE_ID], - self._local_key, - float(self._dev_config_entry[CONF_PROTOCOL_VERSION]), - self._dev_config_entry.get(CONF_ENABLE_DEBUG, False), - self, - ) - self._interface.add_dps_to_request(self.dps_to_request) - except Exception as ex: # pylint: disable=broad-except - self.warning( - f"Failed to connect to {self._dev_config_entry[CONF_HOST]}: %s", ex - ) - if self._interface is not None: - await self._interface.close() - self._interface = None - - if self._interface is not None: - try: - try: - self.debug("Retrieving initial state") - status = await self._interface.status() - if status is None: - raise Exception("Failed to retrieve status") - - self._interface.start_heartbeat() - self.status_updated(status) - - except Exception as ex: - if (self._default_reset_dpids is not None) and ( - len(self._default_reset_dpids) > 0 - ): - self.debug( - "Initial state update failed, trying reset command " - + "for DP IDs: %s", - self._default_reset_dpids, - ) - await self._interface.reset(self._default_reset_dpids) - - self.debug("Update completed, retrying initial state") - status = await self._interface.status() - if status is None or not status: - raise Exception("Failed to retrieve status") from ex - - self._interface.start_heartbeat() - self.status_updated(status) - else: - self.error("Initial state update failed, giving up: %r", ex) - if self._interface is not None: - await self._interface.close() - self._interface = None - - except (UnicodeDecodeError, json.decoder.JSONDecodeError) as ex: - self.warning("Initial state update failed (%s), trying key update", ex) - await self.update_local_key() - - if self._interface is not None: - await self._interface.close() - self._interface = None - - if self._interface is not None: - # Attempt to restore status for all entities that need to first set - # the DPS value before the device will respond with status. - for entity in self._entities: - await entity.restore_state_when_connected() - - def _new_entity_handler(entity_id): - self.debug( - "New entity %s was added to %s", - entity_id, - self._dev_config_entry[CONF_HOST], - ) - self._dispatch_status() - - signal = f"localtuya_entity_{self._dev_config_entry[CONF_DEVICE_ID]}" - self._disconnect_task = async_dispatcher_connect( - self._hass, signal, _new_entity_handler - ) - - if ( - CONF_SCAN_INTERVAL in self._dev_config_entry - and int(self._dev_config_entry[CONF_SCAN_INTERVAL]) > 0 - ): - self._unsub_interval = async_track_time_interval( - self._hass, - self._async_refresh, - timedelta(seconds=int(self._dev_config_entry[CONF_SCAN_INTERVAL])), - ) - - self.info(f"Successfully connected to {self._dev_config_entry[CONF_HOST]}") - - self._connect_task = None - - async def update_local_key(self): - """Retrieve updated local_key from Cloud API and update the config_entry.""" - dev_id = self._dev_config_entry[CONF_DEVICE_ID] - await self._hass.data[DOMAIN][DATA_CLOUD].async_get_devices_list() - cloud_devs = self._hass.data[DOMAIN][DATA_CLOUD].device_list - if dev_id in cloud_devs: - self._local_key = cloud_devs[dev_id].get(CONF_LOCAL_KEY) - new_data = self._config_entry.data.copy() - new_data[CONF_DEVICES][dev_id][CONF_LOCAL_KEY] = self._local_key - new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) - self._hass.config_entries.async_update_entry( - self._config_entry, - data=new_data, - ) - self.info("local_key updated for device %s.", dev_id) - - async def _async_refresh(self, _now): - if self._interface is not None: - await self._interface.update_dps() - - async def close(self): - """Close connection and stop re-connect loop.""" - self._is_closing = True - if self._connect_task is not None: - self._connect_task.cancel() - await self._connect_task - if self._interface is not None: - await self._interface.close() - if self._disconnect_task is not None: - self._disconnect_task() - self.info( - "Closed connection with device %s.", - self._dev_config_entry[CONF_FRIENDLY_NAME], - ) - - async def set_dp(self, state, dp_index): - """Change value of a DP of the Tuya device.""" - if self._interface is not None: - try: - await self._interface.set_dp(state, dp_index) - except Exception: # pylint: disable=broad-except - self.exception("Failed to set DP %d to %s", dp_index, str(state)) - else: - self.error( - "Not connected to device %s", self._dev_config_entry[CONF_FRIENDLY_NAME] - ) - - async def set_dps(self, states): - """Change value of a DPs of the Tuya device.""" - if self._interface is not None: - try: - await self._interface.set_dps(states) - except Exception: # pylint: disable=broad-except - self.exception("Failed to set DPs %r", states) - else: - self.error( - "Not connected to device %s", self._dev_config_entry[CONF_FRIENDLY_NAME] - ) - - @callback - def status_updated(self, status): - """Device updated status.""" - self._status.update(status) - self._dispatch_status() - - def _dispatch_status(self): - signal = f"localtuya_{self._dev_config_entry[CONF_DEVICE_ID]}" - async_dispatcher_send(self._hass, signal, self._status) - - @callback - def disconnected(self): - """Device disconnected.""" - signal = f"localtuya_{self._dev_config_entry[CONF_DEVICE_ID]}" - async_dispatcher_send(self._hass, signal, None) - if self._unsub_interval is not None: - self._unsub_interval() - self._unsub_interval = None - self._interface = None - - if self._connect_task is not None: - self._connect_task.cancel() - self._connect_task = None - self.warning("Disconnected - waiting for discovery broadcast") - - -class LocalTuyaEntity(RestoreEntity, pytuya.ContextualLogger): - """Representation of a Tuya entity.""" - - def __init__(self, device, config_entry, dp_id, logger, **kwargs): - """Initialize the Tuya entity.""" - super().__init__() - self._device = device - self._dev_config_entry = config_entry - self._config = get_entity_config(config_entry, dp_id) - self._dp_id = dp_id - self._status = {} - self._state = None - self._last_state = None - - # Default value is available to be provided by Platform entities if required - self._default_value = self._config.get(CONF_DEFAULT_VALUE) - - # Determine whether is a passive entity - self._is_passive_entity = self._config.get(CONF_PASSIVE_ENTITY) or False - - """ Restore on connect setting is available to be provided by Platform entities - if required""" - self._restore_on_reconnect = ( - self._config.get(CONF_RESTORE_ON_RECONNECT) or False - ) - self.set_logger(logger, self._dev_config_entry[CONF_DEVICE_ID]) - - async def async_added_to_hass(self): - """Subscribe localtuya events.""" - await super().async_added_to_hass() - - self.debug("Adding %s with configuration: %s", self.entity_id, self._config) - - state = await self.async_get_last_state() - if state: - self.status_restored(state) - - def _update_handler(status): - """Update entity state when status was updated.""" - if status is None: - status = {} - if self._status != status: - self._status = status.copy() - if status: - self.status_updated() - - # Update HA - self.schedule_update_ha_state() - - signal = f"localtuya_{self._dev_config_entry[CONF_DEVICE_ID]}" - - self.async_on_remove( - async_dispatcher_connect(self.hass, signal, _update_handler) - ) - - signal = f"localtuya_entity_{self._dev_config_entry[CONF_DEVICE_ID]}" - async_dispatcher_send(self.hass, signal, self.entity_id) - - @property - def extra_state_attributes(self): - """Return entity specific state attributes to be saved. - - These attributes are then available for restore when the - entity is restored at startup. - """ - attributes = {} - if self._state is not None: - attributes[ATTR_STATE] = self._state - elif self._last_state is not None: - attributes[ATTR_STATE] = self._last_state - - self.debug("Entity %s - Additional attributes: %s", self.name, attributes) - return attributes - - @property - def device_info(self): - """Return device information for the device registry.""" - model = self._dev_config_entry.get(CONF_MODEL, "Tuya generic") - return { - "identifiers": { - # Serial numbers are unique identifiers within a specific domain - (DOMAIN, f"local_{self._dev_config_entry[CONF_DEVICE_ID]}") - }, - "name": self._dev_config_entry[CONF_FRIENDLY_NAME], - "manufacturer": "Tuya", - "model": f"{model} ({self._dev_config_entry[CONF_DEVICE_ID]})", - "sw_version": self._dev_config_entry[CONF_PROTOCOL_VERSION], - } - - @property - def name(self): - """Get name of Tuya entity.""" - return self._config[CONF_FRIENDLY_NAME] - - @property - def should_poll(self): - """Return if platform should poll for updates.""" - return False - - @property - def unique_id(self): - """Return unique device identifier.""" - return f"local_{self._dev_config_entry[CONF_DEVICE_ID]}_{self._dp_id}" - - def has_config(self, attr): - """Return if a config parameter has a valid value.""" - value = self._config.get(attr, "-1") - return value is not None and value != "-1" - - @property - def available(self): - """Return if device is available or not.""" - return str(self._dp_id) in self._status - - def dps(self, dp_index): - """Return cached value for DPS index.""" - value = self._status.get(str(dp_index)) - if value is None: - self.warning( - "Entity %s is requesting unknown DPS index %s", - self.entity_id, - dp_index, - ) - - return value - - def dps_conf(self, conf_item): - """Return value of datapoint for user specified config item. - - This method looks up which DP a certain config item uses based on - user configuration and returns its value. - """ - dp_index = self._config.get(conf_item) - if dp_index is None: - self.warning( - "Entity %s is requesting unset index for option %s", - self.entity_id, - conf_item, - ) - return self.dps(dp_index) - - def status_updated(self): - """Device status was updated. - - Override in subclasses and update entity specific state. - """ - state = self.dps(self._dp_id) - self._state = state - - # Keep record in last_state as long as not during connection/re-connection, - # as last state will be used to restore the previous state - if (state is not None) and (not self._device.is_connecting): - self._last_state = state - - def status_restored(self, stored_state): - """Device status was restored. - - Override in subclasses and update entity specific state. - """ - raw_state = stored_state.attributes.get(ATTR_STATE) - if raw_state is not None: - self._last_state = raw_state - self.debug( - "Restoring state for entity: %s - state: %s", - self.name, - str(self._last_state), - ) - - def default_value(self): - """Return default value of this entity. - - Override in subclasses to specify the default value for the entity. - """ - # Check if default value has been set - if not, default to the entity defaults. - if self._default_value is None: - self._default_value = self.entity_default_value() - - return self._default_value - - def entity_default_value(self): # pylint: disable=no-self-use - """Return default value of the entity type. - - Override in subclasses to specify the default value for the entity. - """ - return 0 - - @property - def restore_on_reconnect(self): - """Return whether the last state should be restored on a reconnect. - - Useful where the device loses settings if powered off - """ - return self._restore_on_reconnect - - async def restore_state_when_connected(self): - """Restore if restore_on_reconnect is set, or if no status has been yet found. - - Which indicates a DPS that needs to be set before it starts returning - status. - """ - if (not self.restore_on_reconnect) and ( - (str(self._dp_id) in self._status) or (not self._is_passive_entity) - ): - self.debug( - "Entity %s (DP %d) - Not restoring as restore on reconnect is " - + "disabled for this entity and the entity has an initial status " - + "or it is not a passive entity", - self.name, - self._dp_id, - ) - return - - self.debug("Attempting to restore state for entity: %s", self.name) - # Attempt to restore the current state - in case reset. - restore_state = self._state - - # If no state stored in the entity currently, go from last saved state - if (restore_state == STATE_UNKNOWN) | (restore_state is None): - self.debug("No current state for entity") - restore_state = self._last_state - - # If no current or saved state, then use the default value - if restore_state is None: - if self._is_passive_entity: - self.debug("No last restored state - using default") - restore_state = self.default_value() - else: - self.debug("Not a passive entity and no state found - aborting restore") - return - - self.debug( - "Entity %s (DP %d) - Restoring state: %s", - self.name, - self._dp_id, - str(restore_state), - ) - - # Manually initialise - await self._device.set_dp(restore_state, self._dp_id) diff --git a/custom_components/localtuya/config_flow.py b/custom_components/localtuya/config_flow.py index 5c87e254..87c82a29 100644 --- a/custom_components/localtuya/config_flow.py +++ b/custom_components/localtuya/config_flow.py @@ -1,11 +1,24 @@ """Config flow for LocalTuya integration integration.""" + +import asyncio import errno import logging import time from importlib import import_module +from functools import partial +from collections.abc import Coroutine +from typing import Any +from copy import deepcopy + import homeassistant.helpers.config_validation as cv import homeassistant.helpers.entity_registry as er +from homeassistant.helpers.selector import ( + SelectSelector, + SelectSelectorConfig, + SelectSelectorMode, + SelectOptionDict, +) import voluptuous as vol from homeassistant import config_entries, core, exceptions from homeassistant.const import ( @@ -15,67 +28,108 @@ CONF_DEVICES, CONF_ENTITIES, CONF_FRIENDLY_NAME, + CONF_ENTITY_CATEGORY, CONF_HOST, + CONF_ICON, CONF_ID, CONF_NAME, CONF_PLATFORM, CONF_REGION, CONF_SCAN_INTERVAL, CONF_USERNAME, + EntityCategory, ) from homeassistant.core import callback -from .cloud_api import TuyaCloudApi -from .common import pytuya +from .coordinator import pytuya, TuyaCloudApi +from .core.cloud_api import TUYA_ENDPOINTS +from .core.helpers import templates, get_gateway_by_deviceid, gen_localtuya_entities from .const import ( ATTR_UPDATED_AT, - CONF_ACTION, CONF_ADD_DEVICE, + CONF_CONFIGURE_CLOUD, CONF_DPS_STRINGS, CONF_EDIT_DEVICE, + CONF_ENABLE_ADD_ENTITIES, CONF_ENABLE_DEBUG, + CONF_GATEWAY_ID, CONF_LOCAL_KEY, CONF_MANUAL_DPS, CONF_MODEL, + CONF_NODE_ID, CONF_NO_CLOUD, + CONF_PRODUCT_KEY, CONF_PRODUCT_NAME, CONF_PROTOCOL_VERSION, CONF_RESET_DPIDS, - CONF_SETUP_CLOUD, + CONF_TUYA_GWID, + CONF_TUYA_IP, + CONF_TUYA_VERSION, CONF_USER_ID, - CONF_ENABLE_ADD_ENTITIES, - DATA_CLOUD, DATA_DISCOVERY, + DEFAULT_CATEGORIES, DOMAIN, + ENTITY_CATEGORY, PLATFORMS, + SUPPORTED_PROTOCOL_VERSIONS, + CONF_DEVICE_SLEEP_TIME, ) from .discovery import discover _LOGGER = logging.getLogger(__name__) -ENTRIES_VERSION = 2 +ENTRIES_VERSION = 4 PLATFORM_TO_ADD = "platform_to_add" +USE_TEMPLATE = "use_template" +TEMPLATES = "templates" NO_ADDITIONAL_ENTITIES = "no_additional_entities" SELECTED_DEVICE = "selected_device" +EXPORT_CONFIG = "export_config" -CUSTOM_DEVICE = "..." +TUYA_CATEGORY = "category" +DEVICE_CLOUD_DATA = "device_cloud_data" -CONF_ACTIONS = { - CONF_ADD_DEVICE: "Add a new device", - CONF_EDIT_DEVICE: "Edit a device", - CONF_SETUP_CLOUD: "Reconfigure Cloud API account", -} +# Using list method so we can translate options. +CONFIGURE_MENU = [CONF_ADD_DEVICE, CONF_EDIT_DEVICE, CONF_CONFIGURE_CLOUD] + + +def col_to_select( + opt_list: dict | list, multi_select=False, is_dps=False, custom_value=False +) -> SelectSelector: + """Convert collections to SelectSelectorConfig.""" + if type(opt_list) == dict: + return SelectSelector( + SelectSelectorConfig( + options=[ + SelectOptionDict(value=str(v), label=k) for k, v in opt_list.items() + ], + mode=SelectSelectorMode.DROPDOWN, + custom_value=custom_value, + multiple=True if multi_select else False, + ) + ) + elif type(opt_list) == list: + # value used the same method as func available_dps_string, no spaces values. + return SelectSelector( + SelectSelectorConfig( + options=[ + SelectOptionDict( + value=str(kv).split(" ")[0] if is_dps else str(kv), + label=str(kv), + ) + for kv in opt_list + ], + mode=SelectSelectorMode.DROPDOWN, + custom_value=custom_value, + multiple=True if multi_select else False, + ) + ) -CONFIGURE_SCHEMA = vol.Schema( - { - vol.Required(CONF_ACTION, default=CONF_ADD_DEVICE): vol.In(CONF_ACTIONS), - } -) -CLOUD_SETUP_SCHEMA = vol.Schema( +CLOUD_CONFIGURE_SCHEMA = vol.Schema( { - vol.Required(CONF_REGION, default="eu"): vol.In(["eu", "us", "cn", "in"]), + vol.Required(CONF_REGION, default="eu"): col_to_select(TUYA_ENDPOINTS), vol.Optional(CONF_CLIENT_ID): cv.string, vol.Optional(CONF_CLIENT_SECRET): cv.string, vol.Optional(CONF_USER_ID): cv.string, @@ -84,246 +138,32 @@ } ) - DEVICE_SCHEMA = vol.Schema( { vol.Required(CONF_FRIENDLY_NAME): cv.string, vol.Required(CONF_HOST): cv.string, vol.Required(CONF_DEVICE_ID): cv.string, vol.Required(CONF_LOCAL_KEY): cv.string, - vol.Required(CONF_PROTOCOL_VERSION, default="3.3"): vol.In( - ["3.1", "3.2", "3.3", "3.4"] + vol.Required(CONF_PROTOCOL_VERSION, default="auto"): col_to_select( + ["auto"] + sorted(SUPPORTED_PROTOCOL_VERSIONS) ), vol.Required(CONF_ENABLE_DEBUG, default=False): bool, vol.Optional(CONF_SCAN_INTERVAL): int, vol.Optional(CONF_MANUAL_DPS): cv.string, vol.Optional(CONF_RESET_DPIDS): str, + vol.Optional(CONF_DEVICE_SLEEP_TIME): int, + vol.Optional(CONF_NODE_ID, default=None): vol.Any(None, cv.string), } ) PICK_ENTITY_SCHEMA = vol.Schema( - {vol.Required(PLATFORM_TO_ADD, default="switch"): vol.In(PLATFORMS)} + {vol.Required(PLATFORM_TO_ADD, default="switch"): col_to_select(PLATFORMS)} ) -def devices_schema(discovered_devices, cloud_devices_list, add_custom_device=True): - """Create schema for devices step.""" - devices = {} - for dev_id, dev_host in discovered_devices.items(): - dev_name = dev_id - if dev_id in cloud_devices_list.keys(): - dev_name = cloud_devices_list[dev_id][CONF_NAME] - devices[dev_id] = f"{dev_name} ({dev_host})" - - if add_custom_device: - devices.update({CUSTOM_DEVICE: CUSTOM_DEVICE}) - - # devices.update( - # { - # ent.data[CONF_DEVICE_ID]: ent.data[CONF_FRIENDLY_NAME] - # for ent in entries - # } - # ) - return vol.Schema({vol.Required(SELECTED_DEVICE): vol.In(devices)}) - - -def options_schema(entities): - """Create schema for options.""" - entity_names = [ - f"{entity[CONF_ID]}: {entity[CONF_FRIENDLY_NAME]}" for entity in entities - ] - return vol.Schema( - { - vol.Required(CONF_FRIENDLY_NAME): cv.string, - vol.Required(CONF_HOST): cv.string, - vol.Required(CONF_LOCAL_KEY): cv.string, - vol.Required(CONF_PROTOCOL_VERSION, default="3.3"): vol.In( - ["3.1", "3.2", "3.3", "3.4"] - ), - vol.Required(CONF_ENABLE_DEBUG, default=False): bool, - vol.Optional(CONF_SCAN_INTERVAL): int, - vol.Optional(CONF_MANUAL_DPS): cv.string, - vol.Optional(CONF_RESET_DPIDS): cv.string, - vol.Required( - CONF_ENTITIES, description={"suggested_value": entity_names} - ): cv.multi_select(entity_names), - vol.Required(CONF_ENABLE_ADD_ENTITIES, default=False): bool, - } - ) - - -def schema_defaults(schema, dps_list=None, **defaults): - """Create a new schema with default values filled in.""" - copy = schema.extend({}) - for field, field_type in copy.schema.items(): - if isinstance(field_type, vol.In): - value = None - for dps in dps_list or []: - if dps.startswith(f"{defaults.get(field)} "): - value = dps - break - - if value in field_type.container: - field.default = vol.default_factory(value) - continue - - if field.schema in defaults: - field.default = vol.default_factory(defaults[field]) - return copy - - -def dps_string_list(dps_data): - """Return list of friendly DPS values.""" - return [f"{id} (value: {value})" for id, value in dps_data.items()] - - -def gen_dps_strings(): - """Generate list of DPS values.""" - return [f"{dp} (value: ?)" for dp in range(1, 256)] - - -def platform_schema(platform, dps_strings, allow_id=True, yaml=False): - """Generate input validation schema for a platform.""" - schema = {} - if yaml: - # In YAML mode we force the specified platform to match flow schema - schema[vol.Required(CONF_PLATFORM)] = vol.In([platform]) - if allow_id: - schema[vol.Required(CONF_ID)] = vol.In(dps_strings) - schema[vol.Required(CONF_FRIENDLY_NAME)] = str - return vol.Schema(schema).extend(flow_schema(platform, dps_strings)) - - -def flow_schema(platform, dps_strings): - """Return flow schema for a specific platform.""" - integration_module = ".".join(__name__.split(".")[:-1]) - return import_module("." + platform, integration_module).flow_schema(dps_strings) - - -def strip_dps_values(user_input, dps_strings): - """Remove values and keep only index for DPS config items.""" - stripped = {} - for field, value in user_input.items(): - if value in dps_strings: - stripped[field] = int(user_input[field].split(" ")[0]) - else: - stripped[field] = user_input[field] - return stripped - - -def config_schema(): - """Build schema used for setting up component.""" - entity_schemas = [ - platform_schema(platform, range(1, 256), yaml=True) for platform in PLATFORMS - ] - return vol.Schema( - { - DOMAIN: vol.All( - cv.ensure_list, - [ - DEVICE_SCHEMA.extend( - {vol.Required(CONF_ENTITIES): [vol.Any(*entity_schemas)]} - ) - ], - ) - }, - extra=vol.ALLOW_EXTRA, - ) - - -async def validate_input(hass: core.HomeAssistant, data): - """Validate the user input allows us to connect.""" - detected_dps = {} - - interface = None - - reset_ids = None - try: - interface = await pytuya.connect( - data[CONF_HOST], - data[CONF_DEVICE_ID], - data[CONF_LOCAL_KEY], - float(data[CONF_PROTOCOL_VERSION]), - data[CONF_ENABLE_DEBUG], - ) - if CONF_RESET_DPIDS in data: - reset_ids_str = data[CONF_RESET_DPIDS].split(",") - reset_ids = [] - for reset_id in reset_ids_str: - reset_ids.append(int(reset_id.strip())) - _LOGGER.debug( - "Reset DPIDs configured: %s (%s)", - data[CONF_RESET_DPIDS], - reset_ids, - ) - try: - detected_dps = await interface.detect_available_dps() - except Exception as ex: - try: - _LOGGER.debug( - "Initial state update failed (%s), trying reset command", ex - ) - if len(reset_ids) > 0: - await interface.reset(reset_ids) - detected_dps = await interface.detect_available_dps() - except Exception as ex: - _LOGGER.debug("No DPS able to be detected: %s", ex) - detected_dps = {} - - # if manual DPs are set, merge these. - _LOGGER.debug("Detected DPS: %s", detected_dps) - if CONF_MANUAL_DPS in data: - manual_dps_list = [dps.strip() for dps in data[CONF_MANUAL_DPS].split(",")] - _LOGGER.debug( - "Manual DPS Setting: %s (%s)", data[CONF_MANUAL_DPS], manual_dps_list - ) - # merge the lists - for new_dps in manual_dps_list + (reset_ids or []): - # If the DPS not in the detected dps list, then add with a - # default value indicating that it has been manually added - if str(new_dps) not in detected_dps: - detected_dps[new_dps] = -1 - - except (ConnectionRefusedError, ConnectionResetError) as ex: - raise CannotConnect from ex - except ValueError as ex: - raise InvalidAuth from ex - finally: - if interface: - await interface.close() - - # Indicate an error if no datapoints found as the rest of the flow - # won't work in this case - if not detected_dps: - raise EmptyDpsList - - _LOGGER.debug("Total DPS: %s", detected_dps) - - return dps_string_list(detected_dps) - - -async def attempt_cloud_connection(hass, user_input): - """Create device.""" - cloud_api = TuyaCloudApi( - hass, - user_input.get(CONF_REGION), - user_input.get(CONF_CLIENT_ID), - user_input.get(CONF_CLIENT_SECRET), - user_input.get(CONF_USER_ID), - ) - - res = await cloud_api.async_get_access_token() - if res != "ok": - _LOGGER.error("Cloud API connection failed: %s", res) - return cloud_api, {"reason": "authentication_failed", "msg": res} - - res = await cloud_api.async_get_devices_list() - if res != "ok": - _LOGGER.error("Cloud API get_devices_list failed: %s", res) - return cloud_api, {"reason": "device_list_failed", "msg": res} - _LOGGER.info("Cloud API connection succeeded.") - - return cloud_api, {} +CONF_MASS_CONFIGURE = "mass_configure" +MASS_CONFIGURE_SCHEMA = {vol.Optional(CONF_MASS_CONFIGURE, default=False): bool} +CUSTOM_DEVICE = {"Add Device Manually": "..."} class LocaltuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @@ -356,6 +196,11 @@ async def async_step_user(self, user_input=None): if not res: return await self._create_entry(user_input) errors["base"] = res["reason"] + # 1004 = Secret, 1106 = USER ID, 2009 = Client ID + if "1106" in res["msg"]: + res["msg"] = f"{res['msg']} Check UserID or country code!" + if "1004" in res["msg"]: + res["msg"] = f"{res['msg']} Check Secret Key!" placeholders = {"msg": res["msg"]} defaults = {} @@ -363,7 +208,7 @@ async def async_step_user(self, user_input=None): return self.async_show_form( step_id="user", - data_schema=schema_defaults(CLOUD_SETUP_SCHEMA, **defaults), + data_schema=schema_defaults(CLOUD_CONFIGURE_SCHEMA, **defaults), errors=errors, description_placeholders=placeholders, ) @@ -374,6 +219,8 @@ async def _create_entry(self, user_input): # return self.async_abort(reason="already_configured") await self.async_set_unique_id(user_input.get(CONF_USER_ID)) + self._abort_if_unique_id_configured() + user_input[CONF_DEVICES] = {} return self.async_create_entry( @@ -391,52 +238,52 @@ async def async_step_import(self, user_input): class LocalTuyaOptionsFlowHandler(config_entries.OptionsFlow): """Handle options flow for LocalTuya integration.""" - def __init__(self, config_entry): + def __init__(self, config_entry: config_entries.ConfigEntry): """Initialize localtuya options flow.""" self.config_entry = config_entry - # self.dps_strings = config_entry.data.get(CONF_DPS_STRINGS, gen_dps_strings()) - # self.entities = config_entry.data[CONF_ENTITIES] + self._entry_id = config_entry.entry_id + self.selected_device = None - self.editing_device = False - self.device_data = None + self.nodeID = None + + self.editing_device: bool = False + self.device_data: dict = None self.dps_strings = [] self.selected_platform = None self.discovered_devices = {} self.entities = [] + self.use_template = False + self.template_device = None + + self.cloud_data: TuyaCloudApi async def async_step_init(self, user_input=None): """Manage basic options.""" - # device_id = self.config_entry.data[CONF_DEVICE_ID] - if user_input is not None: - if user_input.get(CONF_ACTION) == CONF_SETUP_CLOUD: - return await self.async_step_cloud_setup() - if user_input.get(CONF_ACTION) == CONF_ADD_DEVICE: - return await self.async_step_add_device() - if user_input.get(CONF_ACTION) == CONF_EDIT_DEVICE: - return await self.async_step_edit_device() + configure_menu = CONFIGURE_MENU.copy() + # Remove Reconfigure existing device option if there is no existed devices. + if not self.config_entry.data[CONF_DEVICES]: + configure_menu.pop(configure_menu.index(CONF_EDIT_DEVICE)) - return self.async_show_form( - step_id="init", - data_schema=CONFIGURE_SCHEMA, - ) + self.cloud_data = self.hass.data[DOMAIN][self._entry_id].cloud_data + if not self.config_entry.data.get(CONF_NO_CLOUD): + # Refresh devices List data. + self.hass.async_create_task(self.cloud_data.async_get_devices_list()) - async def async_step_cloud_setup(self, user_input=None): + return self.async_show_menu(step_id="init", menu_options=configure_menu) + + async def async_step_configure_cloud(self, user_input=None): """Handle the initial step.""" errors = {} placeholders = {} if user_input is not None: + username = user_input.get(CONF_USERNAME) if user_input.get(CONF_NO_CLOUD): new_data = self.config_entry.data.copy() new_data.update(user_input) for i in [CONF_CLIENT_ID, CONF_CLIENT_SECRET, CONF_USER_ID]: new_data[i] = "" - self.hass.config_entries.async_update_entry( - self.config_entry, - data=new_data, - ) - return self.async_create_entry( - title=new_data.get(CONF_USERNAME), data={} - ) + + return self._update_entry(new_data, new_title=username) cloud_api, res = await attempt_cloud_connection(self.hass, user_input) @@ -448,15 +295,9 @@ async def async_step_cloud_setup(self, user_input=None): if CONF_MODEL not in dev and dev_id in cloud_devs: model = cloud_devs[dev_id].get(CONF_PRODUCT_NAME) new_data[CONF_DEVICES][dev_id][CONF_MODEL] = model - new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) - self.hass.config_entries.async_update_entry( - self.config_entry, - data=new_data, - ) - return self.async_create_entry( - title=new_data.get(CONF_USERNAME), data={} - ) + return self._update_entry(new_data, new_title=username) + errors["base"] = res["reason"] placeholders = {"msg": res["msg"]} @@ -465,8 +306,8 @@ async def async_step_cloud_setup(self, user_input=None): defaults[CONF_NO_CLOUD] = False return self.async_show_form( - step_id="cloud_setup", - data_schema=schema_defaults(CLOUD_SETUP_SCHEMA, **defaults), + step_id="configure_cloud", + data_schema=schema_defaults(CLOUD_CONFIGURE_SCHEMA, **defaults), errors=errors, description_placeholders=placeholders, ) @@ -478,9 +319,35 @@ async def async_step_add_device(self, user_input=None): self.selected_device = None errors = {} if user_input is not None: - if user_input[SELECTED_DEVICE] != CUSTOM_DEVICE: + if user_input[SELECTED_DEVICE] != CUSTOM_DEVICE["Add Device Manually"]: self.selected_device = user_input[SELECTED_DEVICE] + if user_input.pop(CONF_MASS_CONFIGURE, False): + # Handle auto configure all recognized devices. + devices, fails = await setup_localtuya_devices( + self.hass, + self.config_entry.entry_id, + self.discovered_devices, + self.cloud_data.device_list, + log_fails=True, + ) + if devices: + devices_sucessed, devices_fails = "", "" + for sucess_dev in devices.values(): + devices_sucessed += f"\n{sucess_dev[CONF_FRIENDLY_NAME]}" + for fail_dev in fails.values(): + devices_fails += f"\n{fail_dev['name']}: {fail_dev['reason']}" + + msg = f"Sucessed devices: ``{len(devices)}``\n ```{devices_sucessed}\n```" + if fails: + msg += f" \n Failed devices: ``{len(fails)}``\n ```{devices_fails}\n```" + + return await self.async_step_confirm( + msg=msg, + confirm_callback=self._update_entry, + callback_args=(devices, CONF_DEVICES), + ) + return await self.async_step_configure_device() self.discovered_devices = {} @@ -489,28 +356,31 @@ async def async_step_add_device(self, user_input=None): if data and DATA_DISCOVERY in data: self.discovered_devices = data[DATA_DISCOVERY].devices else: - try: - self.discovered_devices = await discover() - except OSError as ex: - if ex.errno == errno.EADDRINUSE: - errors["base"] = "address_in_use" - else: - errors["base"] = "discovery_failed" - except Exception as ex: - _LOGGER.exception("discovery failed: %s", ex) - errors["base"] = "discovery_failed" + self.discovered_devices, errors = await discover_devices() - devices = { - dev_id: dev["ip"] - for dev_id, dev in self.discovered_devices.items() - if dev["gwId"] not in self.config_entry.data[CONF_DEVICES] - } + allDevices = mergeDevicesList( + self.discovered_devices, self.cloud_data.device_list + ) + + self.discovered_devices = allDevices + devices = {} + # To avoid duplicated entities we will get all devices in every hub. + entries = self.hass.config_entries.async_entries(DOMAIN) + configured_Devices = [] + for entry in entries: + for devID in entry.data[CONF_DEVICES].keys(): + configured_Devices.append(devID) + + for dev_id, dev in allDevices.items(): + if dev_id not in configured_Devices: + if dev.get(CONF_NODE_ID, None) is not None: + devices[dev_id] = "Sub Device" + else: + devices[dev_id] = dev.get(CONF_TUYA_IP, "") return self.async_show_form( step_id="add_device", - data_schema=devices_schema( - devices, self.hass.data[DOMAIN][DATA_CLOUD].device_list - ), + data_schema=devices_schema(devices, self.cloud_data.device_list), errors=errors, ) @@ -524,44 +394,92 @@ async def async_step_edit_device(self, user_input=None): dev_conf = self.config_entry.data[CONF_DEVICES][self.selected_device] self.dps_strings = dev_conf.get(CONF_DPS_STRINGS, gen_dps_strings()) self.entities = dev_conf[CONF_ENTITIES] - return await self.async_step_configure_device() devices = {} for dev_id, configured_dev in self.config_entry.data[CONF_DEVICES].items(): - devices[dev_id] = configured_dev[CONF_HOST] + if configured_dev.get(CONF_NODE_ID, None): + devices[dev_id] = "Sub Device" + else: + devices[dev_id] = configured_dev[CONF_HOST] return self.async_show_form( step_id="edit_device", data_schema=devices_schema( - devices, self.hass.data[DOMAIN][DATA_CLOUD].device_list, False + devices, + self.cloud_data.device_list, + False, + self.config_entry.data[CONF_DEVICES], ), errors=errors, ) + async def async_step_device_setup_method(self, user_input=None): + """Manage basic options.""" + DEVICE_SETUP_METHOD = [ + "auto_configure_device", + "pick_entity_type", + "choose_template", + ] + return self.async_show_menu( + step_id="device_setup_method", + menu_options=DEVICE_SETUP_METHOD, + ) + async def async_step_configure_device(self, user_input=None): """Handle input of basic info.""" errors = {} + placeholders = {} dev_id = self.selected_device + cloud_devs = self.cloud_data.device_list if user_input is not None: try: self.device_data = user_input.copy() + self.selected_device: str = dev_id or user_input.get(CONF_DEVICE_ID) + self.nodeID: str = self.nodeID or user_input.get(CONF_NODE_ID) if dev_id is not None: - # self.device_data[CONF_PRODUCT_KEY] = self.devices[ - # self.selected_device - # ]["productKey"] - cloud_devs = self.hass.data[DOMAIN][DATA_CLOUD].device_list if dev_id in cloud_devs: self.device_data[CONF_MODEL] = cloud_devs[dev_id].get( CONF_PRODUCT_NAME ) + # Pulls some of device data that aren't required from user in config_flow. + if device := self.discovered_devices.get(dev_id): + self.device_data[CONF_PRODUCT_KEY] = device.get("productKey") + if gateway_id := device.get(CONF_GATEWAY_ID): + self.device_data[CONF_GATEWAY_ID] = gateway_id + + # Handle Inputs on edit device mode. if self.editing_device: - if user_input[CONF_ENABLE_ADD_ENTITIES]: + dev_config: dict = self.config_entry.data[CONF_DEVICES].get( + dev_id, {} + ) + if self.device_data.pop(EXPORT_CONFIG, False): + dev_config = self.config_entry.data[CONF_DEVICES][dev_id].copy() + await self.hass.async_add_executor_job( + templates.export_config, + dev_config, + self.device_data[CONF_FRIENDLY_NAME], + ) + return self.async_create_entry(title="", data={}) + # We will restore device details if it's already existed! + for res_conf in [CONF_GATEWAY_ID, CONF_MODEL, CONF_PRODUCT_KEY]: + if dev_config.get(res_conf): + self.device_data[res_conf] = dev_config.get(res_conf) + # Remove the values that assigned as "- or empty space" + for rm_conf in [CONF_RESET_DPIDS, CONF_MANUAL_DPS]: + if rm_conf in user_input and user_input[rm_conf] in ["-", " "]: + self.device_data.pop(rm_conf) + + self.dps_strings = merge_dps_manual_strings( + self.device_data.get(CONF_MANUAL_DPS, ""), self.dps_strings + ) + if self.device_data.pop(CONF_ENABLE_ADD_ENTITIES, False): self.editing_device = False user_input[CONF_DEVICE_ID] = dev_id self.device_data.update( { CONF_DEVICE_ID: dev_id, + CONF_NODE_ID: self.nodeID, CONF_DPS_STRINGS: self.dps_strings, } ) @@ -570,46 +488,71 @@ async def async_step_configure_device(self, user_input=None): self.device_data.update( { CONF_DEVICE_ID: dev_id, + CONF_NODE_ID: self.nodeID, CONF_DPS_STRINGS: self.dps_strings, CONF_ENTITIES: [], } ) + if len(user_input[CONF_ENTITIES]) == 0: - return self.async_abort( - reason="no_entities", - description_placeholders={}, - ) + # If user unchecked all entities. + return self.async_abort(reason="no_entities") + if user_input[CONF_ENTITIES]: entity_ids = [ - int(entity.split(":")[0]) - for entity in user_input[CONF_ENTITIES] + int(e.split(":")[0]) for e in user_input[CONF_ENTITIES] ] - device_config = self.config_entry.data[CONF_DEVICES][dev_id] + if self.use_template: + device_config = self.template_device + else: + device_config = self.config_entry.data[CONF_DEVICES][dev_id] self.entities = [ entity for entity in device_config[CONF_ENTITIES] - if entity[CONF_ID] in entity_ids + if int(entity[CONF_ID]) in entity_ids ] return await self.async_step_configure_entity() - self.dps_strings = await validate_input(self.hass, user_input) - return await self.async_step_pick_entity_type() + valid_data = await validate_input( + self.hass, self.config_entry.entry_id, user_input + ) + self.dps_strings = valid_data[CONF_DPS_STRINGS] + # We will also get protocol version from valid date in case auto used. + self.device_data[CONF_PROTOCOL_VERSION] = valid_data[ + CONF_PROTOCOL_VERSION + ] + + return await self.async_step_device_setup_method() + # return await self.async_step_pick_entity_type() except CannotConnect: errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" except EmptyDpsList: errors["base"] = "empty_dps" - except Exception as ex: - _LOGGER.exception("Unexpected exception: %s", ex) + except (OSError, ValueError, pytuya.DecodeError) as ex: + _LOGGER.debug("Unexpected exception: %s", ex) + placeholders["ex"] = str(ex) errors["base"] = "unknown" + except Exception as ex: + _LOGGER.debug("Unexpected exception: %s", ex) + raise ex defaults = {} if self.editing_device: # If selected device exists as a config entry, load config from it - defaults = self.config_entry.data[CONF_DEVICES][dev_id].copy() - cloud_devs = self.hass.data[DOMAIN][DATA_CLOUD].device_list - placeholders = {"for_device": f" for device `{dev_id}`"} + defaults = ( + self.device_data + if self.use_template + else self.config_entry.data[CONF_DEVICES][dev_id].copy() + ) + + self.nodeID = defaults.get(CONF_NODE_ID, None) + placeholders["for_device"] = f" for device `{dev_id}`" + if self.nodeID: + placeholders.update( + {"for_device": f"for Sub-Device `{dev_id}.NodeID {self.nodeID}`"} + ) if dev_id in cloud_devs: cloud_local_key = cloud_devs[dev_id].get(CONF_LOCAL_KEY) if defaults[CONF_LOCAL_KEY] != cloud_local_key: @@ -621,27 +564,39 @@ async def async_step_configure_device(self, user_input=None): defaults[CONF_LOCAL_KEY] = cloud_devs[dev_id].get(CONF_LOCAL_KEY) note = "\nNOTE: a new local_key has been retrieved using cloud API" placeholders = {"for_device": f" for device `{dev_id}`.{note}"} - defaults[CONF_ENABLE_ADD_ENTITIES] = False + if self.nodeID: + placeholders = { + "for_device": f" for sub-device `{dev_id}.\nNodeID {self.nodeID}.{note}`" + } schema = schema_defaults(options_schema(self.entities), **defaults) else: - defaults[CONF_PROTOCOL_VERSION] = "3.3" - defaults[CONF_HOST] = "" - defaults[CONF_DEVICE_ID] = "" - defaults[CONF_LOCAL_KEY] = "" - defaults[CONF_FRIENDLY_NAME] = "" - if dev_id is not None: + # user_in will restore input if an error occurred instead of clears all fields. + user_in = user_input or {} + defaults[CONF_PROTOCOL_VERSION] = user_in.get(CONF_PROTOCOL_VERSION, "auto") + defaults[CONF_HOST] = user_in.get(CONF_HOST, "") + defaults[CONF_DEVICE_ID] = user_in.get(CONF_DEVICE_ID, "") + defaults[CONF_LOCAL_KEY] = user_in.get(CONF_LOCAL_KEY, "") + defaults[CONF_FRIENDLY_NAME] = user_in.get(CONF_FRIENDLY_NAME, "") + defaults[CONF_NODE_ID] = user_in.get(CONF_NODE_ID, "") + + if defaults[CONF_DEVICE_ID] in [cloud_devs, self.selected_device]: + dev_id = defaults[CONF_DEVICE_ID] + + if dev_id is not None and dev_id in self.discovered_devices: # Insert default values from discovery and cloud if present - device = self.discovered_devices[dev_id] - defaults[CONF_HOST] = device.get("ip") - defaults[CONF_DEVICE_ID] = device.get("gwId") - defaults[CONF_PROTOCOL_VERSION] = device.get("version") - cloud_devs = self.hass.data[DOMAIN][DATA_CLOUD].device_list - if dev_id in cloud_devs: - defaults[CONF_LOCAL_KEY] = cloud_devs[dev_id].get(CONF_LOCAL_KEY) - defaults[CONF_FRIENDLY_NAME] = cloud_devs[dev_id].get(CONF_NAME) + device = self.discovered_devices.get(dev_id, {}) + defaults[CONF_HOST] = device.get(CONF_TUYA_IP) + defaults[CONF_DEVICE_ID] = device.get(CONF_TUYA_GWID) + defaults[CONF_PROTOCOL_VERSION] = device.get(CONF_TUYA_VERSION) + defaults[CONF_NODE_ID] = device.get(CONF_NODE_ID, None) + + if dev_id in cloud_devs: + defaults[CONF_LOCAL_KEY] = cloud_devs[dev_id].get(CONF_LOCAL_KEY) + defaults[CONF_FRIENDLY_NAME] = cloud_devs[dev_id].get(CONF_NAME) + schema = schema_defaults(DEVICE_SCHEMA, **defaults) - placeholders = {"for_device": ""} + placeholders["for_device"] = "" return self.async_show_form( step_id="configure_device", @@ -650,6 +605,53 @@ async def async_step_configure_device(self, user_input=None): description_placeholders=placeholders, ) + async def async_step_auto_configure_device(self, user_input=None): + """Handle asking which templates to use""" + + errors = {} + placeholders = {} + + # Gather the informations + is_cloud = not self.config_entry.data.get(CONF_NO_CLOUD) + dev_id = self.selected_device + category = None + node_id = self.nodeID + device_data = self.cloud_data.device_list.get(dev_id) + if device_data: + category = self.cloud_data.device_list[dev_id].get(TUYA_CATEGORY, "") + + localtuya_data = { + DEVICE_CLOUD_DATA: device_data, + CONF_DPS_STRINGS: self.dps_strings, + CONF_FRIENDLY_NAME: self.device_data.get(CONF_FRIENDLY_NAME), + } + + dev_data = gen_localtuya_entities(localtuya_data, category) + + # Process to add the device to localtuya HA Config. + if dev_data: + self.entities = dev_data + return await self.async_step_pick_entity_type( + {NO_ADDITIONAL_ENTITIES: True} + ) + + if not is_cloud: + err_msg = f"This feature requires cloud API setup for now" + elif not device_data: + err_msg = f"Couldn't find your device in the cloud account you using" + elif not category: + err_msg = f"Your device category isn't supported" + elif not dev_data: + err_msg = f"Couldn't find the data for your device category: {category}." + + placeholders = {"err_msg": err_msg} + + return self.async_show_menu( + step_id="auto_configure_device", + menu_options=["device_setup_method"], + description_placeholders=placeholders, + ) + async def async_step_pick_entity_type(self, user_input=None): """Handle asking if user wants to add another entity.""" if user_input is not None: @@ -663,14 +665,11 @@ async def async_step_pick_entity_type(self, user_input=None): dev_id = self.device_data.get(CONF_DEVICE_ID) new_data = self.config_entry.data.copy() - new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) new_data[CONF_DEVICES].update({dev_id: config}) + return self._update_entry(new_data) - self.hass.config_entries.async_update_entry( - self.config_entry, - data=new_data, - ) - return self.async_create_entry(title="", data={}) + if user_input.get(USE_TEMPLATE): + return await self.async_step_choose_template() self.selected_platform = user_input[PLATFORM_TO_ADD] return await self.async_step_configure_entity() @@ -685,15 +684,31 @@ async def async_step_pick_entity_type(self, user_input=None): return self.async_show_form(step_id="pick_entity_type", data_schema=schema) - def available_dps_strings(self): - """Return list of DPs use by the device's entities.""" - available_dps = [] - used_dps = [str(entity[CONF_ID]) for entity in self.entities] - for dp_string in self.dps_strings: - dp = dp_string.split(" ")[0] - if dp not in used_dps: - available_dps.append(dp_string) - return available_dps + async def async_step_choose_template(self, user_input=None): + """Handle asking which templates to use""" + if user_input is not None: + self.use_template = True + filename = user_input.get(TEMPLATES) + _config = await self.hass.async_add_executor_job( + templates.import_config, filename + ) + dev_conf = self.device_data + dev_conf[CONF_ENTITIES] = _config + dev_conf[CONF_DPS_STRINGS] = self.dps_strings + dev_conf[CONF_NODE_ID] = self.nodeID + self.device_data = dev_conf + + self.entities = dev_conf[CONF_ENTITIES] + self.template_device = self.device_data + self.editing_device = True + return await self.async_step_configure_device() + templates_list = await self.hass.async_add_executor_job( + templates.list_templates + ) + schema = vol.Schema( + {vol.Required(TEMPLATES): col_to_select(templates_list, custom_value=True)} + ) + return self.async_show_form(step_id="choose_template", data_schema=schema) async def async_step_entity(self, user_input=None): """Manage entity settings.""" @@ -703,17 +718,11 @@ async def async_step_entity(self, user_input=None): entity[CONF_ID] = self.current_entity[CONF_ID] entity[CONF_PLATFORM] = self.current_entity[CONF_PLATFORM] self.device_data[CONF_ENTITIES].append(entity) - if len(self.entities) == len(self.device_data[CONF_ENTITIES]): - self.hass.config_entries.async_update_entry( - self.config_entry, - title=self.device_data[CONF_FRIENDLY_NAME], - data=self.device_data, - ) - return self.async_create_entry(title="", data={}) + return self._update_entry(self.device_data) - schema = platform_schema( - self.current_entity[CONF_PLATFORM], self.dps_strings, allow_id=False + schema = await platform_schema( + self.hass, self.current_entity[CONF_PLATFORM], self.dps_strings, False ) return self.async_show_form( step_id="entity", @@ -722,7 +731,7 @@ async def async_step_entity(self, user_input=None): schema, self.dps_strings, **self.current_entity ), description_placeholders={ - "id": self.current_entity[CONF_ID], + "id": int(self.current_entity[CONF_ID]), "platform": self.current_entity[CONF_PLATFORM], }, ) @@ -735,30 +744,30 @@ async def async_step_configure_entity(self, user_input=None): entity = strip_dps_values(user_input, self.dps_strings) entity[CONF_ID] = self.current_entity[CONF_ID] entity[CONF_PLATFORM] = self.current_entity[CONF_PLATFORM] + entity[CONF_ICON] = self.current_entity.get(CONF_ICON, "") self.device_data[CONF_ENTITIES].append(entity) - if len(self.entities) == len(self.device_data[CONF_ENTITIES]): # finished editing device. Let's store the new config entry.... dev_id = self.device_data[CONF_DEVICE_ID] new_data = self.config_entry.data.copy() entry_id = self.config_entry.entry_id - # removing entities from registry (they will be recreated) + # Removing the unwanted entites. + entitesNames = [ + name.get(CONF_FRIENDLY_NAME) + for name in self.device_data[CONF_ENTITIES] + ] ent_reg = er.async_get(self.hass) reg_entities = { ent.unique_id: ent.entity_id for ent in er.async_entries_for_config_entry(ent_reg, entry_id) if dev_id in ent.unique_id + and ent.original_name not in entitesNames } for entity_id in reg_entities.values(): ent_reg.async_remove(entity_id) new_data[CONF_DEVICES][dev_id] = self.device_data - new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) - self.hass.config_entries.async_update_entry( - self.config_entry, - data=new_data, - ) - return self.async_create_entry(title="", data={}) + return self._update_entry(new_data) else: user_input[CONF_PLATFORM] = self.selected_platform self.entities.append(strip_dps_values(user_input, self.dps_strings)) @@ -769,17 +778,19 @@ async def async_step_configure_entity(self, user_input=None): return await self.async_step_pick_entity_type(user_input) if self.editing_device: - schema = platform_schema( - self.current_entity[CONF_PLATFORM], self.dps_strings, allow_id=False + schema = await platform_schema( + self.hass, self.current_entity[CONF_PLATFORM], self.dps_strings, False ) schema = schema_defaults(schema, self.dps_strings, **self.current_entity) placeholders = { - "entity": f"entity with DP {self.current_entity[CONF_ID]}", + "entity": f"entity with DP {int(self.current_entity[CONF_ID])}", "platform": self.current_entity[CONF_PLATFORM], } else: available_dps = self.available_dps_strings() - schema = platform_schema(self.selected_platform, available_dps) + schema = await platform_schema( + self.hass, self.selected_platform, available_dps + ) placeholders = { "entity": "an entity", "platform": self.selected_platform, @@ -792,14 +803,58 @@ async def async_step_configure_entity(self, user_input=None): description_placeholders=placeholders, ) - async def async_step_yaml_import(self, user_input=None): - """Manage YAML imports.""" - _LOGGER.error( - "Configuration via YAML file is no longer supported by this integration." + async def async_step_confirm( + self, + msg: str, + confirm_callback: Coroutine = None, + callback_args: tuple[Any, ...] | None = None, + ): + """Create a confirmation config flow page. If submitted, the `confirm_callback` will be called.""" + if confirm_callback: + if callback_args: + self._confirm_callback = partial(confirm_callback, *callback_args) + else: + self._confirm_callback = confirm_callback + + placeholders = {} + placeholders["message"] = msg + + if not msg: + return self._confirm_callback() + + return self.async_show_form( + step_id="confirm", description_placeholders=placeholders ) - # if user_input is not None: - # return self.async_create_entry(title="", data={}) - # return self.async_show_form(step_id="yaml_import") + + # menu = ["confirm", "init"] + # return self.async_show_menu( + # step_id="confirm", menu_options=menu, description_placeholders=placeholders + # ) + + @callback + def _update_entry(self, new_data, target_obj="", new_title=""): + """Update entry data and save etnry,""" + _data = deepcopy(dict(self.config_entry.data)) + if target_obj: + _data[target_obj].update(new_data) + else: + _data.update(new_data) + _data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) + + self.hass.config_entries.async_update_entry( + self.config_entry, data=_data, title=new_title or self.config_entry.title + ) + return self.async_create_entry(title=new_title, data={}) + + def available_dps_strings(self): + """Return list of DPs use by the device's entities.""" + available_dps = [] + used_dps = [str(entity[CONF_ID]) for entity in self.entities] + for dp_string in self.dps_strings: + dp = dp_string.split(" ")[0] + if dp not in used_dps: + available_dps.append(dp_string) + return available_dps @property def current_entity(self): @@ -817,3 +872,478 @@ class InvalidAuth(exceptions.HomeAssistantError): class EmptyDpsList(exceptions.HomeAssistantError): """Error to indicate no datapoints found.""" + + +async def setup_localtuya_devices( + hass: config_entries.HomeAssistant, + entry_id: str, + discovered_devices: dict, + devices_cloud_data: dict, + log_fails=False, +): + """Return a dict of configured devices ready to import into devices data.""" + # Store devices data + devices_cfg = [] + devices = {} + fails = {} + + def update_fails(dev_id: str, reason: str, msg: str = None): + name = devices_cloud_data[dev_id].get(CONF_NAME, dev_id) + fails.update({dev_id: {"name": name, "reason": reason}}) + if log_fails: + msg = f"[ name: {name} — id: {dev_id} — reason: {reason or repr(reason)}]" + _LOGGER.warning(f"Failed to configure device: {msg}") + + # To avoid duplicated entities we will get all devices in every hub. + entries = hass.config_entries.async_entries(DOMAIN) + configured_Devices = [] + for entry in entries: + for devID in entry.data[CONF_DEVICES].keys(): + configured_Devices.append(devID) + + for dev_id, data in discovered_devices.items(): + # Skip configured devices. + if dev_id in configured_Devices: + continue + if dev_cloud_data := devices_cloud_data.get(dev_id): + # Create localtuya devices data and store them into devices_config. + device_data = { + CONF_FRIENDLY_NAME: dev_cloud_data.get(CONF_NAME, dev_id), + CONF_DEVICE_ID: dev_id, + CONF_HOST: data[CONF_TUYA_IP], + CONF_LOCAL_KEY: dev_cloud_data.get(CONF_LOCAL_KEY), + CONF_PROTOCOL_VERSION: data[CONF_TUYA_VERSION], + CONF_ENABLE_DEBUG: False, + CONF_NODE_ID: dev_cloud_data.get(CONF_NODE_ID), + CONF_MODEL: dev_cloud_data.get(CONF_MODEL), + CONF_PRODUCT_KEY: data.get("productKey"), + } + # If device is sub and has Gateway ID store gatewayID + if sub_gwid := data.get(CONF_GATEWAY_ID): + device_data.update({CONF_GATEWAY_ID: sub_gwid}) + + # Store device to device_data. + devices_cfg.append(device_data) + + # Connect to the devices to ensure the are usable. + validate_devices = [validate_input(hass, entry_id, dev) for dev in devices_cfg] + results = await asyncio.gather(*validate_devices, return_exceptions=True) + + # Merge test results with devices config + for i in range(len(results)): + dev_id = devices_cfg[i].get(CONF_DEVICE_ID) + if not isinstance(results[i], dict): + update_fails(dev_id, results[i]) + continue + + devices.update({dev_id: {**devices_cfg[i], **results[i]}}) + + # Configure entities. + for dev_id, dev_data in deepcopy(devices).items(): + category = devices_cloud_data[dev_id].get("category") + dev_data[DEVICE_CLOUD_DATA] = devices_cloud_data[dev_id] + if category and (dps_strings := dev_data.get(CONF_DPS_STRINGS, False)): + dev_entites = gen_localtuya_entities(dev_data, category) + + # Configure entities fails + if not dev_entites: + devices.pop(dev_id) + update_fails(dev_id, f"no configured entities: {dev_entites} - {category}") + continue + + # Add configured entiteis + devices[dev_id].update({CONF_ENTITIES: dev_entites}) + + return devices, fails + + +async def discover_devices() -> tuple[dict[str, dict], dict[str, str]]: + """Start discovering Tuya devices within the network""" + errors = {} + discovered_devices = {} + try: + discovered_devices = await discover() + except OSError as ex: + if ex.errno == errno.EADDRINUSE: + errors["base"] = "address_in_use" + else: + errors["base"] = "discovery_failed" + except Exception as ex: + _LOGGER.exception("discovery failed: %s", ex) + errors["base"] = "discovery_failed" + return discovered_devices, errors + + +def devices_schema( + discovered_devices, cloud_devices_list, add_custom_device=True, existed_devices={} +): + """Create schema for devices step.""" + known_devices = {} + devices = {} + for dev_id, dev_host in discovered_devices.items(): + dev_name = dev_id + # when editing devices get INFOS from stored!. + if not add_custom_device and dev_id in existed_devices.keys(): + dev_name = existed_devices[dev_id].get(CONF_FRIENDLY_NAME, dev_id) + elif dev_id in cloud_devices_list.keys(): + dev_name = cloud_devices_list[dev_id][CONF_NAME] + + known_devices[f"{dev_name} ({dev_host})"] = dev_id + continue + + devices[f"{dev_name} ({dev_host})"] = dev_id + + known_devices = dict(sorted(known_devices.items())) + devices = {**known_devices, **devices} + if add_custom_device: + devices.update(CUSTOM_DEVICE) + else: # Sort devices in edit mode. + devices = dict(sorted(devices.items())) + + schema = vol.Schema( + { + vol.Required(SELECTED_DEVICE): col_to_select(devices), + } + ) + + return schema.extend(MASS_CONFIGURE_SCHEMA) if known_devices else schema + + +def mergeDevicesList(localList: dict, cloudList: dict, addSubDevices=True) -> dict: + """Merge CloudDevices with Discovered LocalDevices (in specific ways)!""" + # try Get SubDevices. + newList = localList.copy() + for _devID, _devData in cloudList.items(): + try: + is_online = _devData.get("online", None) + sub_device = _devData.get(CONF_NODE_ID, False) + # We skip offline devices and already merged devices. + if not is_online or _devID in localList: + continue + # Make sure the device isn't already in localList. + if addSubDevices and sub_device: + # infrared are ir remote sub-devices + if _devData.get(TUYA_CATEGORY, "").startswith("infrared"): + continue + + gateway = get_gateway_by_deviceid(_devID, cloudList) + local_gw = localList.get(gateway.id) + if local_gw: + # Create a data for sub_device [cloud and local gateway] to merge it with discovered devices. + dev_data = { + _devID: { + CONF_TUYA_IP: local_gw.get(CONF_TUYA_IP), + CONF_TUYA_GWID: _devID, + CONF_TUYA_VERSION: local_gw.get(CONF_TUYA_VERSION, "auto"), + CONF_NODE_ID: _devData.get(CONF_NODE_ID, None), + CONF_GATEWAY_ID: local_gw.get(CONF_TUYA_GWID), + } + } + newList.update(dev_data) + except Exception as ex: + _LOGGER.debug(f"An error occurred while trying to pull sub-devices {ex}") + continue + return newList + + +def options_schema(entities): + """Create schema for options.""" + entity_names = [ + f"{entity[CONF_ID]}: {entity[CONF_FRIENDLY_NAME]}" for entity in entities + ] + return vol.Schema( + { + vol.Required(CONF_FRIENDLY_NAME): cv.string, + vol.Required(CONF_HOST): cv.string, + vol.Required(CONF_LOCAL_KEY): cv.string, + vol.Required(CONF_PROTOCOL_VERSION, default="3.3"): col_to_select( + sorted(SUPPORTED_PROTOCOL_VERSIONS) + ), + vol.Required(CONF_ENABLE_DEBUG, default=False): bool, + vol.Optional(CONF_SCAN_INTERVAL): int, + vol.Optional(CONF_MANUAL_DPS): cv.string, + vol.Optional(CONF_RESET_DPIDS): cv.string, + vol.Optional(CONF_DEVICE_SLEEP_TIME): int, + vol.Required( + CONF_ENTITIES, description={"suggested_value": entity_names} + ): cv.multi_select(entity_names), + # col_to_select(entity_names, multi_select=True) + vol.Required(CONF_ENABLE_ADD_ENTITIES, default=False): bool, + vol.Optional(EXPORT_CONFIG, default=False): bool, + } + ) + + +def schema_defaults(schema, dps_list=None, **defaults): + """Create a new schema with default values filled in.""" + copy = schema.extend({}) + for field, field_type in copy.schema.items(): + if isinstance(field_type, vol.In): + value = None + for dps in dps_list or []: + if dps.startswith(f"{defaults.get(field)} "): + value = dps + break + + if value in field_type.container: + field.default = vol.default_factory(value) + continue + + if field.schema in defaults: + field.default = vol.default_factory(defaults[field]) + return copy + + +def dps_string_list(dps_data: dict[str, dict], cloud_dp_codes: dict[str, dict]) -> list: + """Return list of friendly DPS values.""" + strs = [] + + # Merge DPs that found through cloud with local. + for dp, func in cloud_dp_codes.items(): + # Default Manual dp value is -1, we will replace it if it in cloud. + add_dp = dp not in dps_data or dps_data.get(dp) == -1 + if add_dp and ((value := func.get("value")) or value is not None): + dps_data[dp] = f"{value}, cloud pull" + + for dp, value in dps_data.items(): + if (dp_data := cloud_dp_codes.get(dp)) and (code := dp_data.get("code")): + strs.append(f"{dp} ( code: {code} , value: {value} )") + else: + strs.append(f"{dp} ( value: {value} )") + + return sorted(strs, key=lambda i: int(i.split()[0])) + + +def gen_dps_strings(): + """Generate list of DPS values.""" + return [f"{dp} (value: ?)" for dp in range(1, 256)] + + +def strip_dps_values(user_input, dps_strings): + """Remove values and keep only index for DPS config items.""" + stripped = {} + for field, value in user_input.items(): + if value in dps_strings: + stripped[field] = int(user_input[field].split(" ")[0]) + else: + stripped[field] = user_input[field] + return stripped + + +def merge_dps_manual_strings(manual_dps: list, dps_strings: list): + """Split manual_dps by comma and assign -1 as default value. Return merged with dps string.""" + manual_list = [] + avaliable_dps = [dp.split(" ")[0] for dp in dps_strings] + + for dp in manual_dps.split(","): + dp = dp.strip() + if dp.isdigit() and dp not in avaliable_dps and dp != "0": + manual_list.append(f"{dp} ( value: -1 )") + + return sorted(dps_strings + manual_list, key=lambda i: int(i.split(" ")[0])) + + +async def platform_schema( + hass: core.HomeAssistant, platform, dps_strings, allow_id=True, yaml=False +): + """Generate input validation schema for a platform.""" + # decide default value of device by platform. + schema = {} + if yaml: + # In YAML mode we force the specified platform to match flow schema + schema[vol.Required(CONF_PLATFORM)] = col_to_select([platform]) + if allow_id: + schema[vol.Required(CONF_ID)] = col_to_select(dps_strings, is_dps=True) + schema[vol.Optional(CONF_FRIENDLY_NAME, default="")] = vol.Any(None, cv.string) + schema[ + vol.Required(CONF_ENTITY_CATEGORY, default=str(default_category(platform))) + ] = col_to_select(ENTITY_CATEGORY) + + plat_schema = await hass.async_add_import_executor_job( + flow_schema, platform, dps_strings + ) + + return vol.Schema(schema).extend(plat_schema) + + +def default_category(_platform): + """Auto Select default category depends on the platform.""" + if any(_platform in i for i in DEFAULT_CATEGORIES["CONTROL"]): + return None + elif any(_platform in i for i in DEFAULT_CATEGORIES["CONFIG"]): + return EntityCategory.CONFIG + elif any(_platform in i for i in DEFAULT_CATEGORIES["DIAGNOSTIC"]): + return EntityCategory.DIAGNOSTIC + else: + return None + + +def flow_schema(platform, dps_strings): + """Return flow schema for a specific platform.""" + integration_module = ".".join(__name__.split(".")[:-1]) + return import_module("." + platform, integration_module).flow_schema(dps_strings) + + +async def validate_input(hass: core.HomeAssistant, entry_id, data): + """Validate the user input allows us to connect.""" + logger = pytuya.ContextualLogger() + logger.set_logger(_LOGGER, data[CONF_DEVICE_ID], True, data[CONF_FRIENDLY_NAME]) + + detected_dps = {} + error = None + interface = None + reset_ids = None + close = True + bypass_connection = False # On users risk, only used for low-power power devices + bypass_handshake = False # In-case device is passive. + + cid = data.get(CONF_NODE_ID, None) + localtuya_devices = hass.data[DOMAIN][entry_id].devices + try: + conf_protocol = data[CONF_PROTOCOL_VERSION] + auto_protocol = conf_protocol == "auto" + # If sub device we will search if gateway is existed if not create new connection. + if ( + cid + and (existed_interface := localtuya_devices.get(data[CONF_HOST])) + and existed_interface.connected + and not existed_interface.is_connecting + ): + interface = existed_interface._interface + close = False + else: + # If 'auto' will be loop through supported protocols. + for ver in SUPPORTED_PROTOCOL_VERSIONS: + try: + version = ver if auto_protocol else conf_protocol + interface = await asyncio.wait_for( + pytuya.connect( + data[CONF_HOST], + data[CONF_DEVICE_ID], + data[CONF_LOCAL_KEY], + float(version), + data[CONF_ENABLE_DEBUG], + ), + 5, + ) + + detected_dps = await interface.detect_available_dps(cid=cid) + + # Break the loop if input isn't auto. + if not auto_protocol: + break + + # If Auto: using DPS detected we will assume this is the correct version if dps found. + if len(detected_dps) > 0: + # Set the conf_protocol to the worked version to return it and update self.device_data. + conf_protocol = version + break + + # If connection to host is failed raise wrong address. + except (OSError, ValueError, pytuya.DecodeError) as ex: + error = ex + break + except: + continue + finally: + if not auto_protocol and data.get(CONF_DEVICE_SLEEP_TIME, 0) > 0: + bypass_connection = True + if not error and not interface: + error = InvalidAuth + + if CONF_RESET_DPIDS in data: + reset_ids_str = data[CONF_RESET_DPIDS].split(",") + reset_ids = [] + for reset_id in reset_ids_str: + reset_ids.append(int(reset_id.strip())) + logger.debug( + "Reset DPIDs configured: %s (%s)", data[CONF_RESET_DPIDS], reset_ids + ) + try: + # If reset dpids set - then assume reset is needed before status. + if (reset_ids is not None) and (len(reset_ids) > 0): + logger.debug("Resetting command for DP IDs: %s", reset_ids) + # Assume we want to request status updated for the same set of DP_IDs as the reset ones. + interface.set_updatedps_list(reset_ids) + + # Reset the interface + await interface.reset(reset_ids, cid=cid) + + # Detect any other non-manual DPS strings + if not detected_dps: + detected_dps = await interface.detect_available_dps(cid=cid) + + except (ValueError, pytuya.DecodeError) as ex: + error = ex + except Exception as ex: + logger.debug(f"No DPS able to be detected {ex}") + detected_dps = {} + + # if manual DPs are set, merge these. + # detected_dps_device used to pervent user from bypass handshake manual dps. + detected_dps_device = detected_dps.copy() + logger.debug("Detected DPS: %s", detected_dps) + if CONF_MANUAL_DPS in data: + manual_dps_list = [dps.strip() for dps in data[CONF_MANUAL_DPS].split(",")] + logger.debug( + "Manual DPS Setting: %s (%s)", data[CONF_MANUAL_DPS], manual_dps_list + ) + # merge the lists + for new_dps in manual_dps_list + (reset_ids or []): + # If the DPS not in the detected dps list, then add with a + # default value indicating that it has been manually added + if str(new_dps) == "0": + bypass_handshake = True + continue + if str(new_dps) not in detected_dps: + detected_dps[new_dps] = -1 + + except (ConnectionRefusedError, ConnectionResetError) as ex: + raise CannotConnect from ex + except (OSError, ValueError, pytuya.DecodeError) as ex: + error = ex + finally: + if interface and close: + await interface.close() + + # Get DP descriptions from the cloud, if the device is there. + cloud_dp_codes = {} + cloud_data: TuyaCloudApi = hass.data[DOMAIN][entry_id].cloud_data + if device_cloud_data := cloud_data.device_list.get(data[CONF_DEVICE_ID]): + cloud_dp_codes = device_cloud_data.get("dps_data", {}) + + # Indicate an error if no datapoints found as the rest of the flow + # won't work in this case + if not bypass_connection and error: + raise error + # If bypass handshake. otherwise raise faild to make handshake with device. + # --- Cloud: We will use the DPS found on cloud if exists. + # --- No cloud: user will have to input the DPS manually. + if not detected_dps_device and not ( + (cloud_dp_codes or detected_dps) and bypass_handshake + ): + raise EmptyDpsList + + logger.debug("Total DPS: %s", detected_dps) + return { + CONF_DPS_STRINGS: dps_string_list(detected_dps, cloud_dp_codes), + CONF_PROTOCOL_VERSION: conf_protocol, + } + + +async def attempt_cloud_connection(hass, user_input): + """Create device.""" + cloud_api = TuyaCloudApi( + hass, + user_input.get(CONF_REGION), + user_input.get(CONF_CLIENT_ID), + user_input.get(CONF_CLIENT_SECRET), + user_input.get(CONF_USER_ID), + ) + + msg, res = await cloud_api.async_connect() + + if res != "ok": + return cloud_api, {"reason": msg, "msg": res} + + return cloud_api, {} diff --git a/custom_components/localtuya/const.py b/custom_components/localtuya/const.py index 75f7bbd2..bf74e525 100644 --- a/custom_components/localtuya/const.py +++ b/custom_components/localtuya/const.py @@ -1,35 +1,66 @@ """Constants for localtuya integration.""" -DOMAIN = "localtuya" +from dataclasses import dataclass +from typing import Any +from homeassistant.const import ( + CONF_DEVICE_ID, + CONF_ENTITIES, + CONF_FRIENDLY_NAME, + CONF_HOST, + CONF_ID, + CONF_SCAN_INTERVAL, + EntityCategory, + Platform, +) +DOMAIN = "localtuya" DATA_DISCOVERY = "discovery" -DATA_CLOUD = "cloud_data" + +# Order on priority +SUPPORTED_PROTOCOL_VERSIONS = ["3.3", "3.1", "3.2", "3.4", "3.5"] + # Platforms in this list must support config flows -PLATFORMS = [ - "binary_sensor", - "climate", - "cover", - "fan", - "light", - "number", - "select", - "sensor", - "switch", - "vacuum", -] - -TUYA_DEVICES = "tuya_devices" +PLATFORMS = { + "Alarm Control Panel": Platform.ALARM_CONTROL_PANEL, + "Binary Sensor": Platform.BINARY_SENSOR, + "Button": Platform.BUTTON, + "Climate": Platform.CLIMATE, + "Cover": Platform.COVER, + "Fan": Platform.FAN, + "Humidifier": Platform.HUMIDIFIER, + "Light": Platform.LIGHT, + "Lock": Platform.LOCK, + "Number": Platform.NUMBER, + "Remote": Platform.REMOTE, + "Select": Platform.SELECT, + "Sensor": Platform.SENSOR, + "Siren": Platform.SIREN, + "Switch": Platform.SWITCH, + "Vacuum": Platform.VACUUM, + "Water Heater": Platform.WATER_HEATER, +} ATTR_CURRENT = "current" ATTR_CURRENT_CONSUMPTION = "current_consumption" ATTR_VOLTAGE = "voltage" ATTR_UPDATED_AT = "updated_at" +# Tuya Devices +CONF_TUYA_IP = "ip" +CONF_TUYA_GWID = "gwId" +CONF_TUYA_VERSION = "version" + +# Status Payloads. +RESTORE_STATES = {"0": "restore"} + + # config flow CONF_LOCAL_KEY = "local_key" CONF_ENABLE_DEBUG = "enable_debug" CONF_PROTOCOL_VERSION = "protocol_version" +CONF_NODE_ID = "node_id" +CONF_GATEWAY_ID = "gateway_id" CONF_DPS_STRINGS = "dps_strings" CONF_MODEL = "model" CONF_PRODUCT_KEY = "product_key" @@ -38,25 +69,34 @@ CONF_ENABLE_ADD_ENTITIES = "add_entities" -CONF_ACTION = "action" CONF_ADD_DEVICE = "add_device" CONF_EDIT_DEVICE = "edit_device" -CONF_SETUP_CLOUD = "setup_cloud" +CONF_CONFIGURE_CLOUD = "configure_cloud" CONF_NO_CLOUD = "no_cloud" CONF_MANUAL_DPS = "manual_dps_strings" CONF_DEFAULT_VALUE = "dps_default_value" CONF_RESET_DPIDS = "reset_dpids" CONF_PASSIVE_ENTITY = "is_passive_entity" +CONF_DEVICE_SLEEP_TIME = "device_sleep_time" + +# ALARM +CONF_ALARM_SUPPORTED_STATES = "alarm_supported_states" + +# Binary_sensor, Siren +CONF_STATE_ON = "state_on" # light CONF_BRIGHTNESS_LOWER = "brightness_lower" CONF_BRIGHTNESS_UPPER = "brightness_upper" CONF_COLOR = "color" CONF_COLOR_MODE = "color_mode" +CONF_COLOR_MODE_SET = "color_mode_set" CONF_COLOR_TEMP_MIN_KELVIN = "color_temp_min_kelvin" CONF_COLOR_TEMP_MAX_KELVIN = "color_temp_max_kelvin" CONF_COLOR_TEMP_REVERSE = "color_temp_reverse" CONF_MUSIC_MODE = "music_mode" +CONF_SCENE_VALUES = "scene_values" +CONF_SCENE_VALUES_FRIENDLY = "scene_values_friendly" # switch CONF_CURRENT = "current" @@ -68,6 +108,7 @@ CONF_POSITIONING_MODE = "positioning_mode" CONF_CURRENT_POSITION_DP = "current_position_dp" CONF_SET_POSITION_DP = "set_position_dp" +CONF_STOP_SWITCH_DP = "stop_switch_dp" CONF_POSITION_INVERTED = "position_inverted" CONF_SPAN_TIME = "span_time" @@ -84,30 +125,27 @@ # sensor CONF_SCALING = "scaling" +CONF_STATE_CLASS = "state_class" # climate CONF_TARGET_TEMPERATURE_DP = "target_temperature_dp" CONF_CURRENT_TEMPERATURE_DP = "current_temperature_dp" CONF_TEMPERATURE_STEP = "temperature_step" -CONF_MAX_TEMP_DP = "max_temperature_dp" -CONF_MIN_TEMP_DP = "min_temperature_dp" -CONF_TEMP_MAX = "max_temperature_const" -CONF_TEMP_MIN = "min_temperature_const" +CONF_MIN_TEMP = "min_temperature" +CONF_MAX_TEMP = "max_temperature" CONF_PRECISION = "precision" CONF_TARGET_PRECISION = "target_precision" CONF_HVAC_MODE_DP = "hvac_mode_dp" CONF_HVAC_MODE_SET = "hvac_mode_set" -CONF_HVAC_FAN_MODE_DP = "hvac_fan_mode_dp" -CONF_HVAC_FAN_MODE_SET = "hvac_fan_mode_set" -CONF_HVAC_SWING_MODE_DP = "hvac_swing_mode_dp" -CONF_HVAC_SWING_MODE_SET = "hvac_swing_mode_set" CONF_PRESET_DP = "preset_dp" CONF_PRESET_SET = "preset_set" CONF_HEURISTIC_ACTION = "heuristic_action" CONF_HVAC_ACTION_DP = "hvac_action_dp" CONF_HVAC_ACTION_SET = "hvac_action_set" +CONF_HVAC_ADD_OFF = "hvac_add_off" CONF_ECO_DP = "eco_dp" CONF_ECO_VALUE = "eco_value" +CONF_FAN_SPEED_LIST = "fan_speed_list" # vacuum CONF_POWERGO_DP = "powergo_dp" @@ -127,16 +165,66 @@ CONF_PAUSED_STATE = "paused_state" CONF_RETURN_MODE = "return_mode" CONF_STOP_STATUS = "stop_status" +CONF_PAUSE_DP = "pause_dp" # number CONF_MIN_VALUE = "min_value" CONF_MAX_VALUE = "max_value" -CONF_STEPSIZE_VALUE = "step_size" +CONF_STEPSIZE = "step_size" # select CONF_OPTIONS = "select_options" CONF_OPTIONS_FRIENDLY = "select_options_friendly" +# Remote +CONF_RECEIVE_DP = "receive_dp" +CONF_KEY_STUDY_DP = "key_study_dp" + +# Lock +CONF_JAMMED_DP = "jammed_dp" +CONF_LOCK_STATE_DP = "lock_state_dp" + +# Water Heater +CONF_TARGET_TEMPERATURE_LOW_DP = "target_temperature_low_dp" +CONF_TARGET_TEMPERATURE_HIGH_DP = "target_temperature_high_dp" + # States ATTR_STATE = "raw_state" CONF_RESTORE_ON_RECONNECT = "restore_on_reconnect" + +# Categories +ENTITY_CATEGORY = { + "None": None, + "Configuration": EntityCategory.CONFIG, + "Diagnostic": EntityCategory.DIAGNOSTIC, +} + +# Default Categories +DEFAULT_CATEGORIES = { + "CONTROL": ["switch", "climate", "fan", "vacuum", "light"], + "CONFIG": ["select", "number", "button"], + "DIAGNOSTIC": ["sensor", "binary_sensor"], +} + + +@dataclass +class DeviceConfig: + """Represent the main configuration for LocalTuya device.""" + + device_config: dict[str, Any] + + def __post_init__(self) -> None: + self.id: str = self.device_config[CONF_DEVICE_ID] + self.host: str = self.device_config[CONF_HOST] + self.local_key: str = self.device_config[CONF_LOCAL_KEY] + self.entities: list = self.device_config[CONF_ENTITIES] + self.protocol_version: str = self.device_config[CONF_PROTOCOL_VERSION] + self.sleep_time: int = self.device_config.get(CONF_DEVICE_SLEEP_TIME, 0) + self.scan_interval: int = self.device_config.get(CONF_SCAN_INTERVAL, 0) + self.enable_debug: bool = self.device_config.get(CONF_ENABLE_DEBUG, False) + self.name: str = self.device_config.get(CONF_FRIENDLY_NAME) + self.node_id: str | None = self.device_config.get(CONF_NODE_ID) + self.model: str = self.device_config.get(CONF_MODEL, "Tuya generic") + self.reset_dps: str = self.device_config.get(CONF_RESET_DPIDS, "") + self.manual_dps: str = self.device_config.get(CONF_MANUAL_DPS, "") + self.dps_strings: list = self.device_config.get(CONF_DPS_STRINGS, []) diff --git a/custom_components/localtuya/coordinator.py b/custom_components/localtuya/coordinator.py new file mode 100644 index 00000000..442440d8 --- /dev/null +++ b/custom_components/localtuya/coordinator.py @@ -0,0 +1,658 @@ +"""Tuya Device API""" + +from __future__ import annotations +import asyncio +import errno +import logging +import time +from datetime import timedelta +from typing import Any, NamedTuple +from functools import partial + + +from homeassistant.core import HomeAssistant, CALLBACK_TYPE, callback, State +from homeassistant.config_entries import ConfigEntry +from homeassistant.const import CONF_ID, CONF_DEVICES, CONF_HOST, CONF_DEVICE_ID +from homeassistant.helpers.event import async_track_time_interval, async_call_later +from homeassistant.helpers.dispatcher import ( + async_dispatcher_connect, + async_dispatcher_send, + dispatcher_send, +) + +from .core import pytuya +from .core.cloud_api import TuyaCloudApi +from .core.pytuya import ( + HEARTBEAT_INTERVAL, + TuyaListener, + ContextualLogger, + SubdeviceState, +) +from .const import ( + ATTR_UPDATED_AT, + CONF_GATEWAY_ID, + CONF_LOCAL_KEY, + CONF_NODE_ID, + CONF_TUYA_IP, + DATA_DISCOVERY, + DOMAIN, + DeviceConfig, + RESTORE_STATES, +) + +_LOGGER = logging.getLogger(__name__) +RECONNECT_INTERVAL = timedelta(seconds=5) +# Subdevice: Offline events before disconnecting the device, around 5 minutes +MIN_OFFLINE_EVENTS = 5 * 60 // HEARTBEAT_INTERVAL + + +class HassLocalTuyaData(NamedTuple): + """LocalTuya data stored in homeassistant data object.""" + + cloud_data: TuyaCloudApi + devices: dict[str, TuyaDevice] + + +class TuyaDevice(TuyaListener, ContextualLogger): + """Cache wrapper for pytuya.TuyaInterface.""" + + def __init__( + self, + hass: HomeAssistant, + entry: ConfigEntry[Any], + device_config: dict, + fake_gateway=False, + ): + """Initialize the cache.""" + super().__init__() + self._hass = hass + self._entry = entry + self._hass_entry: HassLocalTuyaData = hass.data[DOMAIN][entry.entry_id] + self._device_config = DeviceConfig(device_config.copy()) + self.id = self._device_config.id + + self._status = {} + self._interface = None + self._local_key = self._device_config.local_key + + # For SubDevices + self.gateway: TuyaDevice = None + self.sub_devices: dict[str, TuyaDevice] = {} + self._fake_gateway = fake_gateway + self._node_id: str = self._device_config.node_id + self.subdevice_state = None + self._subdevice_off_count: int = 0 + + # last_update_time: Sleep timer, a device that reports the status every x seconds then goes into sleep. + self._last_update_time = time.time() - 5 + self._pending_status: dict[str, dict[str, Any]] = {} + + self._task_connect: asyncio.Task | None = None + self._task_reconnect: asyncio.Task | None = None + self._task_shutdown_entities: asyncio.Task | None = None + self._unsub_refresh: CALLBACK_TYPE | None = None + self._unsub_new_entity: CALLBACK_TYPE | None = None + + self._entities = [] + self.is_closing = False + + self._default_reset_dpids: list | None = None + dev = self._device_config + if reset_dps := dev.reset_dps: + self._default_reset_dpids = [int(id.strip()) for id in reset_dps.split(",")] + + # This has to be done in case the device type is type_0d + self.dps_to_request = {} + for dp in dev.dps_strings: + self.dps_to_request[dp.split(" ")[0]] = None + + self.set_logger(_LOGGER, dev.id, dev.enable_debug, self.friendly_name) + + @property + def friendly_name(self): + """Name string for log prefixes.""" + name = self._device_config.name + return name if not self._fake_gateway else (name + "/G") + + @property + def connected(self): + """Return if connected to device.""" + return self._interface and self._interface.is_connected + + @property + def is_connecting(self): + """Return whether device is currently connecting.""" + return self._task_connect is not None + + @property + def is_subdevice(self): + """Return whether this is a subdevice or not.""" + return self._node_id and not self._fake_gateway + + @property + def is_sleep(self): + """Return whether the device is sleep or not.""" + device_sleep = self._device_config.sleep_time + if device_sleep > 0: + setattr(self, "low_power", True) + last_update = time.time() - self._last_update_time + is_sleep = last_update < device_sleep + + return device_sleep > 0 and is_sleep + + def add_entities(self, entities): + """Set the entities associated with this device.""" + self._entities.extend(entities) + + async def async_connect(self, _now=None) -> None: + """Connect to device if not already connected.""" + if self.is_closing or self.is_connecting: + return + + if self.connected: + return self._dispatch_status() + + self._task_connect = asyncio.create_task(self._make_connection()) + if not self.is_sleep: + await self._task_connect + + async def _connect_subdevices(self): + """Gateway: connect to sub-devices one by one.""" + if not self.sub_devices: + return + + for subdevice in self.sub_devices.values(): + if not self.connected or self.is_closing: + break + if subdevice.subdevice_state != SubdeviceState.ABSENT: + await subdevice.async_connect() + + async def _make_connection(self): + """Subscribe localtuya entity events.""" + if self.is_sleep and not self._status: + self.status_updated(RESTORE_STATES) + + name, host = self._device_config.name, self._device_config.host + retry = 0 + max_retries = 3 + update_localkey = False + + self.debug(f"Trying to connect to: {host}...", force=True) + # Connect to the device, interface should be connected for next steps. + while retry < max_retries and not self.is_closing: + retry += 1 + try: + if self.is_subdevice: + gateway = self._get_gateway() + if not gateway: + update_localkey = True + break + if not gateway.connected and gateway.is_connecting: + return await self.abort_connect() + self._interface = gateway._interface + if not self._interface: + break + if self._device_config.enable_debug: + self._interface.enable_debug(True, gateway.friendly_name) + else: + self._interface = await pytuya.connect( + self._device_config.host, + self._device_config.id, + self._local_key, + float(self._device_config.protocol_version), + self._device_config.enable_debug, + self, + ) + self._interface.enable_debug( + self._device_config.enable_debug, self.friendly_name + ) + self._interface.add_dps_to_request(self.dps_to_request) + break # Succeed break while loop + except asyncio.CancelledError: + await self.abort_connect() + self._task_connect = None + return + except OSError as e: + await self.abort_connect() + if e.errno == errno.EHOSTUNREACH and not self.is_sleep: + self.warning(f"Connection failed: {e}") + break + except Exception as ex: # pylint: disable=broad-except + await self.abort_connect() + if not self.is_sleep: + self.warning(f"Failed to connect to {host}: {str(ex)}") + if "key" in str(ex): + update_localkey = True + break + + # Get device status and configure DPS. + if self.connected and not self.is_closing: + try: + # If reset dpids set - then assume reset is needed before status. + reset_dpids = self._default_reset_dpids + if (reset_dpids is not None) and (len(reset_dpids) > 0): + self.debug(f"Resetting cmd for DP IDs: {reset_dpids}") + # Assume we want to request status updated for the same set of DP_IDs as the reset ones. + self._interface.set_updatedps_list(reset_dpids) + + # Reset the interface + await self._interface.reset(reset_dpids, cid=self._node_id) + + self.debug("Retrieving initial state") + # Usually we use status instead of detect_available_dps, but some device doesn't reports all dps when ask for status. + status = await self._interface.status(cid=self._node_id) + if status is None: + raise Exception("Failed to retrieve status") + + self.status_updated(status) + except (UnicodeDecodeError, pytuya.DecodeError) as e: + self.exception(f"Handshake with {host} failed: due to {type(e)}: {e}") + await self.abort_connect() + update_localkey = True + except asyncio.CancelledError: + await self.abort_connect() + self._task_connect = None + return + except Exception as e: + if not (self._fake_gateway and "Not found" in str(e)): + e = "Sub device is not connected" if self.is_subdevice else e + self.warning(f"Handshake with {host} failed: {e}") + await self.abort_connect() + if self.is_subdevice: + update_localkey = True + except: + if self._fake_gateway: + self.warning(f"Failed to use {name} as gateway.") + await self.abort_connect() + update_localkey = True + + # Connect and configure the entities, at this point the device should be ready to get commands. + if self.connected and not self.is_closing: + self.debug(f"Success: connected to: {host}", force=True) + # Attempt to restore status for all entities that need to first set + # the DPS value before the device will respond with status. + for entity in self._entities: + await entity.restore_state_when_connected() + + if self._unsub_new_entity is None: + + def _new_entity_handler(entity_id): + self.debug(f"New entity {entity_id} was added to {host}") + self._dispatch_status() + + signal = f"localtuya_entity_{self._device_config.id}" + self._unsub_new_entity = async_dispatcher_connect( + self._hass, signal, _new_entity_handler + ) + + if (scan_inv := int(self._device_config.scan_interval)) > 0: + self._unsub_refresh = async_track_time_interval( + self._hass, self._async_refresh, timedelta(seconds=scan_inv) + ) + + self._task_connect = None + # Ensure the connected sub-device is in its gateway's sub_devices + # and reset offline/absent counters + if self.gateway: + self.gateway.sub_devices[self._node_id] = self + if self.is_subdevice: + self.subdevice_state_updated(SubdeviceState.ONLINE) + + if not self._status and "0" in self._device_config.manual_dps.split(","): + self.status_updated(RESTORE_STATES) + + if self._pending_status: + await self.set_status() + + if self.sub_devices: + asyncio.create_task(self._connect_subdevices()) + + self._interface.keep_alive(len(self.sub_devices) > 0) + + # If not connected try to handle the errors. + if not self.connected and not self.is_closing: + if self._task_reconnect is None: + self._task_reconnect = asyncio.create_task(self._async_reconnect()) + if update_localkey: + # Check if the cloud device info has changed!. + await self.update_local_key() + + self._task_connect = None + + async def abort_connect(self): + """Abort the connect process to the interface[device]""" + if self.is_subdevice: + self._interface = None + self._task_connect = None + + if self._interface is not None: + await self._interface.close() + self._interface = None + + async def check_connection(self): + """Ensure that the device is not still connecting; if it is, wait for it.""" + if not self.connected and self._task_connect: + await self._task_connect + if not self.connected and self.gateway and self.gateway._task_connect: + await self.gateway._task_connect + if not self.connected: + self.error(f"Not connected to device {self._device_config.name}") + + async def close(self): + """Close connection and stop re-connect loop.""" + if self.is_closing: + return + + self.is_closing = True + + tasks = [self._task_shutdown_entities, self._task_reconnect, self._task_connect] + pending_tasks = [task for task in tasks if task and task.cancel()] + await asyncio.gather(*pending_tasks, return_exceptions=True) + + # Close subdevices first, to prevent them try to reconnect + # after gateway disconnected. + for subdevice in self.sub_devices.values(): + await subdevice.close() + + if self._unsub_new_entity: + self._unsub_new_entity() + self._unsub_new_entity = None + + if self._unsub_refresh: + self._unsub_refresh() + self._unsub_refresh = None + + await self.abort_connect() + + if self.gateway: + self.gateway.filter_subdevices() + self.debug("Closed connection", force=True) + + async def update_local_key(self): + """Retrieve updated local_key from Cloud API and update the config_entry.""" + dev_id = self._device_config.id + + cloud_api = self._hass_entry.cloud_data + await cloud_api.async_get_devices_list(force_update=True) + + cloud_devs = cloud_api.device_list + if dev_id in cloud_devs: + cloud_localkey = cloud_devs[dev_id].get(CONF_LOCAL_KEY) + if not cloud_localkey or self._local_key == cloud_localkey: + return + + new_data = self._entry.data.copy() + self._local_key = cloud_localkey + + if self._node_id: + from .core.helpers import get_gateway_by_deviceid + + # Update Node ID. + if new_node_id := cloud_devs[dev_id].get(CONF_NODE_ID): + new_data[CONF_DEVICES][dev_id][CONF_NODE_ID] = new_node_id + + # Update Gateway ID and IP + if new_gw := get_gateway_by_deviceid(dev_id, cloud_devs): + self.info(f"Gateway ID has been updated to: {new_gw.id}") + new_data[CONF_DEVICES][dev_id][CONF_GATEWAY_ID] = new_gw.id + + discovery = self._hass.data[DOMAIN].get(DATA_DISCOVERY) + if discovery and (local_gw := discovery.devices.get(new_gw.id)): + new_ip = local_gw.get(CONF_TUYA_IP, self._device_config.host) + new_data[CONF_DEVICES][dev_id][CONF_HOST] = new_ip + self.info(f"IP has been updated to: {new_ip}") + + new_data[CONF_DEVICES][dev_id][CONF_LOCAL_KEY] = self._local_key + new_data[ATTR_UPDATED_AT] = str(int(time.time() * 1000)) + self._hass.config_entries.async_update_entry(self._entry, data=new_data) + self.info(f"Local-key has been updated") + + async def set_status(self): + """Send self._pending_status payload to device.""" + await self.check_connection() + if self._interface and self._pending_status: + payload, self._pending_status = self._pending_status.copy(), {} + try: + await self._interface.set_dps(payload, cid=self._node_id) + except Exception as ex: # pylint: disable=broad-except + self.debug(f"Failed to set values {payload} --> {ex}", force=True) + elif not self.connected: + self.error(f"Device is not connected.") + + async def set_dp(self, state, dp_index): + """Change value of a DP of the Tuya device.""" + if self._interface is not None: + self._pending_status.update({dp_index: state}) + await asyncio.sleep(0.001) + await self.set_status() + else: + if self.is_sleep: + return self._pending_status.update({str(dp_index): state}) + + async def set_dps(self, states): + """Change value of a DPs of the Tuya device.""" + if self._interface is not None: + self._pending_status.update(states) + await asyncio.sleep(0.001) + await self.set_status() + else: + if self.is_sleep: + return self._pending_status.update(states) + + async def _async_refresh(self, _now): + if self.connected: + self.debug("Refreshing dps for device") + # This a workaround for >= 3.4 devices, since there is an issue on waiting for the correct seqno + try: + await self._interface.update_dps(cid=self._node_id) + except TimeoutError: + pass + + async def _async_reconnect(self): + """Task: continuously attempt to reconnect to the device.""" + attempts = 0 + while True: + try: + # for sub-devices, if it is reported as offline then no need for reconnect. + if ( + self.is_subdevice + and self._subdevice_off_count >= MIN_OFFLINE_EVENTS + ): + await asyncio.sleep(1) + continue + + # for sub-devices, if the gateway isn't connected then no need for reconnect. + if self.gateway and ( + not self.gateway.connected or self.gateway.is_connecting + ): + await asyncio.sleep(3) + continue + + if not self._task_connect: + await self.async_connect() + if self._task_connect: + await self._task_connect + + if self.connected: + if not self.is_sleep and attempts > 0: + self.info(f"Reconnect succeeded on attempt: {attempts}") + break + + if self.is_closing: + break + + attempts += 1 + scale = ( + 2 + if (self.subdevice_state == SubdeviceState.ABSENT) + or (attempts > MIN_OFFLINE_EVENTS) + else 1 + ) + await asyncio.sleep(scale * RECONNECT_INTERVAL.total_seconds()) + except asyncio.CancelledError as e: + self.debug(f"Reconnect task has been canceled: {e}", force=True) + break + + self._task_reconnect = None + + def _dispatch_status(self): + signal = f"localtuya_{self._device_config.id}" + dispatcher_send(self._hass, signal, self._status) + + def _handle_event(self, old_status: dict, new_status: dict, deviceID=None): + """Handle events in HA when devices updated.""" + + def fire_event(event, data: dict): + event_data = {CONF_DEVICE_ID: deviceID or self._device_config.id} + event_data.update(data.copy()) + # Send an event with status, The default length of event without data is 2. + if len(event_data) > 1: + self._hass.bus.async_fire(f"localtuya_{event}", event_data) + + event = "states_update" + device_triggered = "device_triggered" + device_dp_triggered = "device_dp_triggered" + + # Device Initializing. if not old_states. + # States update event. + if old_status and old_status != new_status: + data = {"old_states": old_status, "new_states": new_status} + fire_event(event, data) + + # Device triggered event. + if old_status and new_status is not None: + event = device_triggered + data = {"states": new_status} + fire_event(event, data) + + if self._interface is not None: + if len(self._interface.dispatched_dps) == 1: + event = device_dp_triggered + dpid_trigger = list(self._interface.dispatched_dps)[0] + dpid_value = self._interface.dispatched_dps.get(dpid_trigger) + data = {"dp": dpid_trigger, "value": dpid_value} + fire_event(event, data) + + async def _shutdown_entities(self, exc=""): + """Shutdown device entities""" + # Delay shutdown. + if not self.is_closing: + try: + await asyncio.sleep(3 + self._device_config.sleep_time) + except asyncio.CancelledError as e: + self.debug(f"Shutdown entities task has been canceled: {e}", force=True) + return + + if self.connected or self.is_sleep: + self._task_shutdown_entities = None + return + + signal = f"localtuya_{self._device_config.id}" + dispatcher_send(self._hass, signal, None) + + if self.is_closing: + return + + if self.is_subdevice: + self.info(f"Sub-device disconnected due to: {exc}") + elif hasattr(self, "low_power"): + m, s = divmod((int(time.time()) - self._last_update_time), 60) + h, m = divmod(m, 60) + self.info(f"The device is still out of reach since: {h}h:{m}m:{s}s") + else: + self.info(f"Disconnected due to: {exc}") + + self._task_shutdown_entities = None + + @callback + def status_updated(self, status: dict): + """Device updated status.""" + if self._fake_gateway: + # Fake gateways are only used to pass commands no need to update status. + return + self._last_update_time = int(time.time()) + + self._handle_event(self._status, status) + self._status.update(status) + self._dispatch_status() + + @callback + def disconnected(self, exc=""): + """Device disconnected.""" + if not self._interface: + return + self._interface = None + + if self._unsub_refresh: + self._unsub_refresh() + self._unsub_refresh = None + + for subdevice in self.sub_devices.values(): + subdevice.disconnected("Gateway disconnected") + + if self._task_connect is not None: + self._task_connect.cancel() + self._task_connect = None + + # If it disconnects unexpectedly. + if self.is_closing: + return + + if self._task_reconnect is None: + self._task_reconnect = asyncio.create_task(self._async_reconnect()) + + if self._task_shutdown_entities is not None: + self._task_shutdown_entities.cancel() + self._task_shutdown_entities = asyncio.create_task( + self._shutdown_entities(exc=exc) + ) + + @callback + def subdevice_state_updated(self, state: SubdeviceState): + """Handle the reported states for Sub-Devices.""" + node_id = self._node_id + old_state = self.subdevice_state + self.subdevice_state = state + + # This will trigger if state is absent twice. + if old_state == state and state == SubdeviceState.ABSENT: + self._subdevice_off_count = 0 + return self.disconnected("Device is absent") + elif state == SubdeviceState.ABSENT: + return self.info(f"Sub-device is absent {node_id}") + elif old_state == SubdeviceState.ABSENT: + self.info(f"Sub-device is back {node_id}") + + is_online = state == SubdeviceState.ONLINE + off_count = self._subdevice_off_count + self._subdevice_off_count = 0 if is_online else off_count + 1 + + if is_online: + return self.info(f"Sub-device is online {node_id}") if off_count else None + else: + off_count += 1 + if off_count == 1: + self.warning(f"Sub-device is offline {node_id}") + elif off_count == MIN_OFFLINE_EVENTS: + self.disconnected("Device is offline") + + def filter_subdevices(self): + """Remove closed subdevices that are closed.""" + self.sub_devices = dict( + filter(lambda dev: not dev[1].is_closing, self.sub_devices.items()) + ) + + def _get_gateway(self): + """Return the gateway device of this sub device.""" + if not self._node_id or (gateway := self.gateway) is None: + return None # Should never happen + + # Ensure that sub-device still on the same gateway device. + if gateway._local_key != self._local_key: + if self.subdevice_state != SubdeviceState.ABSENT: + self.warning("Sub-device localkey doesn't match the gateway localkey") + # This will become ONLINE after successful connect + self.subdevice_state = SubdeviceState.ABSENT + return None + else: + return gateway diff --git a/custom_components/localtuya/core/__init__.py b/custom_components/localtuya/core/__init__.py new file mode 100644 index 00000000..1f58fadc --- /dev/null +++ b/custom_components/localtuya/core/__init__.py @@ -0,0 +1 @@ +"""The core of localtuya""" diff --git a/custom_components/localtuya/core/__pycache__/__init__.cpython-313.pyc b/custom_components/localtuya/core/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..93cbab89 Binary files /dev/null and b/custom_components/localtuya/core/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/__pycache__/cloud_api.cpython-313.pyc b/custom_components/localtuya/core/__pycache__/cloud_api.cpython-313.pyc new file mode 100644 index 00000000..e4eeee6e Binary files /dev/null and b/custom_components/localtuya/core/__pycache__/cloud_api.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/__pycache__/helpers.cpython-313.pyc b/custom_components/localtuya/core/__pycache__/helpers.cpython-313.pyc new file mode 100644 index 00000000..70f0c9d2 Binary files /dev/null and b/custom_components/localtuya/core/__pycache__/helpers.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/cloud_api.py b/custom_components/localtuya/core/cloud_api.py new file mode 100644 index 00000000..e6373226 --- /dev/null +++ b/custom_components/localtuya/core/cloud_api.py @@ -0,0 +1,356 @@ +"""Class to perform requests to Tuya Cloud APIs.""" + +import asyncio +import functools +import hashlib +import hmac +import json +import logging +import time + +import requests +from requests.adapters import HTTPAdapter, Retry + + +DEVICES_UPDATE_INTERVAL = 300 +DEVICES_UPDATE_INTERVAL_FORCED = 10 + +TUYA_ENDPOINTS = { + # Regions code + "Central Europe Data Center": "eu", + "China Data Center": "cn", + "Eastern America Data Center": "ea", + "India Data Center": "in", + "Western America Data Center": "us", + "Western Europe Data Center": "we", +} + + +# Signature algorithm. +def calc_sign(msg, key): + """Calculate signature for request.""" + sign = ( + hmac.new( + msg=bytes(msg, "latin-1"), + key=bytes(key, "latin-1"), + digestmod=hashlib.sha256, + ) + .hexdigest() + .upper() + ) + return sign + + +class CustomAdapter(logging.LoggerAdapter): + """Adapter logger for cloud api.""" + + def process(self, msg, kwargs): + return f"[{self.extra.get('prefix', '')}] {msg}", kwargs + + +class TuyaCloudApi: + """Class to send API calls.""" + + def __init__(self, hass, region_code, client_id, secret, user_id): + """Initialize the class.""" + self._logger = CustomAdapter( + logging.getLogger(__name__), {"prefix": user_id[:3] + "..." + user_id[-3:]} + ) + + self._hass = hass + self._client_id = client_id + self._secret = secret + self._user_id = user_id + self._access_token = "" + self._token_expire_time: int = 0 + + if region_code == "ea": + self._base_url = "https://openapi-ueaz.tuyaus.com" + elif region_code == "we": + self._base_url = "https://openapi-weaz.tuyaeu.com" + else: + self._base_url = f"https://openapi.tuya{region_code}.com" + + self.device_list = {} + self.cached_device_list = {} + + self._last_devices_update = int(time.time()) + + def generate_payload(self, method, timestamp, url, headers, body=None): + """Generate signed payload for requests.""" + payload = self._client_id + self._access_token + timestamp + + payload += method + "\n" + # Content-SHA256 + payload += hashlib.sha256(bytes((body or "").encode("utf-8"))).hexdigest() + payload += ( + "\n" + + "".join( + [ + "%s:%s\n" % (key, headers[key]) # Headers + for key in headers.get("Signature-Headers", "").split(":") + if key in headers + ] + ) + + "\n/" + + url.split("//", 1)[-1].split("/", 1)[-1] # Url + ) + # self._logger.debug("PAYLOAD: %s", payload) + return payload + + async def async_make_request(self, method, url, body=None, headers={}): + """Perform requests.""" + # obtain new token if expired. + if not self.token_validate and self._token_expire_time != -1: + if (res := await self.async_get_access_token()) and res != "ok": + return self._logger.debug(f"Refresh Token failed due to: {res}") + + timestamp = str(int(time.time() * 1000)) + payload = self.generate_payload(method, timestamp, url, headers, body) + default_par = { + "client_id": self._client_id, + "access_token": self._access_token, + "sign": calc_sign(payload, self._secret), + "t": timestamp, + "sign_method": "HMAC-SHA256", + } + full_url = self._base_url + url + max_retries = 3 + request_timeout = 3 + + # Create requests session. + request_session = requests.Session() + # Setup retries configuration + retries = Retry(total=max_retries, backoff_factor=0.3) + request_session.mount(full_url, HTTPAdapter(max_retries=retries)) + if method == "GET": + func = functools.partial( + request_session.get, + full_url, + headers=dict(default_par, **headers), + timeout=request_timeout, + ) + elif method == "POST": + func = functools.partial( + request_session.post, + full_url, + headers=dict(default_par, **headers), + data=json.dumps(body), + timeout=request_timeout, + ) + # self._logger.debug("BODY: [%s]", body) + elif method == "PUT": + func = functools.partial( + request_session.put, + full_url, + headers=dict(default_par, **headers), + data=json.dumps(body), + timeout=request_timeout, + ) + + try: + resp = await self._hass.async_add_executor_job(func) + except requests.exceptions.ReadTimeout as ex: + self._logger.debug(f"Requests read timeout: {ex}") + return + # r = json.dumps(r.json(), indent=2, ensure_ascii=False) # Beautify the format + return resp + + async def async_get_access_token(self) -> str | None: + """Obtain a valid access token.""" + # Reset access token + self._token_expire_time = -1 + self._access_token = "" + + try: + resp = await self.async_make_request("GET", "/v1.0/token?grant_type=1") + except requests.exceptions.ConnectionError: + self._token_expire_time = 0 + return "Request failed, status ConnectionError" + + if not resp: + self._token_expire_time = 0 + return + if not resp.ok: + return "Request failed, status " + str(resp.status) + + r_json = resp.json() + if not r_json["success"]: + return f"Error {r_json['code']}: {r_json['msg']}" + + req_results = r_json["result"] + + expire_time = int(req_results.get("expire_time", 3600)) + self._token_expire_time = int(time.time()) + expire_time + self._access_token = resp.json()["result"]["access_token"] + return "ok" + + async def async_get_devices_list(self, force_update=False) -> str | None: + """Obtain the list of devices associated to a user. - force_update will ignore last update check.""" + interval = ( + DEVICES_UPDATE_INTERVAL + if not force_update + else DEVICES_UPDATE_INTERVAL_FORCED + ) + if ( + self.device_list + and int(time.time()) - (self._last_devices_update + interval) < 0 + ): + return self._logger.debug(f"Devices has been updated a minutes ago.") + + resp = await self.async_make_request( + "GET", url=f"/v1.0/users/{self._user_id}/devices" + ) + + if not resp: + return + if not resp.ok: + return "Request failed, status " + str(resp.status) + + r_json = resp.json() + if not r_json["success"]: + # self._logger.debug( + # "Request failed, reply is %s", + # json.dumps(r_json, indent=2, ensure_ascii=False) + # ) + return f"Error {r_json['code']}: {r_json['msg']}" + + self.device_list = {dev["id"]: dev for dev in r_json["result"]} + + # Get Devices DPS Data. + get_functions = [ + self._hass.async_create_task(self.get_device_functions(devid)) + for devid in self.device_list + ] + # await asyncio.run(*get_functions) + + self._last_devices_update = int(time.time()) + return "ok" + + async def async_get_device_specifications(self, device_id) -> dict[str, dict]: + """Obtain the DP ID mappings for a device.""" + resp = await self.async_make_request( + "GET", url=f"/v1.1/devices/{device_id}/specifications" + ) + + if not resp: + return + if not resp.ok: + return {}, "Request failed, status " + str(resp.status) + + r_json = resp.json() + if not r_json["success"]: + return {}, f"Error {r_json['code']}: {r_json['msg']}" + + return r_json["result"], "ok" + + async def async_get_device_query_properties(self, device_id) -> dict[dict, str]: + """Obtain the DP ID mappings for a device correctly! Note: This won't works if the subscription expired.""" + resp = await self.async_make_request( + "GET", url=f"/v2.0/cloud/thing/{device_id}/shadow/properties" + ) + + if not resp: + return + if not resp.ok: + return {}, "Request failed, status " + str(resp.status) + + r_json = resp.json() + if not r_json["success"]: + return {}, f"Error {r_json['code']}: {r_json['msg']}" + + return r_json["result"], "ok" + + async def async_get_device_query_things_data_model( + self, device_id + ) -> dict[str, dict]: + """Obtain the DP ID mappings for a device.""" + resp = await self.async_make_request( + "GET", url=f"/v2.0/cloud/thing/{device_id}/model" + ) + + if not resp: + return + if not resp.ok: + return {}, "Request failed, status " + str(resp.status) + + r_json = resp.json() + if not r_json["success"]: + return {}, f"Error {r_json['code']}: {r_json['msg']}" + + return r_json["result"], "ok" + + async def get_device_functions(self, device_id) -> dict[str, dict]: + """Pull Devices Properties and Specifications to devices_list""" + cached = device_id in self.cached_device_list + if cached and (dps_data := self.cached_device_list[device_id].get("dps_data")): + self.device_list[device_id]["dps_data"] = dps_data + return + + device_data = {} + get_data = [ + self.async_get_device_specifications(device_id), + self.async_get_device_query_properties(device_id), + self.async_get_device_query_things_data_model(device_id), + ] + try: + specs, query_props, query_model = await asyncio.gather(*get_data) + except requests.exceptions.ConnectionError as ex: + self._logger.debug(f"Failed to get DPS functions for {device_id} - {ex}") + return + + if query_props[1] == "ok": + device_data = {str(p["dp_id"]): p for p in query_props[0].get("properties")} + if specs[1] == "ok": + for func in specs[0].get("functions", {}): + if str(func.get("dp_id")) in device_data: + device_data[str(func["dp_id"])].update(func) + elif dp_id := func.get("dp_id"): + device_data[str(dp_id)] = func + if query_model[1] == "ok": + model_data = json.loads(query_model[0]["model"]) + services = model_data.get("services", [{}])[0] + properties = services.get("properties") + for dp_data in properties if properties else {}: + refactored = { + "id": dp_data.get("abilityId"), + # "code": dp_data.get("code"), + "accessMode": dp_data.get("accessMode"), + # values: json.loads later + "values": str(dp_data.get("typeSpec")).replace("'", '"'), + } + if str(dp_data["abilityId"]) in device_data: + device_data[str(dp_data["abilityId"])].update(refactored) + else: + refactored["code"] = dp_data.get("code") + device_data[str(dp_data["abilityId"])] = refactored + + if "28841002" in str(query_props[1]): + # No permissions This affect auto configure feature. + self.device_list[device_id]["localtuya_note"] = str(query_props[1]) + + if device_data: + self.device_list[device_id]["dps_data"] = device_data + self.cached_device_list.update({device_id: self.device_list[device_id]}) + + return device_data + + async def async_connect(self): + """Connect to cloudAPI""" + if (res := await self.async_get_access_token()) and res != "ok": + self._logger.error("Cloud API connection failed: %s", res) + return "authentication_failed", res + if res and (res := await self.async_get_devices_list()) and res != "ok": + self._logger.error("Cloud API connection failed: %s", res) + return "device_list_failed", res + if res: + self._logger.info("Cloud API connection succeeded.") + return True, res + + @property + def token_validate(self): + """Return whether token is expired or not""" + cur_time = int(time.time()) + expire_time = self._token_expire_time - 30 + + return expire_time >= cur_time diff --git a/custom_components/localtuya/core/ha_entities/__init__.py b/custom_components/localtuya/core/ha_entities/__init__.py new file mode 100644 index 00000000..d09d0f5b --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/__init__.py @@ -0,0 +1,300 @@ +""" + Tuya Devices: https://xzetsubou.github.io/hass-localtuya/auto_configure/ + + This functionality is similar to HA Tuya, as it retrieves the category and searches for the corresponding categories. + The categories data has been improved & modified to work seamlessly with localtuya + + Device Data: You can obtain all the data for your device from Home Assistant by directly downloading the diagnostics or using entry diagnostics. + Alternative: Use Tuya IoT. + + Add a new device or modify an existing one: + 1. Make sure the device category doesn't already exist. If you are creating a new one, you can modify existing categories. + 2. In order to add a device, you need to specify the category of the device you want to add inside the entity type dictionary. + + Add entities to devices: + 1. Open the file with the name of the entity type on which you want to make changes [e.g. switches.py] and search for your device category. + 2. You can add entities inside the tuple value of the dictionary by including LocalTuyaEntity and passing the parameters for the entity configurations. + 3. These configurations include "id" (required), "icon" (optional), "device_class" (optional), "state_class" (optional), and "name" (optional) [Using COVERS as an example] + Example: "3 ( code: percent_state , value: 0 )" - Refer to the Device Data section above for more details. + current_state_dp = DPCode.PERCENT_STATE < This maps the "percent_state" code DP to the current_state_dp configuration. + + If the configuration is not DPS, it will be inserted through "custom_configs". This is used to inject any configuration into the entity configuration + Example: custom_configs={"positioning_mode": "position"}. I hope that clarifies the concept + + Check URL above for more details. +""" + +import json +from .base import LocalTuyaEntity, CONF_DPS_STRINGS, CLOUD_VALUE, DPType +from enum import Enum +from homeassistant.const import Platform, CONF_FRIENDLY_NAME, CONF_PLATFORM, CONF_ID + +import logging + +# Supported files +from .alarm_control_panels import ALARMS # not added yet +from .binary_sensors import BINARY_SENSORS +from .buttons import BUTTONS +from .climates import CLIMATES +from .covers import COVERS +from .fans import FANS +from .humidifiers import HUMIDIFIERS +from .lights import LIGHTS +from .numbers import NUMBERS +from .remotes import REMOTES +from .selects import SELECTS +from .sensors import SENSORS +from .sirens import SIRENS +from .switches import SWITCHES +from .vacuums import VACUUMS +from .locks import LOCKS +from .water_heaters import WATER_HEATERS + +# The supported PLATFORMS [ Platform: Data ] +DATA_PLATFORMS = { + Platform.ALARM_CONTROL_PANEL: ALARMS, + Platform.BINARY_SENSOR: BINARY_SENSORS, + Platform.BUTTON: BUTTONS, + Platform.CLIMATE: CLIMATES, + Platform.COVER: COVERS, + Platform.FAN: FANS, + Platform.HUMIDIFIER: HUMIDIFIERS, + Platform.LIGHT: LIGHTS, + Platform.LOCK: LOCKS, + Platform.NUMBER: NUMBERS, + Platform.REMOTE: REMOTES, + Platform.SELECT: SELECTS, + Platform.SENSOR: SENSORS, + Platform.SIREN: SIRENS, + Platform.SWITCH: SWITCHES, + Platform.VACUUM: VACUUMS, + Platform.WATER_HEATER: WATER_HEATERS, +} + +_LOGGER = logging.getLogger(__name__) + +TUYA_CATEGORY = "category" +DEVICE_CLOUD_DATA = "device_cloud_data" + + +def gen_localtuya_entities(localtuya_data: dict, tuya_category: str) -> list[dict]: + """Return localtuya entities using the data that provided from TUYA""" + detected_dps: list = localtuya_data.get(CONF_DPS_STRINGS) + + if not tuya_category or not detected_dps: + _LOGGER.debug(f"Missing category: {tuya_category} or DPS: {detected_dps}") + return + + device_name: str = localtuya_data.get(CONF_FRIENDLY_NAME).strip() + device_cloud_data: dict = localtuya_data.get(DEVICE_CLOUD_DATA, {}) + dps_data = device_cloud_data.get("dps_data", {}) + + entities = {} + + for platform, tuya_data in DATA_PLATFORMS.items(): + # TODO: Refactor needed here. + if cat_data := tuya_data.get(tuya_category): + for ent_data in cat_data: + main_confs = ent_data.data + localtuya_conf = ent_data.localtuya_conf + localtuya_entity_configs = ent_data.entity_configs + # Conditions + contains_any: list[str] = ent_data.contains_any + entity = {} + + # used_dp = 0 + for k, code in localtuya_conf.items(): + if type(code) == Enum: + code = code.value + + # If there's multi possible codes. + if isinstance(code, tuple): + for _code in code: + if any(_code in dp.lower().split() for dp in detected_dps): + code = parse_enum(_code) + break + else: + code = None + + for dp_data in detected_dps: + dp_data: str = dp_data.lower() + # Same method we use in config_flow to get dp. + dp_id = dp_data.split(" ")[0] + + if k in entity: + # if the k already configured break the loop!. + _LOGGER.debug(f"{k} Already configured with: {entity[k]}.") + break + + if contains_any is not None: + if not any(cond in dp_data for cond in contains_any): + continue + + if code and code.lower() in dp_data.split(): + entity[k] = dp_id + + # Pull dp values from cloud. still unsure to apply this to all. + # This is due to the fact that some local values may not same with the values provided from cloud. + # For now, this is applied only to numbers values. + for k, v in localtuya_entity_configs.items(): + if isinstance(v, CLOUD_VALUE): + config_dp = entity.get(v.dp_config) + dp_values = get_dp_values(config_dp, dps_data, v) or {} + + # special case for lights + # if v.value_key in dp_values and "kelvin" in k: + # value = dp_values.get(v.value_key) + # dp_values[v.value_key] = convert_to_kelvin(value) + + entity[k] = dp_values.get(v.value_key, v.default_value) + else: + entity[k] = v + + if entity: + # Entity most contains ID + if not entity.get(CONF_ID): + continue + # Workaround to Prevent duplicated id. + if entity[CONF_ID] in entities: + _LOGGER.debug(f"{device_name}: Duplicated ID: {entity}") + continue + + entity.update(main_confs) + entity[CONF_PLATFORM] = platform + entities[entity.get(CONF_ID)] = entity + _LOGGER.debug(f"{device_name}: Entity configured: {entity}") + + # sort entites by id + sorted_ids = sorted(entities, key=int) + + # convert to list of configs + list_entities = [entities.get(id) for id in sorted_ids] + + _LOGGER.debug(f"{device_name}: Configured entities: {list_entities}") + # return [] + return list_entities + + +def parse_enum(dp_code: Enum) -> str: + """Get enum value if code type is enum""" + try: + parsed_dp_code = dp_code.value + except: + parsed_dp_code = dp_code + + return parsed_dp_code + + +def get_dp_values(dp: str, dps_data: dict, req_info: CLOUD_VALUE = None) -> dict: + """Get DP Values""" + if not dp or not dps_data: + return + + dp_data = dps_data.get(dp, {}) + dp_values = dp_data.get("values") + dp_type = dp_data.get("type") + + if not dp_values or not (dp_values := json.loads(dp_values)): + return + + # Some DPS doesn't have the type, in high level data. + if not dp_type and (_type := dp_values.get("type")): + dp_type = _type.capitalize() + # Fix type names. + dp_type = DPType.INTEGER if dp_type == "Value" else dp_type + + # Integer values: min, max, scale, step + if dp_values and dp_type == DPType.INTEGER: + # We only need the scaling factor, other values will be scaled from via later on. + # dp_values["min"] = scale(dp_values.get("min"), val_scale) + valid_type = req_info.prefer_type and req_info.prefer_type in (str, float, int) + pref_type = req_info.prefer_type if valid_type else int + val_scale = dp_values.get("scale", 1) + dp_values["min"] = pref_type(dp_values.get("min")) + dp_values["max"] = pref_type(dp_values.get("max")) + dp_values["step"] = pref_type(dp_values.get("step")) + + pref_type = req_info.prefer_type if valid_type else float + dp_values["scale"] = pref_type(scale(1, val_scale, float)) + + # Scale if requested. + if req_info.scale: + for v in ("min", "max", "step"): + value = dp_values[v] + dp_values[v] = pref_type(scale(value, val_scale)) + + return dp_values + + # ENUM Values: range: list of values. + if dp_values and dp_type == DPType.ENUM: + range_values = dp_values.get("range", []) + + dp_values["min"] = range_values[0] if range_values else 0 # first value + dp_values["max"] = range_values[-1] if range_values else 0 # Last value + dp_values["range"] = convert_list(range_values, req_info) + return dp_values + + # Sensors don't have type + if dp_values and not dp_type: + # we need scaling factor for sensors. + if "scale" in dp_values: + dp_values["scale"] = scale(1, dp_values["scale"], float) + return dp_values + + +def scale(value: int, scale: int, _type: type = int) -> float: + """Return scaled value.""" + value = _type(value) / (10**scale) + if value.is_integer(): + value = int(value) + return value + + +def convert_list(_list: list, req_info: CLOUD_VALUE = str): + """Return list to dict values.""" + if not _list: + return [] + + prefer_type = req_info.prefer_type + + if prefer_type == str: + # Return str "value1,value2,value3" + to_str = ",".join(str(v) for v in _list) + return to_str + + if prefer_type == dict: + # Return dict {value_1: Value 1, value_2: Value 2, value_3: Value 3} + to_dict = {} + for k in _list: + if k.lower() in req_info.remap_values: + k_name = req_info.remap_values.get(k.lower()) + else: + # k_name = k.replace("_", " ").capitalize() # Default name + k_name = k # Default name + if isinstance(req_info.default_value, dict): + k_name = req_info.default_value.get(k, k_name) + + if req_info.reverse_dict: + to_dict.update({k_name: k}) + else: + to_dict.update({k: k_name}) + return to_dict + + # otherwise return prefer type list + return _list + + +def convert_to_kelvin(value): + """Convert Tuya color temperature to kelvin""" + # Given data points + v0, k0 = 0, 2700 # (0, 2700) + v1, k1 = 1000, 6500 # (1000, 6500) + + # Calculate slope (m) and y-intercept (b) using the given points + m = (k1 - k0) / (v1 - v0) + b = k0 - m * v0 + + # Use the linear equation to calculate the color temperature (K) + kelvin = m * value + b + + return kelvin diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/__init__.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..3ef62e9d Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/alarm_control_panels.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/alarm_control_panels.cpython-313.pyc new file mode 100644 index 00000000..f7d49f6d Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/alarm_control_panels.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/base.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/base.cpython-313.pyc new file mode 100644 index 00000000..bf2f7d72 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/base.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/binary_sensors.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/binary_sensors.cpython-313.pyc new file mode 100644 index 00000000..4a5ddc04 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/binary_sensors.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/buttons.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/buttons.cpython-313.pyc new file mode 100644 index 00000000..283b13c2 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/buttons.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/climates.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/climates.cpython-313.pyc new file mode 100644 index 00000000..6fd5e61e Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/climates.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/covers.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/covers.cpython-313.pyc new file mode 100644 index 00000000..6f3a11eb Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/covers.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/fans.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/fans.cpython-313.pyc new file mode 100644 index 00000000..9cb04143 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/fans.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/humidifiers.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/humidifiers.cpython-313.pyc new file mode 100644 index 00000000..a80c3916 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/humidifiers.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/lights.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/lights.cpython-313.pyc new file mode 100644 index 00000000..3cd9c564 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/lights.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/locks.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/locks.cpython-313.pyc new file mode 100644 index 00000000..cc9e68a9 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/locks.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/numbers.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/numbers.cpython-313.pyc new file mode 100644 index 00000000..b2fdebaf Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/numbers.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/remotes.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/remotes.cpython-313.pyc new file mode 100644 index 00000000..af9201ca Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/remotes.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/selects.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/selects.cpython-313.pyc new file mode 100644 index 00000000..4a3db487 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/selects.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/sensors.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/sensors.cpython-313.pyc new file mode 100644 index 00000000..7ee99bef Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/sensors.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/sirens.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/sirens.cpython-313.pyc new file mode 100644 index 00000000..8efaab5d Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/sirens.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/switches.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/switches.cpython-313.pyc new file mode 100644 index 00000000..dbb88522 Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/switches.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/vacuums.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/vacuums.cpython-313.pyc new file mode 100644 index 00000000..820227ff Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/vacuums.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/__pycache__/water_heaters.cpython-313.pyc b/custom_components/localtuya/core/ha_entities/__pycache__/water_heaters.cpython-313.pyc new file mode 100644 index 00000000..554f726b Binary files /dev/null and b/custom_components/localtuya/core/ha_entities/__pycache__/water_heaters.cpython-313.pyc differ diff --git a/custom_components/localtuya/core/ha_entities/alarm_control_panels.py b/custom_components/localtuya/core/ha_entities/alarm_control_panels.py new file mode 100644 index 00000000..93625f7d --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/alarm_control_panels.py @@ -0,0 +1,48 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import DPCode, LocalTuyaEntity, CLOUD_VALUE +from ...const import CONF_ALARM_SUPPORTED_STATES +from homeassistant.components.alarm_control_panel import AlarmControlPanelState + +MAP_ALARM_STATES = { + "disarmed": AlarmControlPanelState.DISARMED, + "arm": AlarmControlPanelState.ARMED_AWAY, + "home": AlarmControlPanelState.ARMED_HOME, + "sos": AlarmControlPanelState.TRIGGERED, +} + + +def localtuya_alarm(states: dict): + """Generate localtuya alarm configs""" + data = { + CONF_ALARM_SUPPORTED_STATES: CLOUD_VALUE( + states, "id", "range", dict, MAP_ALARM_STATES, True + ), + } + return data + + +# All descriptions can be found here: +# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq +ALARMS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Alarm Host + # https://developer.tuya.com/en/docs/iot/categorymal?id=Kaiuz33clqxaf + "mal": ( + LocalTuyaEntity( + id=DPCode.MASTER_MODE, + custom_configs=localtuya_alarm( + { + AlarmControlPanelState.DISARMED: "disarmed", + AlarmControlPanelState.ARMED_AWAY: "arm", + AlarmControlPanelState.ARMED_HOME: "home", + AlarmControlPanelState.TRIGGERED: "sos", + } + ), + ), + ), +} diff --git a/custom_components/localtuya/core/ha_entities/base.py b/custom_components/localtuya/core/ha_entities/base.py new file mode 100644 index 00000000..78d98760 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/base.py @@ -0,0 +1,728 @@ +from enum import StrEnum +from dataclasses import dataclass, field +from typing import Any + +from homeassistant.const import ( + CONF_FRIENDLY_NAME, + CONF_ICON, + CONF_ENTITY_CATEGORY, + CONF_DEVICE_CLASS, + Platform, + EntityCategory, +) +from ...const import CONF_CLEAN_AREA_DP, CONF_DPS_STRINGS, CONF_STATE_CLASS + + +# Obtain values from cloud data. +@dataclass +class CLOUD_VALUE: + """Retrieve a value from stored cloud data + + `default_value`: The value that will be used if it fails to retrieve from the cloud.\n + `dp_config(str)`: The dp config key that will be used to look for the values into it.\n + `value_key(str)`: The "key" name of the targeted value.\n + `prefer_type`: Convert values + Integer: Type(value) ( int, float or str ).\n + Enums: convert the values to [dict or str splitted by comma, default is list].\n + `remap_values(dict)`: Used to remap dict values, if prefer_type is dict.\n + `reverse_dict(bool)`: Reverse dict keys, value, if prefer_type is dict.\n + `scale(bool)`: For integers, scale final value.\n + """ + + default_value: Any + dp_config: str + value_key: str + prefer_type: type = None + remap_values: dict[str, Any] = field(default_factory=dict) + reverse_dict: bool = False + scale: bool = False + + +class LocalTuyaEntity: + """ + Localtuya entity config. + Each platform has unique custom_configs to give the required data to validate entity setups. + e.g. Switch req( Friendly_Name and DP(Code) ) + """ + + def __init__( + self, + name: str = "", + icon: str = "", + entity_category="None", + device_class=None, + state_class=None, + custom_configs: dict[str, Any | tuple[Any, CLOUD_VALUE]] = {}, + condition_contains_any: list = None, + **kwargs, + ): + # platform, name, icon, entity_category, device_class, *key + # self.platform = platform + self.name = name + self.data = { + CONF_FRIENDLY_NAME: name, + CONF_ICON: icon, + CONF_ENTITY_CATEGORY: entity_category, + } + + # Optional + if device_class: + self.data[CONF_DEVICE_CLASS] = device_class + + # Optional + if state_class: + self.data[CONF_STATE_CLASS] = state_class + + self.entity_configs = custom_configs + + self.contains_any = condition_contains_any + + # Replace key with id if needed + if kwargs.get("key", False): + kwargs["id"] = kwargs.pop("key") + # e.g.e CONF_ID etc.. + + self.localtuya_conf = kwargs + + +class DPType(StrEnum): + """Data point types.""" + + BOOLEAN = "Boolean" + ENUM = "Enum" + INTEGER = "Integer" + JSON = "Json" + RAW = "Raw" + STRING = "String" + + +class DPCode(StrEnum): + """Data Point Codes used by Tuya. + + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + """ + + AC_CURRENT = "ac_current" + AC_VOLT = "ac_volt" + ADD_ELE = "add_ele" + ADD_ELE1 = "add_ele1" + ADD_ELE2 = "add_ele2" + AIR_QUALITY = "air_quality" + AIR_RETURN = "air_return" + ALARMPERIOD = "AlarmPeriod" + ALARMSWITCH = "AlarmSwitch" + ALARMTYPE = "Alarmtype" + ALARM_DELAY_TIME = "alarm_delay_time" + ALARM_LOCK = "alarm_lock" + ALARM_MESSAGE = "alarm_message" + ALARM_RINGTONE = "alarm_ringtone" + ALARM_SETTING = "alarm_setting" + ALARM_STATE = "alarm_state" + ALARM_SWITCH = "alarm_switch" # Alarm switch + ALARM_TIME = "alarm_time" # Alarm time + ALARM_VOLUME = "alarm_volume" # Alarm volume + ALL_ENERGY = "all_energy" + AMBIEN = "ambien" + ANGLE_HORIZONTAL = "angle_horizontal" + ANGLE_VERTICAL = "angle_vertical" + ANION = "anion" # Ionizer unit + ANTILOCK_STATUS = "antilock_status" + APPOINTMENT_TIME = "appointment_time" + ARMING_SWITCH = "arming_switch" + ARM_DOWN_PERCENT = "arm_down_percent" + ARM_UP_PERCENT = "arm_up_percent" + AUTOMATIC_LOCK = "automatic_lock" + AUTO_CLEAN = "auto_clean" + AUTO_LOCK_TIME = "auto_lock_time" + BACKLIGHT_SWITCH = "backlight_switch" + BASIC_ANTI_FLICKER = "basic_anti_flicker" + BASIC_DEVICE_VOLUME = "basic_device_volume" + BASIC_FLIP = "basic_flip" + BASIC_INDICATOR = "basic_indicator" + BASIC_NIGHTVISION = "basic_nightvision" + BASIC_OSD = "basic_osd" + BASIC_PRIVATE = "basic_private" + BASIC_WDR = "basic_wdr" + BASS_CONTROL = "bass_control" + BATTERY = "battery" + BATTERYSTATUS = "BatteryStatus" + BATTERY_PERCENTAGE = "battery_percentage" # Battery percentage + BATTERY_STATE = "battery_state" # Battery state + BATTERY_VALUE = "battery_value" # Battery value + BREAK_CLEAN = "break_clean" + BRIGHTNESS_MAX_1 = "brightness_max_1" + BRIGHTNESS_MAX_2 = "brightness_max_2" + BRIGHTNESS_MAX_3 = "brightness_max_3" + BRIGHTNESS_MIN_1 = "brightness_min_1" + BRIGHTNESS_MIN_2 = "brightness_min_2" + BRIGHTNESS_MIN_3 = "brightness_min_3" + BRIGHT_CONTROLLER = "bright_controller" + BRIGHT_STATE = "bright_state" # Brightness status + BRIGHT_VALUE = "bright_value" # Brightness + BRIGHT_VALUE_1 = "bright_value_1" + BRIGHT_VALUE_2 = "bright_value_2" + BRIGHT_VALUE_3 = "bright_value_3" + BRIGHT_VALUE_4 = "bright_value_4" + BRIGHT_VALUE_V2 = "bright_value_v2" + CALLPHONE = "callphone" + CH2O_STATE = "ch2o_state" + CH2O_VALUE = "ch2o_value" + CH4_SENSOR_STATE = "ch4_sensor_state" + CH4_SENSOR_VALUE = "ch4_sensor_value" + CHILDLOCK = "childlock" + CHILD_LOCK = "child_lock" # Child lock + CISTERN = "cistern" + CLEAN_AREA = "clean_area" + CLEAN_RECORD = "clean_record" + CLEAN_TIME = "clean_time" + CLEAR_ENERGY = "clear_energy" + CLICK_SUSTAIN_TIME = "click_sustain_time" + CLOSED_OPENED = "closed_opened" + CLOSED_OPENED_KIT = "closed_opened_kit" + CLOUD_RECIPE_NUMBER = "cloud_recipe_number" + CO2_STATE = "co2_state" + CO2_VALUE = "co2_value" # CO2 concentration + COEF_B_RESET = "coef_b_reset" + COIL_OUT = "coil_out" + COLLECTION_MODE = "collection_mode" + COLOR_DATA_V2 = "color_data_v2" + COLOUR_DATA = "colour_data" # Colored light mode + COLOUR_DATA_HSV = "colour_data_hsv" # Colored light mode + COLOUR_DATA_V2 = "colour_data_v2" # Colored light mode + COMPRESSOR_COMMAND = "compressor_command" + CONCENTRATION_SET = "concentration_set" # Concentration setting + CONTROL = "control" + CONTROL_2 = "control_2" + CONTROL_3 = "control_3" + CONTROL_4 = "control_4" + CONTROL_BACK = "control_back" + CONTROL_BACK_MODE = "control_back_mode" + COOK_TEMPERATURE = "cook_temperature" + COOK_TIME = "cook_time" + COUNTDOWN = "countdown" # Countdown + COUNTDOWN_1 = "countdown_1" # Countdown 1 + COUNTDOWN_2 = "countdown_2" # Countdown 2 + COUNTDOWN_3 = "countdown_3" # Countdown 3 + COUNTDOWN_4 = "countdown_4" # Countdown 4 + COUNTDOWN_5 = "countdown_5" # Countdown 5 + COUNTDOWN_6 = "countdown_6" # Countdown 6 + COUNTDOWN_LEFT = "countdown_left" + COUNTDOWN_SET = "countdown_set" # Countdown setting + COUNTDOWN_USB = "countdown" # Countdown + COUNTDOWN_USB1 = "countdown_usb1" # Countdown USBS 1 + COUNTDOWN_USB2 = "countdown_usb2" # Countdown USBS 2 + COUNTDOWN_USB3 = "countdown_usb3" # Countdown USBS 3 + COUNTDOWN_USB4 = "countdown_usb4" # Countdown USBS 4 + COUNTDOWN_USB5 = "countdown_usb5" # Countdown USBS 5 + COUNTDOWN_USB6 = "countdown_usb6" # Countdown USBS 6 + CO_STATE = "co_state" + CO_STATUS = "co_status" + CO_VALUE = "co_value" + CRUISE_MODE = "cruise_mode" + CRY_DETECTION_SWITCH = "cry_detection_switch" + CUP_NUMBER = "cup_number" # NUmber of cups + CURRENT_A = "current_a" + CURRENT_A_CALIBRATION = "current_a_calibration" + CURRENT_B = "current_b" + CURRENT_B_CALIBRATION = "current_b_calibration" + CURRENT_C = "current_c" + CURRENT_C_CALIBRATION = "current_c_calibration" + CUR_CURRENT = "cur_current" # Actual current + CUR_CURRENT1 = "cur_current1" + CUR_CURRENT2 = "cur_current2" + CUR_POWER = "cur_power" # Actual power + CUR_POWER1 = "cur_power1" + CUR_POWER2 = "cur_power2" + CUR_VOLTAGE = "cur_voltage" # Actual voltage + CUR_VOLTAGE1 = "cur_voltage1" + CUR_VOLTAGE2 = "cur_voltage2" + C_F = "c_f" # Temperature unit switching + DAY_ENERGY = "day_energy" + DECIBEL_SENSITIVITY = "decibel_sensitivity" + DECIBEL_SWITCH = "decibel_switch" + DEFROST = "defrost" + DEHUMIDITY_SET_ENUM = "dehumidify_set_enum" + DEHUMIDITY_SET_VALUE = "dehumidify_set_value" + DELAY_SET = "delay_set" + DEVICE_STATE1 = "device_state1" + DEVICE_STATE2 = "device_state2" + DIRECTION_A = "direction_a" + DIRECTION_B = "direction_b" + DIRECTION_C = "direction_c" + DIRECTION_CONTROL = "direction_control" + DISINFECTION = "disinfection" + DOORBELL = "doorbell" + DOORCONTACT_STATE = "doorcontact_state" # Status of door window sensor + DOORCONTACT_STATE_2 = "doorcontact_state_2" + DOORCONTACT_STATE_3 = "doorcontact_state_3" + DOOR_UNCLOSED = "door_unclosed" + DOOR_UNCLOSED_TRIGGER = "door_unclosed_trigger" + DOWN_CONFIRM = "down_confirm" # cover reset. + DO_NOT_DISTURB = "do_not_disturb" + DUSTER_CLOTH = "duster_cloth" + ECO = "eco" + ECO2 = "eco2" + EDGE_BRUSH = "edge_brush" + ELECTRICITY_LEFT = "electricity_left" + EMISSION = "emission" + ENERGY = "energy" + ENERGY_A_CALIBRATION_FWD = "energy_a_calibration_fwd" + ENERGY_A_CALIBRATION_REV = "energy_a_calibration_rev" + ENERGY_B_CALIBRATION_FWD = "energy_b_calibration_fwd" + ENERGY_B_CALIBRATION_REV = "energy_b_calibration_rev" + ENERGY_C_CALIBRATION_FWD = "energy_c_calibration_fwd" + ENERGY_C_CALIBRATION_REV = "energy_c_calibration_rev" + ENERGY_FORWORD_A = "energy_forword_a" + ENERGY_FORWORD_B = "energy_forword_b" + ENERGY_FORWORD_C = "energy_forword_c" + ENERGY_RESERSE_A = "energy_reserse_A" + ENERGY_RESERSE_B = "energy_reserse_b" + ENERGY_RESERSE_C = "energy_reserse_c" + ENERGY_REVERSE_A = "energy_reverse_a" + ENERGY_REVERSE_B = "energy_reverse_b" + ENERGY_REVERSE_C = "energy_reverse_c" + FAN_BEEP = "fan_beep" # Sound + FAN_COOL = "fan_cool" # Cool wind + FAN_COUNTDOWN = "fan_countdown" + FAN_COUNTDOWN_2 = "fan_countdown_2" + FAN_COUNTDOWN_3 = "fan_countdown_3" + FAN_COUNTDOWN_4 = "fan_countdown_4" + FAN_DIRECTION = "fan_direction" # Fan direction + FAN_HORIZONTAL = "fan_horizontal" # Horizontal swing flap angle + FAN_MODE = "fan_mode" + FAN_SPEED = "fan_speed" + FAN_SPEED_ENUM = "fan_speed_enum" # Speed mode + FAN_SPEED_PERCENT = "fan_speed_percent" # Stepless speed + FAN_SWITCH = "fan_switch" + FAN_VERTICAL = "fan_vertical" # Vertical swing flap angle + FAR_DETECTION = "far_detection" + FAULT = "fault" + FEED_REPORT = "feed_report" + FEED_STATE = "feed_state" + FILTER = "filter" + FILTER_LIFE = "filter" + FILTER_RESET = "filter_reset" # Filter (cartridge) reset + FLIGHT_BRIGHT_MODE = "flight_bright_mode" + FLOODLIGHT_LIGHTNESS = "floodlight_lightness" + FLOODLIGHT_SWITCH = "floodlight_switch" + FORWARD_ENERGY_TOTAL = "forward_energy_total" + FOUT_WAY_VALVE = "fout_way_valve" + FREQ_CALIBRATION = "freq_calibration" + GAS_SENSOR_STATE = "gas_sensor_state" + GAS_SENSOR_STATUS = "gas_sensor_status" + GAS_SENSOR_VALUE = "gas_sensor_value" + HIGHTPROTECTVALUE = "hightprotectvalue" + HIJACK = "hijack" + HUMIDIFIER = "humidifier" # Humidification + HUMIDITY = "humidity" # Humidity + HUMIDITY_CURRENT = "humidity_current" # Current humidity + HUMIDITY_INDOOR = "humidity_indoor" # Indoor humidity + HUMIDITY_SET = "humidity_set" # Humidity setting + HUMIDITY_VALUE = "humidity_value" # Humidity + HUMI_STATUS = "humi_status" + HUM_ALARM = "hum_alarm" + HUM_PERIODIC_REPORT = "hum_periodic_report" + HUM_SENSITIVITY = "hum_sensitivity" + IDU_ERROR = "idu_error" + ILLUMINANCE_VALUE = "illuminance_value" + INNERDRY = "innerdry" + INSTALLATION_HEIGHT = "installation_height" + INTERVAL_TIME = "interval_time" + IPC_WORK_MODE = "ipc_work_mode" + IR_SEND = "ir_send" + IR_STUDY_CODE = "ir_study_code" + KEY_STUDY = "key_study" + KNOB_SWITCH_MODE_1 = "knob_switch_mode_1" + LED_TYPE_1 = "led_type_1" + LED_TYPE_2 = "led_type_2" + LED_TYPE_3 = "led_type_3" + LEVEL = "level" + LEVEL_CURRENT = "level_current" + LIGHT = "light" # Light + LIGHT_MODE = "light_mode" + LIQUID_DEPTH = "liquid_depth" + LIQUID_DEPTH_MAX = "liquid_depth_max" + LIQUID_LEVEL_PERCENT = "liquid_level_percent" + LIQUID_STATE = "liquid_state" + LOADSTATUS = "loadstatus" + LOCK = "lock" # Lock / Child lock + LOCK_MOTOR_STATE = "lock_motor_state" + LOWER_TEMP = "lower_temp" + LOWER_TEMP_F = "lower_temp_f" + LOWPROTECTVALUE = "lowprotectvalue" + LOW_POWER_THRESHOLD = "low_power_threshold" + LUX = "lux" # Ikuu SXSEN003PIR IP65 Motion Detector (Wi-Fi) + MACH_OPERATE = "mach_operate" + MANUAL_FEED = "manual_feed" + MASTER_MODE = "master_mode" # alarm mode + MASTER_STATE = "master_state" # alarm mode + MATERIAL = "material" # Material + MAXHUM_SET = "maxhum_set" + MAXTEMP_SET = "maxtemp_set" + MAX_HUMI = "max_humi" + MAX_SET = "max_set" + MIDDLE_CONFIRM = "middle_confirm" # cover reset. + MINIHUM_SET = "minihum_set" + MINITEMP_SET = "minitemp_set" + MINI_SET = "mini_set" + MIN_HUMI = "min_humi" + MOD = "mod" # Ikuu SXSEN003PIR IP65 Motion Detector (Wi-Fi) + MODE = "mode" # Working mode / Mode + MODE_1 = "mode_1" # Working mode / Mode + MODE_2 = "mode_2" # Working mode / Mode + MODE_3 = "mode_3" # Working mode / Mode + MODE_4 = "mode_4" # Working mode / Mode + MODE_5 = "mode_5" # Working mode / Mode + MODE_6 = "mode_6" # Working mode / Mode + MOD_ON_TMR = "mod_on_tmr" # Ikuu SXSEN003PIR IP65 Motion Detector (Wi-Fi) + MOD_ON_TMR_CD = "mod_on_tmr_cd" # Ikuu SXSEN003PIR IP65 Motion Detector (Wi-Fi) + MOODLIGHTING = "moodlighting" # Mood light + MOTION_INTERVAL = "motion_interval" + MOTION_RECORD = "motion_record" + MOTION_SENSITIVITY = "motion_sensitivity" + MOTION_SWITCH = "motion_switch" # Motion switch + MOTION_TRACKING = "motion_tracking" + MOTOR_MODE = "motor_mode" + MOVEMENT_DETECT_PIC = "movement_detect_pic" + MUFFLING = "muffling" # Muffling + MUTE = "mute" + NEAR_DETECTION = "near_detection" + NET_STATE = "net_state" + NORMAL_OPEN_SWITCH = "normal_open_switch" + ODU_FAN_SPEED = "odu_fan_speed" + OPEN_CLOSE = "open_close" + OPPOSITE = "opposite" + OPTIMUMSTART = "optimumstart" + OTHEREVENT = "OtherEvent" + OUT_POWER = "out_power" + OVERCHARGE_SWITCH = "overcharge_switch" + OXYGEN = "oxygen" # Oxygen bar + PAUSE = "pause" + PERCENT_CONTROL = "percent_control" + PERCENT_CONTROL_2 = "percent_control_2" + PERCENT_CONTROL_3 = "percent_control_3" + PERCENT_CONTROL_4 = "percent_control_4" + PERCENT_STATE = "percent_state" + PERCENT_STATE_2 = "percent_state_2" + PERCENT_STATE_3 = "percent_state_3" + PERCENT_STATE_4 = "percent_state_4" + PHASE_A = "phase_a" + PHASE_B = "phase_b" + PHASE_C = "phase_c" + PHOTO_MODE = "photo_mode" + PIR = "pir" # Motion sensor + PIR_SENSITIVITY = "pir_sensitivity" + PIR_STATE = "pir_state" + PIR_TIME = "pir_time" + PLANT = "plant" + PLAY_INFO = "play_info" + PLAY_MODE = "play_mode" + PLAY_TIME = "play_time" + PM1 = "pm1" + PM10 = "pm10" + PM100_STATE = "pm100_state" + PM100_VALUE = "pm100_value" + PM10_STATE = "pm10_state" + PM10_VALUE = "pm10_value" + PM25 = "pm25" + PM25_STATE = "pm25_state" + PM25_VALUE = "pm25_value" + POSITION = "position" + POWDER_SET = "powder_set" # Powder + POWER = "power" + POWEREVENT = "PowerEvent" + POWER_A = "power_a" + POWER_ADJUSTMENT = "power_adjustmen" + POWER_A_CALIBRATION = "power_a_calibration" + POWER_B = "power_b" + POWER_B_CALIBRATION = "power_b_calibration" + POWER_C = "power_c" + POWER_C_CALIBRATION = "power_c_calibration" + POWER_FACTOR = "power_factor" + POWER_FACTOR_A = "power_factor_a" + POWER_FACTOR_B = "power_factor_b" + POWER_FACTOR_C = "power_factor_c" + POWER_GO = "power_go" + POWER_TYPE = "power_type" + POWER_TYPE1 = "power_type1" + POWER_TYPE2 = "power_type2" + PRESENCE_STATE = "presence_state" + PRESSURE_STATE = "pressure_state" + PRESSURE_VALUE = "pressure_value" + PRM_CONTENT = "prm_content" + PRM_TEMPERATURE = "prm_temperature" + PTZ_CONTROL = "ptz_control" + PTZ_STOP = "ptz_stop" + PUMP_RESET = "pump_reset" # Water pump reset + PV_CURRENT = "pv_current" + PV_POWER = "pv_power" + PV_VOLT = "pv_volt" + RECORD_MODE = "record_mode" + RECORD_SWITCH = "record_switch" # Recording switch + RELAY_STATUS = "relay_status" + RELAY_STATUS_1 = "relay_status_1" # Scene Switch cjkg + RELAY_STATUS_2 = "relay_status_2" # Scene Switch cjkg + RELAY_STATUS_3 = "relay_status_3" # Scene Switch cjkg + RELAY_STATUS_4 = "relay_status_4" # Scene Switch cjkg + RELAY_STATUS_5 = "relay_status_5" # Scene Switch cjkg + RELAY_STATUS_6 = "relay_status_6" # Scene Switch cjkg + RELAY_STATUS_7 = "relay_status_7" # Scene Switch cjkg + RELAY_STATUS_8 = "relay_status_8" # Scene Switch cjkg + REMAIN_TIME = "remain_time" + REMOTE_REGISTER = "remote_register" + REMOTE_UNLOCK_SWITCH = "remote_unlock_switch" + REPORT_PERIOD_SET = "report_period_set" + REPORT_RATE_CONTROL = "report_rate_control" + RESET_DUSTER_CLOTH = "reset_duster_cloth" + RESET_EDGE_BRUSH = "reset_edge_brush" + RESET_FILTER = "reset_filter" + RESET_LIMIT = "reset_limit" + RESET_MAP = "reset_map" + RESET_ROLL_BRUSH = "reset_roll_brush" + RESIDUAL_ELECTRICITY = "residual_electricity" + REVERSE_ENERGY_TOTAL = "reverse_energy_total" + ROLL_BRUSH = "roll_brush" + RUNNING_FAN_SPEED = "running_fan_speed" + SCENE_1 = "scene_1" + SCENE_10 = "scene_10" + SCENE_11 = "scene_11" + SCENE_12 = "scene_12" + SCENE_13 = "scene_13" + SCENE_14 = "scene_14" + SCENE_15 = "scene_15" + SCENE_16 = "scene_16" + SCENE_17 = "scene_17" + SCENE_18 = "scene_18" + SCENE_19 = "scene_19" + SCENE_2 = "scene_2" + SCENE_20 = "scene_20" + SCENE_3 = "scene_3" + SCENE_4 = "scene_4" + SCENE_5 = "scene_5" + SCENE_6 = "scene_6" + SCENE_7 = "scene_7" + SCENE_8 = "scene_8" + SCENE_9 = "scene_9" + SCENE_DATA = "scene_data" # Colored light mode + SCENE_DATA_V2 = "scene_data_v2" # Colored light mode + SEEK = "seek" + SENS = "sens" # Ikuu SXSEN003PIR IP65 Motion Detector (Wi-Fi) + SENSITIVITY = "sensitivity" # Sensitivity + SENSORTYPE = "sensortype" + SENSOR_HUMIDITY = "sensor_humidity" + SENSOR_TEMPERATURE = "sensor_temperature" + SHAKE = "shake" # Oscillating + SHOCK_STATE = "shock_state" # Vibration status + SIREN_SWITCH = "siren_switch" + SITUATION_SET = "situation_set" + SLEEP = "sleep" # Sleep function + SLOW_FEED = "slow_feed" + SMART_WEATHER = "smart_weather" + SMOKE_SENSOR_STATE = "smoke_sensor_state" + SMOKE_SENSOR_STATUS = "smoke_sensor_status" + SMOKE_SENSOR_VALUE = "smoke_sensor_value" + SOS = "sos" # Emergency State + SOS_STATE = "sos_state" # Emergency mode + SOUND_EFFECTS = "sound_effects" + SOUND_MODE = "sound_mode" + SOURCE = "source" + SPEED = "speed" # Speed level + SPRAY_MODE = "spray_mode" # Spraying mode + SPRAY_VOLUME = "spray_volume" # Dehumidifier + STA = "sta" # Ikuu SXSEN003PIR IP65 Motion Detector (Wi-Fi) + START = "start" # Start + STATUS = "status" + STERILIZATION = "sterilization" # Sterilization + STRIP_DIRECTION = "strip_direction" + STRIP_INPUT_POS = "strip_input_pos" + STUDY_CODE = "study_code" + SUB_CLASS = "sub_class" + SUB_STATE = "sub_state" + SUB_TYPE = "sub_type" + SUCTION = "suction" + SWING = "swing" # Swing mode + SWITCH = "switch" # Switch + SWITCH1 = "switch1" # Switch 1 no underscore + SWITCH1_VALUE = "switch1_value" # scene switch "wxkg" + SWITCH2 = "switch2" # Switch 2 no underscore + SWITCH2_VALUE = "switch2_value" # scene switch "wxkg" + SWITCH3 = "switch3" # Switch 3 no underscore + SWITCH3_VALUE = "switch3_value" # scene switch "wxkg" + SWITCH4 = "switch4" # Switch 4 no underscore + SWITCH4_VALUE = "switch4_value" # scene switch "wxkg" + SWITCH5 = "switch5" # Switch 5 no underscore + SWITCH5_VALUE = "switch5_value" # scene switch "wxkg" + SWITCH6 = "switch6" # Switch 6 no underscore + SWITCH6_VALUE = "switch6_value" # scene switch "wxkg" + SWITCH7 = "switch7" # Switch 7 no underscore + SWITCH8 = "switch8" # Switch 8 no underscore + SWITCH_1 = "switch_1" # Switch 1 + SWITCH_2 = "switch_2" # Switch 2 + SWITCH_3 = "switch_3" # Switch 3 + SWITCH_4 = "switch_4" # Switch 4 + SWITCH_5 = "switch_5" # Switch 5 + SWITCH_6 = "switch_6" # Switch 6 + SWITCH_7 = "switch_7" # Switch 7 + SWITCH_8 = "switch_8" # Switch 8 + SWITCH_ALARM_CALL = "switch_alarm_call" + SWITCH_ALARM_LIGHT = "switch_alarm_light" + SWITCH_ALARM_PROPEL = "switch_alarm_propel" + SWITCH_ALARM_SMS = "switch_alarm_sms" + SWITCH_ALARM_SOUND = "switch_alarm_sound" + SWITCH_BACKLIGHT = "switch_backlight" # Backlight switch + SWITCH_CHARGE = "switch_charge" + SWITCH_COLD = "switch_cold" + SWITCH_CONTROLLER = "switch_controller" + SWITCH_DISTURB = "switch_disturb" + SWITCH_FAN = "switch_fan" + SWITCH_HORIZONTAL = "switch_horizontal" # Horizontal swing flap switch + SWITCH_KB_LIGHT = "switch_kb_light" + SWITCH_KB_SOUND = "switch_kb_sound" + SWITCH_LED = "switch_led" # Switch + SWITCH_LED_1 = "switch_led_1" + SWITCH_LED_2 = "switch_led_2" + SWITCH_LED_3 = "switch_led_3" + SWITCH_LED_4 = "switch_led_4" + SWITCH_NIGHT_LIGHT = "switch_night_light" + SWITCH_SAVE_ENERGY = "switch_save_energy" + SWITCH_SOUND = "switch_sound" # Voice switch + SWITCH_SPRAY = "switch_spray" # Spraying switch + SWITCH_STOP = "switch_stop" + SWITCH_TYPE_1 = "switch_type_1" + SWITCH_TYPE_2 = "switch_type_2" + SWITCH_TYPE_3 = "switch_type_3" + SWITCH_TYPE_4 = "switch_type_4" + SWITCH_TYPE_5 = "switch_type_5" + SWITCH_USB1 = "switch_usb1" # USB 1 + SWITCH_USB2 = "switch_usb2" # USB 2 + SWITCH_USB3 = "switch_usb3" # USB 3 + SWITCH_USB4 = "switch_usb4" # USB 4 + SWITCH_USB5 = "switch_usb5" # USB 5 + SWITCH_USB6 = "switch_usb6" # USB 6 + SWITCH_VERTICAL = "switch_vertical" # Vertical swing flap switch + SWITCH_VOICE = "switch_voice" # Voice switch + SWITCH_WEATHER = "switch_weather" + SWITCH_WELCOME = "switch_welcome" + SYNC_REQUEST = "sync_request" + SYNC_RESPONSE = "sync_response" + SYSTEMMODE = "systemmode" + TBD = "tbd" + TEMP = "temp" # Temperature setting + TEMPACTIVATE = "tempactivate" + TEMPCOMP = "tempcomp" + TEMPCURRENT = "tempcurrent" # Current temperature in °C + TEMPERATURE = "temperature" + TEMPER_ALARM = "temper_alarm" # Tamper alarm + TEMPFLOOR = "TempFloor" + TEMPPROGRAM = "tempprogram" + TEMP_ALARM = "temp_alarm" + TEMP_BOILING_C = "temp_boiling_c" + TEMP_BOILING_F = "temp_boiling_f" + TEMP_CONTROLLER = "temp_controller" + TEMP_CURRENT = "temp_current" # Current temperature in °C + TEMP_CURRENT_F = "temp_current_f" # Current temperature in °F + TEMP_INDOOR = "temp_indoor" # Indoor temperature in °C + TEMP_LOW = "temp_low" + TEMP_PERIODIC_REPORT = "temp_periodic_report" + TEMP_SENSITIVITY = "temp_sensitivity" + TEMP_SET = "temp_set" # Set the temperature in °C + TEMP_SET_F = "temp_set_f" # Set the temperature in °F + TEMP_STATUS = "temp_status" + TEMP_UNIT_CONVERT = "temp_unit_convert" # Temperature unit switching + TEMP_UP = "temp_up" + TEMP_VALUE = "temp_value" # Color temperature + TEMP_VALUE_V2 = "temp_value_v2" + TIM = "tim" # Ikuu SXSEN003PIR IP65 Motion Detector (Wi-Fi) + TIMER = "timer" + TIME_TOTAL = "time_total" + TIME_USE = "time_use" + TODAY_ACC_ENERGY = "today_acc_energy" + TODAY_ACC_ENERGY1 = "today_acc_energy1" + TODAY_ACC_ENERGY2 = "today_acc_energy2" + TODAY_ENERGY_ADD = "today_energy_add" + TODAY_ENERGY_ADD1 = "today_energy_add1" + TODAY_ENERGY_ADD2 = "today_energy_add2" + TOTAL_CLEAN_AREA = "total_clean_area" + TOTAL_CLEAN_COUNT = "total_clean_count" + TOTAL_CLEAN_TIME = "total_clean_time" + TOTAL_ENERGY = "total_energy" + TOTAL_ENERGY1 = "total_energy1" + TOTAL_ENERGY2 = "total_energy2" + TOTAL_FORWARD_ENERGY = "total_forward_energy" + TOTAL_PM = "total_pm" + TOTAL_POWER = "total_power" + TOTAL_TIME = "total_time" + TREBLE_CONTROL = "treble_control" + TVOC = "tvoc" + TV_SIZE = "tv_size" + UNLOCK_APP = "unlock_app" + UNLOCK_BLE = "unlock_ble" + UNLOCK_CARD = "unlock_card" + UNLOCK_DOUBLE = "unlock_double" + UNLOCK_DYNAMIC = "unlock_dynamic" + UNLOCK_EYE = "unlock_eye" + UNLOCK_FACE = "unlock_face" + UNLOCK_FINGERPRINT = "unlock_fingerprint" + UNLOCK_FINGER_VEIN = "unlock_finger_vein" + UNLOCK_HAND = "unlock_hand" + UNLOCK_IDENTITY_CARD = "unlock_identity_card" + UNLOCK_KEY = "unlock_key" + UNLOCK_PASSWORD = "unlock_password" + UNLOCK_PHONE_REMOTE = "unlock_phone_remote" + UNLOCK_REMOTE = "unlock_remote" + UNLOCK_REQUEST = "unlock_request" + UNLOCK_SPECIAL = "unlock_special" + UNLOCK_SWITCH = "unlock_switch" + UNLOCK_TEMPORARY = "unlock_temporary" + UNLOCK_VOICE_REMOTE = "unlock_voice_remote" + UPPER_TEMP = "upper_temp" + UPPER_TEMP_F = "upper_temp_f" + UP_CONFIRM = "up_confirm" # cover reset. + USE_TIME = "use_time" + USE_TIME_ONE = "use_time_one" + UV = "uv" # UV sterilization + VA_BATTERY = "va_battery" + VA_HUMIDITY = "va_humidity" + VA_TEMPERATURE = "va_temperature" + VIDEO_INTENSITY = "video_intensity" + VIDEO_MODE = "video_mode" + VIDEO_SCENE = "video_scene" + VOC_STATE = "voc_state" + VOC_VALUE = "voc_value" + VOICE_BT_PLAY = "voice_bt_play" + VOICE_LANGUAGE = "voice_language" + VOICE_MIC = "voice_mic" + VOICE_PLAY = "voice_play" + VOICE_SWITCH = "voice_switch" + VOICE_TIMES = "voice_times" + VOICE_VOL = "voice_vol" + VOLTAGE_A = "voltage_a" + VOLTAGE_COEF = "voltage_coef" + VOLTAGE_CURRENT = "voltage_current" + VOLUME_SET = "volume_set" + WARM = "warm" # Heat preservation + WARM_TIME = "warm_time" # Heat preservation time + WARN_POWER = "warn_power" + WARN_POWER1 = "warn_power1" + WARN_POWER2 = "warn_power2" + WATER = "water" + WATERSENSOR_STATE = "watersensor_state" + WATER_RESET = "water_reset" # Resetting of water usage days + WATER_SET = "water_set" # Water level + WATER_TEMP = "water_temp" + WATER_USE_DATA = "water_use_data" + WEATHER_DELAY = "weather_delay" + WET = "wet" # Humidification + WINDOWDETECT = "windowdetect" + WINDOW_CHECK = "window_check" + WINDOW_STATE = "window_state" + WINDSPEED = "windspeed" + WIRELESS_BATTERYLOCK = "wireless_batterylock" + WIRELESS_ELECTRICITY = "wireless_electricity" + WORK_MODE = "work_mode" # Working mode + WORK_POWER = "work_power" + WORK_STATE = "work_state" + WORK_STATUS = "work_status" + Y_MOP = "y_mop" + ZONE_ATTRIBUTE = "zone_attribute" + ZONE_NUMBER = "zone_number" diff --git a/custom_components/localtuya/core/ha_entities/binary_sensors.py b/custom_components/localtuya/core/ha_entities/binary_sensors.py new file mode 100644 index 00000000..748e5a77 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/binary_sensors.py @@ -0,0 +1,424 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import DPCode, LocalTuyaEntity, CONF_DEVICE_CLASS, EntityCategory +from homeassistant.components.binary_sensor import BinarySensorDeviceClass + +CONF_STATE_ON = "state_on" + +ALARM_ON = {CONF_STATE_ON: "alarm"} +STATE_TRUE = {CONF_STATE_ON: "true"} +ON_1 = {CONF_STATE_ON: "1"} +ON_FEEDING = {CONF_STATE_ON: "feeding"} +ON_PRESENCE = {CONF_STATE_ON: "presence"} + +ON_OPEN = {CONF_STATE_ON: "open"} +ON_OPENED = {CONF_STATE_ON: "opened"} + +ON_AQAB = {CONF_STATE_ON: "AQAB"} + + +def localtuya_binarySensor(state_on="1"): + """Define localtuya binary_sensor configs""" + data = {CONF_STATE_ON: state_on} + return data + + +# Commonly used sensors +TAMPER_BINARY_SENSOR = LocalTuyaEntity( + key=DPCode.TEMPER_ALARM, + name="Tamper", + device_class=BinarySensorDeviceClass.TAMPER, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=STATE_TRUE, +) + +# Fault +FAULT_SENSOR = ( + LocalTuyaEntity( + id=DPCode.FAULT, + name="Fault", + device_class=BinarySensorDeviceClass.PROBLEM, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=ON_1, + ), + LocalTuyaEntity( + id=DPCode.IDU_ERROR, + name="IDU Error", + device_class=BinarySensorDeviceClass.PROBLEM, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=ON_1, + ), + # CZ - Energy monitor? + LocalTuyaEntity( + id=DPCode.POWER_TYPE, + name="Power State", + device_class=BinarySensorDeviceClass.PROBLEM, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_binarySensor("warn"), + ), + LocalTuyaEntity( + id=DPCode.POWER_TYPE1, + name="Power 1 State", + device_class=BinarySensorDeviceClass.PROBLEM, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_binarySensor("warn"), + ), + LocalTuyaEntity( + id=DPCode.POWER_TYPE2, + name="Power 2 State", + device_class=BinarySensorDeviceClass.PROBLEM, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_binarySensor("warn"), + ), +) + + +BINARY_SENSORS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Multi-functional Sensor + # https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3 + "dgnbj": ( + LocalTuyaEntity( + id=DPCode.GAS_SENSOR_STATE, + name="Gas detection", + icon="mdi:gas-cylinder", + device_class=BinarySensorDeviceClass.GAS, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.CH4_SENSOR_STATE, + name="Methane detection", + device_class=BinarySensorDeviceClass.GAS, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.VOC_STATE, + name="VOC detection", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.PM10_STATE, + name="PM1.0 detection", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.PM25_STATE, + name="PM2.5 detection", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.PM100_STATE, + name="PM10 detection", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.CO_STATE, + name="CO detection", + icon="mdi:molecule-co", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.CO2_STATE, + name="CO2 detection", + icon="mdi:molecule-co2", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.CH2O_STATE, + name="Formaldehyde detection", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.DOORCONTACT_STATE, + name="Door", + device_class=BinarySensorDeviceClass.DOOR, + custom_configs=STATE_TRUE, + ), + LocalTuyaEntity( + id=DPCode.WATERSENSOR_STATE, + device_class=BinarySensorDeviceClass.MOISTURE, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.PRESSURE_STATE, + name="Pressure", + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.SMOKE_SENSOR_STATE, + name="Smoke detection", + icon="mdi:smoke-detector", + device_class=BinarySensorDeviceClass.SMOKE, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # CO2 Detector + # https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy + "co2bj": ( + LocalTuyaEntity( + id=DPCode.CO2_STATE, + icon="mdi:molecule-co2", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # CO Detector + # https://developer.tuya.com/en/docs/iot/categorycobj?id=Kaiuz3u1j6q1v + "cobj": ( + LocalTuyaEntity( + id=DPCode.CO_STATE, + icon="mdi:molecule-co", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ON_1, + ), + LocalTuyaEntity( + id=DPCode.CO_STATUS, + icon="mdi:molecule-co", + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # Smart Pet Feeder + # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld + "cwwsq": ( + LocalTuyaEntity( + id=DPCode.FEED_STATE, + icon="mdi:information", + custom_configs=ON_FEEDING, + ), + ), + # Human Presence Sensor + # https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs + "hps": ( + LocalTuyaEntity( + id=DPCode.PRESENCE_STATE, + device_class=BinarySensorDeviceClass.MOTION, + custom_configs=ON_PRESENCE, + ), + ), + # Formaldehyde Detector + # Note: Not documented + "jqbj": ( + LocalTuyaEntity( + id=DPCode.CH2O_STATE, + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # Methane Detector + # https://developer.tuya.com/en/docs/iot/categoryjwbj?id=Kaiuz40u98lkm + "jwbj": ( + LocalTuyaEntity( + id=DPCode.CH4_SENSOR_STATE, + device_class=BinarySensorDeviceClass.GAS, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # Door and Window Controller + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r5zjsy9 + "mc": ( + LocalTuyaEntity( + id=DPCode.STATUS, + device_class=BinarySensorDeviceClass.DOOR, + custom_configs=ON_OPENED, + ), + LocalTuyaEntity( + id=DPCode.DOOR_UNCLOSED, + device_class=BinarySensorDeviceClass.DOOR, + custom_configs=STATE_TRUE, + ), + ), + # Door Window Sensor + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48hm02l8m + "mcs": ( + LocalTuyaEntity( + id=DPCode.DOORCONTACT_STATE, + device_class=BinarySensorDeviceClass.DOOR, + custom_configs=STATE_TRUE, + ), + TAMPER_BINARY_SENSOR, + ), + # Access Control + # https://developer.tuya.com/en/docs/iot/s?id=Kb0o2xhlkxbet + "mk": ( + LocalTuyaEntity( + id=DPCode.CLOSED_OPENED_KIT, + device_class=BinarySensorDeviceClass.LOCK, + custom_configs=ON_AQAB, + ), + ), + # Luminance Sensor + # https://developer.tuya.com/en/docs/iot/categoryldcg?id=Kaiuz3n7u69l8 + "ldcg": ( + LocalTuyaEntity( + id=DPCode.TEMPER_ALARM, + device_class=BinarySensorDeviceClass.TAMPER, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=STATE_TRUE, + ), + TAMPER_BINARY_SENSOR, + ), + # PIR Detector + # https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80 + "pir": ( + LocalTuyaEntity( + id=(DPCode.PIR, DPCode.PIR_STATE), + device_class=BinarySensorDeviceClass.MOTION, + custom_configs={CONF_STATE_ON: "pir"}, + ), + LocalTuyaEntity( + id=DPCode.STA, + device_class=BinarySensorDeviceClass.MOTION, + custom_configs={CONF_STATE_ON: "true"}, + ), + TAMPER_BINARY_SENSOR, + ), + # PM2.5 Sensor + # https://developer.tuya.com/en/docs/iot/categorypm25?id=Kaiuz3qof3yfu + "pm2.5": ( + LocalTuyaEntity( + id=DPCode.PM25_STATE, + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # Gas Detector + # https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw + "rqbj": ( + LocalTuyaEntity( + id=DPCode.GAS_SENSOR_STATUS, + device_class=BinarySensorDeviceClass.GAS, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.GAS_SENSOR_STATE, + device_class=BinarySensorDeviceClass.GAS, + custom_configs=ON_1, + ), + TAMPER_BINARY_SENSOR, + ), + # Water Detector + # https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli + "sj": ( + LocalTuyaEntity( + id=DPCode.WATERSENSOR_STATE, + device_class=BinarySensorDeviceClass.MOISTURE, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # Emergency Button + # https://developer.tuya.com/en/docs/iot/categorysos?id=Kaiuz3oi6agjy + "sos": ( + LocalTuyaEntity( + id=DPCode.SOS_STATE, + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=STATE_TRUE, + ), + TAMPER_BINARY_SENSOR, + ), + # Volatile Organic Compound Sensor + # Note: Undocumented in cloud API docs, based on test device + "voc": ( + LocalTuyaEntity( + id=DPCode.VOC_STATE, + device_class=BinarySensorDeviceClass.SAFETY, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # Thermostatic Radiator Valve + # Not documented + "wkf": ( + LocalTuyaEntity( + id=DPCode.WINDOW_STATE, + device_class=BinarySensorDeviceClass.WINDOW, + custom_configs=ON_OPENED, + ), + ), + # Temperature and Humidity Sensor + # https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34 + "wsdcg": (TAMPER_BINARY_SENSOR,), + # Pressure Sensor + # https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm + "ylcg": ( + LocalTuyaEntity( + id=DPCode.PRESSURE_STATE, + custom_configs=ALARM_ON, + ), + TAMPER_BINARY_SENSOR, + ), + # Smoke Detector + # https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952 + "ywbj": ( + LocalTuyaEntity( + id=DPCode.SMOKE_SENSOR_STATUS, + device_class=BinarySensorDeviceClass.SMOKE, + custom_configs=ALARM_ON, + ), + LocalTuyaEntity( + id=DPCode.SMOKE_SENSOR_STATE, + device_class=BinarySensorDeviceClass.SMOKE, + custom_configs=ALARM_ON, + condition_contains_any=["alarm"], + ), + LocalTuyaEntity( + id=DPCode.SMOKE_SENSOR_STATE, + device_class=BinarySensorDeviceClass.SMOKE, + custom_configs=ON_1, + ), + TAMPER_BINARY_SENSOR, + ), + # Vibration Sensor + # https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno + "zd": ( + LocalTuyaEntity( + id=(DPCode.SHOCK_STATE, f"{DPCode.SHOCK_STATE}_vibration"), + device_class=BinarySensorDeviceClass.VIBRATION, + custom_configs={CONF_STATE_ON: "vibration"}, + condition_contains_any=["tilt", "true"], + ), + LocalTuyaEntity( + id=(DPCode.SHOCK_STATE, f"{DPCode.SHOCK_STATE}_drop"), + icon="mdi:icon=package-down", + custom_configs={CONF_STATE_ON: "drop"}, + condition_contains_any=["tilt", "true"], + ), + LocalTuyaEntity( + id=(DPCode.SHOCK_STATE, f"{DPCode.SHOCK_STATE}_tilt"), + name="Tilt", + icon="mdi:spirit-level", + custom_configs={CONF_STATE_ON: "tilt"}, + condition_contains_any=["tilt", "true"], + ), + ), +} + +BINARY_SENSORS["cl"] = FAULT_SENSOR +BINARY_SENSORS["wk"] = FAULT_SENSOR +BINARY_SENSORS["kg"] = FAULT_SENSOR +BINARY_SENSORS["pc"] = FAULT_SENSOR +BINARY_SENSORS["cz"] = FAULT_SENSOR +BINARY_SENSORS["cs"] = FAULT_SENSOR +BINARY_SENSORS["jsq"] = FAULT_SENSOR +BINARY_SENSORS["kt"] = FAULT_SENSOR +BINARY_SENSORS["sd"] = FAULT_SENSOR +BINARY_SENSORS["sfkzq"] = FAULT_SENSOR diff --git a/custom_components/localtuya/core/ha_entities/buttons.py b/custom_components/localtuya/core/ha_entities/buttons.py new file mode 100644 index 00000000..91af7068 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/buttons.py @@ -0,0 +1,186 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import DPCode, LocalTuyaEntity, CONF_DEVICE_CLASS, EntityCategory + +BUTTONS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Scene Switch + # https://developer.tuya.com/en/docs/iot/f?id=K9gf7nx6jelo8 + "cjkg": ( + LocalTuyaEntity( + id=DPCode.SCENE_1, + name="Scene 1", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_2, + name="Scene 2", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_3, + name="Scene 3", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_4, + name="Scene 4", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_5, + name="Scene 5", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_6, + name="Scene 6", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_7, + name="Scene 7", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_8, + name="Scene 8", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_9, + name="Scene 9", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_10, + name="Scene 10", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_11, + name="Scene 11", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_12, + name="Scene 12", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_13, + name="Scene 13", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_14, + name="Scene 14", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_15, + name="Scene 15", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_16, + name="Scene 16", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_17, + name="Scene 17", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_18, + name="Scene 18", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_18, + name="Scene 18", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_19, + name="Scene 19", + icon="mdi:palette", + ), + LocalTuyaEntity( + id=DPCode.SCENE_20, + name="Scene 20", + icon="mdi:palette", + ), + ), + # Curtain + # Note: Multiple curtains isn't documented + # https://developer.tuya.com/en/docs/iot/categorycl?id=Kaiuz1hnpo7df + "cl": ( + LocalTuyaEntity( + id=DPCode.REMOTE_REGISTER, + name="Pair Remote", + icon="mdi:remote", + entity_category=EntityCategory.CONFIG, + ), + ), + # Robot Vacuum + # https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo + "sd": ( + LocalTuyaEntity( + id=DPCode.RESET_DUSTER_CLOTH, + name="Reset Duster Cloth", + icon="mdi:restart", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.RESET_EDGE_BRUSH, + name="Reset Edge Brush", + icon="mdi:restart", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.RESET_FILTER, + name="Reset Filter", + icon="mdi:air-filter", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.RESET_MAP, + name="Reset Map", + icon="mdi:map-marker-remove", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.RESET_ROLL_BRUSH, + name="Reset Roll Brush", + icon="mdi:restart", + entity_category=EntityCategory.CONFIG, + ), + ), + # Wake Up Light II + # Not documented + "hxd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_USB6, + name="Snooze", + icon="mdi:sleep", + ), + ), + "cz": ( + LocalTuyaEntity( + id=DPCode.CLEAR_ENERGY, + name="Clear Energy", + icon="mdi:lightning-bolt-circle", + entity_category=EntityCategory.CONFIG, + ), + ), +} + +# Wireless Switch # also can come as knob switch. +# https://developer.tuya.com/en/docs/iot/wxkg?id=Kbeo9t3ryuqm5 +BUTTONS["wxkg"] = BUTTONS["cjkg"] diff --git a/custom_components/localtuya/core/ha_entities/climates.py b/custom_components/localtuya/core/ha_entities/climates.py new file mode 100644 index 00000000..e91018cc --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/climates.py @@ -0,0 +1,268 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from homeassistant.components.climate import ( + HVACMode, + HVACAction, + DEFAULT_MAX_TEMP, + DEFAULT_MIN_TEMP, + ATTR_MAX_TEMP, + ATTR_MIN_TEMP, +) +from homeassistant.const import CONF_TEMPERATURE_UNIT + +from .base import DPCode, LocalTuyaEntity, CLOUD_VALUE +from ...const import ( + CONF_ECO_VALUE, + CONF_HVAC_ACTION_SET, + CONF_HVAC_MODE_SET, + CONF_PRECISION, + CONF_PRESET_SET, + CONF_TARGET_PRECISION, + CONF_TEMPERATURE_STEP, + CONF_HVAC_ACTION_DP, + CONF_HVAC_MODE_DP, + CONF_CURRENT_TEMPERATURE_DP, + CONF_MAX_TEMP, + CONF_MIN_TEMP, + CONF_FAN_SPEED_LIST, + CONF_FAN_SPEED_DP, + CONF_TARGET_TEMPERATURE_DP, + CONF_PRESET_DP, +) + + +UNIT_C = "celsius" +UNIT_F = "fahrenheit" + +FAN_SPEEDS_DEFAULT = "auto,low,middle,high" + + +def localtuya_climate( + hvac_mode_set=None, + temp_step=1, + actions_set=None, + echo_value=None, + preset_set=None, + fans_speeds=FAN_SPEEDS_DEFAULT, + unit=None, + min_temperature=7, + max_temperature=35, + values_precsion=0.1, + target_precision=1, +) -> dict: + """Create localtuya climate configs""" + data = {} + for key, conf in { + CONF_HVAC_MODE_SET: CLOUD_VALUE( + hvac_mode_set, CONF_HVAC_MODE_DP, "range", dict, MAP_CLIMATE_MODES, True + ), + CONF_MIN_TEMP: CLOUD_VALUE( + min_temperature, CONF_TARGET_TEMPERATURE_DP, "min", scale=True + ), + CONF_MAX_TEMP: CLOUD_VALUE( + max_temperature, CONF_TARGET_TEMPERATURE_DP, "max", scale=True + ), + CONF_TEMPERATURE_STEP: CLOUD_VALUE( + str(temp_step), CONF_TARGET_TEMPERATURE_DP, "step", str, scale=True + ), + CONF_HVAC_ACTION_SET: CLOUD_VALUE( + actions_set, CONF_HVAC_ACTION_DP, "range", dict, MAP_CLIMATE_ACTIONS, True + ), + CONF_FAN_SPEED_LIST: CLOUD_VALUE(fans_speeds, CONF_FAN_SPEED_DP, "range", str), + CONF_ECO_VALUE: echo_value, + CONF_PRESET_SET: CLOUD_VALUE(preset_set, CONF_PRESET_DP, "range", dict), + CONF_TEMPERATURE_UNIT: unit, + CONF_PRECISION: CLOUD_VALUE( + str(values_precsion), CONF_CURRENT_TEMPERATURE_DP, "scale", str + ), + CONF_TARGET_PRECISION: CLOUD_VALUE( + str(target_precision), CONF_TARGET_TEMPERATURE_DP, "scale", str + ), + }.items(): + if conf: + data.update({key: conf}) + + return data + + +# Map used for cloud value obtain. +MAP_CLIMATE_MODES = { + "off": HVACMode.OFF, + "auto": HVACMode.AUTO, + "cold": HVACMode.COOL, + "freeze": HVACMode.COOL, + "cooling": HVACMode.COOL, + "hot": HVACMode.HEAT, + "heating": HVACMode.HEAT, + "manual": HVACMode.HEAT_COOL, + "wet": HVACMode.DRY, + "dehum": HVACMode.DRY, + "wind": HVACMode.FAN_ONLY, + "fan": HVACMode.FAN_ONLY, + "off": HVACMode.OFF, + "0": HVACMode.COOL, + "1": HVACMode.HEAT, + "2": HVACMode.FAN_ONLY, +} +MAP_CLIMATE_ACTIONS = { + "heating": HVACAction.HEATING, + "cooling": HVACAction.COOLING, + "warming": HVACAction.IDLE, + "opened": HVACAction.HEATING, + "closed": HVACAction.IDLE, +} + +CLIMATES: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Air conditioner + # https://developer.tuya.com/en/docs/iot/categorykt?id=Kaiuz0z71ov2n + "kt": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + target_temperature_dp=(DPCode.TEMP_SET, DPCode.TEMP_SET_F), + current_temperature_dp=( + DPCode.TEMP_CURRENT, + DPCode.TEMP_CURRENT_F, + DPCode.TEMPCURRENT, + ), + hvac_mode_dp=(DPCode.SYSTEMMODE, DPCode.MODE), + hvac_action_dp=(DPCode.WORK_MODE, DPCode.WORK_STATUS, DPCode.WORK_STATE), + preset_dp=DPCode.MODE, + fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED), + custom_configs=localtuya_climate( + hvac_mode_set={ + HVACMode.AUTO: "auto", + HVACMode.COOL: "cold", + HVACMode.HEAT: "hot", + HVACMode.DRY: "wet", + }, + preset_set={}, + temp_step=1, + actions_set={ + HVACAction.HEATING: "heating", + HVACAction.COOLING: "cooling", + }, + unit=UNIT_C, + values_precsion=0.1, + target_precision=0.1, + ), + ), + ), + # Heater + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46epy4j82 + ## Converted to Water Heaters + # "qn": ( + # LocalTuyaEntity( + # id=DPCode.SWITCH, + # target_temperature_dp=(DPCode.TEMP_SET, DPCode.TEMP_SET_F), + # current_temperature_dp=(DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F), + # hvac_mode_dp=DPCode.SWITCH, + # hvac_action_dp=(DPCode.WORK_STATE, DPCode.WORK_MODE, DPCode.WORK_STATUS), + # preset_dp=DPCode.MODE, + # fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED), + # custom_configs=localtuya_climate( + # hvac_mode_set={ + # HVACMode.OFF: False, + # HVACMode.HEAT: True, + # }, + # temp_step=1, + # actions_set={ + # HVACAction.HEATING: True, + # HVACAction.IDLE: False, + # }, + # values_precsion=0.1, + # target_precision=0.1, + # preset_set={}, + # ), + # ), + # ), + # Heater + # https://developer.tuya.com/en/docs/iot/categoryrs?id=Kaiuz0nfferyx + ## Converted to Water Heaters + # "rs": ( + # LocalTuyaEntity( + # id=DPCode.SWITCH, + # target_temperature_dp=(DPCode.TEMP_SET, DPCode.TEMP_SET_F), + # current_temperature_dp=(DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F), + # hvac_action_dp=(DPCode.WORK_STATE, DPCode.WORK_MODE, DPCode.WORK_STATUS), + # preset_dp=DPCode.MODE, + # fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED), + # custom_configs=localtuya_climate( + # hvac_mode_set={ + # HVACMode.OFF: "off", + # HVACMode.HEAT: "hot", + # }, + # temp_step=1, + # actions_set={ + # HVACAction.HEATING: "heating", + # HVACAction.IDLE: "warming", + # }, + # unit=UNIT_C, + # values_precsion=0.1, + # target_precision=0.1, + # preset_set={}, + # ), + # ), + # ), + # Thermostat + # https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9 + "wk": ( + LocalTuyaEntity( + id=(DPCode.SWITCH, DPCode.MODE), + target_temperature_dp=(DPCode.TEMP_SET, DPCode.TEMP_SET_F), + current_temperature_dp=( + DPCode.TEMP_CURRENT, + DPCode.TEMP_CURRENT_F, + DPCode.TEMPCURRENT, + ), + hvac_mode_dp=(DPCode.SYSTEMMODE, DPCode.SWITCH, DPCode.MODE), + hvac_action_dp=(DPCode.WORK_STATE, DPCode.WORK_MODE, DPCode.WORK_STATUS), + preset_dp=DPCode.MODE, + fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED, DPCode.SPEED), + custom_configs=localtuya_climate( + hvac_mode_set={HVACMode.HEAT: True, HVACMode.OFF: False}, + temp_step=1, + actions_set={ + HVACAction.HEATING: True, + HVACAction.IDLE: False, + }, + unit=UNIT_C, + values_precsion=0.1, + target_precision=0.1, + ), + ), + ), + # Thermostatic Radiator Valve + # Not documented + "wkf": ( + LocalTuyaEntity( + id=(DPCode.SWITCH, DPCode.MODE), + target_temperature_dp=(DPCode.TEMP_SET, DPCode.TEMP_SET_F), + current_temperature_dp=( + DPCode.TEMP_CURRENT, + DPCode.TEMP_CURRENT_F, + DPCode.TEMPCURRENT, + ), + hvac_mode_dp=(DPCode.SYSTEMMODE, DPCode.MODE), + hvac_action_dp=(DPCode.WORK_STATE, DPCode.WORK_MODE, DPCode.WORK_STATUS), + preset_dp=DPCode.MODE, + fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED, DPCode.SPEED), + custom_configs=localtuya_climate( + hvac_mode_set={ + HVACMode.HEAT: "manual", + HVACMode.AUTO: "auto", + }, + temp_step=1, + actions_set={HVACAction.HEATING: "opened", HVACAction.IDLE: "closed"}, + unit=UNIT_C, + values_precsion=0.1, + target_precision=0.1, + ), + ), + ), +} diff --git a/custom_components/localtuya/core/ha_entities/covers.py b/custom_components/localtuya/core/ha_entities/covers.py new file mode 100644 index 00000000..3c926870 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/covers.py @@ -0,0 +1,142 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import DPCode, LocalTuyaEntity, CONF_DEVICE_CLASS, EntityCategory +from homeassistant.components.cover import CoverDeviceClass + +# from const.py this is temporarily. +CONF_COMMANDS_SET = "commands_set" +CONF_POSITIONING_MODE = "positioning_mode" +CONF_CURRENT_POSITION_DP = "current_position_dp" +CONF_SET_POSITION_DP = "set_position_dp" +CONF_POSITION_INVERTED = "position_inverted" + + +def localtuya_cover(cmd_set, position_mode=None, inverted=False): + """Define localtuya cover configs""" + data = { + CONF_COMMANDS_SET: cmd_set, + CONF_POSITIONING_MODE: position_mode, + CONF_POSITION_INVERTED: inverted, + } + return data + + +COVERS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Curtain + # Note: Multiple curtains isn't documented + # https://developer.tuya.com/en/docs/iot/categorycl?id=Kaiuz1hnpo7df + "cl": ( + LocalTuyaEntity( + id=DPCode.CONTROL, + name="Curtain", + custom_configs=localtuya_cover("open_close_stop", "position"), + current_state=DPCode.SITUATION_SET, + current_position_dp=(DPCode.PERCENT_STATE, DPCode.PERCENT_CONTROL), + set_position_dp=DPCode.PERCENT_CONTROL, + ), + LocalTuyaEntity( + id=DPCode.CONTROL_2, + name="Curtain 2", + custom_configs=localtuya_cover("open_close_stop", "position"), + current_position_dp=(DPCode.PERCENT_STATE_2, DPCode.PERCENT_CONTROL_2), + set_position_dp=DPCode.PERCENT_CONTROL_2, + device_class=CoverDeviceClass.CURTAIN, + ), + LocalTuyaEntity( + id=DPCode.CONTROL_3, + name="Curtain 3", + custom_configs=localtuya_cover("open_close_stop", "position"), + current_position_dp=(DPCode.PERCENT_STATE_3, DPCode.PERCENT_CONTROL_3), + set_position_dp=DPCode.PERCENT_CONTROL_3, + device_class=CoverDeviceClass.CURTAIN, + ), + LocalTuyaEntity( + id=DPCode.CONTROL_4, + name="Curtain 4", + custom_configs=localtuya_cover("open_close_stop", "position"), + current_position_dp=(DPCode.PERCENT_STATE_4, DPCode.PERCENT_CONTROL_4), + set_position_dp=DPCode.PERCENT_CONTROL_4, + device_class=CoverDeviceClass.CURTAIN, + ), + LocalTuyaEntity( + id=DPCode.MACH_OPERATE, + name="Curtain", + custom_configs=localtuya_cover("fz_zz_stop", "position"), + current_position_dp=DPCode.POSITION, + set_position_dp=DPCode.POSITION, + device_class=CoverDeviceClass.CURTAIN, + ), + # switch_1 is an undocumented code that behaves identically to control + # It is used by the Kogan Smart Blinds Driver + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="Blind", + custom_configs=localtuya_cover("open_close_stop", "position"), + current_position_dp=DPCode.PERCENT_CONTROL, + set_position_dp=DPCode.PERCENT_CONTROL, + device_class=CoverDeviceClass.BLIND, + ), + ), + # Garage Door Opener + # https://developer.tuya.com/en/docs/iot/categoryckmkzq?id=Kaiuz0ipcboee + "ckmkzq": ( + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="Door", + custom_configs=localtuya_cover("open_close_stop", "position", True), + current_state=DPCode.DOORCONTACT_STATE, + device_class=CoverDeviceClass.GARAGE, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_2, + name="Door 2", + custom_configs=localtuya_cover("open_close_stop", "position", True), + current_state=DPCode.DOORCONTACT_STATE_2, + device_class=CoverDeviceClass.GARAGE, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_3, + name="Door 3", + custom_configs=localtuya_cover("open_close_stop", "position", True), + current_state=DPCode.DOORCONTACT_STATE_3, + device_class=CoverDeviceClass.GARAGE, + ), + ), + # Curtain Switch + # https://developer.tuya.com/en/docs/iot/category-clkg?id=Kaiuz0gitil39 + "clkg": ( + LocalTuyaEntity( + id=DPCode.CONTROL, + name="Curtain", + custom_configs=localtuya_cover("open_close_stop", "position"), + current_position_dp=DPCode.PERCENT_CONTROL, + set_position_dp=DPCode.PERCENT_CONTROL, + device_class=CoverDeviceClass.CURTAIN, + ), + LocalTuyaEntity( + id=DPCode.CONTROL_2, + name="Curtain 2", + custom_configs=localtuya_cover("open_close_stop", "position"), + current_position_dp=DPCode.PERCENT_CONTROL_2, + set_position_dp=DPCode.PERCENT_CONTROL_2, + device_class=CoverDeviceClass.CURTAIN, + ), + ), + # Curtain Robot + # Note: Not documented + "jdcljqr": ( + LocalTuyaEntity( + id=DPCode.CONTROL, + name="Curtain", + custom_configs=localtuya_cover("open_close_stop", "position"), + current_position_dp=DPCode.PERCENT_STATE, + set_position_dp=DPCode.PERCENT_CONTROL, + device_class=CoverDeviceClass.CURTAIN, + ), + ), +} diff --git a/custom_components/localtuya/core/ha_entities/fans.py b/custom_components/localtuya/core/ha_entities/fans.py new file mode 100644 index 00000000..7ae8885a --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/fans.py @@ -0,0 +1,87 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import ( + DPCode, + LocalTuyaEntity, + CONF_DEVICE_CLASS, + EntityCategory, + CLOUD_VALUE, +) +from homeassistant.components.fan import DIRECTION_FORWARD, DIRECTION_REVERSE + +# from const.py this is temporarily +CONF_FAN_SPEED_CONTROL = "fan_speed_control" +CONF_FAN_OSCILLATING_CONTROL = "fan_oscillating_control" +CONF_FAN_DIRECTION = "fan_direction" + +CONF_FAN_SPEED_MIN = "fan_speed_min" +CONF_FAN_SPEED_MAX = "fan_speed_max" +CONF_FAN_DIRECTION_FWD = "fan_direction_forward" +CONF_FAN_DIRECTION_REV = "fan_direction_reverse" +CONF_FAN_DPS_TYPE = "fan_dps_type" +CONF_FAN_ORDERED_LIST = "fan_speed_ordered_list" + +FAN_SPEED_DP = ( + DPCode.FAN_SPEED_PERCENT, + DPCode.FAN_SPEED, + DPCode.SPEED, + DPCode.FAN_SPEED_ENUM, +) + +FANS_OSCILLATING = (DPCode.SWITCH_HORIZONTAL, DPCode.SWITCH_VERTICAL) + + +def localtuya_fan(fwd, rev, min_speed, max_speed, order, dp_type): + """Define localtuya fan configs""" + data = { + CONF_FAN_DIRECTION_FWD: fwd, + CONF_FAN_DIRECTION_REV: rev, + CONF_FAN_SPEED_MIN: CLOUD_VALUE(min_speed, CONF_FAN_SPEED_CONTROL, "min"), + CONF_FAN_SPEED_MAX: CLOUD_VALUE(max_speed, CONF_FAN_SPEED_CONTROL, "max"), + CONF_FAN_ORDERED_LIST: CLOUD_VALUE(order, CONF_FAN_SPEED_CONTROL, "range", str), + CONF_FAN_DPS_TYPE: dp_type, + } + return data + + +FANS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Fan + "fs": ( + LocalTuyaEntity( + id=(DPCode.SWITCH_FAN, DPCode.FAN_SWITCH, DPCode.SWITCH), + name="Fan", + icon="mdi:fan", + fan_speed_control=FAN_SPEED_DP, + fan_direction=DPCode.FAN_DIRECTION, + fan_oscillating_control=FANS_OSCILLATING, + custom_configs=localtuya_fan( + DIRECTION_FORWARD, DIRECTION_REVERSE, 1, 100, "disabled", "int" + ), + ), + ), + # Normal switch with fan controller. + "tdq": ( + LocalTuyaEntity( + id=(DPCode.SWITCH_FAN, DPCode.FAN_SWITCH), + name="Fan", + icon="mdi:fan", + fan_speed_control=FAN_SPEED_DP, + fan_direction=DPCode.FAN_DIRECTION, + fan_oscillating_control=FANS_OSCILLATING, + custom_configs=localtuya_fan( + DIRECTION_FORWARD, DIRECTION_REVERSE, 1, 100, "disabled", "int" + ), + ), + ), +} +# Fan with Light +FANS["fsd"] = FANS["fs"] +# Fan wall switch +FANS["fskg"] = FANS["fs"] +# Air Purifier +FANS["kj"] = FANS["fs"] diff --git a/custom_components/localtuya/core/ha_entities/humidifiers.py b/custom_components/localtuya/core/ha_entities/humidifiers.py new file mode 100644 index 00000000..293980ba --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/humidifiers.py @@ -0,0 +1,84 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import ( + DPCode, + LocalTuyaEntity, + CONF_DEVICE_CLASS, + EntityCategory, + CLOUD_VALUE, +) +from homeassistant.components.humidifier import ( + HumidifierDeviceClass, + ATTR_MAX_HUMIDITY, + ATTR_MIN_HUMIDITY, + DEFAULT_MAX_HUMIDITY, + DEFAULT_MIN_HUMIDITY, +) + +CONF_HUMIDIFIER_SET_HUMIDITY_DP = "humidifier_set_humidity_dp" +CONF_HUMIDIFIER_CURRENT_HUMIDITY_DP = "humidifier_current_humidity_dp" +CONF_HUMIDIFIER_MODE_DP = "humidifier_mode_dp" +CONF_HUMIDIFIER_AVAILABLE_MODES = "humidifier_available_modes" + + +def localtuya_humidifier(modes): + """Define localtuya fan configs""" + + data = { + CONF_HUMIDIFIER_AVAILABLE_MODES: CLOUD_VALUE( + modes, CONF_HUMIDIFIER_MODE_DP, "range", dict + ), + ATTR_MIN_HUMIDITY: CLOUD_VALUE( + DEFAULT_MIN_HUMIDITY, CONF_HUMIDIFIER_SET_HUMIDITY_DP, "min" + ), + ATTR_MAX_HUMIDITY: CLOUD_VALUE( + DEFAULT_MAX_HUMIDITY, CONF_HUMIDIFIER_SET_HUMIDITY_DP, "max" + ), + } + return data + + +HUMIDIFIERS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Dehumidifier + # https://developer.tuya.com/en/docs/iot/categorycs?id=Kaiuz1vcz4dha + "cs": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + humidifier_current_humidity_dp=DPCode.HUMIDITY_INDOOR, + humidifier_set_humidity_dp=DPCode.DEHUMIDITY_SET_VALUE, + humidifier_mode_dp=(DPCode.MODE, DPCode.WORK_MODE), + custom_configs=localtuya_humidifier( + { + "dehumidify": "Dehumidify", + "drying": "Drying", + "continuous": "Continuous", + } + ), + device_class=HumidifierDeviceClass.DEHUMIDIFIER, + ), + ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b + "jsq": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + humidifier_current_humidity_dp=DPCode.HUMIDITY_CURRENT, + humidifier_set_humidity_dp=DPCode.HUMIDITY_SET, + humidifier_mode_dp=(DPCode.MODE, DPCode.WORK_MODE), + custom_configs=localtuya_humidifier( + { + "large": "Large", + "middle": "Middle", + "small": "Small", + } + ), + device_class=HumidifierDeviceClass.HUMIDIFIER, + ), + ), +} diff --git a/custom_components/localtuya/core/ha_entities/lights.py b/custom_components/localtuya/core/ha_entities/lights.py new file mode 100644 index 00000000..dfc580b9 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/lights.py @@ -0,0 +1,423 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from typing import Any +from .base import DPCode, LocalTuyaEntity, EntityCategory, CLOUD_VALUE +from homeassistant.const import CONF_BRIGHTNESS, CONF_COLOR_TEMP, CONF_SCENE + +from ...const import ( + CONF_BRIGHTNESS_LOWER, + CONF_BRIGHTNESS_UPPER, + CONF_COLOR_TEMP_MIN_KELVIN, + CONF_COLOR_TEMP_MAX_KELVIN, + CONF_COLOR_TEMP_REVERSE, + CONF_MUSIC_MODE, +) + + +def localtuya_light( + lower=29, upper=1000, min_kv=2700, max_kv=6500, temp_reverse=False, music_mode=False +) -> dict[str, Any | CLOUD_VALUE]: + """Define localtuya light configs""" + data = { + CONF_BRIGHTNESS_LOWER: CLOUD_VALUE(lower, CONF_BRIGHTNESS, "min"), + CONF_BRIGHTNESS_UPPER: CLOUD_VALUE(upper, CONF_BRIGHTNESS, "max"), + CONF_COLOR_TEMP_MIN_KELVIN: min_kv, # CLOUD_VALUE(min_kv, CONF_COLOR_TEMP, "min") + CONF_COLOR_TEMP_MAX_KELVIN: max_kv, # CLOUD_VALUE(max_kv, CONF_COLOR_TEMP, "max") + CONF_COLOR_TEMP_REVERSE: temp_reverse, + CONF_MUSIC_MODE: music_mode, + } + + return data + + +LIGHTS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Curtain Switch + # https://developer.tuya.com/en/docs/iot/category-clkg?id=Kaiuz0gitil39 + "clkg": ( + LocalTuyaEntity( + id=DPCode.SWITCH_BACKLIGHT, + name="State light", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # String Lights + # https://developer.tuya.com/en/docs/iot/dc?id=Kaof7taxmvadu + "dc": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color_temp=DPCode.TEMP_VALUE, + color=DPCode.COLOUR_DATA, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Strip Lights + # https://developer.tuya.com/en/docs/iot/dd?id=Kaof804aibg2l + "dd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE), + color_temp=(DPCode.TEMP_VALUE_V2, DPCode.TEMP_VALUE), + color=(DPCode.COLOUR_DATA_V2, DPCode.COLOUR_DATA), + scene=(DPCode.SCENE_DATA_V2, DPCode.SCENE_DATA), + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + # default_color_type=DEFAULT_COLOR_TYPE_DATA_V2, + ), + ), + # Light + # https://developer.tuya.com/en/docs/iot/categorydj?id=Kaiuyzy3eheyy + "dj": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE), + color_temp=(DPCode.TEMP_VALUE_V2, DPCode.TEMP_VALUE), + color=(DPCode.COLOUR_DATA_V2, DPCode.COLOUR_DATA), + scene=(DPCode.SCENE_DATA_V2, DPCode.SCENE_DATA), + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, True), + ), + # Not documented + # Based on multiple reports: manufacturer customized Dimmer 2 switches + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="light", + brightness=DPCode.BRIGHT_VALUE_1, + ), + ), + # Ceiling Fan Light + # https://developer.tuya.com/en/docs/iot/fsd?id=Kaof8eiei4c2v + "fsd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color_temp=DPCode.TEMP_VALUE, + color=DPCode.COLOUR_DATA, + scene=(DPCode.SCENE_DATA, DPCode.SCENE_DATA_V2), + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + # Some ceiling fan lights use LIGHT for DPCode instead of SWITCH_LED + LocalTuyaEntity( + id=DPCode.LIGHT, + name=None, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Fan Switch + "fskg": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name="Light", + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color_temp=DPCode.TEMP_VALUE, + color=DPCode.COLOUR_DATA, + scene=(DPCode.SCENE_DATA, DPCode.SCENE_DATA_V2), + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + # Some ceiling fan lights use LIGHT for DPCode instead of SWITCH_LED + LocalTuyaEntity( + id=DPCode.LIGHT, + name=None, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Ambient Light + # https://developer.tuya.com/en/docs/iot/ambient-light?id=Kaiuz06amhe6g + "fwd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color_temp=DPCode.TEMP_VALUE, + color=DPCode.COLOUR_DATA, + scene=(DPCode.SCENE_DATA, DPCode.SCENE_DATA_V2), + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Motion Sensor Light + # https://developer.tuya.com/en/docs/iot/gyd?id=Kaof8a8hycfmy + "gyd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color_temp=DPCode.TEMP_VALUE, + color=DPCode.COLOUR_DATA, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Humidifier Light + # https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b + "jsq": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color=DPCode.COLOUR_DATA_HSV, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Switch + # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s + "kg": ( + LocalTuyaEntity( + id=DPCode.SWITCH_BACKLIGHT, + name="State light", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Air Purifier + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46h2s6dzm + "kj": ( + LocalTuyaEntity( + id=DPCode.LIGHT, + name="State light", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Air conditioner + # https://developer.tuya.com/en/docs/iot/categorykt?id=Kaiuz0z71ov2n + "kt": ( + LocalTuyaEntity( + id=DPCode.LIGHT, + name="State light", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Unknown light product + # Found as VECINO RGBW as provided by diagnostics + # Not documented + "mbd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color=DPCode.COLOUR_DATA, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Unknown product with light capabilities + # Fond in some diffusers, plugs and PIR flood lights + # Not documented + "qjdcz": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color=DPCode.COLOUR_DATA, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Heater + # https://developer.tuya.com/en/docs/iot/categoryqn?id=Kaiuz18kih0sm + "qn": ( + LocalTuyaEntity( + id=DPCode.LIGHT, + name="State light", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Smart Camera + # https://developer.tuya.com/en/docs/iot/categorysp?id=Kaiuz35leyo12 + "sp": ( + LocalTuyaEntity( + id=DPCode.FLOODLIGHT_SWITCH, + brightness=DPCode.FLOODLIGHT_LIGHTNESS, + name="Floodlight", + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.BASIC_INDICATOR, + name="Indicator light", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Dimmer Switch + # https://developer.tuya.com/en/docs/iot/categorytgkg?id=Kaiuz0ktx7m0o + "tgkg": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED_1, + brightness=DPCode.BRIGHT_VALUE_1, + brightness_upper=DPCode.BRIGHTNESS_MAX_1, + brightness_lower=DPCode.BRIGHTNESS_MIN_1, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.SWITCH_LED_2, + name="Light 2", + brightness=DPCode.BRIGHT_VALUE_2, + brightness_upper=DPCode.BRIGHTNESS_MAX_2, + brightness_lower=DPCode.BRIGHTNESS_MIN_2, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.SWITCH_LED_3, + name="Light 3", + brightness=DPCode.BRIGHT_VALUE_3, + brightness_upper=DPCode.BRIGHTNESS_MAX_3, + brightness_lower=DPCode.BRIGHTNESS_MIN_3, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Dimmer + # https://developer.tuya.com/en/docs/iot/tgq?id=Kaof8ke9il4k4 + "tgq": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE), + brightness_upper=DPCode.BRIGHTNESS_MAX_1, + brightness_lower=DPCode.BRIGHTNESS_MIN_1, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.SWITCH_LED_1, + name="Light 1", + brightness=DPCode.BRIGHT_VALUE_1, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.SWITCH_LED_2, + name="Light 2", + brightness=DPCode.BRIGHT_VALUE_2, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.SWITCH_LED_3, + name="Light 3", + brightness=DPCode.BRIGHT_VALUE_3, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.SWITCH_LED_4, + name="Light 4", + brightness=DPCode.BRIGHT_VALUE_4, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Wake Up Light II + # Not documented + "hxd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name="light", + brightness=(DPCode.BRIGHT_VALUE_V2, DPCode.BRIGHT_VALUE), + brightness_upper=DPCode.BRIGHTNESS_MAX_1, + brightness_lower=DPCode.BRIGHTNESS_MIN_1, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Solar Light + # https://developer.tuya.com/en/docs/iot/tynd?id=Kaof8j02e1t98 + "tyndj": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color_temp=DPCode.TEMP_VALUE, + color=DPCode.COLOUR_DATA, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Ceiling Light + # https://developer.tuya.com/en/docs/iot/ceiling-light?id=Kaiuz03xxfc4r + "xdd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color_temp=DPCode.TEMP_VALUE, + color=DPCode.COLOUR_DATA, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.SWITCH_NIGHT_LIGHT, + name="night_light", + ), + ), + # Remote Control + # https://developer.tuya.com/en/docs/iot/ykq?id=Kaof8ljn81aov + "ykq": ( + LocalTuyaEntity( + id=DPCode.SWITCH_CONTROLLER, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_CONTROLLER, + color_temp=DPCode.TEMP_CONTROLLER, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), + # Fan + # https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c + "fs": ( + LocalTuyaEntity( + id=DPCode.LIGHT, + name=None, + color_mode=DPCode.WORK_MODE, + brightness=DPCode.BRIGHT_VALUE, + color_temp=DPCode.TEMP_VALUE, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + LocalTuyaEntity( + id=DPCode.SWITCH_LED, + name="light_2", + brightness=DPCode.BRIGHT_VALUE_1, + custom_configs=localtuya_light(29, 1000, 2700, 6500, False, False), + ), + ), +} + +# HDMI Sync Box A1 +LIGHTS["hdmipmtbq"] = ( + *LIGHTS["tgkg"], + *LIGHTS["dj"], +) + +# Dimmer +LIGHTS["tdq"] = LIGHTS["tgkg"] + +# Scene Switch +# https://developer.tuya.com/en/docs/iot/f?id=K9gf7nx6jelo8 +LIGHTS["cjkg"] = LIGHTS["tgkg"] + +# Wireless Switch # also can come as knob switch. +# https://developer.tuya.com/en/docs/iot/wxkg?id=Kbeo9t3ryuqm5 +LIGHTS["wxkg"] = LIGHTS["tgkg"] + + +# Socket (duplicate of `kg`) +# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s +LIGHTS["cz"] = LIGHTS["kg"] + +# Power Socket (duplicate of `kg`) +# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s +LIGHTS["pc"] = LIGHTS["kg"] + +# Dehumidifier +# https://developer.tuya.com/en/docs/iot/categorycs?id=Kaiuz1vcz4dha +LIGHTS["cs"] = LIGHTS["jsq"] diff --git a/custom_components/localtuya/core/ha_entities/locks.py b/custom_components/localtuya/core/ha_entities/locks.py new file mode 100644 index 00000000..ce2490a5 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/locks.py @@ -0,0 +1,32 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import ( + DPCode, + LocalTuyaEntity, +) + + +def localtuya_lock(): + """Define localtuya lock configs""" + data = {} + return data + + +LOCKS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Locks + "ms": ( + LocalTuyaEntity( + id=(DPCode.REMOTE_UNLOCK_SWITCH, DPCode.SWITCH), + jammed_dp=DPCode.HIJACK, + lock_state_dp=(DPCode.CLOSED_OPENED, DPCode.OPEN_CLOSE), + ), + ), +} + +LOCKS["jtmspro"] = LOCKS["ms"] +LOCKS["jtmsbh"] = LOCKS["ms"] diff --git a/custom_components/localtuya/core/ha_entities/numbers.py b/custom_components/localtuya/core/ha_entities/numbers.py new file mode 100644 index 00000000..e0f17a8b --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/numbers.py @@ -0,0 +1,951 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from homeassistant.components.number import NumberDeviceClass +from homeassistant.const import ( + PERCENTAGE, + UnitOfTime, + UnitOfPower, + UnitOfTemperature, + CONF_UNIT_OF_MEASUREMENT, + UnitOfLength, +) + +from .base import DPCode, LocalTuyaEntity, EntityCategory, CLOUD_VALUE +from ...const import CONF_MIN_VALUE, CONF_MAX_VALUE, CONF_STEPSIZE, CONF_SCALING + + +def localtuya_numbers(_min, _max, _step=1, _scale=1, unit=None) -> dict: + """Will return dict with CONF MIN AND CONF MAX, scale 1 is default, 1=1""" + data = { + CONF_MIN_VALUE: CLOUD_VALUE(_min, "id", "min"), + CONF_MAX_VALUE: CLOUD_VALUE(_max, "id", "max"), + CONF_STEPSIZE: CLOUD_VALUE(_step, "id", "step"), + CONF_SCALING: CLOUD_VALUE(_scale, "id", "scale"), + } + + if unit: + data.update({CONF_UNIT_OF_MEASUREMENT: unit}) + + return data + + +NUMBERS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Smart panel with switches and zigbee hub ? + # Not documented + "dgnzk": ( + LocalTuyaEntity( + id=DPCode.VOICE_VOL, + name="Volume", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 100), + icon="mdi:volume-equal", + ), + LocalTuyaEntity( + id=DPCode.PLAY_TIME, + name="Play time", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 7200, unit=UnitOfTime.SECONDS), + icon="mdi:motion-play-outline", + ), + LocalTuyaEntity( + id=DPCode.BASS_CONTROL, + name="Bass", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 15), + icon="mdi:speaker", + ), + LocalTuyaEntity( + id=DPCode.TREBLE_CONTROL, + name="Treble", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 15), + icon="mdi:music-clef-treble", + ), + ), + # Multi-functional Sensor + # https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3 + "dgnbj": ( + LocalTuyaEntity( + id=DPCode.ALARM_TIME, + name="Time", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 60), + ), + ), + # Smart Kettle + # https://developer.tuya.com/en/docs/iot/fbh?id=K9gf484m21yq7 + "bh": ( + LocalTuyaEntity( + id=DPCode.TEMP_SET, + name="Temperature", + device_class=NumberDeviceClass.TEMPERATURE, + icon="mdi:thermometer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 100), + ), + LocalTuyaEntity( + id=DPCode.TEMP_SET_F, + name="Temperature", + device_class=NumberDeviceClass.TEMPERATURE, + icon="mdi:thermometer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(32, 212), + ), + LocalTuyaEntity( + id=DPCode.TEMP_BOILING_C, + name="Temperature After Boiling", + device_class=NumberDeviceClass.TEMPERATURE, + icon="mdi:thermometer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 100), + ), + LocalTuyaEntity( + id=DPCode.TEMP_BOILING_F, + name="Temperature After Boiling", + device_class=NumberDeviceClass.TEMPERATURE, + icon="mdi:thermometer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(32, 212), + ), + LocalTuyaEntity( + id=DPCode.WARM_TIME, + name="Heat preservation time", + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 360), + ), + ), + # Smart Pet Feeder + # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld + "cwwsq": ( + LocalTuyaEntity( + id=DPCode.MANUAL_FEED, + name="Feed", + icon="mdi:bowl", + custom_configs=localtuya_numbers(1, 12), + ), + LocalTuyaEntity( + id=DPCode.VOICE_TIMES, + name="Voice prompt", + icon="mdi:microphone", + custom_configs=localtuya_numbers(0, 10), + ), + ), + # Light + # https://developer.tuya.com/en/docs/iot/categorydj?id=Kaiuyzy3eheyy + "dj": ( + LocalTuyaEntity( + id=DPCode.COUNTDOWN_1, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Light 1 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_2, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Light 2 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_3, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Light 3 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_4, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Light 4 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + ), + # Human Presence Sensor + # https://developer.tuya.com/en/docs/iot/categoryhps?id=Kaiuz42yhn1hs + "hps": ( + LocalTuyaEntity( + id=DPCode.SENSITIVITY, + name="sensitivity", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 9), + ), + LocalTuyaEntity( + id=DPCode.NEAR_DETECTION, + name="Near Detection CM", + icon="mdi:signal-distance-variant", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 1000), + ), + LocalTuyaEntity( + id=DPCode.FAR_DETECTION, + name="Far Detection CM", + icon="mdi:signal-distance-variant", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 1000), + ), + ), + # Coffee maker + # https://developer.tuya.com/en/docs/iot/categorykfj?id=Kaiuz2p12pc7f + "kfj": ( + LocalTuyaEntity( + id=DPCode.WATER_SET, + name="Water Level", + icon="mdi:cup-water", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 500), + ), + LocalTuyaEntity( + id=DPCode.TEMP_SET, + name="Temperature", + device_class=NumberDeviceClass.TEMPERATURE, + icon="mdi:thermometer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 100), + ), + LocalTuyaEntity( + id=DPCode.WARM_TIME, + name="Heat preservation time", + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 1440), + ), + LocalTuyaEntity( + id=DPCode.POWDER_SET, + name="Powder", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 24), + ), + ), + # Switch + # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s + "kg": ( + LocalTuyaEntity( + id=DPCode.COUNTDOWN_1, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Switch 1 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_2, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Switch 2 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_3, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Switch 3 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_4, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Switch 4 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_5, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Switch 5 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_6, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Switch 6 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_USB1, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="USB1 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_USB2, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="USB2 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_USB3, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="USB3 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_USB4, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="USB4 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_USB5, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="USB5 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_USB6, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="USB6 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Switch Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_USB, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Switch Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + # CZ - Energy monitor? + LocalTuyaEntity( + id=DPCode.WARN_POWER, + icon="mdi:alert-outline", + entity_category=EntityCategory.CONFIG, + name="Power Wanring Limit", + custom_configs=localtuya_numbers(0, 50000, 1, 1, UnitOfPower.WATT), + ), + LocalTuyaEntity( + id=DPCode.WARN_POWER1, + icon="mdi:alert-outline", + entity_category=EntityCategory.CONFIG, + name="Power 1 Wanring Limit", + custom_configs=localtuya_numbers(0, 50000, 1, 1, UnitOfPower.WATT), + ), + LocalTuyaEntity( + id=DPCode.WARN_POWER2, + icon="mdi:alert-outline", + entity_category=EntityCategory.CONFIG, + name="Power 2 Wanring Limit", + custom_configs=localtuya_numbers(0, 50000, 1, 1, UnitOfPower.WATT), + ), + LocalTuyaEntity( + id=DPCode.POWER_ADJUSTMENT, + icon="mdi:generator-mobile", + entity_category=EntityCategory.CONFIG, + name="Power Adjustment", + custom_configs=localtuya_numbers(20, 100, 1, 1, PERCENTAGE), + ), + # Fan "tdq" + LocalTuyaEntity( + id=DPCode.FAN_COUNTDOWN, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Fan Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.FAN_COUNTDOWN_2, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Fan 2 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.FAN_COUNTDOWN_3, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Fan 3 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.FAN_COUNTDOWN_4, + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + name="Fan 4 Timer", + custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS), + ), + ), + # Smart Lock + # https://developer.tuya.com/en/docs/iot/s?id=Kb0o2xhlkxbet + "mc": ( + LocalTuyaEntity( + id=( + DPCode.UNLOCK_APP, + DPCode.UNLOCK_FINGERPRINT, + DPCode.UNLOCK_CARD, + DPCode.UNLOCK_DYNAMIC, + DPCode.UNLOCK_TEMPORARY, + ), + name="Temporary Unlock", + icon="mdi:lock-open", + custom_configs=localtuya_numbers(0, 999, 1, 1, UnitOfTime.SECONDS), + ), + ), + # Sous Vide Cooker + # https://developer.tuya.com/en/docs/iot/categorymzj?id=Kaiuz2vy130ux + "mzj": ( + LocalTuyaEntity( + id=DPCode.COOK_TEMPERATURE, + name="Cooking temperature", + icon="mdi:thermometer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 500), + ), + LocalTuyaEntity( + id=DPCode.COOK_TIME, + name="Cooking time", + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 360, 1, 1, UnitOfTime.MINUTES), + ), + LocalTuyaEntity( + id=DPCode.CLOUD_RECIPE_NUMBER, + name="Cloud Recipes", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 999999), + ), + LocalTuyaEntity( + id=DPCode.APPOINTMENT_TIME, + name="Appointment time", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 360), + ), + ), + # PIR Detector + # https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80 + "pir": ( + LocalTuyaEntity( + id=DPCode.SENS, + icon="mdi:signal-distance-variant", + entity_category=EntityCategory.CONFIG, + name="Sensitivity", + custom_configs=localtuya_numbers(0, 4), + ), + LocalTuyaEntity( + id=DPCode.TIM, + icon="mdi:timer-10", + entity_category=EntityCategory.CONFIG, + name="Timer Duration", + custom_configs=localtuya_numbers(10, 900, 1, 1, UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=DPCode.LUX, + icon="mdi:brightness-6", + entity_category=EntityCategory.CONFIG, + name="Light level", + custom_configs=localtuya_numbers(0, 981, 1, 1, "lx"), + ), + LocalTuyaEntity( + id=DPCode.INTERVAL_TIME, + icon="mdi:timer-sand-complete", + entity_category=EntityCategory.CONFIG, + name="Interval", + custom_configs=localtuya_numbers(1, 720, 1, 1, UnitOfTime.MINUTES), + ), + ), + # Robot Vacuum + # https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo + "sd": ( + LocalTuyaEntity( + id=DPCode.VOLUME_SET, + name="volume", + icon="mdi:volume-high", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 100), + ), + ), + # Siren Alarm + # https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu + "sgbj": ( + LocalTuyaEntity( + id=(DPCode.ALARM_TIME, DPCode.ALARMPERIOD), + name="Alarm duration", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(1, 60), + ), + ), + # Smart Camera + # https://developer.tuya.com/en/docs/iot/categorysp?id=Kaiuz35leyo12 + "sp": ( + LocalTuyaEntity( + id=DPCode.BASIC_DEVICE_VOLUME, + name="volume", + icon="mdi:volume-high", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(1, 10), + ), + LocalTuyaEntity( + id=DPCode.FLOODLIGHT_LIGHTNESS, + name="Floodlight brightness", + icon="mdi:brightness-6", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(1, 100), + ), + ), + # Dimmer Switch + # https://developer.tuya.com/en/docs/iot/categorytgkg?id=Kaiuz0ktx7m0o + "tgkg": ( + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MIN_1, + name="minimum_brightness", + icon="mdi:lightbulb-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MAX_1, + name="maximum_brightness", + icon="mdi:lightbulb-on-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MIN_2, + name="minimum_brightness_2", + icon="mdi:lightbulb-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MAX_2, + name="maximum_brightness_2", + icon="mdi:lightbulb-on-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MIN_3, + name="minimum_brightness_3", + icon="mdi:lightbulb-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MAX_3, + name="maximum_brightness_3", + icon="mdi:lightbulb-on-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + ), + # Dimmer Switch + # https://developer.tuya.com/en/docs/iot/categorytgkg?id=Kaiuz0ktx7m0o + "tgq": ( + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MIN_1, + name="minimum_brightness", + icon="mdi:lightbulb-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MAX_1, + name="maximum_brightness", + icon="mdi:lightbulb-on-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MIN_2, + name="minimum_brightness_2", + icon="mdi:lightbulb-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + LocalTuyaEntity( + id=DPCode.BRIGHTNESS_MAX_2, + name="maximum_brightness_2", + icon="mdi:lightbulb-on-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(10, 1000), + ), + ), + # Vibration Sensor + # https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno + "zd": ( + LocalTuyaEntity( + id=DPCode.SENSITIVITY, + name="Sensitivity", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 9), + ), + ), + # Fingerbot + # arm_down_percent: "{\"min\":50,\"max\":100,\"scale\":0,\"step\":1}" + # arm_up_percent: "{\"min\":0,\"max\":50,\"scale\":0,\"step\":1}" + # click_sustain_time: "values": "{\"unit\":\"s\",\"min\":2,\"max\":10,\"scale\":0,\"step\":1}" + "szjqr": ( + LocalTuyaEntity( + id=DPCode.ARM_DOWN_PERCENT, + name="Move Down", + icon="mdi:arrow-down-bold", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(50, 100, 1, 1, PERCENTAGE), + ), + LocalTuyaEntity( + id=DPCode.ARM_UP_PERCENT, + name="Move UP", + icon="mdi:arrow-up-bold", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 50, 1, 1, PERCENTAGE), + ), + LocalTuyaEntity( + id=DPCode.CLICK_SUSTAIN_TIME, + name="Down Delay", + icon="mdi:timer", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(2, 10), + ), + ), + # Fan + # https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c + "fs": ( + LocalTuyaEntity( + id=DPCode.TEMP, + name="Temperature", + device_class=NumberDeviceClass.TEMPERATURE, + icon="mdi:thermometer-lines", + ), + ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b + "jsq": ( + LocalTuyaEntity( + id=DPCode.TEMP_SET, + name="Temperature", + device_class=NumberDeviceClass.TEMPERATURE, + icon="mdi:thermometer-lines", + custom_configs=localtuya_numbers(0, 50), + ), + LocalTuyaEntity( + id=DPCode.TEMP_SET_F, + name="Temperature", + device_class=NumberDeviceClass.TEMPERATURE, + icon="mdi:thermometer-lines", + custom_configs=localtuya_numbers(32, 212, 1), + ), + ), + # Thermostat + "wk": ( + LocalTuyaEntity( + id=DPCode.TEMPCOMP, + name="Calibration offset", + custom_configs=localtuya_numbers(-9, 9), + ), + LocalTuyaEntity( + id=DPCode.TEMPACTIVATE, + name="Calibration swing", + custom_configs=localtuya_numbers(1, 9), + ), + ), + # Temperature and Humidity Sensor + # https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34 + "wsdcg": ( + LocalTuyaEntity( + id=(DPCode.MAXTEMP_SET, DPCode.UPPER_TEMP, DPCode.UPPER_TEMP_F), + name="Max Temperature", + icon="mdi:thermometer-high", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(-200, 600, unit=UnitOfTemperature.CELSIUS), + ), + LocalTuyaEntity( + id=(DPCode.MINITEMP_SET, DPCode.LOWER_TEMP, DPCode.LOWER_TEMP_F), + name="Min Temperature", + icon="mdi:thermometer-low", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(-200, 600, unit=UnitOfTemperature.CELSIUS), + ), + LocalTuyaEntity( + id=(DPCode.MAXHUM_SET, DPCode.MAX_HUMI), + name="Max Humidity", + icon="mdi:water-percent", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 100, unit=PERCENTAGE), + ), + LocalTuyaEntity( + id=(DPCode.MINIHUM_SET, DPCode.MIN_HUMI), + name="Min Humidity", + icon="mdi:water-percent", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(0, 100, unit=PERCENTAGE), + ), + LocalTuyaEntity( + id=DPCode.TEMP_PERIODIC_REPORT, + name="Report Temperature Period", + icon="mdi:timer-sand", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(1, 120, unit=UnitOfTime.MINUTES), + ), + LocalTuyaEntity( + id=DPCode.HUM_PERIODIC_REPORT, + name="Report Humidity Period", + icon="mdi:timer-sand", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(1, 120, unit=UnitOfTime.MINUTES), + ), + LocalTuyaEntity( + id=DPCode.TEMP_SENSITIVITY, + name="Temperature Sensitivity", + icon="mdi:thermometer-lines", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(3, 20, unit=UnitOfTemperature.CELSIUS), + ), + LocalTuyaEntity( + id=DPCode.HUM_SENSITIVITY, + name="Humidity Sensitivity", + icon="mdi:water-opacity", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_numbers(3, 20, unit=PERCENTAGE), + ), + ), + # Alarm Host + # https://developer.tuya.com/en/docs/iot/categorymal?id=Kaiuz33clqxaf + "mal": ( + LocalTuyaEntity( + id=DPCode.DELAY_SET, + name="Delay Setting", + custom_configs=localtuya_numbers(0, 65535), + icon="mdi:clock-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.ALARM_TIME, + name="Duration", + custom_configs=localtuya_numbers(0, 65535), + icon="mdi:alarm", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.ALARM_DELAY_TIME, + name="Delay Alarm", + custom_configs=localtuya_numbers(0, 65535), + icon="mdi:history", + entity_category=EntityCategory.CONFIG, + ), + ), + # Air conditioner + # https://developer.tuya.com/en/docs/iot/categorykt?id=Kaiuz0z71ov2n + "kt": ( + LocalTuyaEntity( + id=DPCode.TIMER, + name="Timer", + custom_configs=localtuya_numbers(0, 24, unit=UnitOfTime.HOURS), + icon="mdi:timer-outline", + entity_category=EntityCategory.CONFIG, + ), + ), + # Smart Electricity Meter + # https://developer.tuya.com/en/docs/iot/smart-meter?id=Kaiuz4gv6ack7 + "zndb": ( + LocalTuyaEntity( + id=DPCode.ENERGY_A_CALIBRATION_FWD, + name="Energy A Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:lightning-bolt-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.ENERGY_B_CALIBRATION_FWD, + name="Energy A Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:lightning-bolt-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.ENERGY_C_CALIBRATION_FWD, + name="Energy A Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:lightning-bolt-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.ENERGY_A_CALIBRATION_REV, + name="Reverse Energy A Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:lightning-bolt-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.ENERGY_B_CALIBRATION_REV, + name="Reverse Energy B Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:lightning-bolt-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.ENERGY_C_CALIBRATION_REV, + name="Reverse Energy C Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:lightning-bolt-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.CURRENT_A_CALIBRATION, + name="Current A Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:power-cycle", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.CURRENT_B_CALIBRATION, + name="Current B Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:power-cycle", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.CURRENT_C_CALIBRATION, + name="Current C Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:power-cycle", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.POWER_A_CALIBRATION, + name="Power A Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:power-cycle", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.POWER_B_CALIBRATION, + name="Power B Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:power-cycle", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.POWER_C_CALIBRATION, + name="Power C Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:power-cycle", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.FREQ_CALIBRATION, + name="Frequency Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:sine-wave", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.VOLTAGE_COEF, + name="Voltage Calibrations", + custom_configs=localtuya_numbers(800, 1200), + icon="mdi:flash-triangle-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.REPORT_RATE_CONTROL, + name="Report Period", + custom_configs=localtuya_numbers(3, 60, unit=UnitOfTime.SECONDS), + icon="mdi:timer-sand", + entity_category=EntityCategory.CONFIG, + ), + ), + # Ultrasonic level sensor + "ywcgq": ( + LocalTuyaEntity( + id=DPCode.MAX_SET, + name="Maximum", + custom_configs=localtuya_numbers(0, 100, unit=PERCENTAGE), + icon="mdi:pan-top-right", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.MINI_SET, + name="Minimum", + custom_configs=localtuya_numbers(0, 100, unit=PERCENTAGE), + icon="mdi:pan-bottom-left", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.LIQUID_DEPTH_MAX, + name="Depth Maximum", + custom_configs=localtuya_numbers(100, 2400, unit=UnitOfLength.METERS), + icon="mdi:arrow-collapse-down", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.INSTALLATION_HEIGHT, + name="Installation Height", + custom_configs=localtuya_numbers( + 200, 2500, _scale=0.001, unit=UnitOfLength.METERS + ), + icon="mdi:table-row-height", + entity_category=EntityCategory.CONFIG, + ), + ), +} + +# Wireless Switch # also can come as knob switch. +# https://developer.tuya.com/en/docs/iot/wxkg?id=Kbeo9t3ryuqm5 +NUMBERS["wxkg"] = ( + LocalTuyaEntity( + id=DPCode.TEMP_VALUE, + name="Temperature", + icon="mdi:thermometer", + custom_configs=localtuya_numbers(0, 1000), + ), + *NUMBERS["kg"], +) + +# Water Valve +NUMBERS["sfkzq"] = NUMBERS["kg"] + +# Water Detector +# https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli +NUMBERS["sj"] = NUMBERS["wsdcg"] + +# Circuit Breaker +# https://developer.tuya.com/en/docs/iot/dlq?id=Kb0kidk9enyh8 +NUMBERS["dlq"] = NUMBERS["zndb"] + +# HDMI Sync Box A1 +NUMBERS["hdmipmtbq"] = NUMBERS["dj"] + +# Scene Switch +# https://developer.tuya.com/en/docs/iot/f?id=K9gf7nx6jelo8 +NUMBERS["cjkg"] = NUMBERS["kg"] + +NUMBERS["cz"] = NUMBERS["kg"] +NUMBERS["tdq"] = NUMBERS["kg"] +NUMBERS["pc"] = NUMBERS["kg"] + +# Locker +NUMBERS["bxx"] = NUMBERS["mc"] +NUMBERS["gyms"] = NUMBERS["mc"] +NUMBERS["jtmspro"] = NUMBERS["mc"] +NUMBERS["hotelms"] = NUMBERS["mc"] +NUMBERS["ms_category"] = NUMBERS["mc"] +NUMBERS["jtmsbh"] = NUMBERS["mc"] +NUMBERS["mk"] = NUMBERS["mc"] +NUMBERS["videolock"] = NUMBERS["mc"] +NUMBERS["photolock"] = NUMBERS["mc"] diff --git a/custom_components/localtuya/core/ha_entities/remotes.py b/custom_components/localtuya/core/ha_entities/remotes.py new file mode 100644 index 00000000..546ffed2 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/remotes.py @@ -0,0 +1,31 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import DPCode, LocalTuyaEntity + + +CONF_RECEIVE_DP = "receive_dp" + + +# def localtuya_remote(_): +# """Define localtuya fan configs""" +# data = {} +# return data + + +REMOTES: dict[str, tuple[LocalTuyaEntity, ...]] = { + # IR Remote + # not documented + "wnykq": ( + LocalTuyaEntity( + id=(DPCode.IR_SEND, DPCode.CONTROL), + receive_dp=(DPCode.IR_STUDY_CODE, DPCode.STUDY_CODE), + key_study_dp=DPCode.KEY_STUDY, + ), + ), +} diff --git a/custom_components/localtuya/core/ha_entities/selects.py b/custom_components/localtuya/core/ha_entities/selects.py new file mode 100644 index 00000000..84cbdddd --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/selects.py @@ -0,0 +1,1325 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import ( + DPCode, + LocalTuyaEntity, + CONF_DEVICE_CLASS, + EntityCategory, + CLOUD_VALUE, +) + +# from const.py this is temporarily. + +from ...select import CONF_OPTIONS as OPS_VALS + + +def localtuya_selector(options): + """Generate localtuya select configs""" + data = {OPS_VALS: CLOUD_VALUE(options, "id", "range", dict)} + return data + + +COUNT_DOWN = { + "cancel": "Disable", + "1": "1 Hour", + "2": "2 Hours", + "3": "3 Hours", + "4": "4 Hours", + "5": "5 Hours", + "6": "6 Hours", +} +COUNT_DOWN_HOURS = { + "off": "Disable", + "1h": "1 Hour", + "2h": "2 Hours", + "3h": "3 Hours", + "4h": "4 Hours", + "5h": "5 Hours", + "6h": "6 Hours", +} + +SELECTS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Smart panel with switches and zigbee hub ? + # Not documented + "dgnzk": ( + LocalTuyaEntity( + id=DPCode.SOURCE, + name="Source", + icon="mdi:volume-source", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "cloud": "Cloud", + "local": "Local", + "aux": "Aux", + "bluetooth": "Bluetooth", + } + ), + ), + LocalTuyaEntity( + id=DPCode.PLAY_MODE, + name="Mode", + icon="mdi:cog-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "order": "Order", + "repeat_all": "Repeat ALL", + "repeat_one": "Repeat one", + "random": "Random", + } + ), + ), + LocalTuyaEntity( + id=DPCode.SOUND_EFFECTS, + name="Sound Effects", + icon="mdi:sine-wave", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "normal": "Normal", + "pop": "Pop", + "opera": "Opera", + "classical": "Classical", + "jazz": "Jazz", + "rock": "Rock", + "folk": "Folk", + "heavy_metal": "Metal", + "hip_hop": "HipHop", + "wave": "Wave", + } + ), + ), + ), + # Multi-functional Sensor + # https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3 + "dgnbj": ( + LocalTuyaEntity( + id=DPCode.ALARM_VOLUME, + name="volume", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "low": "Low", + "middle": "Middle", + "high": "High", + "mute": "Mute", + } + ), + ), + LocalTuyaEntity( + id=DPCode.ALARM_RINGTONE, + name="Ringtone", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + } + ), + ), + ), + # Heater + "kt": ( + LocalTuyaEntity( + id=(DPCode.C_F, DPCode.TEMP_UNIT_CONVERT), + name="Temperature Unit", + custom_configs=localtuya_selector({"c": "Celsius", "f": "Fahrenheit"}), + ), + ), + # Heater + "rs": ( + LocalTuyaEntity( + id=(DPCode.C_F, DPCode.TEMP_UNIT_CONVERT), + name="Temperature Unit", + custom_configs=localtuya_selector({"c": "Celsius", "f": "Fahrenheit"}), + ), + LocalTuyaEntity( + id=DPCode.CRUISE_MODE, + name="Cruise mode", + custom_configs=localtuya_selector( + {"all_day": "Always", "water_control": "Water", "single_cruise": "Once"} + ), + ), + ), + # Coffee maker + # https://developer.tuya.com/en/docs/iot/categorykfj?id=Kaiuz2p12pc7f + "kfj": ( + LocalTuyaEntity( + id=DPCode.CUP_NUMBER, + name="Cups", + icon="mdi:numeric", + custom_configs=localtuya_selector( + { + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "10": "10", + "11": "11", + "12": "12", + } + ), + ), + LocalTuyaEntity( + id=DPCode.CONCENTRATION_SET, + name="Concentration", + icon="mdi:altimeter", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + {"regular": "REGULAR", "middle": "MIDDLE", "bold": "BOLD"} + ), + ), + LocalTuyaEntity( + id=DPCode.MATERIAL, + name="Material", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector({"bean": "BEAN", "powder": "POWDER"}), + ), + LocalTuyaEntity( + id=DPCode.MODE, + name="Mode", + icon="mdi:coffee", + custom_configs=localtuya_selector( + { + "espresso": "Espresso", + "americano": "Americano", + "machiatto": "Machiatto", + "caffe_latte": "Latte", + "caffe_mocha": "Mocha", + "cappuccino": "Cappuccino", + } + ), + ), + ), + # Switch + # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s + "kg": ( + LocalTuyaEntity( + id=DPCode.RELAY_STATUS, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior", + custom_configs=localtuya_selector( + {"power_on": "ON", "power_off": "OFF", "last": "Last State"} + ), + condition_contains_any=["power_on", "power_off", "last"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior", + custom_configs=localtuya_selector( + {"on": "ON", "off": "OFF", "memory": "Last State"} + ), + condition_contains_any=["on", "off", "memory"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior", + custom_configs=localtuya_selector( + {"0": "ON", "1": "OFF", "2": "Last State"} + ), + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_1, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 1", + custom_configs=localtuya_selector( + {"power_on": "ON", "power_off": "OFF", "last": "Last State"} + ), + condition_contains_any=["power_on", "power_off", "last"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_1, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 1", + custom_configs=localtuya_selector( + {"on": "ON", "off": "OFF", "memory": "Last State"} + ), + condition_contains_any=["on", "off", "memory"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_1, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 1", + custom_configs=localtuya_selector( + {"0": "ON", "1": "OFF", "2": "Last State"} + ), + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_2, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 2", + custom_configs=localtuya_selector( + {"power_on": "ON", "power_off": "OFF", "last": "Last State"} + ), + condition_contains_any=["power_on", "power_off", "last"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_2, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 2", + custom_configs=localtuya_selector( + {"on": "ON", "off": "OFF", "memory": "Last State"} + ), + condition_contains_any=["on", "off", "memory"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_2, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 2", + custom_configs=localtuya_selector( + {"0": "ON", "1": "OFF", "2": "Last State"} + ), + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_3, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 3", + custom_configs=localtuya_selector( + {"power_on": "ON", "power_off": "OFF", "last": "Last State"} + ), + condition_contains_any=["power_on", "power_off", "last"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_3, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 3", + custom_configs=localtuya_selector( + {"on": "ON", "off": "OFF", "memory": "Last State"} + ), + condition_contains_any=["on", "off", "memory"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_3, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 3", + custom_configs=localtuya_selector( + {"0": "ON", "1": "OFF", "2": "Last State"} + ), + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_4, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 4", + custom_configs=localtuya_selector( + {"power_on": "ON", "power_off": "OFF", "last": "Last State"} + ), + condition_contains_any=["power_on", "power_off", "last"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_4, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 4", + custom_configs=localtuya_selector( + {"on": "ON", "off": "OFF", "memory": "Last State"} + ), + condition_contains_any=["on", "off", "memory"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_4, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 4", + custom_configs=localtuya_selector( + {"0": "ON", "1": "OFF", "2": "Last State"} + ), + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_5, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 5", + custom_configs=localtuya_selector( + {"power_on": "ON", "power_off": "OFF", "last": "Last State"} + ), + condition_contains_any=["power_on", "power_off", "last"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_5, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 5", + custom_configs=localtuya_selector( + {"on": "ON", "off": "OFF", "memory": "Last State"} + ), + condition_contains_any=["on", "off", "memory"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_5, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 5", + custom_configs=localtuya_selector( + {"0": "ON", "1": "OFF", "2": "Last State"} + ), + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_6, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 6", + custom_configs=localtuya_selector( + {"power_on": "ON", "power_off": "OFF", "last": "Last State"} + ), + condition_contains_any=["power_on", "power_off", "last"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_6, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 6", + custom_configs=localtuya_selector( + {"on": "ON", "off": "OFF", "memory": "Last State"} + ), + condition_contains_any=["on", "off", "memory"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS_6, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior 6", + custom_configs=localtuya_selector( + {"0": "ON", "1": "OFF", "2": "Last State"} + ), + ), + LocalTuyaEntity( + id=DPCode.LIGHT_MODE, + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + {"relay": "State", "pos": "Position", "none": "OFF"} + ), + name="Light Mode", + ), + ), + # Heater + # https://developer.tuya.com/en/docs/iot/categoryqn?id=Kaiuz18kih0sm + "qn": ( + LocalTuyaEntity( + id=DPCode.LEVEL, + name="Temperature Level", + icon="mdi:thermometer-lines", + custom_configs=localtuya_selector( + {"1": "Level 1", "2": " Levell 2", "3": " Level 3"} + ), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN, + name="Set Countdown", + icon="mdi:timer-cog-outline", + custom_configs=localtuya_selector(COUNT_DOWN), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_SET, + name="Set Countdown", + icon="mdi:timer-cog-outline", + custom_configs=localtuya_selector(COUNT_DOWN_HOURS), + ), + ), + # Siren Alarm + # https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu + "sgbj": ( + LocalTuyaEntity( + id=DPCode.ALARM_VOLUME, + name="Volume", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + {"low": "LOW", "middle": "MIDDLE", "high": "HIGH", "mute": "MUTE"} + ), + ), + LocalTuyaEntity( + id=DPCode.ALARM_STATE, + name="State", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "alarm_sound": "Sound", + "alarm_light": "Light", + "alarm_sound_light": "Sound and Light", + "normal": "NNORMAL", + } + ), + ), + LocalTuyaEntity( + id=DPCode.BRIGHT_STATE, + name="Brightness", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + {"low": "LOW", "middle": "MIDDLE", "high": "HIGH", "strong": "MAX"} + ), + ), + LocalTuyaEntity( + id=DPCode.ALARM_SETTING, + name="Alarm Setting", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + {"0": "Setting 1", "0": "Setting 2", "2": "Setting 3", "3": "Setting 4"} + ), + ), + LocalTuyaEntity( + id=DPCode.ALARMTYPE, + name="Alarm Setting", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "10": "10", + "11": "11", + "12": "12", + } + ), + ), + ), + # Smart Camera + # https://developer.tuya.com/en/docs/iot/categorysp?id=Kaiuz35leyo12 + "sp": ( + LocalTuyaEntity( + id=DPCode.IPC_WORK_MODE, + entity_category=EntityCategory.CONFIG, + name="Working mode", + custom_configs=localtuya_selector({"0": "Low Power", "1": "Continuous"}), + ), + LocalTuyaEntity( + id=DPCode.DECIBEL_SENSITIVITY, + icon="mdi:volume-vibrate", + entity_category=EntityCategory.CONFIG, + name="Decibel Sensitivity", + custom_configs=localtuya_selector( + {"0": "Low Sensitivity", "1": "High Sensitivity"} + ), + ), + LocalTuyaEntity( + id=DPCode.RECORD_MODE, + icon="mdi:record-rec", + entity_category=EntityCategory.CONFIG, + name="Record Mode", + custom_configs=localtuya_selector( + {"1": "Record Events Only", "2": "Allways Record"} + ), + ), + LocalTuyaEntity( + id=DPCode.BASIC_NIGHTVISION, + icon="mdi:theme-light-dark", + entity_category=EntityCategory.CONFIG, + name="IR Night Vision", + custom_configs=localtuya_selector({"0": "Auto", "1": "OFF", "2": "ON"}), + ), + LocalTuyaEntity( + id=DPCode.BASIC_ANTI_FLICKER, + icon="mdi:image-outline", + entity_category=EntityCategory.CONFIG, + name="Anti-Flicker", + custom_configs=localtuya_selector( + {"0": "Disable", "1": "50 Hz", "2": "60 Hz"} + ), + ), + LocalTuyaEntity( + id=DPCode.MOTION_SENSITIVITY, + icon="mdi:motion-sensor", + entity_category=EntityCategory.CONFIG, + name="Motion Sensitivity", + custom_configs=localtuya_selector({"0": "Low", "1": "Medium", "2": "High"}), + ), + LocalTuyaEntity( + id=DPCode.PTZ_CONTROL, + icon="mdi:image-filter-tilt-shift", + entity_category=EntityCategory.CONFIG, + name="PTZ control", + custom_configs=localtuya_selector( + { + "0": "UP", + "1": "Upper Right", + "2": "Right", + "3": "Bottom Right", + "4": "Down", + "5": "Bottom Left", + "6": "Left", + "7": "Upper Left", + } + ), + ), + LocalTuyaEntity( + id=DPCode.FLIGHT_BRIGHT_MODE, + entity_category=EntityCategory.CONFIG, + name="Brightness mode", + custom_configs=localtuya_selector({"0": "Manual", "1": "Auto"}), + ), + LocalTuyaEntity( + id=DPCode.PIR_SENSITIVITY, + icon="mdi:ray-start-arrow", + entity_category=EntityCategory.CONFIG, + name="PIR Sensitivity", + custom_configs=localtuya_selector({"0": "Low", "1": "Medium", "2": "High"}), + ), + ), + # Dimmer Switch + # https://developer.tuya.com/en/docs/iot/categorytgkg?id=Kaiuz0ktx7m0o + "tgkg": ( + LocalTuyaEntity( + id=DPCode.RELAY_STATUS, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior", + custom_configs=localtuya_selector( + {"on": "ON", "off": "OFF", "memory": "Last State"} + ), + condition_contains_any=["on", "off", "memory"], + ), + LocalTuyaEntity( + id=DPCode.RELAY_STATUS, + icon="mdi:circle-double", + entity_category=EntityCategory.CONFIG, + name="Power-on behavior", + custom_configs=localtuya_selector( + {"0": "ON", "1": "OFF", "2": "Last State"} + ), + ), + LocalTuyaEntity( + id=DPCode.LIGHT_MODE, + entity_category=EntityCategory.CONFIG, + name="Light Mode", + custom_configs=localtuya_selector( + {"relay": "State", "pos": "Position", "none": "OFF"} + ), + ), + LocalTuyaEntity( + id=DPCode.LED_TYPE_1, + entity_category=EntityCategory.CONFIG, + name="Led Type 1", + custom_configs=localtuya_selector( + {"led": "Led", "incandescent": "Incandescent", "halogen": "Halogen"} + ), + ), + LocalTuyaEntity( + id=DPCode.LED_TYPE_2, + entity_category=EntityCategory.CONFIG, + name="Led Type 2", + custom_configs=localtuya_selector( + {"led": "Led", "incandescent": "Incandescent", "halogen": "Halogen"} + ), + ), + LocalTuyaEntity( + id=DPCode.LED_TYPE_3, + entity_category=EntityCategory.CONFIG, + name="Led Type 3", + custom_configs=localtuya_selector( + {"led": "Led", "incandescent": "Incandescent", "halogen": "Halogen"} + ), + ), + ), + # Dimmer + # https://developer.tuya.com/en/docs/iot/tgq?id=Kaof8ke9il4k4 + "tgq": ( + LocalTuyaEntity( + id=DPCode.LED_TYPE_1, + entity_category=EntityCategory.CONFIG, + name="Led Type 1", + custom_configs=localtuya_selector( + {"led": "Led", "incandescent": "Incandescent", "halogen": "Halogen"} + ), + ), + LocalTuyaEntity( + id=DPCode.LED_TYPE_2, + entity_category=EntityCategory.CONFIG, + name="Led Type 2", + custom_configs=localtuya_selector( + {"led": "Led", "incandescent": "Incandescent", "halogen": "Halogen"} + ), + ), + ), + # Fingerbot + "szjqr": ( + LocalTuyaEntity( + id=DPCode.MODE, + entity_category=EntityCategory.CONFIG, + name="Fingerbot Mode", + custom_configs=localtuya_selector( + {"click": "Click", "switch": "Switch", "toggle": "Toggle"} + ), + ), + ), + # Robot Vacuum + # https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo + "sd": ( + LocalTuyaEntity( + id=DPCode.CISTERN, + entity_category=EntityCategory.CONFIG, + icon="mdi:water-opacity", + name="Water Tank Adjustment", + custom_configs=localtuya_selector( + {"low": "Low", "middle": "Middle", "high": "High", "closed": "Closed"} + ), + ), + LocalTuyaEntity( + id=DPCode.COLLECTION_MODE, + entity_category=EntityCategory.CONFIG, + icon="mdi:air-filter", + name="Dust Collection Mode", + custom_configs=localtuya_selector( + {"small": "Small", "middle": "Middle", "large": "Large"} + ), + ), + LocalTuyaEntity( + id=DPCode.VOICE_LANGUAGE, + entity_category=EntityCategory.CONFIG, + icon="mdi:air-filter", + name="Dust Collection Mode", + custom_configs=localtuya_selector({"cn": "Chinese", "en": "English"}), + ), + LocalTuyaEntity( + id=DPCode.DIRECTION_CONTROL, + entity_category=EntityCategory.CONFIG, + icon="mdi:arrow-all", + name="Direction", + custom_configs=localtuya_selector( + { + "foward": "Forward", + "backward": "Backward", + "turn_left": "Left", + "turn_right": "Right", + "stop": "Stop", + } + ), + ), + LocalTuyaEntity( + id=DPCode.MODE, + entity_category=EntityCategory.CONFIG, + icon="mdi:layers-outline", + name="Mode", + custom_configs=localtuya_selector( + { + "standby": "StandBy", + "random": "Random", + "smart": "Smart", + "wallfollow": "Follow Wall", + "mop": "Mop", + "spiral": "Spiral", + "left_spiral": "Spiral Left", + "right_spiral": "Spiral Right", + "right_bow": "Bow Right", + "left_bow": "Bow Left", + "partial_bow": "Bow Partial", + "chargego": "Charge", + } + ), + ), + ), + # Fan + # https://developer.tuya.com/en/docs/iot/f?id=K9gf45vs7vkge + "fs": ( + LocalTuyaEntity( + id=DPCode.MODE, + entity_category=EntityCategory.CONFIG, + icon="mdi:cog", + name="Mode", + custom_configs=localtuya_selector( + {"sleep": "Sleep", "normal": "Normal", "nature": "Nature"} + ), + ), + LocalTuyaEntity( + id=DPCode.FAN_VERTICAL, + entity_category=EntityCategory.CONFIG, + icon="mdi:format-vertical-align-center", + name="Vertical swing", + custom_configs=localtuya_selector( + {"30": "30 Deg", "60": "60 Deg", "90": "90 Deg"} + ), + ), + LocalTuyaEntity( + id=DPCode.FAN_HORIZONTAL, + entity_category=EntityCategory.CONFIG, + icon="mdi:format-horizontal-align-center", + name="Horizontal swing", + custom_configs=localtuya_selector( + {"30": "30 Deg", "60": "60 Deg", "90": "90 Deg"} + ), + ), + LocalTuyaEntity( + id=DPCode.WORK_MODE, + entity_category=EntityCategory.CONFIG, + icon="mdi:ceiling-fan-light", + name="Light mode", + custom_configs=localtuya_selector( + {"white": "White", "colour": "Colour", "colourful": "Colourful"} + ), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + name="Countdown", + custom_configs=localtuya_selector(COUNT_DOWN), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_SET, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + name="Countdown", + custom_configs=localtuya_selector(COUNT_DOWN_HOURS), + ), + ), + # Curtain + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc + "cl": ( + LocalTuyaEntity( + id=(DPCode.CONTROL_BACK_MODE, DPCode.CONTROL_BACK), + name="Motor Direction", + entity_category=EntityCategory.CONFIG, + icon="mdi:swap-vertical", + custom_configs=localtuya_selector({"forward": "Forward", "back": "Back"}), + ), + LocalTuyaEntity( + id=DPCode.MOTOR_MODE, + name="Motor Mode", + entity_category=EntityCategory.CONFIG, + icon="mdi:cog-transfer", + custom_configs=localtuya_selector( + {"contiuation": "Auto", "point": "Manual"} + ), + ), + LocalTuyaEntity( + id=DPCode.MODE, + entity_category=EntityCategory.CONFIG, + name="Cover Mode", + custom_configs=localtuya_selector({"morning": "Morning", "night": "Night"}), + ), + ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b + "jsq": ( + LocalTuyaEntity( + id=DPCode.SPRAY_MODE, + entity_category=EntityCategory.CONFIG, + icon="mdi:spray", + name="Spraying mode", + custom_configs=localtuya_selector( + { + "auto": "AUTO", + "health": "Health", + "baby": "BABY", + "sleep": "SLEEP", + "humidity": "HUMIDITY", + "work": "WORK", + } + ), + ), + LocalTuyaEntity( + id=DPCode.LEVEL, + entity_category=EntityCategory.CONFIG, + icon="mdi:spray", + name="Spraying level", + custom_configs=localtuya_selector( + { + "level_1": "LEVEL 1", + "level_2": "LEVEL 2", + "level_3": "LEVEL 3", + "level_4": "LEVEL 4", + "level_5": "LEVEL 5", + "level_6": "LEVEL 6", + "level_7": "LEVEL 7", + "level_8": "LEVEL 8", + "level_9": "LEVEL 9", + "level_10": "LEVEL 10", + } + ), + ), + LocalTuyaEntity( + id=DPCode.MOODLIGHTING, + entity_category=EntityCategory.CONFIG, + icon="mdi:lightbulb-multiple", + name="Mood light", + custom_configs=localtuya_selector( + {"1": "1", "2": "2", "3": "3", "4": "4", "5": "5"} + ), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + name="Countdown", + custom_configs=localtuya_selector(COUNT_DOWN), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_SET, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + name="Countdown", + custom_configs=localtuya_selector(COUNT_DOWN_HOURS), + ), + ), + # Air Purifier + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46h2s6dzm + "kj": ( + LocalTuyaEntity( + id=DPCode.COUNTDOWN, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + name="Countdown", + custom_configs=localtuya_selector(COUNT_DOWN), + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_SET, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + name="Countdown", + custom_configs=localtuya_selector(COUNT_DOWN_HOURS), + ), + ), + # Dehumidifier + # https://developer.tuya.com/en/docs/iot/categorycs?id=Kaiuz1vcz4dha + "cs": ( + LocalTuyaEntity( + id=DPCode.COUNTDOWN_SET, + entity_category=EntityCategory.CONFIG, + icon="mdi:timer-cog-outline", + name="Countdown", + custom_configs=localtuya_selector( + {"cancel": "Disable", "2h": "2 Hours", "4h": "4 Hours", "8h": "8 Hours"} + ), + ), + LocalTuyaEntity( + id=DPCode.DEHUMIDITY_SET_ENUM, + name="Target Humidity", + entity_category=EntityCategory.CONFIG, + icon="mdi:water-percent", + custom_configs=localtuya_selector( + {"10": "10", "20": "20", "30": "30", "40": "40", "50": "50", "60": "60"} + ), + ), + LocalTuyaEntity( + id=DPCode.SPRAY_VOLUME, + name="Intensity", + entity_category=EntityCategory.CONFIG, + icon="mdi:volume-source", + custom_configs=localtuya_selector( + {"small": "Low", "middle": "Medium", "large": "High"} + ), + ), + LocalTuyaEntity( + id=DPCode.FAN_SPEED_ENUM, + name="Fan Speed", + entity_category=EntityCategory.CONFIG, + icon="mdi:fan", + custom_configs=localtuya_selector({"low": "Low", "high": "High"}), + ), + ), + # Water Detector + # https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli + "sj": ( + LocalTuyaEntity( + id=(DPCode.C_F, DPCode.TEMP_UNIT_CONVERT), + name="Temperature Unit", + icon="mdi:cog", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector({"c": "Celsius", "f": "Fahrenheit"}), + ), + ), + # Water Valve + "sfkzq": ( + LocalTuyaEntity( + id=DPCode.SMART_WEATHER, + name="Smart Weather Mode", + icon="mdi:cog", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + {"cloudy": "Cloudy", "rainy": "Rainy", "snowy": "Snowy"} + ), + ), + ), + # sous vide cookers + # https://developer.tuya.com/en/docs/iot/f?id=K9r2v9hgmyk3h + "mzj": ( + LocalTuyaEntity( + id=DPCode.MODE, + entity_category=EntityCategory.CONFIG, + name="Cooking Mode", + custom_configs=localtuya_selector( + { + "vegetables": "Vegetables", + "meat": "Meat", + "shrimp": "Shrimp", + "fish": "Fish", + "chicken": "Chicken", + "drumsticks": "Drumsticks", + "beef": "Beef", + "rice": "Rice", + } + ), + ), + ), + # PIR Detector + # https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80 + "pir": ( + LocalTuyaEntity( + id=DPCode.MOD, + icon="mdi:cog", + entity_category=EntityCategory.CONFIG, + name="Mode", + custom_configs=localtuya_selector( + {"mode_auto": "AUTO", "mode_on": "ON", "mode_off": "OFF"} + ), + ), + LocalTuyaEntity( + id=DPCode.PIR_SENSITIVITY, + icon="mdi:ray-start-arrow", + entity_category=EntityCategory.CONFIG, + name="PIR Sensitivity", + custom_configs=localtuya_selector( + {"low": "Low", "middle": "Middle", "high": "High"} + ), + ), + LocalTuyaEntity( + id=DPCode.PIR_TIME, + icon="mdi:timer-sand", + entity_category=EntityCategory.CONFIG, + name="Reset Time", + custom_configs=localtuya_selector( + {"30s": "30 Seconds", "60s": "60 Seconds", "120s": "120 Seconds"} + ), + ), + ), + # Thermostat + # https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9 + "wk": ( + LocalTuyaEntity( + id=DPCode.SENSORTYPE, + entity_category=EntityCategory.CONFIG, + name="Temperature sensor", + custom_configs=localtuya_selector( + {"0": "Internal", "1": "External", "2": "Both"} + ), + ), + ), + # Temperature and Humidity Sensor + # https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34 + "wsdcg": ( + LocalTuyaEntity( + id=(DPCode.C_F, DPCode.TEMP_UNIT_CONVERT), + name="Temperature Unit", + icon="mdi:cog", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector({"c": "Celsius", "f": "Fahrenheit"}), + ), + # LocalTuyaEntity( + # id=DPCode.TEMP_ALARM, + # name="Temperature Alarm", + # entity_category=EntityCategory.CONFIG, + # icon="mdi:bell-alert", + # custom_configs=localtuya_selector( + # {"loweralarm": "Low", "upperalarm": "High", "cancel": "Cancel"} + # ), + # ), + # LocalTuyaEntity( + # id=DPCode.HUM_ALARM, + # name="Humidity Alarm", + # icon="mdi:bell-alert", + # entity_category=EntityCategory.CONFIG, + # custom_configs=localtuya_selector( + # {"loweralarm": "Low", "upperalarm": "High", "cancel": "Cancel"} + # ), + # ), + ), + # Alarm Host + # https://developer.tuya.com/en/docs/iot/categorymal?id=Kaiuz33clqxaf + "mal": ( + LocalTuyaEntity( + id=DPCode.ZONE_ATTRIBUTE, + entity_category=EntityCategory.CONFIG, + name="Zone Attribute", + custom_configs=localtuya_selector( + { + "MODE_HOME_ARM": "Home Arm", + "MODE_ARM": "Arm", + "MODE_24": "24H", + "MODE_DOORBELL": "Doorbell", + "MODE_24_SILENT": "Silent", + "HOME_ARM_NO_DELAY": "Home, Arm No delay", + "ARM_NO_DELAY": "Arm No delay", + } + ), + ), + LocalTuyaEntity( + id=DPCode.MASTER_STATE, + entity_category=EntityCategory.CONFIG, + name="Host Status", + custom_configs=localtuya_selector({"normal": "Normal", "alarm": "Alarm"}), + ), + LocalTuyaEntity( + id=DPCode.SUB_CLASS, + entity_category=EntityCategory.CONFIG, + name="Sub-device category", + custom_configs=localtuya_selector( + { + "remote_controller": "Remote Controller", + "detector": "Detector", + "socket": "Socket", + } + ), + ), + LocalTuyaEntity( + id=DPCode.SUB_TYPE, + entity_category=EntityCategory.CONFIG, + name="Sub-device type", + custom_configs=localtuya_selector( + { + "OTHER": "Other", + "DOOR": "Door", + "PIR": "Pir", + "SOS": "SoS", + "ROOM": "Room", + "WINDOW": "Window", + "BALCONY": "Balcony", + "FENCE": "Fence", + "SMOKE": "Smoke", + "GAS": "Gas", + "CO": "CO", + "WATER": "Water", + } + ), + ), + ), + # Smart Water Meter + # https://developer.tuya.com/en/docs/iot/f?id=Ka8n052xu7w4c + "znsb": ( + LocalTuyaEntity( + id=DPCode.REPORT_PERIOD_SET, + entity_category=EntityCategory.CONFIG, + name="Report Period", + custom_configs=localtuya_selector( + { + "1h": "1 Hours", + "2h": "2 Hours", + "3h": "3 Hours", + "4h": "4 Hours", + "6h": "6 Hours", + "8h": "8 Hours", + "12h": "12 Hours", + "24h": "24 Hours", + "48h": "48 Hours", + "72h": "72 Hours", + } + ), + icon="mdi:file-chart-outline", + ), + ), + # HDMI Sync Box A1 + "hdmipmtbq": ( + LocalTuyaEntity( + id=DPCode.VIDEO_SCENE, + entity_category=EntityCategory.CONFIG, + name="Video Type", + icon="mdi:camera-burst", + custom_configs=localtuya_selector({"game": "Gaming", "movie": "Movies"}), + ), + LocalTuyaEntity( + id=DPCode.VIDEO_MODE, + entity_category=EntityCategory.CONFIG, + name="Video Mode", + icon="mdi:format-wrap-square", + custom_configs=localtuya_selector( + { + "nor_closed": "Nor Closed", + "multiple_colour": "Multi Colors", + "single_colour": "Single Color", + } + ), + ), + LocalTuyaEntity( + id=DPCode.VIDEO_INTENSITY, + entity_category=EntityCategory.CONFIG, + name="Intensity", + icon="mdi:television-ambient-light", + custom_configs=localtuya_selector( + { + "low": "Low", + "middle": "Middle", + "high": "High", + "music": "Music", + } + ), + ), + LocalTuyaEntity( + id=DPCode.STRIP_INPUT_POS, + entity_category=EntityCategory.CONFIG, + name="Start Position", + icon="mdi:vector-square-minus", + custom_configs=localtuya_selector( + {"low_right": "Low Right", "low_left": "Low Left"} + ), + ), + LocalTuyaEntity( + id=DPCode.STRIP_DIRECTION, + entity_category=EntityCategory.CONFIG, + name="Strip Direction", + icon="mdi:subdirectory-arrow-right", + custom_configs=localtuya_selector( + {"clockwise": "Clockwise", "anti_clockwise": "Counter-Clockwise"} + ), + ), + LocalTuyaEntity( + id=DPCode.TV_SIZE, + entity_category=EntityCategory.CONFIG, + name="TV Size", + icon="mdi:move-resize", + custom_configs=localtuya_selector( + { + "55_to_64_inch": "55 - 64 Inches", + "65_to_74_inch": "65 - 74 Inches", + "above_75_inch": "75 Inches or Above", + } + ), + ), + ), +} +# Wireless Switch # also can come as knob switch. # and scene switch. +# https://developer.tuya.com/en/docs/iot/wxkg?id=Kbeo9t3ryuqm5 +SELECTS["wxkg"] = ( + LocalTuyaEntity( + id=DPCode.WORK_MODE, + name="Display mode", + icon="mdi:square-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + {"brightness": "Brightness", "temperature": "Temperature"} + ), + ), + LocalTuyaEntity( + id=(DPCode.SWITCH1_VALUE, DPCode.SWITCH_TYPE_1), + name="Switch 1", + icon="mdi:square-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "single_click": "Single click", + "double_click": "Double click", + "long_press": "Long Press", + } + ), + condition_contains_any=["single_click", "double_click", "long_press"], + ), + LocalTuyaEntity( + id=(DPCode.SWITCH2_VALUE, DPCode.SWITCH_TYPE_2), + name="Switch 2", + icon="mdi:palette-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "single_click": "Single click", + "double_click": "Double click", + "long_press": "Long Press", + } + ), + condition_contains_any=["single_click", "double_click", "long_press"], + ), + LocalTuyaEntity( + id=(DPCode.SWITCH3_VALUE, DPCode.SWITCH_TYPE_3), + name="Switch 3", + icon="mdi:palette-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "single_click": "Single click", + "double_click": "Double click", + "long_press": "Long Press", + } + ), + condition_contains_any=["single_click", "double_click", "long_press"], + ), + LocalTuyaEntity( + id=(DPCode.SWITCH4_VALUE, DPCode.SWITCH_TYPE_4), + name="Switch 4", + icon="mdi:palette-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "single_click": "Single click", + "double_click": "Double click", + "long_press": "Long Press", + } + ), + condition_contains_any=["single_click", "double_click", "long_press"], + ), + LocalTuyaEntity( + id=(DPCode.SWITCH5_VALUE, DPCode.SWITCH_TYPE_5), + name="Switch 5", + icon="mdi:palette-outline", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + { + "single_click": "Single click", + "double_click": "Double click", + "long_press": "Long Press", + } + ), + condition_contains_any=["single_click", "double_click", "long_press"], + ), + LocalTuyaEntity( + id=DPCode.MODE, + name="Mode", + icon="mdi:cog", + entity_category=EntityCategory.CONFIG, + custom_configs=localtuya_selector( + {"remote_control": "Remote", "wireless_switch": "Wireless"} + ), + condition_contains_any=["remote_control", "wireless_switch"], + ), + *SELECTS["kg"], +) + +# Scene Switch +# https://developer.tuya.com/en/docs/iot/f?id=K9gf7nx6jelo8 +SELECTS["cjkg"] = SELECTS["kg"] + +# Fan wall switch +# For Power-on behavior +SELECTS["fskg"] = SELECTS["kg"] + +# Socket (duplicate of `kg`) +# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s +SELECTS["cz"] = SELECTS["kg"] + +# Power Socket (duplicate of `kg`) +# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s +SELECTS["pc"] = SELECTS["kg"] + +SELECTS["tdq"] = SELECTS["kg"] + +# Heater +SELECTS["rs"] = SELECTS["kt"] diff --git a/custom_components/localtuya/core/ha_entities/sensors.py b/custom_components/localtuya/core/ha_entities/sensors.py new file mode 100644 index 00000000..26800d09 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/sensors.py @@ -0,0 +1,1608 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from homeassistant.components.sensor import SensorStateClass, SensorDeviceClass +from homeassistant.const import ( + PERCENTAGE, + UnitOfTime, + UnitOfPower, + PERCENTAGE, + UnitOfElectricCurrent, + UnitOfElectricPotential, + UnitOfTime, + CONF_UNIT_OF_MEASUREMENT, + UnitOfTemperature, + UnitOfEnergy, + UnitOfVolume, + UnitOfElectricPotential, + UnitOfMass, + DEGREE, + LIGHT_LUX, + UnitOfLength, +) + +from .base import ( + DPCode, + LocalTuyaEntity, + EntityCategory, + CLOUD_VALUE, +) +from ...const import CONF_SCALING as SCALE_FACTOR + + +def localtuya_sensor(unit_of_measurement=None, scale_factor: float = 1) -> dict: + """Define LocalTuya Configs for Sensor.""" + data = {CONF_UNIT_OF_MEASUREMENT: unit_of_measurement} + data.update({SCALE_FACTOR: CLOUD_VALUE(scale_factor, "id", "scale")}) + + return data + + +# Commonly used battery sensors, that are re-used in the sensors down below. +BATTERY_SENSORS: dict[str, tuple[LocalTuyaEntity, ...]] = ( + LocalTuyaEntity( + id=DPCode.BATTERY_PERCENTAGE, + name="Battery", + device_class=SensorDeviceClass.BATTERY, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_sensor(PERCENTAGE), + ), + LocalTuyaEntity( + id=(DPCode.BATTERY_STATE, DPCode.BATTERYSTATUS), + name="Battery Level", + # name="battery_state", + icon="mdi:battery", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.BATTERY_VALUE, + name="Battery", + device_class=SensorDeviceClass.BATTERY, + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(PERCENTAGE), + ), + LocalTuyaEntity( + id=DPCode.VA_BATTERY, + name="Battery", + device_class=SensorDeviceClass.BATTERY, + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(PERCENTAGE), + ), + LocalTuyaEntity( + id=DPCode.BATTERY, + name="Battery", + device_class=SensorDeviceClass.BATTERY, + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(PERCENTAGE), + ), +) + +# All descriptions can be found here. Mostly the Integer data types in the +# default status set of each category (that don't have a set instruction) +# end up being a sensor. +# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq +SENSORS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Wireless Switch # also can come as knob switch. + # https://developer.tuya.com/en/docs/iot/wxkg?id=Kbeo9t3ryuqm5 + "wxkg": ( + LocalTuyaEntity( + id=DPCode.MODE_1, + name="Switch 1 Mode", + icon="mdi:information-slab-circle-outline", + ), + LocalTuyaEntity( + id=DPCode.MODE_2, + name="Switch 2 Mode", + icon="mdi:information-slab-circle-outline", + ), + LocalTuyaEntity( + id=DPCode.KNOB_SWITCH_MODE_1, + name="Knob Mode", + icon="mdi:knob", + entity_category=EntityCategory.DIAGNOSTIC, + ), + *BATTERY_SENSORS, + ), + # Smart panel with switches and zigbee hub ? + # Not documented + "dgnzk": ( + LocalTuyaEntity( + id=DPCode.PLAY_INFO, + name="Playing", + icon="mdi:playlist-play", + ), + ), + # Multi-functional Sensor + # https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3 + "dgnbj": ( + LocalTuyaEntity( + id=DPCode.GAS_SENSOR_VALUE, + # name="gas", + icon="mdi:gas-cylinder", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CH4_SENSOR_VALUE, + # name="gas", + name="Methane", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.VOC_VALUE, + # name="voc", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.PM25_VALUE, + # name="pm25", + device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CO_VALUE, + # name="carbon_monoxide", + icon="mdi:molecule-co", + device_class=SensorDeviceClass.CO, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CO2_VALUE, + # name="carbon_dioxide", + icon="mdi:molecule-co2", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CH2O_VALUE, + # name="formaldehyde", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.BRIGHT_STATE, + # name="luminosity", + icon="mdi:brightness-6", + ), + LocalTuyaEntity( + id=DPCode.BRIGHT_VALUE, + # name="illuminance", + icon="mdi:brightness-6", + device_class=SensorDeviceClass.ILLUMINANCE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY_VALUE, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.SMOKE_SENSOR_VALUE, + # name="smoke_amount", + icon="mdi:smoke-detector", + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Smart Kettle + # https://developer.tuya.com/en/docs/iot/fbh?id=K9gf484m21yq7 + "bh": ( + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="current_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT_F, + # name="current_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.STATUS, + # name="status", + ), + ), + # CO2 Detector + # https://developer.tuya.com/en/docs/iot/categoryco2bj?id=Kaiuz3wes7yuy + "co2bj": ( + LocalTuyaEntity( + id=DPCode.HUMIDITY_VALUE, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CO2_VALUE, + # name="carbon_dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Two-way temperature and humidity switch + # "MOES Temperature and Humidity Smart Switch Module MS-103" + # Documentation not found + "wkcz": ( + LocalTuyaEntity( + id=DPCode.HUMIDITY_VALUE, + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + ), + # CO Detector + # https://developer.tuya.com/en/docs/iot/categorycobj?id=Kaiuz3u1j6q1v + "cobj": ( + LocalTuyaEntity( + id=DPCode.CO_VALUE, + # name="carbon_monoxide", + device_class=SensorDeviceClass.CO, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Smart Pet Feeder + # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld + "cwwsq": ( + LocalTuyaEntity( + id=DPCode.FEED_REPORT, + # name="last_amount", + icon="mdi:counter", + state_class=SensorStateClass.MEASUREMENT, + ), + ), + # Air Quality Monitor + # No specification on Tuya portal + "hjjcy": ( + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY_VALUE, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CO2_VALUE, + # name="carbon_dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CH2O_VALUE, + # name="formaldehyde", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.VOC_VALUE, + # name="voc", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.PM25_VALUE, + # name="pm25", + device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, + ), + ), + # Formaldehyde Detector + # Note: Not documented + "jqbj": ( + LocalTuyaEntity( + id=DPCode.CO2_VALUE, + # name="carbon_dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.VOC_VALUE, + # name="voc", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.PM25_VALUE, + # name="pm25", + device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.VA_HUMIDITY, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.VA_TEMPERATURE, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CH2O_VALUE, + # name="formaldehyde", + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Methane Detector + # https://developer.tuya.com/en/docs/iot/categoryjwbj?id=Kaiuz40u98lkm + "jwbj": ( + LocalTuyaEntity( + id=DPCode.CH4_SENSOR_VALUE, + # name="methane", + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Switch + # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s + "kg": ( + LocalTuyaEntity( + id=DPCode.CUR_CURRENT, + name="Current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.MILLIAMPERE), + ), + LocalTuyaEntity( + id=DPCode.CUR_POWER, + name="Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + ), + LocalTuyaEntity( + id=DPCode.CUR_VOLTAGE, + name="Voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.1), + ), + LocalTuyaEntity( + id=DPCode.ADD_ELE, + name="Electricity", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + # CZ - Energy monitor? + LocalTuyaEntity( + id=DPCode.CUR_CURRENT1, + name="Current 1", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.MILLIAMPERE), + ), + LocalTuyaEntity( + id=DPCode.CUR_CURRENT2, + name="Current 2", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.MILLIAMPERE), + ), + LocalTuyaEntity( + id=DPCode.CUR_POWER1, + name="Power 1", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + ), + LocalTuyaEntity( + id=DPCode.CUR_POWER2, + name="Power 2", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + ), + LocalTuyaEntity( + id=DPCode.CUR_VOLTAGE1, + name="Voltage 1", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.1), + ), + LocalTuyaEntity( + id=DPCode.CUR_VOLTAGE2, + name="Voltage 2", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.1), + ), + LocalTuyaEntity( + id=DPCode.ADD_ELE1, + name="Electricity 1", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.ADD_ELE2, + name="Electricity 2", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TOTAL_ENERGY, + name="Total Energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TOTAL_ENERGY1, + name="Total Energy 1", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TOTAL_ENERGY2, + name="Total Energy 2", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TODAY_ACC_ENERGY, + name="Today Energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TODAY_ACC_ENERGY1, + name="Today Energy 1", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TODAY_ACC_ENERGY2, + name="Today Energy 2", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TODAY_ENERGY_ADD, + name="Today Energy Increase", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TODAY_ENERGY_ADD1, + name="Today Energy 1 Increase", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.TODAY_ENERGY_ADD2, + name="Today Energy 2 Increase", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + LocalTuyaEntity( + id=DPCode.SYNC_REQUEST, + name="Sync Request", + ), + LocalTuyaEntity( + id=DPCode.DEVICE_STATE1, + name="Device 1 State", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.DEVICE_STATE2, + name="Device 2 State", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.NET_STATE, + name="Connection state", + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:network", + ), + ), + # IoT Switch + # Note: Undocumented + "tdq": ( + LocalTuyaEntity( + id=DPCode.CUR_CURRENT, + name="Current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.MILLIAMPERE), + # entity_registry_enabled_default=False, + ), + LocalTuyaEntity( + id=DPCode.CUR_POWER, + name="Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + # entity_registry_enabled_default=False, + ), + LocalTuyaEntity( + id=DPCode.CUR_VOLTAGE, + name="Voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.1), + # entity_registry_enabled_default=False, + ), + LocalTuyaEntity( + id=DPCode.ADD_ELE, + name="Electricity", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + ), + # Luminance Sensor + # https://developer.tuya.com/en/docs/iot/categoryldcg?id=Kaiuz3n7u69l8 + "ldcg": ( + LocalTuyaEntity( + id=DPCode.BRIGHT_STATE, + # name="luminosity", + icon="mdi:brightness-6", + ), + LocalTuyaEntity( + id=DPCode.BRIGHT_VALUE, + # name="illuminance", + device_class=SensorDeviceClass.ILLUMINANCE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY_VALUE, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CO2_VALUE, + # name="carbon_dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Door and Window Controller + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r5zjsy9 + "mc": BATTERY_SENSORS, + # Door Window Sensor + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48hm02l8m + "mcs": BATTERY_SENSORS, + # Sous Vide Cooker + # https://developer.tuya.com/en/docs/iot/categorymzj?id=Kaiuz2vy130ux + "mzj": ( + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="current_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.STATUS, + # name="sous_vide_status", + ), + LocalTuyaEntity( + id=DPCode.REMAIN_TIME, + name="Timer Remaining", + custom_configs=localtuya_sensor(UnitOfTime.MINUTES), + icon="mdi:timer", + entity_category=EntityCategory.DIAGNOSTIC, + ), + ), + # PIR Detector + # https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80 + "pir": ( + LocalTuyaEntity( + id=DPCode.PM25_VALUE, + # name="pm25", + device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.MOD_ON_TMR_CD, + icon="mdi:timer-edit-outline", + name="Timer left", + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_sensor("s"), + ), + LocalTuyaEntity( + id=DPCode.ILLUMINANCE_VALUE, + name="Illuminance", + entity_category=EntityCategory.DIAGNOSTIC, + device_class=SensorDeviceClass.ILLUMINANCE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(LIGHT_LUX), + ), + *BATTERY_SENSORS, + ), + # PM2.5 Sensor + # https://developer.tuya.com/en/docs/iot/categorypm25?id=Kaiuz3qof3yfu + "pm2.5": ( + LocalTuyaEntity( + id=DPCode.PM25_VALUE, + # name="pm25", + device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CH2O_VALUE, + # name="formaldehyde", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.VOC_VALUE, + # name="voc", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CO2_VALUE, + # name="carbon_dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY_VALUE, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.PM1, + # name="pm1", + device_class=SensorDeviceClass.PM1, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.PM10, + # name="pm10", + device_class=SensorDeviceClass.PM10, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Heater + # https://developer.tuya.com/en/docs/iot/categoryqn?id=Kaiuz18kih0sm + "qn": ( + LocalTuyaEntity( + id=DPCode.WORK_POWER, + name="Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + ), + ), + # Gas Detector + # https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw + "rqbj": ( + LocalTuyaEntity( + id=DPCode.GAS_SENSOR_VALUE, + icon="mdi:gas-cylinder", + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Water Detector + # https://developer.tuya.com/en/docs/iot/categorysj?id=Kaiuz3iub2sli + "sj": ( + LocalTuyaEntity( + id=DPCode.WATERSENSOR_STATE, + icon="mdi:water", + ), + LocalTuyaEntity( + id=DPCode.TEMP_STATUS, + name="Temperature Status", + icon="mdi:thermometer-check", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.HUMI_STATUS, + name="Humidity Status", + icon="mdi:water-percent-alert", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.POWER, + icon="mdi:power", + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY_VALUE, + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(PERCENTAGE, 0.01), + ), + LocalTuyaEntity( + id=(DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F), + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Emergency Button + # https://developer.tuya.com/en/docs/iot/categorysos?id=Kaiuz3oi6agjy + "sos": BATTERY_SENSORS, + # Smart Camera + # https://developer.tuya.com/en/docs/iot/categorysp?id=Kaiuz35leyo12 + "sp": ( + LocalTuyaEntity( + id=DPCode.SENSOR_TEMPERATURE, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.SENSOR_HUMIDITY, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.WIRELESS_ELECTRICITY, + name="Battery", + device_class=SensorDeviceClass.BATTERY, + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + ), + ), + # Water Valve + "sfkzq": ( + LocalTuyaEntity( + id=DPCode.WORK_STATE, + name="State", + icon="mdi:state-machine", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.USE_TIME_ONE, + name="Single Usage Time", + icon="mdi:chart-arc", + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_sensor(unit_of_measurement=UnitOfTime.SECONDS), + ), + LocalTuyaEntity( + id=(DPCode.TIME_USE, DPCode.USE_TIME), + name="Usage Time", + icon="mdi:chart-arc", + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_sensor(unit_of_measurement=UnitOfTime.SECONDS), + ), + *BATTERY_SENSORS, + ), + # Fingerbot + "szjqr": BATTERY_SENSORS, + # Solar Light + # https://developer.tuya.com/en/docs/iot/tynd?id=Kaof8j02e1t98 + "tyndj": BATTERY_SENSORS, + # Volatile Organic Compound Sensor + # Note: Undocumented in cloud API docs, based on test device + "voc": ( + LocalTuyaEntity( + id=DPCode.CO2_VALUE, + # name="carbon_dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.PM25_VALUE, + # name="pm25", + device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CH2O_VALUE, + # name="formaldehyde", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY_VALUE, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.VOC_VALUE, + # name="voc", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Thermostat + # https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9 + "wk": { + LocalTuyaEntity( + id=(DPCode.TEMP_CURRENT, DPCode.TEMPFLOOR), + name="External temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + }, + # Thermostatic Radiator Valve + # Not documented + "wkf": BATTERY_SENSORS, + # Temperature and Humidity Sensor + # https://developer.tuya.com/en/docs/iot/categorywsdcg?id=Kaiuz3hinij34 + "wsdcg": ( + LocalTuyaEntity( + id=DPCode.VA_TEMPERATURE, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=(DPCode.TEMP_CURRENT, DPCode.PRM_CONTENT), + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfTemperature.CELSIUS, 0.01), + ), + LocalTuyaEntity( + id=(DPCode.HUMIDITY_VALUE, DPCode.PRM_CONTENT, DPCode.VA_HUMIDITY), + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(PERCENTAGE, 0.01), + ), + LocalTuyaEntity( + id=DPCode.BRIGHT_VALUE, + name="Illuminance", + device_class=SensorDeviceClass.ILLUMINANCE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(LIGHT_LUX), + ), + *BATTERY_SENSORS, + ), + # Pressure Sensor + # https://developer.tuya.com/en/docs/iot/categoryylcg?id=Kaiuz3kc2e4gm + "ylcg": ( + LocalTuyaEntity( + id=DPCode.PRESSURE_VALUE, + device_class=SensorDeviceClass.PRESSURE, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Smoke Detector + # https://developer.tuya.com/en/docs/iot/categoryywbj?id=Kaiuz3f6sf952 + "ywbj": ( + LocalTuyaEntity( + id=DPCode.SMOKE_SENSOR_VALUE, + # name="smoke_amount", + icon="mdi:smoke-detector", + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Vibration Sensor + # https://developer.tuya.com/en/docs/iot/categoryzd?id=Kaiuz3a5vrzno + "zd": BATTERY_SENSORS, + # Smart Electricity Meter + # https://developer.tuya.com/en/docs/iot/smart-meter?id=Kaiuz4gv6ack7 + "zndb": ( + LocalTuyaEntity( + id=DPCode.FORWARD_ENERGY_TOTAL, + # name="total_energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.01), + ), + LocalTuyaEntity( + id=DPCode.REVERSE_ENERGY_TOTAL, + name="Total Reverse Energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.01), + ), + ## PHASE X Are probably encrypted values. since it duplicated it probably raw dict data. + LocalTuyaEntity( + id=DPCode.PHASE_A, + name="Phase C Current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.MILLIAMPERE), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.PHASE_A, + name="Phase C Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.PHASE_A, + name="Phase A Voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.PHASE_B, + name="Phase B", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.MILLIAMPERE), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.PHASE_B, + name="Phase B Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.PHASE_B, + name="Phase B Voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.PHASE_C, + name="Phase C Current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.MILLIAMPERE), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.PHASE_C, + name="Phase C Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.PHASE_C, + name="Phase C Voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + ## PHASE X Are probably encrypted values. since it duplicated it probably raw dict data. + LocalTuyaEntity( + id=DPCode.POWER_A, + name="Power A", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.POWER_B, + name="Power B", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.POWER_C, + name="Power C", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.ENERGY_FORWORD_A, + name="Energy A", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.ENERGY_FORWORD_B, + name="Energy B", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.ENERGY_FORWORD_C, + name="Energy C", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=(DPCode.ENERGY_REVERSE_A, DPCode.ENERGY_RESERSE_A), + name="Reverse Energy A", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=(DPCode.ENERGY_REVERSE_B, DPCode.ENERGY_RESERSE_B), + name="Reverse Energy B", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=(DPCode.ENERGY_REVERSE_C, DPCode.ENERGY_RESERSE_C), + name="Reverse Energy C", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=(DPCode.POWER_FACTOR, DPCode.POWER_FACTOR_A), + name="Power Factor A", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.POWER_FACTOR_B, + name="Power Factor B", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.POWER_FACTOR_C, + name="Power Factor C", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.DIRECTION_A, + name="Direction A", + icon="mdi:arrow-up-down", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.DIRECTION_B, + name="Direction B", + icon="mdi:arrow-up-down", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.DIRECTION_C, + name="Direction C", + icon="mdi:arrow-up-down", + entity_category=EntityCategory.DIAGNOSTIC, + ), + ), + # Robot Vacuum + # https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo + "sd": ( + LocalTuyaEntity( + id=DPCode.CLEAN_AREA, + # name="cleaning_area", + icon="mdi:texture-box", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CLEAN_TIME, + # name="cleaning_time", + icon="mdi:progress-clock", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TOTAL_CLEAN_AREA, + # name="total_cleaning_area", + icon="mdi:texture-box", + state_class=SensorStateClass.TOTAL_INCREASING, + ), + LocalTuyaEntity( + id=DPCode.TOTAL_CLEAN_TIME, + # name="total_cleaning_time", + icon="mdi:history", + state_class=SensorStateClass.TOTAL_INCREASING, + ), + LocalTuyaEntity( + id=DPCode.TOTAL_CLEAN_COUNT, + # name="total_cleaning_times", + icon="mdi:counter", + state_class=SensorStateClass.TOTAL_INCREASING, + ), + LocalTuyaEntity( + id=DPCode.DUSTER_CLOTH, + # name="duster_cloth_life", + icon="mdi:ticket-percent-outline", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.EDGE_BRUSH, + # name="side_brush_life", + icon="mdi:ticket-percent-outline", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.FILTER_LIFE, + # name="filter_life", + icon="mdi:ticket-percent-outline", + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.ROLL_BRUSH, + # name="rolling_brush_life", + icon="mdi:ticket-percent-outline", + state_class=SensorStateClass.MEASUREMENT, + ), + ), + # Curtain + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48qy7wkre + "cl": ( + LocalTuyaEntity( + id=DPCode.TIME_TOTAL, + # name="last_operation_duration", + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:progress-clock", + ), + ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48qwjz0i3 + "jsq": ( + LocalTuyaEntity( + id=DPCode.HUMIDITY_CURRENT, + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT_F, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.LEVEL_CURRENT, + name="Water Level", + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:waves-arrow-up", + ), + ), + # Air Purifier + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r41mn81 + "kj": ( + LocalTuyaEntity( + id=DPCode.FILTER, + # name="filter_utilization", + entity_category=EntityCategory.DIAGNOSTIC, + icon="mdi:ticket-percent-outline", + ), + LocalTuyaEntity( + id=DPCode.PM25, + # name="pm25", + device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, + icon="mdi:molecule", + ), + LocalTuyaEntity( + id=DPCode.TEMP, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TVOC, + # name="total_volatile_organic_compound", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.ECO2, + # name="concentration_carbon_dioxide", + device_class=SensorDeviceClass.CO2, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.TOTAL_TIME, + # name="total_operating_time", + icon="mdi:history", + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.TOTAL_PM, + # name="total_absorption_particles", + icon="mdi:texture-box", + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.AIR_QUALITY, + # name="air_quality", + icon="mdi:air-filter", + ), + ), + # Fan + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48quojr54 + "fs": ( + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + ), + # eMylo Smart WiFi IR Remote + # Air Conditioner Mate (Smart IR Socket) + "wnykq": ( + LocalTuyaEntity( + id=(DPCode.VA_TEMPERATURE, DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F), + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=(DPCode.VA_HUMIDITY, DPCode.HUMIDITY_VALUE), + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.CUR_CURRENT, + name="Current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.MILLIAMPERE), + # entity_registry_enabled_default=False, + ), + LocalTuyaEntity( + id=DPCode.CUR_POWER, + name="Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_sensor(UnitOfPower.WATT, 0.1), + # entity_registry_enabled_default=False, + ), + LocalTuyaEntity( + id=DPCode.CUR_VOLTAGE, + name="Voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.1), + # entity_registry_enabled_default=False, + ), + LocalTuyaEntity( + id=DPCode.ADD_ELE, + name="Electricity", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR, 0.001), + ), + ), + # Dehumidifier + # https://developer.tuya.com/en/docs/iot/s?id=K9gf48r6jke8e + "cs": ( + LocalTuyaEntity( + id=DPCode.TEMP_INDOOR, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY_INDOOR, + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN_LEFT, + name="Timer Remaining", + custom_configs=localtuya_sensor(UnitOfTime.MINUTES), + icon="mdi:timer", + entity_category=EntityCategory.DIAGNOSTIC, + ), + # Sensors 'Micro Inverter' ? + LocalTuyaEntity( + id=DPCode.PV_POWER, + name="PV Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT), + ), + LocalTuyaEntity( + id=DPCode.EMISSION, + name="Emission", + device_class=SensorDeviceClass.WEIGHT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfMass.KILOGRAMS), + ), + LocalTuyaEntity( + id=DPCode.PV_VOLT, + name="PV Voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT), + ), + LocalTuyaEntity( + id=DPCode.TEMPERATURE, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfTemperature.CELSIUS), + ), + LocalTuyaEntity( + id=DPCode.AC_CURRENT, + name="AC Current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.AMPERE), + ), + LocalTuyaEntity( + id=DPCode.PV_CURRENT, + name="PV Current", + device_class=SensorDeviceClass.CURRENT, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricCurrent.AMPERE), + ), + LocalTuyaEntity( + id=DPCode.AC_VOLT, + name="AC Voltage", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT), + ), + LocalTuyaEntity( + id=DPCode.DAY_ENERGY, + name="Daily Consumption", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR), + ), + LocalTuyaEntity( + id=DPCode.ENERGY, + name="Energy", + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfEnergy.KILO_WATT_HOUR), + ), + LocalTuyaEntity( + id=DPCode.OUT_POWER, + name="Out Power", + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfPower.WATT), + ), + LocalTuyaEntity( + id=DPCode.PLANT, + name="Plant", + custom_configs=localtuya_sensor("pcs"), + ), + ), + # Soil sensor (Plant monitor) + "zwjcy": ( + LocalTuyaEntity( + id=DPCode.TEMP_CURRENT, + # name="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), + LocalTuyaEntity( + id=DPCode.HUMIDITY, + # name="humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, + ), + *BATTERY_SENSORS, + ), + # Alarm Host + # https://developer.tuya.com/en/docs/iot/categorymal?id=Kaiuz33clqxaf + "mal": ( + LocalTuyaEntity( + id=DPCode.SUB_STATE, + name="Sub-Device State", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.POWEREVENT, + name="Power Event", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.ZONE_NUMBER, + name="Zone Number", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.OTHEREVENT, + name="Other Event", + entity_category=EntityCategory.DIAGNOSTIC, + ), + ), + # Lock + "ms": ( + LocalTuyaEntity( + id=DPCode.LOCK_MOTOR_STATE, + name="Motor State", + entity_category=EntityCategory.DIAGNOSTIC, + ), + ), + # Smart Water Meter + # https://developer.tuya.com/en/docs/iot/f?id=Ka8n052xu7w4c + "znsb": ( + LocalTuyaEntity( + id=DPCode.WATER_USE_DATA, + name="Total Water Consumption", + icon="mdi:water-outline", + device_class=SensorDeviceClass.WATER, + state_class=SensorStateClass.TOTAL_INCREASING, + custom_configs=localtuya_sensor(UnitOfVolume.LITERS, 1), + ), + LocalTuyaEntity( + id=DPCode.WATER_TEMP, + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + custom_configs=localtuya_sensor(UnitOfTemperature.CELSIUS, 0.01), + ), + LocalTuyaEntity( + id=DPCode.VOLTAGE_CURRENT, + name="Battery", + device_class=SensorDeviceClass.VOLTAGE, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.01), + ), + ), + # Air conditioner + # https://developer.tuya.com/en/docs/iot/categorykt?id=Kaiuz0z71ov2n + "kt": ( + LocalTuyaEntity( + id=DPCode.AIR_RETURN, + name="AIR Return", + icon="mdi:air-filter", + custom_configs=localtuya_sensor(DEGREE, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.COIL_OUT, + name="Coil Out", + icon="mdi:heating-coil", + custom_configs=localtuya_sensor(DEGREE, 0.1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.DEFROST, + name="Defrosting", + icon="mdi:snowflake-melt", + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.COUNTDOWN, + name="Timer State", + icon="mdi:timer-sand", + custom_configs=localtuya_sensor(UnitOfTime.MINUTES, 1), + entity_category=EntityCategory.DIAGNOSTIC, + ), + LocalTuyaEntity( + id=DPCode.COMPRESSOR_COMMAND, + name="Compressor", + ), + LocalTuyaEntity( + id=DPCode.FOUT_WAY_VALVE, + name="Fout Way Valve", + ), + LocalTuyaEntity( + id=DPCode.ODU_FAN_SPEED, + name="ODU Fan Speed", + icon="mdi:fan", + ), + ), + # Ultrasonic level sensor + "ywcgq": ( + LocalTuyaEntity( + id=DPCode.LIQUID_STATE, + name="State", + ), + LocalTuyaEntity( + id=DPCode.LIQUID_DEPTH, + name="Depth", + icon="mdi:altimeter", + custom_configs=localtuya_sensor(UnitOfLength.METERS, 1), + ), + LocalTuyaEntity( + id=DPCode.LIQUID_LEVEL_PERCENT, + name="Level", + icon="mdi:altimeter", + custom_configs=localtuya_sensor(PERCENTAGE, 1), + ), + ), +} + + +# Circuit Breaker +# https://developer.tuya.com/en/docs/iot/dlq?id=Kb0kidk9enyh8 +SENSORS["dlq"] = SENSORS["zndb"] + +# Socket (duplicate of `kg`) +# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s +SENSORS["cz"] = SENSORS["kg"] + +# Power Socket (duplicate of `kg`) +# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s +SENSORS["pc"] = SENSORS["kg"] diff --git a/custom_components/localtuya/core/ha_entities/sirens.py b/custom_components/localtuya/core/ha_entities/sirens.py new file mode 100644 index 00000000..42b65a3a --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/sirens.py @@ -0,0 +1,34 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import DPCode, LocalTuyaEntity, CONF_DEVICE_CLASS, EntityCategory + +# All descriptions can be found here: +# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq +SIRENS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Multi-functional Sensor + # https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3 + "dgnbj": ( + LocalTuyaEntity( + id=(DPCode.ALARM_SWITCH, DPCode.ALARMSWITCH), + ), + ), + # Siren Alarm + # https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu + "sgbj": ( + LocalTuyaEntity( + id=(DPCode.ALARM_SWITCH, DPCode.ALARMSWITCH), + ), + ), + # Smart Camera + # https://developer.tuya.com/en/docs/iot/categorysp?id=Kaiuz35leyo12 + "sp": ( + LocalTuyaEntity( + id=DPCode.SIREN_SWITCH, + ), + ), +} diff --git a/custom_components/localtuya/core/ha_entities/switches.py b/custom_components/localtuya/core/ha_entities/switches.py new file mode 100644 index 00000000..e53aaec1 --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/switches.py @@ -0,0 +1,966 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import DPCode, LocalTuyaEntity, CONF_DEVICE_CLASS, EntityCategory +from homeassistant.components.switch import SwitchDeviceClass + +CHILD_LOCK = ( + LocalTuyaEntity( + id=DPCode.CHILD_LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), +) +SWITCHES: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Smart Kettle + # https://developer.tuya.com/en/docs/iot/fbh?id=K9gf484m21yq7 + "bh": ( + LocalTuyaEntity( + id=DPCode.START, + name="Start", + icon="mdi:kettle-steam", + ), + LocalTuyaEntity( + id=DPCode.WARM, + name="Warm", + entity_category=EntityCategory.CONFIG, + ), + ), + # EasyBaby + # Undocumented, might have a wider use + "cn": ( + LocalTuyaEntity( + id=DPCode.DISINFECTION, + name="Disinfection", + icon="mdi:bacteria", + ), + LocalTuyaEntity( + id=DPCode.WATER, + name="Water", + icon="mdi:water", + ), + ), + # Smart Pet Feeder + # https://developer.tuya.com/en/docs/iot/categorycwwsq?id=Kaiuz2b6vydld + "cwwsq": ( + LocalTuyaEntity( + id=DPCode.SLOW_FEED, + name="Slow Feed", + icon="mdi:speedometer-slow", + entity_category=EntityCategory.CONFIG, + ), + ), + # Pet Water Feeder + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46aewxem5 + "cwysj": ( + LocalTuyaEntity( + id=DPCode.FILTER_RESET, + name="Reset Filter", + icon="mdi:filter", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.PUMP_RESET, + name="Reset Water Pump", + icon="mdi:pump", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Power", + ), + LocalTuyaEntity( + id=DPCode.WATER_RESET, + name="Reset Water", + icon="mdi:water-sync", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.UV, + name="UV Sterilization", + icon="mdi:lightbulb", + entity_category=EntityCategory.CONFIG, + ), + ), + # Light + # https://developer.tuya.com/en/docs/iot/f?id=K9i5ql3v98hn3 + "dj": ( + # There are sockets available with an RGB light + # that advertise as `dj`, but provide an additional + # switch to control the plug. + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Plug", + ), + ), + # Circuit Breaker + "dlq": ( + LocalTuyaEntity( + id=DPCode.CHILD_LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Switch", + ), + ), + # Wake Up Light II + # Not documented + "hxd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="Radio", + icon="mdi:radio", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_2, + name="Alarm 2", + icon="mdi:alarm", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_3, + name="Alarm 3", + icon="mdi:alarm", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_4, + name="Alarm 4", + icon="mdi:alarm", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_5, + name="Alarm 5", + icon="mdi:alarm", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_6, + name="Alarm 6", + icon="mdi:power-sleep", + ), + ), + # Two-way temperature and humidity switch + # "MOES Temperature and Humidity Smart Switch Module MS-103" + # Documentation not found + "wkcz": ( + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="Switch 1", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_2, + name="Switch 2", + device_class=SwitchDeviceClass.OUTLET, + ), + ), + # Switch + # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s + "kg": ( + LocalTuyaEntity( + id=DPCode.CHILD_LOCK, + name="Child lock", + icon="mdi:account-lock", + ), + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Switch", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="Switch 1", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_2, + name="Switch 2", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_3, + name="Switch 3", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_4, + name="Switch 4", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_5, + name="Switch 5", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_6, + name="Switch 6", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_7, + name="Switch 7", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_8, + name="Switch 8", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB1, + name="USB", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB2, + name="USB 2", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB3, + name="USB 3", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB4, + name="USB 4", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB5, + name="USB 5", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB6, + name="USB 6", + device_class=SwitchDeviceClass.OUTLET, + ), + ), + # Air Purifier + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46h2s6dzm + "kj": ( + LocalTuyaEntity( + id=DPCode.ANION, + name="Ionizer", + icon="mdi:minus-circle-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.FILTER_RESET, + name="Reset Filter Cartridge_", + icon="mdi:filter", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Power", + ), + LocalTuyaEntity( + id=DPCode.WET, + name="Humidification", + icon="mdi:water-percent", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.UV, + name="UV Sterilization", + icon="mdi:minus-circle-outline", + entity_category=EntityCategory.CONFIG, + ), + ), + # Air conditioner + # https://developer.tuya.com/en/docs/iot/categorykt?id=Kaiuz0z71ov2n + "kt": ( + LocalTuyaEntity( + id=DPCode.ANION, + name="Ionizer", + icon="mdi:minus-circle-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SLEEP, + name="Sleep", + icon="mdi:sleep", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SHAKE, + name="Shake", + # icon="mdi:vibrate", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.INNERDRY, + name="Inner Dry", + icon="mdi:water-outline", + entity_category=EntityCategory.CONFIG, + ), + ), + # Sous Vide Cooker + # https://developer.tuya.com/en/docs/iot/categorymzj?id=Kaiuz2vy130ux + "mzj": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Switch", + icon="mdi:power", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.START, + name="Start", + icon="mdi:pot-steam", + entity_category=EntityCategory.CONFIG, + ), + ), + # Power Socket + # https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s + "pc": ( + LocalTuyaEntity( + id=DPCode.CHILD_LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.OVERCHARGE_SWITCH, + name="Overcharge", + icon="mdi:flash-alert", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="Switch 1", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_2, + name="Switch 2", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_3, + name="Switch 3", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_4, + name="Switch 4", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_5, + name="Switch 5", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_6, + name="Switch 6", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB1, + name="USB 1", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB2, + name="USB 2", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB3, + name="USB 3", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB4, + name="USB 4", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB5, + name="USB 5", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_USB6, + name="USB 6", + ), + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Socket", + device_class=SwitchDeviceClass.OUTLET, + ), + ), + # Smart panel with switches and zigbee hub ? + # Not documented + "dgnzk": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Switch", + ), + LocalTuyaEntity( + id=(DPCode.SWITCH_1, DPCode.SWITCH1), + name="Switch 1", + ), + LocalTuyaEntity( + id=(DPCode.SWITCH_2, DPCode.SWITCH2), + name="Switch 2", + ), + LocalTuyaEntity( + id=(DPCode.SWITCH_3, DPCode.SWITCH3), + name="Switch 3", + ), + LocalTuyaEntity( + id=(DPCode.SWITCH_4, DPCode.SWITCH4), + name="Switch 4", + ), + LocalTuyaEntity( + id=(DPCode.SWITCH_5, DPCode.SWITCH5), + name="Switch 5", + ), + LocalTuyaEntity( + id=(DPCode.SWITCH_6, DPCode.SWITCH6), + name="Switch 6", + ), + LocalTuyaEntity( + id=DPCode.VOICE_PLAY, + name="Voice", + icon="mdi:play", + ), + LocalTuyaEntity( + id=DPCode.VOICE_BT_PLAY, + name="BT Voice", + icon="mdi:play", + ), + LocalTuyaEntity( + id=DPCode.MUTE, + name="Mute", + icon="mdi:volume-off", + ), + LocalTuyaEntity( + id=DPCode.VOICE_MIC, + name="Microphone", + icon="mdi:microphone-off", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_WELCOME, + name="Welcome", + icon="mdi:human-greeting", + ), + ), + # Unknown product with switch capabilities + # Fond in some diffusers, plugs and PIR flood lights + # Not documented + "qjdcz": ( + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="Switch", + ), + ), + # Heater + # https://developer.tuya.com/en/docs/iot/categoryqn?id=Kaiuz18kih0sm + "qn": ( + LocalTuyaEntity( + id=DPCode.ANION, + name="Ionizer", + icon="mdi:minus-circle-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + ), + # Robot Vacuum + # https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo + "sd": ( + LocalTuyaEntity( + id=DPCode.SWITCH_DISTURB, + name="Do Not Disturb", + icon="mdi:minus-circle", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.VOICE_SWITCH, + name="Mute Voice", + icon="mdi:account-voice", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.RESET_MAP, + name="Map Resetting", + icon="mdi:backup-restore", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.BREAK_CLEAN, + name="Resumable Cleaning", + icon="mdi:cog-play-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.Y_MOP, + name="Mop Y", + icon="mdi:dots-vertical", + entity_category=EntityCategory.CONFIG, + ), + ), + # Water Valve + "sfkzq": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + icon="mdi:valve", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_WEATHER, + name="Smart Weather", + icon="mdi:auto-mode", + entity_category=EntityCategory.CONFIG, + ), + ), + # Siren Alarm + # https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu + "sgbj": ( + LocalTuyaEntity( + id=DPCode.MUFFLING, + name="Mute", + entity_category=EntityCategory.CONFIG, + ), + ), + # Smart Camera + # https://developer.tuya.com/en/docs/iot/categorysp?id=Kaiuz35leyo12 + "sp": ( + LocalTuyaEntity( + id=DPCode.WIRELESS_BATTERYLOCK, + name="Battery Lock", + icon="mdi:battery-lock", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.CRY_DETECTION_SWITCH, + name="Cry Detection", + icon="mdi:emoticon-cry", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.DECIBEL_SWITCH, + name="Sound Detection", + icon="mdi:microphone-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.RECORD_SWITCH, + name="Video Recording", + icon="mdi:record-rec", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.MOTION_RECORD, + name="Motion Recording", + icon="mdi:record-rec", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.BASIC_PRIVATE, + name="Privacy Mode", + icon="mdi:eye-off", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.BASIC_FLIP, + name="Flip", + icon="mdi:flip-horizontal", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.BASIC_OSD, + name="Time Watermark", + icon="mdi:watermark", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.BASIC_WDR, + name="Wide Dynamic Range", + icon="mdi:watermark", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.MOTION_TRACKING, + name="Motion Tracking", + icon="mdi:motion-sensor", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.MOTION_SWITCH, + name="Motion Alarm", + icon="mdi:motion-sensor", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.PTZ_STOP, + name="PTZ Stop", + icon="mdi:stop-circle", + entity_category=EntityCategory.CONFIG, + ), + ), + # Fingerbot + "szjqr": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Switch", + icon="mdi:cursor-pointer", + ), + ), + # IoT Switch? + # Note: Undocumented + "tdq": ( + LocalTuyaEntity( + id=DPCode.SWITCH_1, + name="Switch 1", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_2, + name="Switch 2", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_3, + name="Switch 3", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_4, + name="Switch 4", + device_class=SwitchDeviceClass.OUTLET, + ), + LocalTuyaEntity( + id=DPCode.CHILD_LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + ), + # Solar Light + # https://developer.tuya.com/en/docs/iot/tynd?id=Kaof8j02e1t98 + "tyndj": ( + LocalTuyaEntity( + id=DPCode.SWITCH_SAVE_ENERGY, + name="Energy Saving", + icon="mdi:leaf", + entity_category=EntityCategory.CONFIG, + ), + ), + # PIR Detector + # https://developer.tuya.com/en/docs/iot/categorypir?id=Kaiuz3ss11b80 + "pir": ( + LocalTuyaEntity( + id=DPCode.MOD_ON_TMR, + icon="mdi:timer-play", + entity_category=EntityCategory.CONFIG, + name="Timer", + ), + ), + # Thermostatic Radiator Valve + # Not documented + "wkf": ( + LocalTuyaEntity( + id=DPCode.CHILD_LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=(DPCode.WINDOW_CHECK, DPCode.WINDOW_STATE), + name="Open Window Detection", + icon="mdi:window-open", + entity_category=EntityCategory.CONFIG, + ), + ), + # Air Conditioner Mate (Smart IR Socket) + "wnykq": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Switch", + ), + ), + # Zigbee Gateway (dunno if it's useful) + # "wg2": ( + # LocalTuyaEntity( + # id=DPCode.SWITCH_ALARM_SOUND, + # name="Switch", + # ), + # ), + # SIREN: Siren (switch) with Temperature and humidity sensor + # https://developer.tuya.com/en/docs/iot/f?id=Kavck4sr3o5ek + "wsdcg": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Switch", + device_class=SwitchDeviceClass.OUTLET, + ), + ), + # Ceiling Light + # https://developer.tuya.com/en/docs/iot/ceiling-light?id=Kaiuz03xxfc4r + "xdd": ( + LocalTuyaEntity( + id=DPCode.DO_NOT_DISTURB, + name="Do Not Disturb", + icon="mdi:minus-circle-outline", + entity_category=EntityCategory.CONFIG, + ), + ), + # Diffuser + # https://developer.tuya.com/en/docs/iot/categoryxxj?id=Kaiuz1f9mo6bl + "xxj": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Power", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_SPRAY, + name="Spray", + icon="mdi:spray", + ), + LocalTuyaEntity( + id=DPCode.SWITCH_VOICE, + name="Voice", + icon="mdi:account-voice", + entity_category=EntityCategory.CONFIG, + ), + ), + # Smart Electricity Meter + # https://developer.tuya.com/en/docs/iot/smart-meter?id=Kaiuz4gv6ack7 + "zndb": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + name="Switch", + ), + ), + # Fan + # https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c + "fs": ( + LocalTuyaEntity( + id=DPCode.ANION, + name="Anion", + icon="mdi:atom", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.HUMIDIFIER, + name="Humidification", + icon="mdi:air-humidifier", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.OXYGEN, + name="Oxygen Bar", + icon="mdi:molecule", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.FAN_COOL, + name="Natural Wind", + icon="mdi:weather-windy", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.FAN_BEEP, + name="Sound", + icon="mdi:minus-circle", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.CHILD_LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + ), + # Fan switch + "fskg": ( + LocalTuyaEntity( + id=DPCode.BACKLIGHT_SWITCH, + name="LED Siwtch", + icon="mdi:led-outline", + entity_category=EntityCategory.CONFIG, + ), + ), + # Curtain + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc + "cl": ( + LocalTuyaEntity( + id=DPCode.CONTROL_BACK, + name="Reverse", + icon="mdi:swap-horizontal", + entity_category=EntityCategory.CONFIG, + condition_contains_any=["true", "false"], + ), + LocalTuyaEntity( + id=DPCode.OPPOSITE, + name="Reverse", + icon="mdi:swap-horizontal", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.UP_CONFIRM, + name="Set Upper Limit", + icon="mdi:arrow-collapse-up", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.MIDDLE_CONFIRM, + name="Set Middle Limit", + icon="mdi:format-vertical-align-center", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.DOWN_CONFIRM, + name="Set Down Limit", + icon="mdi:arrow-collapse-down", + entity_category=EntityCategory.CONFIG, + ), + ), + # Humidifier + # https://developer.tuya.com/en/docs/iot/categoryjsq?id=Kaiuz1smr440b + "jsq": ( + LocalTuyaEntity( + id=DPCode.SWITCH_SOUND, + name="Voice", + icon="mdi:account-voice", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SLEEP, + name="Sleep", + icon="mdi:power-sleep", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.STERILIZATION, + name="Sterilization", + icon="mdi:minus-circle-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_SPRAY, + name="Spray", + icon="mdi:spray", + entity_category=EntityCategory.CONFIG, + ), + ), + # Alarm Host + # https://developer.tuya.com/en/docs/iot/categorymal?id=Kaiuz33clqxaf + "mal": ( + LocalTuyaEntity( + id=DPCode.SWITCH_ALARM_SOUND, + name="Sound", + icon="mdi:volume-source", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_ALARM_LIGHT, + name="Light", + icon="mdi:alarm-light-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_KB_SOUND, + name="Key Tone Sound", + icon="mdi:volume-source", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_KB_LIGHT, + name="Keypad Light", + icon="mdi:alarm-light-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_ALARM_CALL, + name="Call", + icon="mdi:phone", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_ALARM_SMS, + name="SMS", + icon="mdi:message", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.SWITCH_ALARM_PROPEL, + name="Push Notification", + icon="mdi:bell-badge-outline", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.MUFFLING, + name="Mute", + icon="mdi:volume-mute", + entity_category=EntityCategory.CONFIG, + ), + ), + # Smart Water Meter + # https://developer.tuya.com/en/docs/iot/f?id=Ka8n052xu7w4c + "znsb": ( + LocalTuyaEntity( + id=DPCode.SWITCH_COLD, + name="Valve", + icon="mdi:Valve", + ), + LocalTuyaEntity( + id=DPCode.AUTO_CLEAN, + name="Auto Clean", + icon="mdi:auto-fix", + entity_category=EntityCategory.CONFIG, + ), + ), + # Thermostat + # https://developer.tuya.com/en/docs/iot/f?id=K9gf45ld5l0t9 + "wk": ( + LocalTuyaEntity( + id=DPCode.CHILD_LOCK, + name="Child Lock", + icon="mdi:account-lock", + entity_category=EntityCategory.CONFIG, + ), + LocalTuyaEntity( + id=DPCode.ECO, + name="ECO", + icon="mdi:sprout", + entity_category=EntityCategory.CONFIG, + ), + ), +} + +# Scene Switch +# https://developer.tuya.com/en/docs/iot/f?id=K9gf7nx6jelo8 +SWITCHES["cjkg"] = SWITCHES["kg"] + +# Wireless Switch # also can come as knob switch. +# https://developer.tuya.com/en/docs/iot/wxkg?id=Kbeo9t3ryuqm5 +SWITCHES["wxkg"] = SWITCHES["kg"] + +# Socket (duplicate of `pc`) +# https://developer.tuya.com/en/docs/iot/s?id=K9gf7o5prgf7s +SWITCHES["cz"] = SWITCHES["pc"] + +# Climates / heaters +SWITCHES["wkf"] = SWITCHES["wk"] +SWITCHES["rs"] = SWITCHES["wk"] +SWITCHES["qn"] = SWITCHES["wk"] +SWITCHES["kt"] = SWITCHES["wk"] + +# Dehumidifier +# https://developer.tuya.com/en/docs/iot/categorycs?id=Kaiuz1vcz4dha +SWITCHES["cs"] = SWITCHES["jsq"] diff --git a/custom_components/localtuya/core/ha_entities/vacuums.py b/custom_components/localtuya/core/ha_entities/vacuums.py new file mode 100644 index 00000000..c3c96a1e --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/vacuums.py @@ -0,0 +1,100 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from .base import DPCode, LocalTuyaEntity, CLOUD_VALUE + +CONF_POWERGO_DP = "powergo_dp" +CONF_IDLE_STATUS_VALUE = "idle_status_value" +CONF_RETURNING_STATUS_VALUE = "returning_status_value" +CONF_DOCKED_STATUS_VALUE = "docked_status_value" +CONF_BATTERY_DP = "battery_dp" +CONF_MODE_DP = "mode_dp" +CONF_MODES = "modes" +CONF_FAN_SPEED_DP = "fan_speed_dp" +CONF_FAN_SPEEDS = "fan_speeds" +CONF_CLEAN_TIME_DP = "clean_time_dp" +CONF_CLEAN_AREA_DP = "clean_area_dp" +CONF_CLEAN_RECORD_DP = "clean_record_dp" +CONF_LOCATE_DP = "locate_dp" +CONF_FAULT_DP = "fault_dp" +CONF_PAUSED_STATE = "paused_state" +CONF_RETURN_MODE = "return_mode" +CONF_STOP_STATUS = "stop_status" + +DEFAULT_IDLE_STATUS = "standby,sleep" +DEFAULT_RETURNING_STATUS = "docking,to_charge,goto_charge" +DEFAULT_DOCKED_STATUS = "charging,chargecompleted,charge_done" +DEFAULT_MODES = "smart,wall_follow,spiral,single" +DEFAULT_FAN_SPEEDS = "low,normal,high" +DEFAULT_PAUSED_STATE = "paused" +DEFAULT_RETURN_MODE = "chargego" +DEFAULT_STOP_STATUS = "standby" + + +def localtuya_vaccuums( + modes: str = None, + returning_status_value: str = None, + return_mode: str = None, + fan_speeds: str = None, + paused_state: str = None, + stop_status: str = None, + idle_status_value: str = None, + docked_status_value: str = None, +) -> dict: + """Will return dict with the vacuum localtuya entity configs""" + data = { + CONF_MODES: CLOUD_VALUE(modes, CONF_MODE_DP, "range", str), + CONF_IDLE_STATUS_VALUE: idle_status_value or DEFAULT_IDLE_STATUS, + CONF_STOP_STATUS: stop_status or DEFAULT_STOP_STATUS, + CONF_PAUSED_STATE: paused_state or DEFAULT_PAUSED_STATE, + CONF_FAN_SPEEDS: CLOUD_VALUE(fan_speeds, CONF_FAN_SPEED_DP, "range", str), + CONF_RETURN_MODE: return_mode or DEFAULT_RETURN_MODE, + CONF_RETURNING_STATUS_VALUE: returning_status_value or DEFAULT_RETURNING_STATUS, + CONF_DOCKED_STATUS_VALUE: docked_status_value or CONF_DOCKED_STATUS_VALUE, + } + + return data + + +VACUUMS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Robot Vacuum + # https://developer.tuya.com/en/docs/iot/fsd?id=K9gf487ck1tlo + "sd": ( + LocalTuyaEntity( + id=DPCode.STATUS, + icon="mdi:robot-vacuum", + powergo_dp=(DPCode.POWER_GO, DPCode.POWER, DPCode.SWITCH), + battery_dp=( + DPCode.BATTERY_PERCENTAGE, + DPCode.ELECTRICITY_LEFT, + DPCode.RESIDUAL_ELECTRICITY, + ), + mode_dp=DPCode.MODE, + fan_speed_dp=DPCode.SUCTION, + pause_dp=DPCode.PAUSE, + locate_dp=DPCode.SEEK, + clean_time_dp=( + DPCode.CLEAN_TIME, + DPCode.TOTAL_CLEAN_AREA, + DPCode.TOTAL_CLEAN_TIME, + ), + clean_area_dp=DPCode.CLEAN_AREA, + clean_record_dp=DPCode.CLEAN_RECORD, + fault_dp=DPCode.FAULT, + custom_configs=localtuya_vaccuums( + modes=DEFAULT_MODES, + returning_status_value=DEFAULT_RETURNING_STATUS, + return_mode=DEFAULT_RETURN_MODE, + fan_speeds=DEFAULT_FAN_SPEEDS, + paused_state=DEFAULT_PAUSED_STATE, + stop_status=DEFAULT_STOP_STATUS, + idle_status_value=DEFAULT_IDLE_STATUS, + docked_status_value=DEFAULT_DOCKED_STATUS, + ), + ), + ), +} diff --git a/custom_components/localtuya/core/ha_entities/water_heaters.py b/custom_components/localtuya/core/ha_entities/water_heaters.py new file mode 100644 index 00000000..941a749b --- /dev/null +++ b/custom_components/localtuya/core/ha_entities/water_heaters.py @@ -0,0 +1,99 @@ +""" + This a file contains available tuya data + https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq + + Credits: official HA Tuya integration. + Modified by: xZetsubou +""" + +from homeassistant.components.water_heater import ( + DEFAULT_MAX_TEMP, + DEFAULT_MIN_TEMP, +) +from homeassistant.const import CONF_TEMPERATURE_UNIT + +from .base import DPCode, LocalTuyaEntity, CLOUD_VALUE +from ...const import ( + CONF_TARGET_TEMPERATURE_LOW_DP, + CONF_TARGET_TEMPERATURE_HIGH_DP, + CONF_PRECISION, + CONF_TARGET_PRECISION, + CONF_CURRENT_TEMPERATURE_DP, + CONF_MAX_TEMP, + CONF_MIN_TEMP, + CONF_TARGET_TEMPERATURE_DP, + CONF_MODES, + CONF_MODE_DP, +) + + +UNIT_C = "celsius" +UNIT_F = "fahrenheit" + + +def localtuya_water_heater( + modes={}, + unit=None, + min_temperature=DEFAULT_MIN_TEMP, + max_temperature=DEFAULT_MAX_TEMP, + current_precsion=0.1, + target_precision=1, +) -> dict: + """Create localtuya climate configs""" + data = {} + for key, conf in { + CONF_MODES: CLOUD_VALUE(modes, CONF_MODE_DP, "range", dict), + CONF_MIN_TEMP: CLOUD_VALUE( + min_temperature, CONF_TARGET_TEMPERATURE_DP, "min", scale=True + ), + CONF_MAX_TEMP: CLOUD_VALUE( + max_temperature, CONF_TARGET_TEMPERATURE_DP, "max", scale=True + ), + CONF_TEMPERATURE_UNIT: unit, + CONF_PRECISION: CLOUD_VALUE( + str(current_precsion), CONF_CURRENT_TEMPERATURE_DP, "scale", str + ), + CONF_TARGET_PRECISION: CLOUD_VALUE( + str(target_precision), CONF_TARGET_TEMPERATURE_DP, "scale", str + ), + }.items(): + if conf is not None: + data.update({key: conf}) + + return data + + +WATER_HEATERS: dict[str, tuple[LocalTuyaEntity, ...]] = { + # Heater + # https://developer.tuya.com/en/docs/iot/f?id=K9gf46epy4j82 + "qn": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + target_temperature_dp=(DPCode.TEMP_SET, DPCode.TEMP_SET_F), + current_temperature_dp=(DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F), + target_temperature_low_dp=(DPCode.TEMP_LOW, DPCode.LOWER_TEMP), + target_temperature_high_dp=(DPCode.TEMP_UP, DPCode.UPPER_TEMP), + mode_dp=DPCode.MODE, + fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED), + custom_configs=localtuya_water_heater( + current_precsion=0.1, target_precision=0.1 + ), + ), + ), + # Heater + # https://developer.tuya.com/en/docs/iot/categoryrs?id=Kaiuz0nfferyx + "rs": ( + LocalTuyaEntity( + id=DPCode.SWITCH, + target_temperature_dp=(DPCode.TEMP_SET, DPCode.TEMP_SET_F), + current_temperature_dp=(DPCode.TEMP_CURRENT, DPCode.TEMP_CURRENT_F), + target_temperature_low_dp=(DPCode.TEMP_LOW, DPCode.LOWER_TEMP), + target_temperature_high_dp=(DPCode.TEMP_UP, DPCode.UPPER_TEMP), + mode_dp=DPCode.MODE, + fan_speed_dp=(DPCode.FAN_SPEED_ENUM, DPCode.WINDSPEED), + custom_configs=localtuya_water_heater( + current_precsion=0.1, target_precision=0.1 + ), + ), + ), +} diff --git a/custom_components/localtuya/core/helpers.py b/custom_components/localtuya/core/helpers.py new file mode 100644 index 00000000..254e6888 --- /dev/null +++ b/custom_components/localtuya/core/helpers.py @@ -0,0 +1,116 @@ +""" +Helpers functions for HASS-LocalTuya. +""" + +import asyncio +import logging +import os.path +from enum import Enum +from fnmatch import fnmatch +from typing import NamedTuple + +from homeassistant.util.yaml import load_yaml, dump +from homeassistant.const import CONF_PLATFORM, CONF_ENTITIES + + +import custom_components.localtuya.templates as templates_dir + +JSON_TYPE = list | dict | str + +_LOGGER = logging.getLogger(__name__) + + +############################### +# Templates # +############################### +class templates: + + def yaml_dump(config, fname: str | None = None) -> JSON_TYPE: + """Save yaml config.""" + try: + with open(fname, "w", encoding="utf-8") as conf_file: + return conf_file.write(dump(config)) + except UnicodeDecodeError as exc: + _LOGGER.error("Unable to save file %s: %s", fname, exc) + + def list_templates(): + """Return the available templates files.""" + dir = os.path.dirname(templates_dir.__file__) + files = {} + for e in sorted(os.scandir(dir), key=lambda e: e.name): + file: str = e.name.lower() + if e.is_file() and (fnmatch(file, "*yaml") or fnmatch(file, "*yml")): + # fn = str(file).replace(".yaml", "").replace("_", " ") + files[e.name] = e.name + return files + + def import_config(filename): + """Create a data that can be used as config in localtuya.""" + template_dir = os.path.dirname(templates_dir.__file__) + template_file = os.path.join(template_dir, filename) + _config = load_yaml(template_file) + entities = [] + for cfg in _config: + ent = {} + for plat, values in cfg.items(): + for key, value in values.items(): + ent[str(key)] = ( + str(value) + if not isinstance(value, (bool, float, dict, list)) + else value + ) + ent[CONF_PLATFORM] = plat + entities.append(ent) + if not entities: + raise ValueError("No entities found the can be used for localtuya") + return entities + + @classmethod + def export_config(cls, config: dict, config_name: str): + """Create a yaml config file for localtuya.""" + export_config = [] + for cfg in config[CONF_ENTITIES]: + # Special case device_classes + for k, v in cfg.items(): + if not type(v) is str and isinstance(v, Enum): + cfg[k] = v.value + + ents = {cfg[CONF_PLATFORM]: cfg} + export_config.append(ents) + fname = ( + config_name + ".yaml" if not config_name.endswith(".yaml") else config_name + ) + fname = fname.replace(" ", "_") + template_dir = os.path.dirname(templates_dir.__file__) + template_file = os.path.join(template_dir, fname) + + cls.yaml_dump(export_config, template_file) + + +################################ +## config flows ## +################################ + +from ..const import CONF_LOCAL_KEY, CONF_NODE_ID + +GATEWAY = NamedTuple("Gateway", [("id", str), ("data", dict)]) + + +def get_gateway_by_deviceid(device_id: str, cloud_data: dict) -> GATEWAY: + """Return the gateway (id, data) of the sub-deviceID if existed in cloud_data.""" + + if sub_device := cloud_data.get(device_id): + for dev_id, dev_data in cloud_data.items(): + # Get gateway Assuming the LocalKey is the same gateway LocalKey! + if ( + dev_id != device_id + and not dev_data.get(CONF_NODE_ID) + and dev_data.get(CONF_LOCAL_KEY) == sub_device.get(CONF_LOCAL_KEY) + ): + return GATEWAY(dev_id, dev_data) + + +############################### +# Auto configure device # +############################### +from .ha_entities import gen_localtuya_entities diff --git a/custom_components/localtuya/core/pytuya/__init__.py b/custom_components/localtuya/core/pytuya/__init__.py new file mode 100644 index 00000000..8797fb5e --- /dev/null +++ b/custom_components/localtuya/core/pytuya/__init__.py @@ -0,0 +1,1662 @@ +# PyTuya Module +# -*- coding: utf-8 -*- +""" +Python module to interface with Tuya WiFi smart devices. + +Author: clach04, postlund +Maintained by: rospogrigio, xZetsubou + +For more information see https://github.com/clach04/python-tuya + +Classes + TuyaInterface(dev_id, address, local_key=None) + dev_id (str): Device ID e.g. 01234567891234567890 + address (str): Device Network IP Address e.g. 10.0.1.99 + local_key (str, optional): The encryption key. Defaults to None. + +Functions + json = status() # returns json payload + set_version(version) # 3.1 [default], 3.2, 3.3, 3.4 or 3.5 + detect_available_dps() # returns a list of available dps provided by the device + update_dps(dps) # sends update dps command + add_dps_to_request(dp_index) # adds dp_index to the list of dps used by the + # device (to be queried in the payload) + set_dp(on, dp_index) # Set value of any dps index. + + +Credits + * TuyaAPI https://github.com/codetheweb/tuyapi by codetheweb and blackrozes + For protocol reverse engineering + * PyTuya https://github.com/clach04/python-tuya by clach04 + The origin of this python module (now abandoned) + * Tuya Protocol 3.4 and 3.5 Support by uzlonewolf + Enhancement to TuyaMessage logic for multi-payload messages and Tuya Protocol 3.4 support + * TinyTuya https://github.com/jasonacox/tinytuya by jasonacox, uzlonewolf + Several CLI tools and code for Tuya devices +""" + +import os +import asyncio +import errno +import base64 +import binascii +import hmac +import json +import logging +import struct +import time +import weakref +from enum import Enum +from abc import ABC, abstractmethod +from typing import Self +from collections import namedtuple +from hashlib import md5, sha256 + +from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes + +version_tuple = (2024, 6, 0) +version = version_string = __version__ = "%d.%d.%d" % version_tuple +__author__ = "rospogrigio, xZetsubou" + +_LOGGER = logging.getLogger(__name__) + +# Tuya Packet Format +TuyaHeader = namedtuple("TuyaHeader", "prefix seqno cmd length total_length") +MessagePayload = namedtuple("MessagePayload", "cmd payload") +try: + TuyaMessage = namedtuple( + "TuyaMessage", + "seqno cmd retcode payload crc crc_good prefix iv", + defaults=(True, 0x55AA, None), + ) +except: + TuyaMessage = namedtuple( + "TuyaMessage", "seqno cmd retcode payload crc crc_good prefix iv" + ) + +# TinyTuya Error Response Codes +ERR_JSON = 900 +ERR_CONNECT = 901 +ERR_TIMEOUT = 902 +ERR_RANGE = 903 +ERR_PAYLOAD = 904 +ERR_OFFLINE = 905 +ERR_STATE = 906 +ERR_FUNCTION = 907 +ERR_DEVTYPE = 908 +ERR_CLOUDKEY = 909 +ERR_CLOUDRESP = 910 +ERR_CLOUDTOKEN = 911 +ERR_PARAMS = 912 +ERR_CLOUD = 913 + +error_codes = { + ERR_JSON: "Invalid JSON Response from Device", + ERR_CONNECT: "Network Error: Unable to Connect", + ERR_TIMEOUT: "Timeout Waiting for Device", + ERR_RANGE: "Specified Value Out of Range", + ERR_PAYLOAD: "Unexpected Payload from Device", + ERR_OFFLINE: "Network Error: Device Unreachable", + ERR_STATE: "Device in Unknown State", + ERR_FUNCTION: "Function Not Supported by Device", + ERR_DEVTYPE: "Device22 Detected: Retry Command", + ERR_CLOUDKEY: "Missing Tuya Cloud Key and Secret", + ERR_CLOUDRESP: "Invalid JSON Response from Cloud", + ERR_CLOUDTOKEN: "Unable to Get Cloud Token", + ERR_PARAMS: "Missing Function Parameters", + ERR_CLOUD: "Error Response from Tuya Cloud", + None: "Unknown Error", +} + + +class DecodeError(Exception): + """Specific Exception caused by decoding error.""" + + pass + + +class SubdeviceState(Enum): + ONLINE = 1 + OFFLINE = 2 + ABSENT = 3 + + +# Tuya Command Types +# Reference: +# https://github.com/tuya/tuya-iotos-embeded-sdk-wifi-ble-bk7231n/blob/master/sdk/include/lan_protocol.h +AP_CONFIG = 0x01 # FRM_TP_CFG_WF # only used for ap 3.0 network config +ACTIVE = 0x02 # FRM_TP_ACTV (discard) # WORK_MODE_CMD +SESS_KEY_NEG_START = 0x03 # FRM_SECURITY_TYPE3 # negotiate session key +SESS_KEY_NEG_RESP = 0x04 # FRM_SECURITY_TYPE4 # negotiate session key response +SESS_KEY_NEG_FINISH = 0x05 # FRM_SECURITY_TYPE5 # finalize session key negotiation +UNBIND = 0x06 # FRM_TP_UNBIND_DEV # DATA_QUERT_CMD - issue command +CONTROL = 0x07 # FRM_TP_CMD # STATE_UPLOAD_CMD +STATUS = 0x08 # FRM_TP_STAT_REPORT # STATE_QUERY_CMD +HEART_BEAT = 0x09 # FRM_TP_HB +DP_QUERY = 0x0A # 10 # FRM_QUERY_STAT # UPDATE_START_CMD - get data points +QUERY_WIFI = 0x0B # 11 # FRM_SSID_QUERY (discard) # UPDATE_TRANS_CMD +TOKEN_BIND = 0x0C # 12 # FRM_USER_BIND_REQ # GET_ONLINE_TIME_CMD - system time (GMT) +CONTROL_NEW = 0x0D # 13 # FRM_TP_NEW_CMD # FACTORY_MODE_CMD +ENABLE_WIFI = 0x0E # 14 # FRM_ADD_SUB_DEV_CMD # WIFI_TEST_CMD +WIFI_INFO = 0x0F # 15 # FRM_CFG_WIFI_INFO +DP_QUERY_NEW = 0x10 # 16 # FRM_QUERY_STAT_NEW +SCENE_EXECUTE = 0x11 # 17 # FRM_SCENE_EXEC +UPDATEDPS = 0x12 # 18 # FRM_LAN_QUERY_DP # Request refresh of DPS +UDP_NEW = 0x13 # 19 # FR_TYPE_ENCRYPTION +AP_CONFIG_NEW = 0x14 # 20 # FRM_AP_CFG_WF_V40 +BOARDCAST_LPV34 = 0x23 # 35 # FR_TYPE_BOARDCAST_LPV34 +LAN_EXT_STREAM = 0x40 # 64 # FRM_LAN_EXT_STREAM + +UPDATE_DPS_LIST = [3.2, 3.3, 3.4, 3.5] # 3.2 behaves like 3.3 with type_0d + +PROTOCOL_VERSION_BYTES_31 = b"3.1" +PROTOCOL_VERSION_BYTES_33 = b"3.3" +PROTOCOL_VERSION_BYTES_34 = b"3.4" +PROTOCOL_VERSION_BYTES_35 = b"3.5" + +PROTOCOL_3x_HEADER = 12 * b"\x00" +PROTOCOL_33_HEADER = PROTOCOL_VERSION_BYTES_33 + PROTOCOL_3x_HEADER +PROTOCOL_34_HEADER = PROTOCOL_VERSION_BYTES_34 + PROTOCOL_3x_HEADER +PROTOCOL_35_HEADER = PROTOCOL_VERSION_BYTES_35 + PROTOCOL_3x_HEADER +MESSAGE_RECV_HEADER_FMT = ">5I" # 4*uint32: prefix, seqno, cmd, length, retcode +MESSAGE_HEADER_FMT = MESSAGE_HEADER_FMT_55AA = ( + ">4I" # 4*uint32: prefix, seqno, cmd, length [, retcode] +) +MESSAGE_HEADER_FMT_6699 = ">IHIII" # 4*uint32: prefix, unknown, seqno, cmd, length +MESSAGE_RETCODE_FMT = ">I" # retcode for received messages +MESSAGE_END_FMT = MESSAGE_END_FMT_55AA = ">2I" # 2*uint32: crc, suffix +MESSAGE_END_FMT_HMAC = ">32sI" # 32s:hmac, uint32:suffix +MESSAGE_END_FMT_6699 = ">16sI" # 16s:tag, suffix +PREFIX_VALUE = PREFIX_55AA_VALUE = 0x000055AA +PREFIX_BIN = PREFIX_55AA_BIN = b"\x00\x00U\xaa" +SUFFIX_VALUE = SUFFIX_55AA_VALUE = 0x0000AA55 +SUFFIX_BIN = SUFFIX_55AA_BIN = b"\x00\x00\xaaU" +PREFIX_6699_VALUE = 0x00006699 +PREFIX_6699_BIN = b"\x00\x00\x66\x99" +SUFFIX_6699_VALUE = 0x00009966 +SUFFIX_6699_BIN = b"\x00\x00\x99\x66" + +NO_PROTOCOL_HEADER_CMDS = [ + DP_QUERY, + DP_QUERY_NEW, + UPDATEDPS, + HEART_BEAT, + SESS_KEY_NEG_START, + SESS_KEY_NEG_RESP, + SESS_KEY_NEG_FINISH, + LAN_EXT_STREAM, +] + +HEARTBEAT_INTERVAL = 9 + +# DPS that are known to be safe to use with update_dps (0x12) command +UPDATE_DPS_WHITELIST = [18, 19, 20] # Socket (Wi-Fi) + +# Tuya Device Dictionary - Command and Payload Overrides +# This is intended to match requests.json payload at +# https://github.com/codetheweb/tuyapi : +# 'type_0a' devices require the 0a command for the DP_QUERY request +# 'type_0d' devices require the 0d command for the DP_QUERY request and a list of +# dps used set to Null in the request payload +# prefix: # Next byte is command byte ("hexByte") some zero padding, then length +# of remaining payload, i.e. command + suffix (unclear if multiple bytes used for +# length, zero padding implies could be more than one byte) + +# Any command not defined in payload_dict will be sent as-is with a +# payload of {"gwId": "", "devId": "", "uid": "", "t": ""} + +payload_dict = { + # Default Device + "type_0a": { + AP_CONFIG: { # [BETA] Set Control Values on Device + "command": {"gwId": "", "devId": "", "uid": "", "t": "", "cid": ""}, + }, + CONTROL: { # Set Control Values on Device + "command": {"devId": "", "uid": "", "t": "", "cid": ""}, + }, + STATUS: { # Get Status from Device + "command": {"gwId": "", "devId": "", "cid": ""}, + }, + HEART_BEAT: {"command": {"gwId": "", "devId": ""}}, + DP_QUERY: { # Get Data Points from Device + "command": {"gwId": "", "devId": "", "uid": "", "t": "", "cid": ""}, + }, + CONTROL_NEW: {"command": {"devId": "", "uid": "", "t": "", "cid": ""}}, + DP_QUERY_NEW: {"command": {"devId": "", "uid": "", "t": "", "cid": ""}}, + UPDATEDPS: {"command": {"dpId": [18, 19, 20], "cid": ""}}, + LAN_EXT_STREAM: {"command": {"reqType": "", "data": {}}}, + }, + # Special Case Device "0d" - Some of these devices + # Require the 0d command as the DP_QUERY status request and the list of + # dps requested payload + "type_0d": { + DP_QUERY: { # Get Data Points from Device + "command_override": CONTROL_NEW, # Uses CONTROL_NEW command for some reason + "command": {"devId": "", "uid": "", "t": "", "cid": ""}, + }, + }, + "v3.4": { + CONTROL: { + "command_override": CONTROL_NEW, # Uses CONTROL_NEW command + "command": {"protocol": 5, "t": "int", "data": {"cid": ""}}, + }, + DP_QUERY: {"command_override": DP_QUERY_NEW}, + }, + "v3.5": { + CONTROL: { + "command_override": CONTROL_NEW, # Uses CONTROL_NEW command + "command": {"protocol": 5, "t": "int", "data": {"cid": ""}}, + }, + DP_QUERY: {"command_override": DP_QUERY_NEW}, + }, +} + + +class TuyaLoggingAdapter(logging.LoggerAdapter): + """Adapter that adds device id to all log points.""" + + def process(self, msg, kwargs): + """Process log point and return output.""" + dev_id = self.extra["device_id"] + name = self.extra.get("name") + prefix = f"{dev_id[0:3]}...{dev_id[-3:]}" + if name: + return f"[{prefix} - {name}] {msg}", kwargs + + return f"[{prefix}] {msg}", kwargs + + +class ContextualLogger: + """Contextual logger adding device id to log points.""" + + def __init__(self): + """Initialize a new ContextualLogger.""" + self._logger = None + self._enable_debug = False + + self._reset_warning = int(time.time()) + self._last_warning = "" + + def set_logger(self, logger, device_id, enable_debug=False, name=None): + """Set base logger to use.""" + self._enable_debug = enable_debug + self._logger = TuyaLoggingAdapter( + logger, {"device_id": device_id, "name": name} + ) + return self + + def debug(self, msg, *args, force=False): + """Debug level log for device. force will ignore device debug check.""" + if not self._enable_debug and not force: + return + return self._logger.log(logging.DEBUG, msg, *args) + + def info(self, msg, *args, clear_warning=False): + """Info level log. clear_warning to re-enable warings msgs if duplicated""" + if clear_warning: + self._last_warning = "" + + return self._logger.log(logging.INFO, msg, *args) + + def warning(self, msg, *args): + """Warning method log.""" + if msg != self._last_warning: + self._last_warning = msg + return self._logger.log(logging.WARNING, msg, *args) + # else: + # self.info(msg) + + def error(self, msg, *args): + """Error level log.""" + return self._logger.log(logging.ERROR, msg, *args) + + def exception(self, msg, *args): + """Exception level log.""" + return self._logger.exception(msg, *args) + + +def pack_message(msg, hmac_key=None): + """Pack a TuyaMessage into bytes.""" + if msg.prefix == PREFIX_55AA_VALUE: + header_fmt = MESSAGE_HEADER_FMT_55AA + end_fmt = MESSAGE_END_FMT_HMAC if hmac_key else MESSAGE_END_FMT_55AA + msg_len = len(msg.payload) + struct.calcsize(end_fmt) + header_data = (msg.prefix, msg.seqno, msg.cmd, msg_len) + elif msg.prefix == PREFIX_6699_VALUE: + if not hmac_key: + raise TypeError("key must be provided to pack 6699-format messages") + header_fmt = MESSAGE_HEADER_FMT_6699 + end_fmt = MESSAGE_END_FMT_6699 + msg_len = len(msg.payload) + (struct.calcsize(end_fmt) - 4) + 12 + if type(msg.retcode) == int: + msg_len += struct.calcsize(MESSAGE_RETCODE_FMT) + header_data = (msg.prefix, 0, msg.seqno, msg.cmd, msg_len) + else: + raise ValueError( + "pack_message() cannot handle message format %08X" % msg.prefix + ) + + # Create full message excluding CRC and suffix + data = struct.pack(header_fmt, *header_data) + + if msg.prefix == PREFIX_6699_VALUE: + cipher = AESCipher(hmac_key) + if type(msg.retcode) == int: + raw = struct.pack(MESSAGE_RETCODE_FMT, msg.retcode) + msg.payload + else: + raw = msg.payload + data2 = cipher.encrypt( + raw, + use_base64=False, + pad=False, + iv=True if not msg.iv else msg.iv, + header=data[4:], + ) + data += data2 + SUFFIX_6699_BIN + else: + data += msg.payload + if hmac_key: + crc = hmac.new(hmac_key, data, sha256).digest() + else: + crc = binascii.crc32(data) & 0xFFFFFFFF + # Calculate CRC, add it together with suffix + data += struct.pack(end_fmt, crc, SUFFIX_VALUE) + + return data + + +def unpack_message(data, hmac_key=None, header=None, no_retcode=False, logger=_LOGGER): + """Unpack bytes into a TuyaMessage.""" + if header is None: + header = parse_header(data) + + if header.prefix == PREFIX_55AA_VALUE: + # 4-word header plus return code + header_len = struct.calcsize(MESSAGE_HEADER_FMT_55AA) + end_fmt = MESSAGE_END_FMT_HMAC if hmac_key else MESSAGE_END_FMT_55AA + retcode_len = 0 if no_retcode else struct.calcsize(MESSAGE_RETCODE_FMT) + msg_len = header_len + header.length + elif header.prefix == PREFIX_6699_VALUE: + if not hmac_key: + raise TypeError("key must be provided to unpack 6699-format messages") + header_len = struct.calcsize(MESSAGE_HEADER_FMT_6699) + end_fmt = MESSAGE_END_FMT_6699 + retcode_len = 0 + msg_len = header_len + header.length + 4 + else: + raise ValueError( + "unpack_message() cannot handle message format %08X" % header.prefix + ) + + if len(data) < msg_len: + logger.debug( + "unpack_message(): not enough data to unpack payload! need %d but only have %d", + header_len + header.length, + len(data), + ) + raise DecodeError(f"Not enough data to unpack payload: {data}") + + end_len = struct.calcsize(end_fmt) + # the retcode is technically part of the payload, but strip it as we do not want it here + retcode = ( + 0 + if not retcode_len + else struct.unpack( + MESSAGE_RETCODE_FMT, data[header_len : header_len + retcode_len] + )[0] + ) + payload = data[header_len + retcode_len : msg_len] + crc, suffix = struct.unpack(end_fmt, payload[-end_len:]) + payload = payload[:-end_len] + + if header.prefix == PREFIX_55AA_VALUE: + if hmac_key: + have_crc = hmac.new( + hmac_key, data[: (header_len + header.length) - end_len], sha256 + ).digest() + else: + have_crc = ( + binascii.crc32(data[: (header_len + header.length) - end_len]) + & 0xFFFFFFFF + ) + + if suffix != SUFFIX_VALUE: + logger.debug("Suffix prefix wrong! %08X != %08X", suffix, SUFFIX_VALUE) + + if crc != have_crc: + if hmac_key: + logger.debug( + "HMAC checksum wrong! %r != %r", + binascii.hexlify(have_crc), + binascii.hexlify(crc), + ) + else: + logger.debug("CRC wrong! %08X != %08X", have_crc, crc) + crc_good = crc == have_crc + iv = None + elif header.prefix == PREFIX_6699_VALUE: + iv = payload[:12] + payload = payload[12:] + try: + cipher = AESCipher(hmac_key) + payload = cipher.decrypt( + payload, + use_base64=False, + decode_text=False, + iv=iv, + header=data[4:header_len], + tag=crc, + ) + crc_good = True + except: + crc_good = False + + retcode_len = struct.calcsize(MESSAGE_RETCODE_FMT) + if no_retcode is False: + pass + elif ( + no_retcode is None + and payload[0:1] != b"{" + and payload[retcode_len : retcode_len + 1] == b"{" + ): + retcode_len = struct.calcsize(MESSAGE_RETCODE_FMT) + else: + retcode_len = 0 + if retcode_len: + retcode = struct.unpack(MESSAGE_RETCODE_FMT, payload[:retcode_len])[0] + payload = payload[retcode_len:] + + return TuyaMessage( + header.seqno, header.cmd, retcode, payload, crc, crc_good, header.prefix, iv + ) + + +def parse_header(data, logger=_LOGGER): + """Unpack bytes into a TuyaHeader.""" + if data[:4] == PREFIX_6699_BIN: + fmt = MESSAGE_HEADER_FMT_6699 + else: + fmt = MESSAGE_HEADER_FMT_55AA + + header_len = struct.calcsize(fmt) + + if len(data) < header_len: + err = "Not enough data to unpack header" + logger.error(err) + raise DecodeError(err) + + unpacked = struct.unpack(fmt, data[:header_len]) + prefix = unpacked[0] + + if prefix == PREFIX_55AA_VALUE: + prefix, seqno, cmd, payload_len = unpacked + total_length = payload_len + header_len + elif prefix == PREFIX_6699_VALUE: + prefix, unknown, seqno, cmd, payload_len = unpacked + # seqno |= unknown << 32 + total_length = payload_len + header_len + len(SUFFIX_6699_BIN) + else: + err = f"Header prefix wrong! {prefix} is not {PREFIX_55AA_VALUE} or {PREFIX_6699_VALUE}" + logger.error(err) + raise DecodeError(err) + + # sanity check. currently the max payload length is somewhere around 300 bytes + if payload_len > 2000: + err = f"Header claims the packet size is over 2000 bytes! It is most likely corrupt. Claimed size: {payload_len} bytes. fmt: {fmt} unpacked: {unpacked}" + logger.error(err) + raise DecodeError(err) + + return TuyaHeader(prefix, seqno, cmd, payload_len, total_length) + + +class AESCipher: + """Cipher module for Tuya communication.""" + + def __init__(self, key): + """Initialize a new AESCipher.""" + self.block_size = 16 + self.key = key + self.cipher = Cipher(algorithms.AES(key), modes.ECB(), default_backend()) + + def encrypt(self, raw, use_base64=True, pad=True, iv=False, header=None): + """Encrypt data to be sent to device.""" + if iv: + if iv is True: + if _LOGGER.isEnabledFor(logging.DEBUG): + iv = b"0123456789ab" + else: + iv = str(time.time() * 10)[:12].encode("utf8") + encryptor = Cipher(algorithms.AES(self.key), modes.GCM(iv)).encryptor() + if header: + encryptor.authenticate_additional_data(header) + crypted_text = encryptor.update(raw) + encryptor.finalize() + crypted_text = iv + crypted_text + encryptor.tag + else: + encryptor = self.cipher.encryptor() + if pad: + raw = self._pad(raw) + crypted_text = encryptor.update(raw) + encryptor.finalize() + return base64.b64encode(crypted_text) if use_base64 else crypted_text + + def decrypt( + self, enc, use_base64=True, decode_text=True, iv=False, header=None, tag=None + ): + """Decrypt data from device.""" + if not iv: + if use_base64: + enc = base64.b64decode(enc) + + if iv: + if iv is True: + iv = enc[:12] + enc = enc[12:] + if tag is None: + decryptor = Cipher( + algorithms.AES(self.key), modes.CTR(iv + b"\x00\x00\x00\x02") + ).decryptor() + else: + decryptor = Cipher( + algorithms.AES(self.key), modes.GCM(iv, tag) + ).decryptor() + if header and (tag is not None): + decryptor.authenticate_additional_data(header) + raw = decryptor.update(enc) + decryptor.finalize() + else: + decryptor = self.cipher.decryptor() + raw = decryptor.update(enc) + decryptor.finalize() + raw = self._unpad(raw) + + return raw.decode("utf-8") if decode_text else raw + + def _pad(self, data): + padnum = self.block_size - len(data) % self.block_size + return data + padnum * chr(padnum).encode() + + @staticmethod + def _unpad(data): + return data[: -ord(data[len(data) - 1 :])] + + +class MessageDispatcher(ContextualLogger): + """Buffer and dispatcher for Tuya messages.""" + + # Heartbeats on protocols < 3.3 respond with sequence number 0, + # so they can't be waited for like other messages. + # This is a hack to allow waiting for heartbeats. + HEARTBEAT_SEQNO = -100 + RESET_SEQNO = -101 + SESS_KEY_SEQNO = -102 + SUB_DEVICE_QUERY_SEQNO = -103 + + def __init__(self, dev_id, callback_status_update, protocol_version, local_key): + """Initialize a new MessageBuffer.""" + super().__init__() + self.buffer = b"" + self.listeners: dict[str, asyncio.Semaphore] = {} + self.callback_status_update = callback_status_update + self.version = protocol_version + self.local_key = local_key + + def abort(self): + """Abort all waiting clients.""" + for key in self.listeners: + sem = self.listeners[key] + self.listeners[key] = None + + # TODO: Received data and semahore should be stored separately + if isinstance(sem, asyncio.Semaphore): + sem.release() + + async def wait_for(self, seqno, cmd, timeout=5): + """Wait for response to a sequence number to be received and return it.""" + if seqno in self.listeners: + self.debug(f"listener exists for {seqno}") + if seqno == self.HEARTBEAT_SEQNO: + raise Exception(f"listener exists for {seqno}") + + self.debug("Command %d waiting for seq. number %d", cmd, seqno) + self.listeners[seqno] = asyncio.Semaphore(0) + try: + await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout) + except asyncio.TimeoutError: + self.debug( + "Command %d timed out waiting for sequence number %d", cmd, seqno + ) + del self.listeners[seqno] + raise TimeoutError( + f"Command {cmd} timed out waiting for sequence number {seqno}" + ) + return self.listeners.pop(seqno) + + def add_data(self, data): + """Add new data to the buffer and try to parse messages.""" + self.buffer += data + + header_len = struct.calcsize(MESSAGE_RECV_HEADER_FMT) + while self.buffer: + # Check if enough data for measage header + if len(self.buffer) < header_len: + break + + prefix_offset_55AA = self.buffer.find(PREFIX_55AA_BIN) + prefix_offset_6699 = self.buffer.find(PREFIX_6699_BIN) + prefixes = (prefix_offset_55AA, prefix_offset_6699) + + # If somehow we got unexpected message, we will ignore it and reset the buffer. + if prefix_offset_55AA < 0 and prefix_offset_6699 < 0: + self.debug(f"Got unexpected Message prefix: {self.buffer}", force=True) + self.buffer = b"" + break + + # If the prefix is not at the start of the message. + if prefix_offset_55AA != 0 and prefix_offset_6699 != 0: + self.debug(f"Message prefix offset not at the start {self.buffer}") + prefix_offset = min(prefix for prefix in prefixes if not prefix < 0) + self.buffer = self.buffer[prefix_offset:] + + header = parse_header(self.buffer, logger=self) + # Check if the all data for the message has been received. + if len(self.buffer) < header.total_length: + break + + hmac_key = self.local_key if self.version >= 3.4 else None + no_retcode = False + msg = unpack_message( + self.buffer, + header=header, + hmac_key=hmac_key, + no_retcode=no_retcode, + logger=self, + ) + self.buffer = self.buffer[header.total_length :] + self._dispatch(msg) + + def _dispatch(self, msg): + """Dispatch a message to someone that is listening.""" + + self.debug("Dispatching message CMD %r %s", msg.cmd, msg) + + if msg.seqno in self.listeners: + self.debug("Dispatching sequence number %d", msg.seqno) + self._release_listener(msg.seqno, msg) + + if msg.cmd == HEART_BEAT: + self.debug("Got heartbeat response") + self._release_listener(self.HEARTBEAT_SEQNO, msg) + elif msg.cmd == UPDATEDPS: + self.debug("Got normal updatedps response") + self._release_listener(self.RESET_SEQNO, msg) + elif msg.cmd == SESS_KEY_NEG_RESP: + self.debug("Got key negotiation response") + self._release_listener(self.SESS_KEY_SEQNO, msg) + elif msg.cmd == STATUS: + if self.RESET_SEQNO in self.listeners: + self.debug("Got reset status update") + self._release_listener(self.RESET_SEQNO, msg) + else: + self.debug("Got status update") + self.callback_status_update(msg) + elif msg.cmd == LAN_EXT_STREAM: + self._release_listener(self.SUB_DEVICE_QUERY_SEQNO, msg) + if msg.payload: + self.debug(f"Got Sub-devices status update") + self.callback_status_update(msg) + else: + if msg.cmd == CONTROL_NEW or not msg.payload: + self.debug( + "Got ACK message for command %d: ignoring it %s", msg.cmd, msg.seqno + ) + self.callback_status_update(msg, ack=True) + elif msg.seqno not in self.listeners: + self.debug( + "Got message type %d for unknown listener %d: %s", + msg.cmd, + msg.seqno, + msg, + ) + + def _release_listener(self, seqno, msg): + if seqno not in self.listeners: + return + + sem = self.listeners[seqno] + if isinstance(sem, asyncio.Semaphore): + self.listeners[seqno] = msg + sem.release() + else: + self.debug(f"{seqno} - Got additional message without request: skip {sem}") + + +class TuyaListener(ABC): + """Listener interface for Tuya device changes.""" + + sub_devices: dict[str, Self] + + @abstractmethod + def status_updated(self, status): + """Device updated status.""" + + @abstractmethod + def disconnected(self, exc=""): + """Device disconnected.""" + + @abstractmethod + def subdevice_state_updated(self, state: SubdeviceState): + """Device is offline or online.""" + + +class EmptyListener(TuyaListener): + """Listener doing nothing.""" + + def status_updated(self, status): + """Device updated status.""" + + def disconnected(self, exc=""): + """Device disconnected.""" + + def subdevice_state_updated(self, state: SubdeviceState): + """Device is offline or online.""" + + +class TuyaProtocol(asyncio.Protocol, ContextualLogger): + """Implementation of the Tuya protocol.""" + + def __init__( + self, + dev_id: str, + local_key: str, + protocol_version: float, + enable_debug: bool, + on_connected: asyncio.Future, + listener: TuyaListener, + ): + """ + Initialize a new TuyaInterface. + + Args: + dev_id (str): The device id. + address (str): The network address. + local_key (str, optional): The encryption key. Defaults to None. + + Attributes: + port (int): The port to connect to. + """ + super().__init__() + self.loop = asyncio.get_running_loop() + self.id = dev_id + self.local_key = local_key.encode("latin1") + self.real_local_key = self.local_key + self.dev_type = "type_0a" + self.dps_to_request = {} + + if protocol_version: + self.set_version(float(protocol_version)) + else: + # make sure we call our set_version() and not a subclass since some of + # them (such as BulbDevice) make connections when called + TuyaProtocol.set_version(self, 3.1) + + self.cipher = AESCipher(self.local_key) + self.seqno = 1 + self.transport = None + self.listener = weakref.ref(listener) + self.dispatcher = self._setup_dispatcher() + self.on_connected = on_connected + self.heartbeater: asyncio.Task | None = None + self._sub_devs_query_task: asyncio.Task | None = None + self.dps_cache = {} + self.sub_devices_states = {"online": [], "offline": []} + self.local_nonce = b"0123456789abcdef" # not-so-random random key + self.remote_nonce = b"" + self.dps_whitelist = UPDATE_DPS_WHITELIST + self.dispatched_dps = {} # Store payload so we can trigger an event in HA. + self._last_command_sent = 1 # The time last command was sent + self._write_lock = asyncio.Lock() # To serialize writes + self.enable_debug(enable_debug) + + def set_version(self, protocol_version): + """Set the device version and eventually start available DPs detection.""" + self.version = protocol_version + self.version_bytes = str(protocol_version).encode("latin1") + self.version_header = self.version_bytes + PROTOCOL_3x_HEADER + if protocol_version == 3.2: # 3.2 behaves like 3.3 with type_0d + # self.version = 3.3 + self.dev_type = "type_0d" + elif protocol_version == 3.4: + self.dev_type = "v3.4" + elif protocol_version == 3.5: + self.dev_type = "v3.5" + + def error_json(self, number=None, payload=None): + """Return error details in JSON.""" + try: + spayload = json.dumps(payload) + # spayload = payload.replace('\"','').replace('\'','') + except Exception: # pylint: disable=broad-except + spayload = '""' + + vals = (error_codes[number], str(number), spayload) + self.debug("ERROR %s - %s - payload: %s", *vals) + + return json.loads('{ "Error":"%s", "Err":"%s", "Payload":%s }' % vals) + + def _msg_subdevs_query(self, decoded_message): + """ + Handle the sub-devices query message. + Message: {"online": [cids, ...], "offline": [cids, ...], "nearby": [cids, ...]} + """ + + async def _action(): + try: + await asyncio.sleep(2) + + self.debug(f"Sub-Devices States Update: {self.sub_devices_states}") + on_devs = self.sub_devices_states.get("online") + off_devs = self.sub_devices_states.get("offline") + listener = self.listener and self.listener() + if listener is None or (on_devs is None and off_devs is None): + return + for cid, device in listener.sub_devices.items(): + if cid in on_devs: + device.subdevice_state_updated(SubdeviceState.ONLINE) + elif cid in off_devs: + device.subdevice_state_updated(SubdeviceState.OFFLINE) + else: + device.subdevice_state_updated(SubdeviceState.ABSENT) + except asyncio.CancelledError: + pass + + if (data := decoded_message.get("data")) and isinstance(data, dict): + devs_states = self.sub_devices_states + updated_states = {} + + cached_on_devs = devs_states.get("online", []) + cached_off_devs = devs_states.get("offline", []) + + on_devs, off_devs = data.get("online", []), data.get("offline", []) + + updated_states["online"] = list(set(cached_on_devs + on_devs)) + updated_states["offline"] = list(set(cached_off_devs + off_devs)) + + if self._sub_devs_query_task is not None: + self._sub_devs_query_task.cancel() + + self.sub_devices_states = updated_states + self._sub_devs_query_task = self.loop.create_task(_action()) + + def _setup_dispatcher(self) -> MessageDispatcher: + def _status_update(msg, ack=False): + if msg.seqno > 0: + if msg.seqno >= self.seqno: + self.seqno = msg.seqno + 1 + if ack: + self.debug( + f"Got update ack message update seqno only. msg.seqno={msg.seqno} self.seqno={self.seqno}" + ) + return + + decoded_message: dict = self._decode_payload(msg.payload) + cid = None + + # Sub-devices query message. + if msg.cmd == LAN_EXT_STREAM: + return self._msg_subdevs_query(decoded_message) + + if "dps" not in decoded_message: + return + + if dps_payload := decoded_message.get("dps"): + if cid := decoded_message.get("cid"): + self.dps_cache.setdefault(cid, {}) + self.dps_cache[cid].update(dps_payload) + else: + self.dps_cache.setdefault("parent", {}) + self.dps_cache["parent"].update(dps_payload) + + listener = self.listener and self.listener() + if listener is not None: + if cid: + # Don't pass sub-device's payload to the (fake)gateway! + if not (listener := listener.sub_devices.get(cid, None)): + return self.debug( + f'Payload for missing sub-device discarded: "{decoded_message}"' + ) + status = self.dps_cache.get(cid, {}) + else: + status = self.dps_cache.get("parent", {}) + + listener.status_updated(status) + + return MessageDispatcher(self.id, _status_update, self.version, self.local_key) + + def connection_made(self, transport): + """Did connect to the device.""" + self.transport = transport + self.on_connected.set_result(True) + + def keep_alive(self, is_gateway: bool = False): + """ + Start the heartbeat transmissions with the device. + is_gateway: will use subdevices_query as heartbeat. + """ + + async def keep_alive_loop(action): + """Continuously send heart beat updates.""" + self.debug("Started keep alive loop.") + fail_attempt = 0 + while True: + try: + await asyncio.sleep(HEARTBEAT_INTERVAL) + await action() + fail_attempt = 0 + except asyncio.CancelledError: + self.debug("Stopped heartbeat loop") + break + except asyncio.TimeoutError: + fail_attempt += 1 + if fail_attempt >= 2: + self.debug("Heartbeat failed due to timeout, disconnecting") + break + except Exception as ex: # pylint: disable=broad-except + self.exception("Heartbeat failed (%s), disconnecting", ex) + break + + self.heartbeater = None + if self.transport is not None: + self.clean_up_session() + + self.debug("Stopped heartbeat loop") + + if self.heartbeater is None: + # Prevent duplicates heartbeat task + self.heartbeater = self.loop.create_task( + keep_alive_loop( + # Ver. 3.3 gateways don't respond to subdevice query + self.subdevices_query + if is_gateway and self.version >= 3.4 + else self.heartbeat + ) + ) + + def data_received(self, data): + """Received data from device.""" + # self.debug("received data=%r", binascii.hexlify(data), force=True) + self.dispatcher.add_data(data) + + def connection_lost(self, exc): + """Disconnected from device.""" + self.debug("Connection lost: %s", exc, force=True) + + listener = self.listener and self.listener() + self.clean_up_session() + + try: + if listener is not None: + listener.disconnected(exc or "Connection lost") + except Exception: # pylint: disable=broad-except + self.exception("Failed to call disconnected callback") + + async def transport_write(self, data): + """Write data on transport, ensure that no massive requests happen all at once.""" + async with self._write_lock: + while self.last_command_sent < 0.050: + await asyncio.sleep(0.010) + + self._last_command_sent = time.time() + self.transport.write(data) + + async def close(self): + """Close connection and abort all outstanding listeners.""" + self.debug("Closing connection") + self.clean_up_session() + + if self.heartbeater: + await self.heartbeater + + if self._sub_devs_query_task: + await self._sub_devs_query_task + + def clean_up_session(self): + """Clean up session.""" + self.debug(f"Cleaning up session.") + self.real_local_key = self.local_key + + if self.heartbeater: + self.heartbeater.cancel() + + if self._sub_devs_query_task: + self._sub_devs_query_task.cancel() + + if self.is_connected: + self.transport.close() + + if self.dispatcher: + self.dispatcher.abort() + + async def exchange_quick(self, payload, recv_retries): + """Similar to exchange() but never retries sending and does not decode the response.""" + if not self.is_connected: + self.debug("send quick failed, could not get socket: %s", payload) + return None + enc_payload = ( + self._encode_message(payload) + if isinstance(payload, MessagePayload) + else payload + ) + # self.debug("Quick-dispatching message %s, seqno %s", binascii.hexlify(enc_payload), self.seqno) + + try: + await self.transport_write(enc_payload) + except Exception: # pylint: disable=broad-except + return self.clean_up_session() + + while recv_retries: + try: + seqno = MessageDispatcher.SESS_KEY_SEQNO + msg = await self.dispatcher.wait_for(seqno, payload.cmd) + # for 3.4 devices, we get the starting seqno with the SESS_KEY_NEG_RESP message + self.seqno = msg.seqno + except Exception: # pylint: disable=broad-except + msg = None + if msg and len(msg.payload) != 0: + return msg + recv_retries -= 1 + if recv_retries == 0: + self.debug( + "received null payload (%r) but out of recv retries, giving up", msg + ) + else: + self.debug( + "received null payload (%r), fetch new one - %s retries remaining", + msg, + recv_retries, + ) + return None + + async def exchange(self, command, dps=None, nodeID=None, payload=None): + """Send and receive a message, returning response from device.""" + if not self.is_connected: + return None + + if self.version >= 3.4 and self.real_local_key == self.local_key: + self.debug("3.4 or 3.5 device: negotiating a new session key") + if not await self._negotiate_session_key(): + return self.clean_up_session() + + self.debug( + "Sending command %s (device type: %s) DPS: %s", command, self.dev_type, dps + ) + payload = payload or self._generate_payload(command, dps, nodeId=nodeID) + real_cmd = payload.cmd + dev_type = self.dev_type + + # Wait for special sequence number + seqno = self.seqno + + if payload.cmd == HEART_BEAT: + seqno = MessageDispatcher.HEARTBEAT_SEQNO + elif payload.cmd == UPDATEDPS: + seqno = MessageDispatcher.RESET_SEQNO + elif payload.cmd == LAN_EXT_STREAM: + seqno = MessageDispatcher.SUB_DEVICE_QUERY_SEQNO + + enc_payload = self._encode_message(payload) + + try: + await self.transport_write(enc_payload) + except Exception: # pylint: disable=broad-except + return self.clean_up_session() + msg = await self.dispatcher.wait_for(seqno, payload.cmd) + if msg is None: + self.debug("Wait was aborted for seqno %d", seqno) + return None + + # TODO: Verify stuff, e.g. CRC sequence number? + if real_cmd in [HEART_BEAT, CONTROL, CONTROL_NEW] and len(msg.payload) == 0: + # device may send messages with empty payload in response + # to a HEART_BEAT or CONTROL or CONTROL_NEW command: consider them an ACK + self.debug(f"ACK received for command {real_cmd}: ignoring: {msg.seqno}") + return None + payload = self._decode_payload(msg.payload) + + # Perform a new exchange (once) if we switched device type + if dev_type != self.dev_type: + self.debug( + "Re-send %s due to device type change (%s -> %s)", + command, + dev_type, + self.dev_type, + ) + return await self.exchange(command, dps, nodeID=nodeID) + return payload + + async def status(self, cid=None): + """Return device status.""" + status: dict = await self.exchange(command=DP_QUERY, nodeID=cid) + + self.dps_cache.setdefault("parent", {}) + if status and "dps" in status: + if "cid" in status: + self.dps_cache.update({status["cid"]: status["dps"]}) + else: + self.dps_cache["parent"].update(status["dps"]) + + return self.dps_cache.get(cid or "parent", {}) + + async def heartbeat(self): + """Send a heartbeat message.""" + return await self.exchange(HEART_BEAT) + + async def reset(self, dpIds=None, cid=None): + """Send a reset message (3.3 only).""" + if self.version == 3.3: + self.dev_type = "type_0a" + self.debug("reset switching to dev_type %s", self.dev_type) + return await self.exchange(UPDATEDPS, dpIds, nodeID=cid) + + return True + + def set_updatedps_list(self, update_list): + """Set the DPS to be requested with the update command.""" + self.dps_whitelist = update_list + + async def update_dps(self, dps=None, cid=None): + """ + Request device to update index. + + Args: + dps([int]): list of dps to update, default=detected&whitelisted + """ + if self.version in UPDATE_DPS_LIST and self.is_connected: + if dps is None: + if not self.dps_cache: + await self.detect_available_dps(cid=cid) + if self.dps_cache: + if cid and cid in self.dps_cache: + dps = [int(dp) for dp in self.dps_cache[cid]] + else: + dps = [int(dp) for dp in self.dps_cache["parent"]] + # filter non whitelisted dps + dps = list(set(dps).intersection(set(self.dps_whitelist))) + payload = self._generate_payload(UPDATEDPS, dps, nodeId=cid) + enc_payload = self._encode_message(payload) + await self.transport_write(enc_payload) + return True + + async def set_dp(self, value, dp_index, cid=None): + """ + Set value (may be any type: bool, int or string) of any dps index. + + Args: + dp_index(int): dps index to set + value: new value for the dps index + """ + return await self.exchange(CONTROL, {str(dp_index): value}, nodeID=cid) + + async def set_dps(self, dps, cid=None): + """Set values for a set of datapoints.""" + return await self.exchange(CONTROL, dps, nodeID=cid) + + async def subdevices_query(self): + """Request a list of sub-devices and their status.""" + # Return payload: {"online": [cid1, ...], "offline": [cid2, ...]} + # "nearby": [cids, ...] can come in payload. + self.sub_devices_states = {"online": [], "offline": []} + payload = self._generate_payload( + LAN_EXT_STREAM, rawData={"cids": []}, reqType="subdev_online_stat_query" + ) + + return await self.exchange(command=LAN_EXT_STREAM, payload=payload) + + async def detect_available_dps(self, cid=None): + """Return which datapoints are supported by the device.""" + # type_0d devices need a sort of bruteforce querying in order to detect the + # list of available dps experience shows that the dps available are usually + # in the ranges [1-25] and [100-110] need to split the bruteforcing in + # different steps due to request payload limitation (max. length = 255) + + ranges = [(2, 11), (11, 21), (21, 31), (100, 111)] + + for dps_range in ranges: + # dps 1 must always be sent, otherwise it might fail in case no dps is found + # in the requested range + self.dps_to_request = {"1": None} + self.add_dps_to_request(range(*dps_range)) + data = await self.status(cid=cid) + if cid and cid in data: + self.dps_cache.update({cid: data[cid]}) + elif not cid and "parent" in data: + self.dps_cache.update({"parent": data["parent"]}) + + if self.dev_type == "type_0a" and not cid: + return self.dps_cache.get("parent", {}) + + return self.dps_cache.get(cid or "parent", {}) + + def add_dps_to_request(self, dp_indicies): + """Add a datapoint (DP) to be included in requests.""" + if isinstance(dp_indicies, int): + self.dps_to_request[str(dp_indicies)] = None + else: + self.dps_to_request.update({str(index): None for index in dp_indicies}) + + def _decode_payload(self, payload): + cipher = AESCipher(self.local_key) + + if self.version == 3.4: + # 3.4 devices encrypt the version header in addition to the payload + try: + # self.debug("decrypting=%r", payload) + payload = cipher.decrypt(payload, False, decode_text=False) + except Exception as ex: + self.debug( + "incomplete payload=%r with len:%d (%s)", payload, len(payload), ex + ) + return self.error_json(ERR_PAYLOAD) + + # self.debug("decrypted 3.x payload=%r", payload) + + if payload.startswith(PROTOCOL_VERSION_BYTES_31): + # Received an encrypted payload + # Remove version header + payload = payload[len(PROTOCOL_VERSION_BYTES_31) :] + # Decrypt payload + # Remove 16-bytes of MD5 hexdigest of payload + payload = cipher.decrypt(payload[16:]) + elif self.version >= 3.2: # 3.2 or 3.3 or 3.4 + # Trim header for non-default device type + if payload.startswith(self.version_bytes): + payload = payload[len(self.version_header) :] + # self.debug("removing 3.x=%r", payload) + elif self.dev_type == "type_0d" and (len(payload) & 0x0F) != 0: + payload = payload[len(self.version_header) :] + # self.debug("removing type_0d 3.x header=%r", payload) + + if self.version < 3.4: + try: + # self.debug("decrypting=%r", payload) + payload = cipher.decrypt(payload, False) + except Exception as ex: + self.debug( + "incomplete payload=%r with len:%d (%s)", + payload, + len(payload), + ex, + ) + return self.error_json(ERR_PAYLOAD) + + # self.debug("decrypted 3.x payload=%r", payload) + # Try to detect if type_0d found + + if not isinstance(payload, str): + try: + payload = payload.decode() + except Exception as ex: + self.debug("payload was not string type and decoding failed") + return self.error_json(ERR_JSON, payload) + + if "data unvalid" in payload: + if self.version <= 3.3: + self.dev_type = "type_0d" + self.debug( + "'data unvalid' error detected: switching to dev_type %r", + self.dev_type, + ) + return None + elif not payload.startswith(b"{"): + self.debug("Unexpected payload=%r", payload) + return self.error_json(ERR_PAYLOAD, payload) + + if not isinstance(payload, str): + payload = payload.decode() + self.debug("Deciphered data = %r", payload) + try: + json_payload = json.loads(payload) + except Exception as ex: + json_payload = self.error_json(ERR_JSON, payload) + + if "devid not" in payload: # DeviceID Not found. + raise ValueError(f"DeviceID [{self.id}] Not found") + # else: + # raise DecodeError( + # f"[{self.id}]: could not decrypt data: wrong local_key? (exception: {ex}, payload: {payload})" + # ) + # json_payload = self.error_json(ERR_JSON, payload) + + # v3.4 stuffs it into {"data":{"dps":{"1":true}}, ...} + if ( + "dps" not in json_payload + and "data" in json_payload + and "dps" in json_payload["data"] + ): + json_payload["dps"] = json_payload["data"]["dps"] + + if "cid" in json_payload["data"]: + json_payload["cid"] = json_payload["data"]["cid"] + + # We will store the payload to trigger an event in HA. + if "dps" in json_payload: + self.dispatched_dps = json_payload["dps"] + return json_payload + + async def _negotiate_session_key(self): + self.remote_nonce = b"" + self.local_key = self.real_local_key + + rkey = await self.exchange_quick( + MessagePayload(SESS_KEY_NEG_START, self.local_nonce), 2 + ) + if not rkey or not isinstance(rkey, TuyaMessage) or len(rkey.payload) < 48: + # error + self.debug("session key negotiation failed on step 1") + return False + + if rkey.cmd != SESS_KEY_NEG_RESP: + self.debug( + "session key negotiation step 2 returned wrong command: %d", rkey.cmd + ) + return False + + payload = rkey.payload + if self.version == 3.4: + try: + # self.debug("decrypting %r using %r", payload, self.real_local_key) + cipher = AESCipher(self.real_local_key) + payload = cipher.decrypt(payload, False, decode_text=False) + except Exception as ex: + self.debug( + "session key step 2 decrypt failed, payload=%r with len:%d (%s)", + payload, + len(payload), + ex, + ) + return False + + self.debug("decrypted session key negotiation step 2: payload=%r", payload) + + if len(payload) < 48: + self.debug("session key negotiation step 2 failed, too short response") + return False + + self.remote_nonce = payload[:16] + hmac_check = hmac.new(self.local_key, self.local_nonce, sha256).digest() + + if hmac_check != payload[16:48]: + self.debug( + "session key negotiation step 2 failed HMAC check! wanted=%r but got=%r", + binascii.hexlify(hmac_check), + binascii.hexlify(payload[16:48]), + ) + + # self.debug("session local nonce: %r remote nonce: %r", self.local_nonce, self.remote_nonce) + rkey_hmac = hmac.new(self.local_key, self.remote_nonce, sha256).digest() + await self.exchange_quick(MessagePayload(SESS_KEY_NEG_FINISH, rkey_hmac), None) + + self.local_key = bytes( + [a ^ b for (a, b) in zip(self.local_nonce, self.remote_nonce)] + ) + # self.debug("Session nonce XOR'd: %r" % self.local_key) + + cipher = AESCipher(self.real_local_key) + if self.version == 3.4: + self.local_key = self.dispatcher.local_key = cipher.encrypt( + self.local_key, False, pad=False + ) + else: + iv = self.local_nonce[:12] + self.debug("Session IV: %r", iv) + self.local_key = self.dispatcher.local_key = cipher.encrypt( + self.local_key, use_base64=False, pad=False, iv=iv + )[12:28] + + self.debug("Session key negotiate success! session key: %r", self.local_key) + return True + + # adds protocol header (if needed) and encrypts + def _encode_message(self, msg): + hmac_key = None + iv = None + payload = msg.payload + self.cipher = AESCipher(self.local_key) + + if self.version >= 3.4: + hmac_key = self.local_key + if msg.cmd not in NO_PROTOCOL_HEADER_CMDS: + # add the 3.x header + payload = self.version_header + payload + self.debug("final payload for cmd %r: %r", msg.cmd, payload) + + if self.version >= 3.5: + iv = True + # seqno cmd retcode payload crc crc_good, prefix, iv + msg = TuyaMessage( + self.seqno, msg.cmd, None, payload, 0, True, PREFIX_6699_VALUE, True + ) + self.seqno += 1 # increase message sequence number + data = pack_message(msg, hmac_key=self.local_key) + self.debug("payload encrypted=%r", binascii.hexlify(data)) + return data + + payload = self.cipher.encrypt(payload, False) + elif self.version >= 3.2: + # expect to connect and then disconnect to set new + payload = self.cipher.encrypt(payload, False) + if msg.cmd not in NO_PROTOCOL_HEADER_CMDS: + # add the 3.x header + payload = self.version_header + payload + elif msg.cmd == CONTROL: + # need to encrypt + payload = self.cipher.encrypt(payload) + preMd5String = ( + b"data=" + + payload + + b"||lpv=" + + PROTOCOL_VERSION_BYTES_31 + + b"||" + + self.local_key + ) + m = md5() + m.update(preMd5String) + hexdigest = m.hexdigest() + # some tuya libraries strip 8: to :24 + payload = ( + PROTOCOL_VERSION_BYTES_31 + + hexdigest[8:][:16].encode("latin1") + + payload + ) + + self.cipher = None + msg = TuyaMessage( + self.seqno, msg.cmd, 0, payload, 0, True, PREFIX_55AA_VALUE, False + ) + self.seqno += 1 # increase message sequence number + buffer = pack_message(msg, hmac_key=hmac_key) + # self.debug("payload encrypted with key %r => %r", self.local_key, binascii.hexlify(buffer)) + return buffer + + def _generate_payload( + self, + command, + data=None, + gwId=None, + devId=None, + uid=None, + nodeId=None, + rawData=None, + reqType=None, + ): + """ + Generate the payload to send. + + Args: + command(str): The type of command. + This is one of the entries from payload_dict + data(dict, optional): The data to be send. + This is what will be passed via the 'dps' entry + gwId(str, optional): Will be used for gwId + devId(str, optional): Will be used for devId + uid(str, optional): Will be used for uid + """ + json_data = command_override = None + + # Create a deep copy of payload_dict. otherwise, the original references will be overwritten + def deepcopy_dict(_dict: dict): + output = _dict.copy() + for key, value in output.items(): + output[key] = deepcopy_dict(value) if isinstance(value, dict) else value + return output + + payloads = deepcopy_dict(payload_dict) + + if command in payloads[self.dev_type]: + if "command" in payloads[self.dev_type][command]: + json_data = payloads[self.dev_type][command]["command"].copy() + if "command_override" in payloads[self.dev_type][command]: + command_override = payloads[self.dev_type][command]["command_override"] + + if self.dev_type != "type_0a": + if ( + json_data is None + and command in payloads["type_0a"] + and "command" in payloads["type_0a"][command] + ): + json_data = payloads["type_0a"][command]["command"].copy() + if ( + command_override is None + and command in payloads["type_0a"] + and "command_override" in payloads["type_0a"][command] + ): + command_override = payloads["type_0a"][command]["command_override"] + + if command_override is None: + command_override = command + if json_data is None: + # I have yet to see a device complain about included but unneeded attribs, but they *will* + # complain about missing attribs, so just include them all unless otherwise specified + json_data = {"gwId": "", "devId": "", "uid": "", "t": "", "cid": ""} + + if "gwId" in json_data: + if gwId is not None: + json_data["gwId"] = gwId + else: + json_data["gwId"] = self.id + if "devId" in json_data: + if devId is not None: + json_data["devId"] = devId + else: + json_data["devId"] = self.id + if "uid" in json_data: + if uid is not None: + json_data["uid"] = uid + else: + json_data["uid"] = self.id + if "cid" in json_data: + if cid := nodeId: + json_data["cid"] = cid + # for <= 3.3 we don't need `gwID`, `devID` and `uid` in payload. + if command in (CONTROL, DP_QUERY): + for k in ("gwId", "devId", "uid"): + if k in json_data: + json_data.pop(k) + else: + del json_data["cid"] + if "data" in json_data and "cid" in json_data["data"]: + # "cid" is inside "data" For 3.4 and 3.5 versions. + if cid := nodeId: + json_data["data"]["cid"] = cid + else: + del json_data["data"]["cid"] + if "t" in json_data: + if json_data["t"] == "int": + json_data["t"] = int(time.time()) + else: + json_data["t"] = str(int(time.time())) + if rawData is not None and "data" in json_data: + json_data["data"] = rawData + elif data is not None: + if "dpId" in json_data: + json_data["dpId"] = data + elif "data" in json_data: + json_data["data"]["dps"] = data # We don't want to remove CID + else: + json_data["dps"] = data + elif self.dev_type == "type_0d" and command == DP_QUERY: + json_data["dps"] = self.dps_to_request + if reqType and "reqType" in json_data: + json_data["reqType"] = reqType + + if json_data == "": + payload = "" + else: + payload = json.dumps(json_data) + # if spaces are not removed device does not respond! + payload = payload.replace(" ", "").encode("utf-8") + self.debug("Sending payload: %s", payload) + + return MessagePayload(command_override, payload) + + def enable_debug(self, enable=False, friendly_name=None): + """Enable the debug logs for the device.""" + self.set_logger(_LOGGER, self.id, enable, friendly_name) + self.dispatcher.set_logger(_LOGGER, self.id, enable, friendly_name) + + @property + def is_connected(self): + return self.transport and not self.transport.is_closing() + + @property + def last_command_sent(self): + """Return last command sent by seconds""" + return time.time() - self._last_command_sent + + def __repr__(self): + """Return internal string representation of object.""" + return self.id + + +async def connect( + address, + device_id, + local_key, + protocol_version, + enable_debug, + listener=None, + port=6668, + timeout=5, +): + """Connect to a device.""" + loop = asyncio.get_running_loop() + on_connected = loop.create_future() + try: + _, protocol = await asyncio.wait_for( + loop.create_connection( + lambda: TuyaProtocol( + device_id, + local_key, + protocol_version, + enable_debug, + on_connected, + listener or EmptyListener(), + ), + address, + port, + ), + timeout=3, + ) + # Assuming the connect timed out then then the host isn't reachable. + except (OSError, TimeoutError) as ex: + if ex.errno == errno.EHOSTUNREACH or isinstance(ex, TimeoutError): + raise OSError( + errno.EHOSTUNREACH, + os.strerror(errno.EHOSTUNREACH) + f" ('{address}', '{port}')", + ) + + raise ex + except (Exception, asyncio.CancelledError) as ex: + raise ex + except: + raise Exception(f"The host refused to connect") + + await asyncio.wait_for(on_connected, timeout=timeout) + return protocol diff --git a/custom_components/localtuya/core/pytuya/__pycache__/__init__.cpython-313.pyc b/custom_components/localtuya/core/pytuya/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..3ebb4728 Binary files /dev/null and b/custom_components/localtuya/core/pytuya/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/localtuya/cover.py b/custom_components/localtuya/cover.py index 700dc3f1..c21076f0 100644 --- a/custom_components/localtuya/cover.py +++ b/custom_components/localtuya/cover.py @@ -1,4 +1,5 @@ """Platform to locally control Tuya-based cover devices.""" + import asyncio import logging import time @@ -8,10 +9,13 @@ from homeassistant.components.cover import ( ATTR_POSITION, DOMAIN, - CoverEntity, CoverEntityFeature, + CoverEntityFeature, + CoverEntity, + DEVICE_CLASSES_SCHEMA, ) - -from .common import LocalTuyaEntity, async_setup_entry +from homeassistant.const import CONF_DEVICE_CLASS +from .config_flow import col_to_select +from .entity import LocalTuyaEntity, async_setup_entry from .const import ( CONF_COMMANDS_SET, CONF_CURRENT_POSITION_DP, @@ -19,49 +23,74 @@ CONF_POSITIONING_MODE, CONF_SET_POSITION_DP, CONF_SPAN_TIME, + CONF_STOP_SWITCH_DP, ) + +# cover states. +STATE_OPENING = "opening" +STATE_CLOSING = "closing" +STATE_STOPPED = "stopped" +STATE_SET_CMD = "moving" +STATE_SET_OPENING = "set_opeing" +STATE_SET_CLOSING = "set_closing" + _LOGGER = logging.getLogger(__name__) -COVER_ONOFF_CMDS = "on_off_stop" -COVER_OPENCLOSE_CMDS = "open_close_stop" -COVER_FZZZ_CMDS = "fz_zz_stop" -COVER_12_CMDS = "1_2_3" -COVER_MODE_NONE = "none" -COVER_MODE_POSITION = "position" -COVER_MODE_TIMED = "timed" + +COVER_COMMANDS = { + "Open, Close and Stop": "open_close_stop", + "Open, Close and Continue": "open_close_continue", + "ON, OFF and Stop": "on_off_stop", + "fz, zz and Stop": "fz_zz_stop", + "zz, fz and Stop": "zz_fz_stop", + "1, 2 and 3": "1_2_3", + "0, 1 and 2": "0_1_2", +} + +MODE_NONE = "none" +MODE_SET_POSITION = "position" +MODE_TIME_BASED = "timed" +COVER_MODES = { + "Neither": MODE_NONE, + "Set Position": MODE_SET_POSITION, + "Time Based": MODE_TIME_BASED, +} + COVER_TIMEOUT_TOLERANCE = 3.0 -DEFAULT_COMMANDS_SET = COVER_ONOFF_CMDS -DEFAULT_POSITIONING_MODE = COVER_MODE_NONE +DEF_CMD_SET = list(COVER_COMMANDS.values())[0] +DEF_POS_MODE = list(COVER_MODES.values())[0] DEFAULT_SPAN_TIME = 25.0 def flow_schema(dps): """Return schema used in config flow.""" return { - vol.Optional(CONF_COMMANDS_SET): vol.In( - [COVER_ONOFF_CMDS, COVER_OPENCLOSE_CMDS, COVER_FZZZ_CMDS, COVER_12_CMDS] + vol.Optional(CONF_COMMANDS_SET, default=DEF_CMD_SET): col_to_select( + COVER_COMMANDS ), - vol.Optional(CONF_POSITIONING_MODE, default=DEFAULT_POSITIONING_MODE): vol.In( - [COVER_MODE_NONE, COVER_MODE_POSITION, COVER_MODE_TIMED] + vol.Optional(CONF_POSITIONING_MODE, default=DEF_POS_MODE): col_to_select( + COVER_MODES ), - vol.Optional(CONF_CURRENT_POSITION_DP): vol.In(dps), - vol.Optional(CONF_SET_POSITION_DP): vol.In(dps), + vol.Optional(CONF_CURRENT_POSITION_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_SET_POSITION_DP): col_to_select(dps, is_dps=True), vol.Optional(CONF_POSITION_INVERTED, default=False): bool, vol.Optional(CONF_SPAN_TIME, default=DEFAULT_SPAN_TIME): vol.All( vol.Coerce(float), vol.Range(min=1.0, max=300.0) ), + vol.Optional(CONF_STOP_SWITCH_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_DEVICE_CLASS): DEVICE_CLASSES_SCHEMA, } -class LocaltuyaCover(LocalTuyaEntity, CoverEntity): +class LocalTuyaCover(LocalTuyaEntity, CoverEntity): """Tuya cover device.""" def __init__(self, device, config_entry, switchid, **kwargs): - """Initialize a new LocaltuyaCover.""" + """Initialize a new LocalTuyaCover.""" super().__init__(device, config_entry, switchid, _LOGGER, **kwargs) - commands_set = DEFAULT_COMMANDS_SET + commands_set = DEF_CMD_SET if self.has_config(CONF_COMMANDS_SET): commands_set = self._config[CONF_COMMANDS_SET] self._open_cmd = commands_set.split("_")[0] @@ -71,51 +100,77 @@ def __init__(self, device, config_entry, switchid, **kwargs): self._state = self._stop_cmd self._previous_state = self._state self._current_cover_position = 0 - _LOGGER.debug("Initialized cover [%s]", self.name) + self._current_state_action = STATE_STOPPED # Default. + self._set_new_position = int | None + self._stop_switch = self._config.get(CONF_STOP_SWITCH_DP, None) + self._position_inverted = self._config.get(CONF_POSITION_INVERTED) + self._current_task = None @property def supported_features(self): """Flag supported features.""" - supported_features = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP - if self._config[CONF_POSITIONING_MODE] != COVER_MODE_NONE: + supported_features = ( + CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP + ) + if self._config[CONF_POSITIONING_MODE] != MODE_NONE: supported_features = supported_features | CoverEntityFeature.SET_POSITION return supported_features + @property + def _current_state(self) -> str: + """Return the current state of the cover.""" + state = self._current_state_action + curr_pos = self.current_cover_position + # Reset STATE when cover is fully closed or fully opened. + if (state == STATE_CLOSING and curr_pos == 0) or ( + state == STATE_OPENING and curr_pos == 100 + ): + self._current_state_action = STATE_STOPPED + # in case cover moving by set position cmd. + if ( + self._current_state_action == STATE_SET_CLOSING + or self._current_state_action == STATE_SET_OPENING + ): + set_pos = self._set_new_position + # Reset state whenn cover reached the position. + if curr_pos - set_pos < 5 and curr_pos - set_pos >= -5: + self._current_state_action = STATE_STOPPED + return self._current_state_action + @property def current_cover_position(self): """Return current cover position in percent.""" - if self._config[CONF_POSITIONING_MODE] == COVER_MODE_NONE: + if self._config[CONF_POSITIONING_MODE] == MODE_NONE: return None return self._current_cover_position @property def is_opening(self): """Return if cover is opening.""" - state = self._state - return state == self._open_cmd + state = self._current_state + return state == STATE_SET_OPENING or state == STATE_OPENING @property def is_closing(self): """Return if cover is closing.""" - state = self._state - return state == self._close_cmd + state = self._current_state + return state == STATE_SET_CLOSING or state == STATE_CLOSING @property def is_closed(self): """Return if the cover is closed or not.""" - if self._config[CONF_POSITIONING_MODE] == COVER_MODE_NONE: - return False - - if self._current_cover_position == 0: - return True - if self._current_cover_position == 100: - return False - return False + if self._config[CONF_POSITIONING_MODE] == MODE_NONE: + return None + return self.current_cover_position == 0 and self._current_state == STATE_STOPPED async def async_set_cover_position(self, **kwargs): """Move the cover to a specific position.""" + # Update device values IF the device is moving at the moment. + if self._current_state != STATE_STOPPED: + await self.async_stop_cover() + self.debug("Setting cover position: %r", kwargs[ATTR_POSITION]) - if self._config[CONF_POSITIONING_MODE] == COVER_MODE_TIMED: + if self._config[CONF_POSITIONING_MODE] == MODE_TIME_BASED: newpos = float(kwargs[ATTR_POSITION]) currpos = self.current_cover_position @@ -123,62 +178,85 @@ async def async_set_cover_position(self, **kwargs): mydelay = posdiff / 100.0 * self._config[CONF_SPAN_TIME] if newpos > currpos: self.debug("Opening to %f: delay %f", newpos, mydelay) - await self.async_open_cover() + await self.async_open_cover(delay=mydelay) + self.update_state(STATE_OPENING) else: self.debug("Closing to %f: delay %f", newpos, mydelay) - await self.async_close_cover() - self.hass.async_create_task(self.async_stop_after_timeout(mydelay)) + await self.async_close_cover(delay=mydelay) + self.update_state(STATE_CLOSING) self.debug("Done") - elif self._config[CONF_POSITIONING_MODE] == COVER_MODE_POSITION: + elif self._config[CONF_POSITIONING_MODE] == MODE_SET_POSITION: converted_position = int(kwargs[ATTR_POSITION]) - if self._config[CONF_POSITION_INVERTED]: + if self._position_inverted: converted_position = 100 - converted_position - if 0 <= converted_position <= 100 and self.has_config(CONF_SET_POSITION_DP): await self._device.set_dp( converted_position, self._config[CONF_SET_POSITION_DP] ) + # Give it a moment, to make sure hass updated current pos. + await asyncio.sleep(0.1) + self.update_state(STATE_SET_CMD, int(kwargs[ATTR_POSITION])) async def async_stop_after_timeout(self, delay_sec): """Stop the cover if timeout (max movement span) occurred.""" - await asyncio.sleep(delay_sec) - await self.async_stop_cover() + try: + await asyncio.sleep(delay_sec) + self._current_task = None + await self.async_stop_cover() + except asyncio.CancelledError: + self._current_task = None async def async_open_cover(self, **kwargs): """Open the cover.""" self.debug("Launching command %s to cover ", self._open_cmd) await self._device.set_dp(self._open_cmd, self._dp_id) - if self._config[CONF_POSITIONING_MODE] == COVER_MODE_TIMED: + if self._config[CONF_POSITIONING_MODE] == MODE_TIME_BASED: + if self._current_task is not None: + self._current_task.cancel() # for timed positioning, stop the cover after a full opening timespan # instead of waiting the internal timeout - self.hass.async_create_task( + self._current_task = self.hass.async_create_task( self.async_stop_after_timeout( - self._config[CONF_SPAN_TIME] + COVER_TIMEOUT_TOLERANCE + kwargs.get( + "delay", self._config[CONF_SPAN_TIME] + COVER_TIMEOUT_TOLERANCE + ) ) ) + self.update_state(STATE_OPENING) async def async_close_cover(self, **kwargs): """Close cover.""" self.debug("Launching command %s to cover ", self._close_cmd) await self._device.set_dp(self._close_cmd, self._dp_id) - if self._config[CONF_POSITIONING_MODE] == COVER_MODE_TIMED: + if self._config[CONF_POSITIONING_MODE] == MODE_TIME_BASED: + if self._current_task is not None: + self._current_task.cancel() # for timed positioning, stop the cover after a full opening timespan # instead of waiting the internal timeout - self.hass.async_create_task( + self._current_task = self.hass.async_create_task( self.async_stop_after_timeout( - self._config[CONF_SPAN_TIME] + COVER_TIMEOUT_TOLERANCE + kwargs.get( + "delay", self._config[CONF_SPAN_TIME] + COVER_TIMEOUT_TOLERANCE + ) ) ) + self.update_state(STATE_CLOSING) async def async_stop_cover(self, **kwargs): """Stop the cover.""" + if self._current_task is not None: + self._current_task.cancel() self.debug("Launching command %s to cover ", self._stop_cmd) - await self._device.set_dp(self._stop_cmd, self._dp_id) + command = {self._dp_id: self._stop_cmd} + if self._stop_switch is not None: + command[self._stop_switch] = True + await self._device.set_dps(command) + self.update_state(STATE_STOPPED) def status_restored(self, stored_state): """Restore the last stored cover status.""" - if self._config[CONF_POSITIONING_MODE] == COVER_MODE_TIMED: + if self._config[CONF_POSITIONING_MODE] == MODE_TIME_BASED: stored_pos = stored_state.attributes.get("current_position") if stored_pos is not None: self._current_cover_position = stored_pos @@ -187,20 +265,20 @@ def status_restored(self, stored_state): def status_updated(self): """Device status was updated.""" self._previous_state = self._state - self._state = self.dps(self._dp_id) - if self._state.isupper(): + self._state = self.dp_value(self._dp_id) + if self._state and self._state.isupper(): self._open_cmd = self._open_cmd.upper() self._close_cmd = self._close_cmd.upper() self._stop_cmd = self._stop_cmd.upper() if self.has_config(CONF_CURRENT_POSITION_DP): - curr_pos = self.dps_conf(CONF_CURRENT_POSITION_DP) - if self._config[CONF_POSITION_INVERTED]: + curr_pos = self.dp_value(CONF_CURRENT_POSITION_DP) + if self._position_inverted: self._current_cover_position = 100 - curr_pos else: self._current_cover_position = curr_pos if ( - self._config[CONF_POSITIONING_MODE] == COVER_MODE_TIMED + self._config[CONF_POSITIONING_MODE] == MODE_TIME_BASED and self._state != self._previous_state ): if self._previous_state != self._stop_cmd: @@ -229,5 +307,27 @@ def status_updated(self): if (self._state is not None) and (not self._device.is_connecting): self._last_state = self._state + def update_state(self, action, position=None): + """Update cover current states.""" + state = self._current_state_action + # using Commands. + if position is None: + self._current_state_action = action + # Set position cmd, check if target position weither close or open + if action == STATE_SET_CMD and position is not None: + curr_pos = self.current_cover_position + self._set_new_position = position + pos_diff = position - curr_pos + # Prevent stuck state when interrupted on middle of cmd + if state == STATE_STOPPED: + if pos_diff > 0: + self._current_state_action = STATE_SET_OPENING + elif pos_diff < 0: + self._current_state_action = STATE_SET_CLOSING + else: + self._current_state_action = STATE_STOPPED + # Write state data. + self.async_write_ha_state() + -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaCover, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaCover, flow_schema) diff --git a/custom_components/localtuya/diagnostics.py b/custom_components/localtuya/diagnostics.py index 9c84a931..4db57e8a 100644 --- a/custom_components/localtuya/diagnostics.py +++ b/custom_components/localtuya/diagnostics.py @@ -1,4 +1,5 @@ """Diagnostics support for LocalTuya.""" + from __future__ import annotations import copy @@ -10,7 +11,8 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.device_registry import DeviceEntry -from .const import CONF_LOCAL_KEY, CONF_USER_ID, DATA_CLOUD, DOMAIN +from . import HassLocalTuyaData +from .const import CONF_LOCAL_KEY, CONF_USER_ID, DOMAIN CLOUD_DEVICES = "cloud_devices" DEVICE_CONFIG = "device_config" @@ -18,6 +20,8 @@ _LOGGER = logging.getLogger(__name__) +DATA_OBFUSCATE = {"ip": 1, "uid": 3, CONF_LOCAL_KEY: 3, "lat": 0, "lon": 0} + async def async_get_config_entry_diagnostics( hass: HomeAssistant, entry: ConfigEntry @@ -25,20 +29,21 @@ async def async_get_config_entry_diagnostics( """Return diagnostics for a config entry.""" data = {} data = dict(entry.data) - tuya_api = hass.data[DOMAIN][DATA_CLOUD] + hass_localtuya: HassLocalTuyaData = hass.data[DOMAIN][entry.entry_id] + tuya_api = hass_localtuya.cloud_data # censoring private information on integration diagnostic data for field in [CONF_CLIENT_ID, CONF_CLIENT_SECRET, CONF_USER_ID]: - data[field] = f"{data[field][0:3]}...{data[field][-3:]}" + data[field] = obfuscate(data[field]) data[CONF_DEVICES] = copy.deepcopy(entry.data[CONF_DEVICES]) for dev_id, dev in data[CONF_DEVICES].items(): local_key = dev[CONF_LOCAL_KEY] - local_key_obfuscated = f"{local_key[0:3]}...{local_key[-3:]}" + local_key_obfuscated = obfuscate(local_key) dev[CONF_LOCAL_KEY] = local_key_obfuscated - data[CLOUD_DEVICES] = tuya_api.device_list + data[CLOUD_DEVICES] = copy.deepcopy(tuya_api.device_list) for dev_id, dev in data[CLOUD_DEVICES].items(): - local_key = data[CLOUD_DEVICES][dev_id][CONF_LOCAL_KEY] - local_key_obfuscated = f"{local_key[0:3]}...{local_key[-3:]}" - data[CLOUD_DEVICES][dev_id][CONF_LOCAL_KEY] = local_key_obfuscated + for obf, obf_len in DATA_OBFUSCATE.items(): + if ob := data[CLOUD_DEVICES][dev_id].get(obf): + data[CLOUD_DEVICES][dev_id][obf] = obfuscate(ob, obf_len, obf_len) return data @@ -53,9 +58,13 @@ async def async_get_device_diagnostics( # local_key = data[DEVICE_CONFIG][CONF_LOCAL_KEY] # data[DEVICE_CONFIG][CONF_LOCAL_KEY] = f"{local_key[0:3]}...{local_key[-3:]}" - tuya_api = hass.data[DOMAIN][DATA_CLOUD] + hass_localtuya: HassLocalTuyaData = hass.data[DOMAIN][entry.entry_id] + tuya_api = hass_localtuya.cloud_data if dev_id in tuya_api.device_list: - data[DEVICE_CLOUD_INFO] = tuya_api.device_list[dev_id] + data[DEVICE_CLOUD_INFO] = copy.deepcopy(tuya_api.device_list[dev_id]) + for obf, obf_len in DATA_OBFUSCATE.items(): + if ob := data[DEVICE_CLOUD_INFO].get(obf): + data[DEVICE_CLOUD_INFO][obf] = obfuscate(ob, obf_len, obf_len) # NOT censoring private information on device diagnostic data # local_key = data[DEVICE_CLOUD_INFO][CONF_LOCAL_KEY] # local_key_obfuscated = "{local_key[0:3]}...{local_key[-3:]}" @@ -63,3 +72,11 @@ async def async_get_device_diagnostics( # data["log"] = hass.data[DOMAIN][CONF_DEVICES][dev_id].logger.retrieve_log() return data + + +def obfuscate(key, start_characters=3, end_characters=3) -> str: + """Return obfuscated text by removing characters between [start_characters and end_characters]""" + if start_characters <= 0 and end_characters <= 0: + return "" + + return f"{key[0:start_characters]}...{key[-end_characters:]}" diff --git a/custom_components/localtuya/discovery.py b/custom_components/localtuya/discovery.py index 0c93ab79..e4dc3399 100644 --- a/custom_components/localtuya/discovery.py +++ b/custom_components/localtuya/discovery.py @@ -1,33 +1,58 @@ """Discovery module for Tuya devices. -Entirely based on tuya-convert.py from tuya-convert: +based on tuya-convert.py from tuya-convert: + https://github.com/ct-Open-Source/tuya-convert/blob/master/scripts/tuya-discovery.py -https://github.com/ct-Open-Source/tuya-convert/blob/master/scripts/tuya-discovery.py +Maintained by @xZetsubou """ + +import os import asyncio import json import logging from hashlib import md5 +from socket import inet_aton from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes +from .entity import pytuya + _LOGGER = logging.getLogger(__name__) UDP_KEY = md5(b"yGAdlopoPVldABfn").digest() +PREFIX_55AA_BIN = b"\x00\x00U\xaa" +PREFIX_6699_BIN = b"\x00\x00\x66\x99" +UDP_COMMAND = b"\x00\x00\x00\x00" + DEFAULT_TIMEOUT = 6.0 -def decrypt_udp(message): - """Decrypt encrypted UDP broadcasts.""" - +def decrypt(msg, key): def _unpad(data): return data[: -ord(data[len(data) - 1 :])] - cipher = Cipher(algorithms.AES(UDP_KEY), modes.ECB(), default_backend()) + cipher = Cipher(algorithms.AES(key), modes.ECB(), default_backend()) decryptor = cipher.decryptor() - return _unpad(decryptor.update(message) + decryptor.finalize()).decode() + return _unpad(decryptor.update(msg) + decryptor.finalize()).decode() + + +def decrypt_udp(message): + """Decrypt encrypted UDP broadcasts.""" + if message[:4] == PREFIX_55AA_BIN: + payload = message[20:-8] + if message[8:12] == UDP_COMMAND: + return payload + return decrypt(payload, UDP_KEY) + if message[:4] == PREFIX_6699_BIN: + unpacked = pytuya.unpack_message(message, hmac_key=UDP_KEY, no_retcode=None) + payload = unpacked.payload.decode() + # app sometimes has extra bytes at the end + while payload[-1] == chr(0): + payload = payload[:-1] + return payload + return decrypt(message, UDP_KEY) class TuyaDiscovery(asyncio.DatagramProtocol): @@ -42,15 +67,18 @@ def __init__(self, callback=None): async def start(self): """Start discovery by listening to broadcasts.""" loop = asyncio.get_running_loop() + op_reuse_port = {"reuse_port": True} if os.name != "nt" else {} listener = loop.create_datagram_endpoint( - lambda: self, local_addr=("0.0.0.0", 6666), reuse_port=True + lambda: self, local_addr=("0.0.0.0", 6666), **op_reuse_port ) encrypted_listener = loop.create_datagram_endpoint( - lambda: self, local_addr=("0.0.0.0", 6667), reuse_port=True + lambda: self, local_addr=("0.0.0.0", 6667), **op_reuse_port ) - + # tuyaApp_encrypted_listener = loop.create_datagram_endpoint( + # lambda: self, local_addr=("0.0.0.0", 7000), **op_reuse_port + # ) self._listeners = await asyncio.gather(listener, encrypted_listener) - _LOGGER.debug("Listening to broadcasts on UDP port 6666 and 6667") + _LOGGER.debug("Listening to broadcasts on UDP port 6666, 6667") def close(self): """Stop discovery.""" @@ -60,21 +88,33 @@ def close(self): def datagram_received(self, data, addr): """Handle received broadcast message.""" - data = data[20:-8] try: - data = decrypt_udp(data) - except Exception: # pylint: disable=broad-except - data = data.decode() - - decoded = json.loads(data) - self.device_found(decoded) + try: + data = decrypt_udp(data) + except Exception: # pylint: disable=broad-except + data = data.decode() + decoded = json.loads(data) + self.device_found(decoded) + except: + # _LOGGER.debug("Bordcast from app from ip: %s", addr[0]) + _LOGGER.debug("Failed to decode broadcast from %r: %r", addr[0], data) def device_found(self, device): """Discover a new device.""" - if device.get("gwId") not in self.devices: - self.devices[device.get("gwId")] = device - _LOGGER.debug("Discovered device: %s", device) + gwid, ip = device.get("gwId"), device.get("ip") + # If device found but the ip changed. + if gwid in self.devices and (self.devices[gwid].get("ip") != ip): + self.devices.pop(gwid) + + if gwid not in self.devices: + self.devices[gwid] = device + # Sort devices by ip. + sort_devices = sorted( + self.devices.items(), key=lambda i: inet_aton(i[1].get("ip", "0")) + ) + self.devices = dict(sort_devices) + _LOGGER.debug("Discovered device: %s", device) if self._callback: self._callback(device) diff --git a/custom_components/localtuya/entity.py b/custom_components/localtuya/entity.py new file mode 100644 index 00000000..b3bc9b74 --- /dev/null +++ b/custom_components/localtuya/entity.py @@ -0,0 +1,379 @@ +"""Code shared between all platforms.""" + +import logging +from typing import Any + +from homeassistant.core import HomeAssistant, State +from homeassistant.config_entries import ConfigEntry + +from homeassistant.const import ( + CONF_DEVICES, + CONF_DEVICE_CLASS, + CONF_ENTITIES, + CONF_ENTITY_CATEGORY, + CONF_FRIENDLY_NAME, + CONF_HOST, + CONF_ICON, + CONF_ID, + CONF_PLATFORM, + EntityCategory, + STATE_UNAVAILABLE, + STATE_UNKNOWN, + ATTR_VIA_DEVICE, +) +from homeassistant.helpers.device_registry import DeviceInfo +from homeassistant.helpers.dispatcher import ( + async_dispatcher_connect, + async_dispatcher_send, +) + +from homeassistant.helpers.restore_state import RestoreEntity +from homeassistant.helpers.entity_platform import AddEntitiesCallback + +from .core import pytuya +from .coordinator import HassLocalTuyaData, TuyaDevice +from .const import ( + ATTR_STATE, + CONF_DEFAULT_VALUE, + CONF_ID, + CONF_NODE_ID, + CONF_PASSIVE_ENTITY, + CONF_RESTORE_ON_RECONNECT, + CONF_SCALING, + DOMAIN, + RESTORE_STATES, + DeviceConfig, +) + +_LOGGER = logging.getLogger(__name__) + + +async def async_setup_entry( + domain, + entity_class, + flow_schema, + hass: HomeAssistant, + config_entry: ConfigEntry, + async_add_entities: AddEntitiesCallback, +): + """Set up a Tuya platform based on a config entry. + + This is a generic method and each platform should lock domain and + entity_class with functools.partial. + """ + entities = [] + hass_entry_data: HassLocalTuyaData = hass.data[DOMAIN][config_entry.entry_id] + + for dev_id in config_entry.data[CONF_DEVICES]: + dev_entry: dict = config_entry.data[CONF_DEVICES][dev_id] + + host = dev_entry.get(CONF_HOST) + node_id = dev_entry.get(CONF_NODE_ID) + device_key = f"{host}_{node_id}" if node_id else host + + if device_key not in hass_entry_data.devices: + continue + + entities_to_setup = [ + entity + for entity in dev_entry[CONF_ENTITIES] + if entity[CONF_PLATFORM] == domain + ] + + if entities_to_setup: + device: TuyaDevice = hass_entry_data.devices[device_key] + dps_config_fields = list(get_dps_for_platform(flow_schema)) + + for entity_config in entities_to_setup: + # Add DPS used by this platform to the request list + for dp_conf in dps_config_fields: + if dp_conf in entity_config: + device.dps_to_request[entity_config[dp_conf]] = None + + entities.append( + entity_class( + device, + dev_entry, + entity_config[CONF_ID], + ) + ) + # Once the entities have been created, add to the TuyaDevice instance + if entities: + device.add_entities(entities) + async_add_entities(entities) + + +def get_dps_for_platform(flow_schema): + """Return config keys for all platform keys that depends on a datapoint.""" + for key, value in flow_schema(None).items(): + if hasattr(value, "container") and value.container is None: + yield key.schema + + +def get_entity_config(config_entry, dp_id) -> dict: + """Return entity config for a given DPS id.""" + for entity in config_entry[CONF_ENTITIES]: + if entity[CONF_ID] == dp_id: + return entity + raise Exception(f"missing entity config for id {dp_id}") + + +class LocalTuyaEntity(RestoreEntity, pytuya.ContextualLogger): + """Representation of a Tuya entity.""" + + _attr_device_class = None + _attr_has_entity_name = True + _attr_should_poll = False + + def __init__( + self, device: TuyaDevice, device_config: dict, dp_id: str, logger, **kwargs + ): + """Initialize the Tuya entity.""" + super().__init__() + self._device = device + self._device_config = DeviceConfig(device_config) + self._config = get_entity_config(device_config, dp_id) + self._dp_id = dp_id + self._status = {} + self._state = None + self._last_state = None + self._stored_states: State | None = None + self._hass = device._hass + + # Default value is available to be provided by Platform entities if required + self._default_value = self._config.get(CONF_DEFAULT_VALUE) + + """ Restore on connect setting is available to be provided by Platform entities + if required""" + dev = self._device_config + self.set_logger(logger, dev.id, dev.enable_debug, dev.name) + self.debug(f"Initialized {self._config.get(CONF_PLATFORM)} [{self.name}]") + + async def async_added_to_hass(self): + """Subscribe localtuya events.""" + await super().async_added_to_hass() + + self.debug(f"Adding {self.entity_id} with configuration: {self._config}") + + stored_data = await self.async_get_last_state() + if stored_data: + self._stored_states = stored_data + self.status_restored(stored_data) + + def _update_handler(new_status: dict | None): + """Update entity state when status was updated.""" + status = self._status.clear() if new_status is None else new_status.copy() + + if status == RESTORE_STATES and stored_data and not self._status: + if stored_data.state not in (STATE_UNAVAILABLE, STATE_UNKNOWN): + self.debug(f"{self.name}: Restore state: {stored_data.state}") + status[self._dp_id] = stored_data.state + + if self._status != status: + if status: + # Pop the special DPs + status.pop("0", None) + self._status.update(status) + self.status_updated() + + # Update HA + self.schedule_update_ha_state() + + signal = f"localtuya_{self._device_config.id}" + + self.async_on_remove( + async_dispatcher_connect(self.hass, signal, _update_handler) + ) + + signal = f"localtuya_entity_{self._device_config.id}" + async_dispatcher_send(self.hass, signal, self.entity_id) + + @property + def extra_state_attributes(self): + """Return entity specific state attributes to be saved. + + These attributes are then available for restore when the + entity is restored at startup. + """ + attributes = {} + if self._state is not None: + attributes[ATTR_STATE] = self._state + elif self._last_state is not None: + attributes[ATTR_STATE] = self._last_state + + self.debug(f"Entity {self.name} - Additional attributes: {attributes}") + return attributes + + @property + def device_info(self) -> DeviceInfo: + """Return device information for the device registry.""" + model = self._device_config.model + device_info = DeviceInfo( + # Serial numbers are unique identifiers within a specific domain + identifiers={(DOMAIN, f"local_{self._device_config.id}")}, + name=self._device_config.name, + manufacturer="Tuya", + model=f"{model} ({self._device_config.id})", + sw_version=self._device_config.protocol_version, + ) + if self._device.is_subdevice: + device_info[ATTR_VIA_DEVICE] = (DOMAIN, f"local_{self._device.gateway.id}") + return device_info + + @property + def name(self) -> str: + """Get name of Tuya entity.""" + return self._config.get(CONF_FRIENDLY_NAME) + + @property + def icon(self) -> str | None: + """Icon of the entity.""" + return self._config.get(CONF_ICON, None) + + @property + def unique_id(self) -> str: + """Return unique device identifier.""" + return f"local_{self._device_config.id}_{self._dp_id}" + + @property + def available(self) -> bool: + """Return if device is available or not.""" + return (len(self._status) > 0) or self._device.connected + + @property + def entity_category(self) -> str: + """Return the category of the entity.""" + if category := self._config.get(CONF_ENTITY_CATEGORY): + return EntityCategory(category) if category != "None" else None + else: + # Set Default values for unconfigured devices. + if platform := self._config.get(CONF_PLATFORM): + # Call default_category from config_flow to set default values! + # This will be removed after a while, this is only made to convert who came from main integration. + # new users will be forced to choose category from config_flow. + from .config_flow import default_category + + return default_category(platform) + return None + + @property + def device_class(self): + """Return the class of this device.""" + return self._config.get(CONF_DEVICE_CLASS, self._attr_device_class) + + def has_config(self, attr) -> bool: + """Return if a config parameter has a valid value.""" + value = self._config.get(attr, "-1") + return value is not None and value != "-1" + + def dp_value(self, key, default=None) -> Any | None: + """Return cached value for DPS index or Entity Config Key. else default None""" + requested_dp = str(key) + # If requested_dp in DP ID, get cached value. + if (value := self._status.get(requested_dp)) or value is not None: + return value + + # If requested_dp is an config key get config dp then get cached value. + if (conf_key := self._config.get(requested_dp)) or conf_key is not None: + if (value := self._status.get(conf_key)) or value is not None: + return value + + if value is None: + value = default + # self.debug(f"{self.name}: is requesting unknown DP Value {key}", force=True) + + return value + + def status_updated(self) -> None: + """Device status was updated. + + Override in subclasses and update entity specific state. + """ + state = self.dp_value(self._dp_id) + self._state = state + + # Keep record in last_state as long as not during connection/re-connection, + # as last state will be used to restore the previous state + if (state is not None) and (not self._device.is_connecting): + self._last_state = state + + def status_restored(self, stored_state) -> None: + """Device status was restored. + + Override in subclasses and update entity specific state. + """ + raw_state = stored_state.attributes.get(ATTR_STATE) + if raw_state is not None: + self._last_state = raw_state + self.debug( + f"Restoring state for entity: {self.name} - state: {str(self._last_state)}" + ) + + def default_value(self): + """Return default value of this entity. + + Override in subclasses to specify the default value for the entity. + """ + # Check if default value has been set - if not, default to the entity defaults. + if self._default_value is None: + self._default_value = self.entity_default_value() + + return self._default_value + + def entity_default_value(self): # pylint: disable=no-self-use + """Return default value of the entity type. + + Override in subclasses to specify the default value for the entity. + """ + return 0 + + def scale(self, value): + """Return the scaled factor of the value, else same value.""" + scale_factor = self._config.get(CONF_SCALING) + if scale_factor is not None and isinstance(value, (int, float)): + value = round(value * scale_factor, 2) + + return value + + async def restore_state_when_connected(self) -> None: + """Restore if restore_on_reconnect is set, or if no status has been yet found. + + Which indicates a DPS that needs to be set before it starts returning + status. + """ + restore_on_reconnect = self._config.get(CONF_RESTORE_ON_RECONNECT, False) + passive_entity = self._config.get(CONF_PASSIVE_ENTITY, False) + dp_id = str(self._dp_id) + + if not restore_on_reconnect and (dp_id in self._status or not passive_entity): + self.debug( + f"Entity {self.name} (DP {self._dp_id}) - Not restoring as restore on reconnect is " + + "disabled for this entity and the entity has an initial status " + + "or it is not a passive entity" + ) + return + + self.debug(f"Attempting to restore state for entity: {self.name}") + # Attempt to restore the current state - in case reset. + restore_state = self._state + + # If no state stored in the entity currently, go from last saved state + if (restore_state == STATE_UNKNOWN) | (restore_state is None): + self.debug("No current state for entity") + restore_state = self._last_state + + # If no current or saved state, then use the default value + if restore_state is None: + if passive_entity: + self.debug("No last restored state - using default") + restore_state = self.default_value() + else: + self.debug("Not a passive entity and no state found - aborting restore") + return + + self.debug( + f"Entity {self.name} (DP {self._dp_id}) - Restoring state: {str(restore_state)}" + ) + + # Manually initialise + await self._device.set_dp(restore_state, self._dp_id) diff --git a/custom_components/localtuya/fan.py b/custom_components/localtuya/fan.py index 5e1a3c9c..c276d53a 100644 --- a/custom_components/localtuya/fan.py +++ b/custom_components/localtuya/fan.py @@ -1,7 +1,9 @@ """Platform to locally control Tuya-based fan devices.""" + import logging import math from functools import partial +from .config_flow import col_to_select import homeassistant.helpers.config_validation as cv import voluptuous as vol @@ -9,7 +11,8 @@ DIRECTION_FORWARD, DIRECTION_REVERSE, DOMAIN, - FanEntity, FanEntityFeature, + FanEntityFeature, + FanEntity, ) from homeassistant.util.percentage import ( int_states_in_range, @@ -19,7 +22,7 @@ ranged_value_to_percentage, ) -from .common import LocalTuyaEntity, async_setup_entry +from .entity import LocalTuyaEntity, async_setup_entry from .const import ( CONF_FAN_DIRECTION, CONF_FAN_DIRECTION_FWD, @@ -38,19 +41,19 @@ def flow_schema(dps): """Return schema used in config flow.""" return { - vol.Optional(CONF_FAN_SPEED_CONTROL): vol.In(dps), - vol.Optional(CONF_FAN_OSCILLATING_CONTROL): vol.In(dps), - vol.Optional(CONF_FAN_DIRECTION): vol.In(dps), + vol.Optional(CONF_FAN_SPEED_CONTROL): col_to_select(dps, is_dps=True), + vol.Optional(CONF_FAN_OSCILLATING_CONTROL): col_to_select(dps, is_dps=True), + vol.Optional(CONF_FAN_DIRECTION): col_to_select(dps, is_dps=True), vol.Optional(CONF_FAN_DIRECTION_FWD, default="forward"): cv.string, vol.Optional(CONF_FAN_DIRECTION_REV, default="reverse"): cv.string, vol.Optional(CONF_FAN_SPEED_MIN, default=1): cv.positive_int, vol.Optional(CONF_FAN_SPEED_MAX, default=9): cv.positive_int, vol.Optional(CONF_FAN_ORDERED_LIST, default="disabled"): cv.string, - vol.Optional(CONF_FAN_DPS_TYPE, default="str"): vol.In(["str", "int"]), + # vol.Optional(CONF_FAN_DPS_TYPE, default="str"): vol.In(["str", "int"]), } -class LocaltuyaFan(LocalTuyaEntity, FanEntity): +class LocalTuyaFan(LocalTuyaEntity, FanEntity): """Representation of a Tuya fan.""" def __init__( @@ -71,19 +74,11 @@ def __init__( self._config.get(CONF_FAN_SPEED_MAX), ) self._ordered_list = self._config.get(CONF_FAN_ORDERED_LIST).split(",") - self._ordered_list_mode = None - self._dps_type = int if self._config.get(CONF_FAN_DPS_TYPE) == "int" else str if isinstance(self._ordered_list, list) and len(self._ordered_list) > 1: self._use_ordered_list = True - _LOGGER.debug( - "Fan _use_ordered_list: %s > %s", - self._use_ordered_list, - self._ordered_list, - ) else: self._use_ordered_list = False - _LOGGER.debug("Fan _use_ordered_list: %s", self._use_ordered_list) @property def oscillating(self): @@ -136,9 +131,10 @@ async def async_set_percentage(self, percentage): return await self.async_turn_off() if not self.is_on: await self.async_turn_on() + if self._use_ordered_list: await self._device.set_dp( - self._dps_type( + str( percentage_to_ordered_list_item(self._ordered_list, percentage) ), self._config.get(CONF_FAN_SPEED_CONTROL), @@ -148,10 +144,9 @@ async def async_set_percentage(self, percentage): percentage, percentage_to_ordered_list_item(self._ordered_list, percentage), ) - else: await self._device.set_dp( - self._dps_type( + int( math.ceil( percentage_to_ranged_value(self._speed_range, percentage) ) @@ -186,9 +181,9 @@ async def async_set_direction(self, direction): self.schedule_update_ha_state() @property - def supported_features(self) -> int: + def supported_features(self) -> FanEntityFeature: """Flag supported features.""" - features = 0 + features = FanEntityFeature(0) if self.has_config(CONF_FAN_OSCILLATING_CONTROL): features |= FanEntityFeature.OSCILLATE @@ -199,20 +194,25 @@ def supported_features(self) -> int: if self.has_config(CONF_FAN_DIRECTION): features |= FanEntityFeature.DIRECTION + features |= FanEntityFeature.TURN_OFF + features |= FanEntityFeature.TURN_ON + return features @property def speed_count(self) -> int: """Speed count for the fan.""" + if self._use_ordered_list: + return len(self._ordered_list) speed_count = int_states_in_range(self._speed_range) _LOGGER.debug("Fan speed_count: %s", speed_count) return speed_count def status_updated(self): """Get state of Tuya fan.""" - self._is_on = self.dps(self._dp_id) + self._is_on = self.dp_value(self._dp_id) - current_speed = self.dps_conf(CONF_FAN_SPEED_CONTROL) + current_speed = self.dp_value(CONF_FAN_SPEED_CONTROL) if self._use_ordered_list: _LOGGER.debug( "Fan current_speed ordered_list_item_to_percentage: %s from %s", @@ -238,11 +238,11 @@ def status_updated(self): _LOGGER.debug("Fan current_percentage: %s", self._percentage) if self.has_config(CONF_FAN_OSCILLATING_CONTROL): - self._oscillating = self.dps_conf(CONF_FAN_OSCILLATING_CONTROL) + self._oscillating = self.dp_value(CONF_FAN_OSCILLATING_CONTROL) _LOGGER.debug("Fan current_oscillating : %s", self._oscillating) if self.has_config(CONF_FAN_DIRECTION): - value = self.dps_conf(CONF_FAN_DIRECTION) + value = self.dp_value(CONF_FAN_DIRECTION) if value is not None: if value == self._config.get(CONF_FAN_DIRECTION_FWD): self._direction = DIRECTION_FORWARD @@ -252,4 +252,4 @@ def status_updated(self): _LOGGER.debug("Fan current_direction : %s > %s", value, self._direction) -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaFan, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaFan, flow_schema) diff --git a/custom_components/localtuya/humidifier.py b/custom_components/localtuya/humidifier.py new file mode 100644 index 00000000..e18e31f7 --- /dev/null +++ b/custom_components/localtuya/humidifier.py @@ -0,0 +1,156 @@ +"""Platform to locally control Tuya-based button devices.""" + +import logging +from functools import partial +from .config_flow import col_to_select +from homeassistant.helpers import selector + +import voluptuous as vol +from homeassistant.const import CONF_DEVICE_CLASS +from homeassistant.components.humidifier import ( + DOMAIN, + HumidifierDeviceClass, + DEVICE_CLASSES_SCHEMA, + HumidifierEntity, + HumidifierEntityDescription, + HumidifierEntityFeature, +) +from homeassistant.components.humidifier.const import ( + ATTR_MAX_HUMIDITY, + ATTR_MIN_HUMIDITY, + DEFAULT_MAX_HUMIDITY, + DEFAULT_MIN_HUMIDITY, +) + +CONF_HUMIDIFIER_SET_HUMIDITY_DP = "humidifier_set_humidity_dp" +CONF_HUMIDIFIER_CURRENT_HUMIDITY_DP = "humidifier_current_humidity_dp" +CONF_HUMIDIFIER_MODE_DP = "humidifier_mode_dp" +CONF_HUMIDIFIER_AVAILABLE_MODES = "humidifier_available_modes" + +from .entity import LocalTuyaEntity, async_setup_entry + + +_LOGGER = logging.getLogger(__name__) + + +def flow_schema(dps): + """Return schema used in config flow.""" + return { + vol.Optional(CONF_HUMIDIFIER_SET_HUMIDITY_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_HUMIDIFIER_CURRENT_HUMIDITY_DP): col_to_select( + dps, is_dps=True + ), + vol.Optional(CONF_HUMIDIFIER_MODE_DP): col_to_select(dps, is_dps=True), + vol.Required(ATTR_MIN_HUMIDITY, default=DEFAULT_MIN_HUMIDITY): int, + vol.Required(ATTR_MAX_HUMIDITY, default=DEFAULT_MAX_HUMIDITY): int, + vol.Optional( + CONF_HUMIDIFIER_AVAILABLE_MODES, default={} + ): selector.ObjectSelector(), + vol.Optional(CONF_DEVICE_CLASS): DEVICE_CLASSES_SCHEMA, + } + + +class LocalTuyaHumidifier(LocalTuyaEntity, HumidifierEntity): + """Representation of a Localtuya Humidifier.""" + + _dp_mode = CONF_HUMIDIFIER_MODE_DP + _available_modes = CONF_HUMIDIFIER_AVAILABLE_MODES + _dp_current_humidity = CONF_HUMIDIFIER_CURRENT_HUMIDITY_DP + _dp_set_humidity = CONF_HUMIDIFIER_SET_HUMIDITY_DP + _mode_name_to_value = {} + + def __init__( + self, + device, + config_entry, + humidifierID, + **kwargs, + ): + """Initialize the Tuya button.""" + super().__init__(device, config_entry, humidifierID, _LOGGER, **kwargs) + self._state = None + self._current_mode = None + + if self._config.get(self._dp_mode) and self._config.get(self._available_modes): + self._attr_supported_features |= HumidifierEntityFeature.MODES + self._mode_name_to_value = { + v: k if k else v.replace("_", " ").capitalize() + for k, v in self._config.get(self._available_modes, {}).items() + } + + self._attr_min_humidity = self._config.get( + ATTR_MIN_HUMIDITY, DEFAULT_MIN_HUMIDITY + ) + self._attr_max_humidity = self._config.get( + ATTR_MAX_HUMIDITY, DEFAULT_MAX_HUMIDITY + ) + + @property + def is_on(self) -> bool: + """Return the device is on or off.""" + return self._state + + @property + def mode(self) -> str | None: + """Return the current mode.""" + return self._current_mode + + @property + def target_humidity(self) -> int | None: + """Return the humidity we try to reach.""" + target_dp = self._config.get(self._dp_set_humidity, None) + + return self.dp_value(target_dp) if target_dp else None + + @property + def current_humidity(self) -> int | None: + """Return the current humidity.""" + curr_humidity = self._config.get(self._dp_current_humidity) + + return self.dp_value(self._dp_current_humidity) if curr_humidity else None + + async def async_turn_on(self, **kwargs): + """Turn the device on.""" + await self._device.set_dp(True, self._dp_id) + + async def async_turn_off(self, **kwargs): + """Turn the device off.""" + await self._device.set_dp(False, self._dp_id) + + async def async_set_humidity(self, humidity: int) -> None: + """Set new target humidity.""" + set_humidity_dp = self._config.get(self._dp_set_humidity, None) + if set_humidity_dp is None: + return None + + await self._device.set_dp(humidity, set_humidity_dp) + + @property + def available_modes(self): + """Return the list of presets that this device supports.""" + if modes := self._config.get(self._available_modes, {}).values(): + modes = list(modes) + return modes + + async def async_set_mode(self, mode): + """Set new target preset mode.""" + set_mode_dp = self._config.get(self._dp_mode, None) + if set_mode_dp is None: + return None + + set_mode = self._mode_name_to_value.get(mode) + await self._device.set_dp(set_mode, set_mode_dp) + + def status_updated(self): + """Device status was updated.""" + super().status_updated() + current_mode = self.dp_value(self._dp_mode) + for mode, mode_name in self._config.get(self._available_modes, {}).items(): + if mode == current_mode: + self._current_mode = mode_name + break + else: + self._current_mode = "unknown" + + +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaHumidifier, flow_schema) diff --git a/custom_components/localtuya/light.py b/custom_components/localtuya/light.py index 7c74e49f..8818060b 100644 --- a/custom_components/localtuya/light.py +++ b/custom_components/localtuya/light.py @@ -1,34 +1,38 @@ """Platform to locally control Tuya-based light devices.""" + import logging import textwrap -from functools import partial - import homeassistant.util.color as color_util import voluptuous as vol + +from dataclasses import dataclass +from functools import partial +from homeassistant.helpers import selector from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_HS_COLOR, DOMAIN, - SUPPORT_BRIGHTNESS, - SUPPORT_COLOR, - SUPPORT_COLOR_TEMP, - SUPPORT_EFFECT, + LightEntityFeature, + ColorMode, LightEntity, ) from homeassistant.const import CONF_BRIGHTNESS, CONF_COLOR_TEMP, CONF_SCENE -from .common import LocalTuyaEntity, async_setup_entry +from .config_flow import col_to_select +from .entity import LocalTuyaEntity, async_setup_entry from .const import ( CONF_BRIGHTNESS_LOWER, CONF_BRIGHTNESS_UPPER, CONF_COLOR, CONF_COLOR_MODE, + CONF_COLOR_MODE_SET, CONF_COLOR_TEMP_MAX_KELVIN, CONF_COLOR_TEMP_MIN_KELVIN, CONF_COLOR_TEMP_REVERSE, CONF_MUSIC_MODE, + CONF_SCENE_VALUES, ) _LOGGER = logging.getLogger(__name__) @@ -41,6 +45,7 @@ DEFAULT_LOWER_BRIGHTNESS = 29 DEFAULT_UPPER_BRIGHTNESS = 1000 +MODE_MANUAL = "manual" MODE_COLOR = "colour" MODE_MUSIC = "music" MODE_SCENE = "scene" @@ -49,6 +54,18 @@ SCENE_CUSTOM = "Custom" SCENE_MUSIC = "Music" +MODES_SET = {"Colour, Music, Scene and White": 0, "Manual, Music, Scene and White": 1} + +SCENE_LIST_RGBW_255 = { + "Night": "bd76000168ffff", + "Read": "fffcf70168ffff", + "Meeting": "cf38000168ffff", + "Leasure": "3855b40168ffff", + "Scenario 1": "scene_1", + "Scenario 2": "scene_2", + "Scenario 3": "scene_3", + "Scenario 4": "scene_4", +} SCENE_LIST_RGBW_1000 = { "Night": "000e0d0000000000000000c80000", "Read": "010e0d0000000000000003e801f4", @@ -63,18 +80,6 @@ + "03e800000000464602003d03e803e80000000046460200ae03e803e800000000464602011303e80" + "3e800000000", } - -SCENE_LIST_RGBW_255 = { - "Night": "bd76000168ffff", - "Read": "fffcf70168ffff", - "Meeting": "cf38000168ffff", - "Leasure": "3855b40168ffff", - "Scenario 1": "scene_1", - "Scenario 2": "scene_2", - "Scenario 3": "scene_3", - "Scenario 4": "scene_4", -} - SCENE_LIST_RGB_1000 = { "Night": "000e0d00002e03e802cc00000000", "Read": "010e0d000084000003e800000000", @@ -86,52 +91,66 @@ + "e800000000", "Dazzling": "06464601000003e803e800000000464601007803e803e80000000046460100f003e80" + "3e800000000", - "Music": "07464602000003e803e800000000464602007803e803e80000000046460200f003e803e8" + "Gorgeous": "07464602000003e803e800000000464602007803e803e80000000046460200f003e803e8" + "00000000464602003d03e803e80000000046460200ae03e803e800000000464602011303e803e80" + "0000000", } -def map_range(value, from_lower, from_upper, to_lower, to_upper): +@dataclass(frozen=True) +class Mode: + color: str = MODE_COLOR + music: str = MODE_MUSIC + scene: str = MODE_SCENE + white: str = MODE_WHITE + + def as_list(self) -> list: + return [self.color, self.music, self.scene, self.white] + + def as_dict(self) -> dict[str, str]: + default = {"Default": self.white} + return {**default, "Mode Color": self.color, "Mode Scene": self.scene} + + +MAP_MODE_SET = {0: Mode(), 1: Mode(color=MODE_MANUAL)} + + +def map_range(value, from_lower, from_upper, to_lower=0, to_upper=255, reverse=False): """Map a value in one range to another.""" - mapped = (value - from_lower) * (to_upper - to_lower) / ( - from_upper - from_lower - ) + to_lower - return round(min(max(mapped, to_lower), to_upper)) + if reverse: + value = from_upper - value + from_lower + mapped = value * to_upper / from_upper + return min(max(round(mapped), to_lower), to_upper) def flow_schema(dps): """Return schema used in config flow.""" return { - vol.Optional(CONF_BRIGHTNESS): vol.In(dps), - vol.Optional(CONF_COLOR_TEMP): vol.In(dps), + vol.Optional(CONF_BRIGHTNESS): col_to_select(dps, is_dps=True), + vol.Optional(CONF_COLOR_TEMP): col_to_select(dps, is_dps=True), vol.Optional(CONF_BRIGHTNESS_LOWER, default=DEFAULT_LOWER_BRIGHTNESS): vol.All( vol.Coerce(int), vol.Range(min=0, max=10000) ), vol.Optional(CONF_BRIGHTNESS_UPPER, default=DEFAULT_UPPER_BRIGHTNESS): vol.All( vol.Coerce(int), vol.Range(min=0, max=10000) ), - vol.Optional(CONF_COLOR_MODE): vol.In(dps), - vol.Optional(CONF_COLOR): vol.In(dps), + vol.Optional(CONF_COLOR_MODE): col_to_select(dps, is_dps=True), + vol.Required(CONF_COLOR_MODE_SET, default="0"): col_to_select(MODES_SET), + vol.Optional(CONF_COLOR): col_to_select(dps, is_dps=True), vol.Optional(CONF_COLOR_TEMP_MIN_KELVIN, default=DEFAULT_MIN_KELVIN): vol.All( vol.Coerce(int), vol.Range(min=1500, max=8000) ), vol.Optional(CONF_COLOR_TEMP_MAX_KELVIN, default=DEFAULT_MAX_KELVIN): vol.All( vol.Coerce(int), vol.Range(min=1500, max=8000) ), - vol.Optional( - CONF_COLOR_TEMP_REVERSE, - default=DEFAULT_COLOR_TEMP_REVERSE, - description={"suggested_value": DEFAULT_COLOR_TEMP_REVERSE}, - ): bool, - vol.Optional(CONF_SCENE): vol.In(dps), - vol.Optional( - CONF_MUSIC_MODE, default=False, description={"suggested_value": False} - ): bool, + vol.Optional(CONF_COLOR_TEMP_REVERSE, default=DEFAULT_COLOR_TEMP_REVERSE): bool, + vol.Optional(CONF_SCENE): col_to_select(dps, is_dps=True), + vol.Optional(CONF_SCENE_VALUES, default={}): selector.ObjectSelector(), + vol.Optional(CONF_MUSIC_MODE, default=False): selector.BooleanSelector(), } -class LocaltuyaLight(LocalTuyaEntity, LightEntity): +class LocalTuyaLight(LocalTuyaEntity, LightEntity): """Representation of a Tuya light.""" def __init__( @@ -146,34 +165,47 @@ def __init__( self._state = False self._brightness = None self._color_temp = None - self._lower_brightness = self._config.get( - CONF_BRIGHTNESS_LOWER, DEFAULT_LOWER_BRIGHTNESS + self._lower_brightness = int( + self._config.get(CONF_BRIGHTNESS_LOWER, DEFAULT_LOWER_BRIGHTNESS) ) - self._upper_brightness = self._config.get( - CONF_BRIGHTNESS_UPPER, DEFAULT_UPPER_BRIGHTNESS + self._upper_brightness = int( + self._config.get(CONF_BRIGHTNESS_UPPER, DEFAULT_UPPER_BRIGHTNESS) ) self._upper_color_temp = self._upper_brightness - self._max_mired = color_util.color_temperature_kelvin_to_mired( + self._min_kelvin = int( self._config.get(CONF_COLOR_TEMP_MIN_KELVIN, DEFAULT_MIN_KELVIN) ) - self._min_mired = color_util.color_temperature_kelvin_to_mired( + self._max_kelvin = int( self._config.get(CONF_COLOR_TEMP_MAX_KELVIN, DEFAULT_MAX_KELVIN) ) self._color_temp_reverse = self._config.get( CONF_COLOR_TEMP_REVERSE, DEFAULT_COLOR_TEMP_REVERSE ) + self._modes = MAP_MODE_SET[int(self._config.get(CONF_COLOR_MODE_SET, 0))] self._hs = None self._effect = None self._effect_list = [] - self._scenes = None + self._scenes = {} + + custom_scenes = False if self.has_config(CONF_SCENE): - if self._config.get(CONF_SCENE) < 20: + if self.has_config(CONF_SCENE_VALUES): + custom_scenes = True + values_list = list(self._config.get(CONF_SCENE_VALUES)) + values_name = list(self._config.get(CONF_SCENE_VALUES).values()) + self._scenes = dict(zip(values_name, values_list)) + elif int(self._config.get(CONF_SCENE)) < 20: self._scenes = SCENE_LIST_RGBW_255 elif self._config.get(CONF_BRIGHTNESS) is None: self._scenes = SCENE_LIST_RGB_1000 else: self._scenes = SCENE_LIST_RGBW_1000 + + if not custom_scenes: + self._scenes = {**self._modes.as_dict(), **self._scenes} + self._effect_list = list(self._scenes.keys()) + if self._config.get(CONF_MUSIC_MODE): self._effect_list.append(SCENE_MUSIC) @@ -185,9 +217,19 @@ def is_on(self): @property def brightness(self): """Return the brightness of the light.""" - if self.is_color_mode or self.is_white_mode: + brightness = self._brightness + if brightness is not None and (self.is_color_mode or self.is_white_mode): + if self._upper_brightness >= 1000: + # Round to the nearest 10th, since Tuya does that. + # If the value is less than 5, it will round down to 0. + # So instead, we take _lower_brightness, which is < 5 in this case. + brightness = ( + (brightness + 5) // 10 * 10 + if brightness >= 5 + else self._lower_brightness + ) return map_range( - self._brightness, self._lower_brightness, self._upper_brightness, 0, 255 + brightness, self._lower_brightness, self._upper_brightness, 0, 255 ) return None @@ -197,8 +239,8 @@ def hs_color(self): if self.is_color_mode: return self._hs if ( - self.supported_features & SUPPORT_COLOR - and not self.supported_features & SUPPORT_COLOR_TEMP + ColorMode.HS in self.supported_color_modes + and not ColorMode.COLOR_TEMP in self.supported_color_modes ): return [0, 0] return None @@ -206,17 +248,19 @@ def hs_color(self): @property def color_temp(self): """Return the color_temp of the light.""" - if self.has_config(CONF_COLOR_TEMP) and self.is_white_mode: - color_temp_value = ( + if self._color_temp is None: + return + if self.has_config(CONF_COLOR_TEMP): + color_temp = ( self._upper_color_temp - self._color_temp if self._color_temp_reverse else self._color_temp ) return int( - self._max_mired + self.max_mireds - ( - ((self._max_mired - self._min_mired) / self._upper_color_temp) - * color_temp_value + ((self.max_mireds - self.min_mireds) / self._upper_color_temp) + * color_temp ) ) return None @@ -224,65 +268,98 @@ def color_temp(self): @property def min_mireds(self): """Return color temperature min mireds.""" - return self._min_mired + return color_util.color_temperature_kelvin_to_mired(self._max_kelvin) @property def max_mireds(self): """Return color temperature max mireds.""" - return self._max_mired + return color_util.color_temperature_kelvin_to_mired(self._min_kelvin) @property def effect(self): """Return the current effect for this light.""" if self.is_scene_mode or self.is_music_mode: return self._effect + elif (color_mode := self.__get_color_mode()) in self._scenes.values(): + return self.__find_scene_by_scene_data(color_mode) return None @property def effect_list(self): """Return the list of supported effects for this light.""" - return self._effect_list + if len(self._effect_list) > 0: + return self._effect_list + return None @property - def supported_features(self): - """Flag supported features.""" - supports = 0 - if self.has_config(CONF_BRIGHTNESS): - supports |= SUPPORT_BRIGHTNESS + def supported_color_modes(self) -> set[ColorMode] | set[str] | None: + """Flag supported color modes.""" + color_modes: set[ColorMode] = set() + if self.has_config(CONF_COLOR_TEMP): - supports |= SUPPORT_COLOR_TEMP + color_modes.add(ColorMode.COLOR_TEMP) if self.has_config(CONF_COLOR): - supports |= SUPPORT_COLOR | SUPPORT_BRIGHTNESS + color_modes.add(ColorMode.HS) + + if not color_modes and self.has_config(CONF_BRIGHTNESS): + return {ColorMode.BRIGHTNESS} + + if not color_modes: + return {ColorMode.ONOFF} + + return color_modes + + @property + def supported_features(self) -> LightEntityFeature: + """Flag supported features.""" + supports = LightEntityFeature(0) if self.has_config(CONF_SCENE) or self.has_config(CONF_MUSIC_MODE): - supports |= SUPPORT_EFFECT + supports |= LightEntityFeature.EFFECT return supports @property def is_white_mode(self): """Return true if the light is in white mode.""" color_mode = self.__get_color_mode() - return color_mode is None or color_mode == MODE_WHITE + return color_mode is None or color_mode == self._modes.white @property def is_color_mode(self): """Return true if the light is in color mode.""" color_mode = self.__get_color_mode() - return color_mode is not None and color_mode == MODE_COLOR + return color_mode is not None and color_mode == self._modes.color @property def is_scene_mode(self): """Return true if the light is in scene mode.""" color_mode = self.__get_color_mode() - return color_mode is not None and color_mode.startswith(MODE_SCENE) + return color_mode is not None and color_mode.startswith(self._modes.scene) @property def is_music_mode(self): """Return true if the light is in music mode.""" color_mode = self.__get_color_mode() - return color_mode is not None and color_mode == MODE_MUSIC + return color_mode is not None and color_mode == self._modes.music + + @property + def color_mode(self) -> ColorMode: + """Return the color_mode of the light.""" + if len(self.supported_color_modes) == 1: + return next(iter(self.supported_color_modes)) + + if self.is_color_mode: + return ColorMode.HS + if self.is_white_mode: + return ColorMode.COLOR_TEMP + if self._brightness: + return ColorMode.BRIGHTNESS + + return ColorMode.ONOFF def __is_color_rgb_encoded(self): - return len(self.dps_conf(CONF_COLOR)) > 12 + # for now we will prefer non encoded if color is none "added by manual or cloud pull dp" + color = self.dp_value(CONF_COLOR) + return False if color is None else len(color) > 12 def __find_scene_by_scene_data(self, data): return next( @@ -292,9 +369,9 @@ def __find_scene_by_scene_data(self, data): def __get_color_mode(self): return ( - self.dps_conf(CONF_COLOR_MODE) + self.dp_value(CONF_COLOR_MODE) if self.has_config(CONF_COLOR_MODE) - else MODE_WHITE + else self._modes.white ) async def async_turn_on(self, **kwargs): @@ -303,19 +380,30 @@ async def async_turn_on(self, **kwargs): if not self.is_on: states[self._dp_id] = True features = self.supported_features + color_modes = self.supported_color_modes brightness = None - if ATTR_EFFECT in kwargs and (features & SUPPORT_EFFECT): - scene = self._scenes.get(kwargs[ATTR_EFFECT]) + if ATTR_EFFECT in kwargs and (features & LightEntityFeature.EFFECT): + effect = kwargs[ATTR_EFFECT] + scene = self._scenes.get(effect) if scene is not None: - if scene.startswith(MODE_SCENE): + if scene.startswith(self._modes.scene) or scene in ( + self._modes.white, + self._modes.color, + ): states[self._config.get(CONF_COLOR_MODE)] = scene else: - states[self._config.get(CONF_COLOR_MODE)] = MODE_SCENE + states[self._config.get(CONF_COLOR_MODE)] = self._modes.scene states[self._config.get(CONF_SCENE)] = scene - elif kwargs[ATTR_EFFECT] == SCENE_MUSIC: - states[self._config.get(CONF_COLOR_MODE)] = MODE_MUSIC - - if ATTR_BRIGHTNESS in kwargs and (features & SUPPORT_BRIGHTNESS): + elif effect in self._modes.as_list(): + states[self._config.get(CONF_COLOR_MODE)] = effect + elif effect == self._modes.music: + states[self._config.get(CONF_COLOR_MODE)] = self._modes.music + + if ATTR_BRIGHTNESS in kwargs and ( + ColorMode.BRIGHTNESS in color_modes + or self.has_config(CONF_BRIGHTNESS) + or self.has_config(CONF_COLOR) + ): brightness = map_range( int(kwargs[ATTR_BRIGHTNESS]), 0, @@ -323,7 +411,7 @@ async def async_turn_on(self, **kwargs): self._lower_brightness, self._upper_brightness, ) - if self.is_white_mode: + if self.is_white_mode or self.dp_value(CONF_COLOR) is None: states[self._config.get(CONF_BRIGHTNESS)] = brightness else: if self.__is_color_rgb_encoded(): @@ -345,15 +433,15 @@ async def async_turn_on(self, **kwargs): round(self._hs[0]), round(self._hs[1] * 10.0), brightness ) states[self._config.get(CONF_COLOR)] = color - states[self._config.get(CONF_COLOR_MODE)] = MODE_COLOR + states[self._config.get(CONF_COLOR_MODE)] = self._modes.color - if ATTR_HS_COLOR in kwargs and (features & SUPPORT_COLOR): + if ATTR_HS_COLOR in kwargs and ColorMode.HS in color_modes: if brightness is None: brightness = self._brightness hs = kwargs[ATTR_HS_COLOR] if hs[1] == 0 and self.has_config(CONF_BRIGHTNESS): states[self._config.get(CONF_BRIGHTNESS)] = brightness - states[self._config.get(CONF_COLOR_MODE)] = MODE_WHITE + states[self._config.get(CONF_COLOR_MODE)] = self._modes.white else: if self.__is_color_rgb_encoded(): rgb = color_util.color_hsv_to_RGB( @@ -372,26 +460,27 @@ async def async_turn_on(self, **kwargs): round(hs[0]), round(hs[1] * 10.0), brightness ) states[self._config.get(CONF_COLOR)] = color - states[self._config.get(CONF_COLOR_MODE)] = MODE_COLOR + states[self._config.get(CONF_COLOR_MODE)] = self._modes.color - if ATTR_COLOR_TEMP in kwargs and (features & SUPPORT_COLOR_TEMP): + if ATTR_COLOR_TEMP in kwargs and ColorMode.COLOR_TEMP in color_modes: if brightness is None: brightness = self._brightness mired = int(kwargs[ATTR_COLOR_TEMP]) if self._color_temp_reverse: - mired = self._max_mired - (mired - self._min_mired) - if mired < self._min_mired: - mired = self._min_mired - elif mired > self._max_mired: - mired = self._max_mired + mired = self.max_mireds - (mired - self.min_mireds) + if mired < self.min_mireds: + mired = self.min_mireds + elif mired > self.max_mireds: + mired = self.max_mireds color_temp = int( self._upper_color_temp - - (self._upper_color_temp / (self._max_mired - self._min_mired)) - * (mired - self._min_mired) + - (self._upper_color_temp / (self.max_mireds - self.min_mireds)) + * (mired - self.min_mireds) ) - states[self._config.get(CONF_COLOR_MODE)] = MODE_WHITE + states[self._config.get(CONF_COLOR_MODE)] = self._modes.white states[self._config.get(CONF_BRIGHTNESS)] = brightness states[self._config.get(CONF_COLOR_TEMP)] = color_temp + await self._device.set_dps(states) async def async_turn_off(self, **kwargs): @@ -400,14 +489,15 @@ async def async_turn_off(self, **kwargs): def status_updated(self): """Device status was updated.""" - self._state = self.dps(self._dp_id) + self._state = self.dp_value(self._dp_id) supported = self.supported_features self._effect = None - if supported & SUPPORT_BRIGHTNESS and self.has_config(CONF_BRIGHTNESS): - self._brightness = self.dps_conf(CONF_BRIGHTNESS) - if supported & SUPPORT_COLOR: - color = self.dps_conf(CONF_COLOR) + if brightness_dp_value := self.dp_value(CONF_BRIGHTNESS, None): + self._brightness = brightness_dp_value + + if ColorMode.HS in self.supported_color_modes: + color = self.dp_value(CONF_COLOR) if color is not None and not self.is_white_mode: if self.__is_color_rgb_encoded(): hue = int(color[6:10], 16) @@ -421,18 +511,20 @@ def status_updated(self): ] self._hs = [hue, sat / 10.0] self._brightness = value + elif self._brightness is None: + self._brightness = 20 - if supported & SUPPORT_COLOR_TEMP: - self._color_temp = self.dps_conf(CONF_COLOR_TEMP) + if ColorMode.COLOR_TEMP in self.supported_color_modes: + self._color_temp = self.dp_value(CONF_COLOR_TEMP) - if self.is_scene_mode and supported & SUPPORT_EFFECT: - if self.dps_conf(CONF_COLOR_MODE) != MODE_SCENE: + if self.is_scene_mode and supported & LightEntityFeature.EFFECT: + if self.dp_value(CONF_COLOR_MODE) != self._modes.scene: self._effect = self.__find_scene_by_scene_data( - self.dps_conf(CONF_COLOR_MODE) + self.dp_value(CONF_COLOR_MODE) ) else: self._effect = self.__find_scene_by_scene_data( - self.dps_conf(CONF_SCENE) + self.dp_value(CONF_SCENE) ) if self._effect == SCENE_CUSTOM: if SCENE_CUSTOM not in self._effect_list: @@ -440,8 +532,8 @@ def status_updated(self): elif SCENE_CUSTOM in self._effect_list: self._effect_list.remove(SCENE_CUSTOM) - if self.is_music_mode and supported & SUPPORT_EFFECT: + if self.is_music_mode and supported & LightEntityFeature.EFFECT: self._effect = SCENE_MUSIC -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaLight, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaLight, flow_schema) diff --git a/custom_components/localtuya/lock.py b/custom_components/localtuya/lock.py new file mode 100644 index 00000000..ee8272a2 --- /dev/null +++ b/custom_components/localtuya/lock.py @@ -0,0 +1,64 @@ +"""Platform to present any Tuya DP as a Lock.""" + +import logging +from functools import partial +from typing import Any +from .config_flow import col_to_select + +import voluptuous as vol +from homeassistant.components.lock import DOMAIN, LockEntity +from .entity import LocalTuyaEntity, async_setup_entry + +from .const import CONF_JAMMED_DP, CONF_LOCK_STATE_DP + +_LOGGER = logging.getLogger(__name__) + + +def flow_schema(dps): + """Return schema used in config flow.""" + return { + vol.Optional(CONF_LOCK_STATE_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_JAMMED_DP): col_to_select(dps, is_dps=True), + } + + +class LocalTuyaLock(LocalTuyaEntity, LockEntity): + """Representation of a Tuya Lock.""" + + def __init__( + self, + device, + config_entry, + Lockid, + **kwargs, + ): + """Initialize the Tuya Lock.""" + super().__init__(device, config_entry, Lockid, _LOGGER, **kwargs) + self._state = None + + async def async_lock(self, **kwargs: Any) -> None: + """Lock the lock.""" + await self._device.set_dp(True, self._dp_id) + + async def async_unlock(self, **kwargs: Any) -> None: + """Unlock the lock.""" + await self._device.set_dp(False, self._dp_id) + + def status_updated(self): + """Device status was updated.""" + state = self.dp_value(self._dp_id) + if (lock_state := self.dp_value(CONF_LOCK_STATE_DP)) or lock_state is not None: + state = lock_state + + self._attr_is_locked = state in (False, "closed", "close", None) + + if jammed := self.dp_value(CONF_JAMMED_DP, False): + self._attr_is_jammed = jammed + + # No need to restore state for a Lock + async def restore_state_when_connected(self): + """Do nothing for a Lock.""" + return + + +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaLock, flow_schema) diff --git a/custom_components/localtuya/manifest.json b/custom_components/localtuya/manifest.json index 28e36fa0..092cc596 100644 --- a/custom_components/localtuya/manifest.json +++ b/custom_components/localtuya/manifest.json @@ -1,14 +1,13 @@ { "domain": "localtuya", - "name": "LocalTuya integration", - "codeowners": [ - "@rospogrigio", "@postlund" - ], + "name": "Local Tuya", + "codeowners": [], "config_flow": true, "dependencies": [], - "documentation": "https://github.com/rospogrigio/localtuya/", + "documentation": "https://github.com/xZetsubou/hass-localtuya/", + "integration_type": "hub", "iot_class": "local_push", - "issue_tracker": "https://github.com/rospogrigio/localtuya/issues", + "issue_tracker": "https://github.com/xZetsubou/hass-localtuya/issues", "requirements": [], - "version": "5.2.1" + "version": "2024.12.1" } diff --git a/custom_components/localtuya/number.py b/custom_components/localtuya/number.py index 917d3d00..e49768c2 100644 --- a/custom_components/localtuya/number.py +++ b/custom_components/localtuya/number.py @@ -1,19 +1,25 @@ """Platform to present any Tuya DP as a number.""" + import logging from functools import partial import voluptuous as vol -from homeassistant.components.number import DOMAIN, NumberEntity -from homeassistant.const import CONF_DEVICE_CLASS, STATE_UNKNOWN +from homeassistant.components.number import DOMAIN, NumberEntity, DEVICE_CLASSES_SCHEMA +from homeassistant.const import ( + CONF_DEVICE_CLASS, + STATE_UNKNOWN, + CONF_UNIT_OF_MEASUREMENT, +) -from .common import LocalTuyaEntity, async_setup_entry +from .entity import LocalTuyaEntity, async_setup_entry from .const import ( CONF_DEFAULT_VALUE, CONF_MAX_VALUE, CONF_MIN_VALUE, CONF_PASSIVE_ENTITY, CONF_RESTORE_ON_RECONNECT, - CONF_STEPSIZE_VALUE, + CONF_SCALING, + CONF_STEPSIZE, ) _LOGGER = logging.getLogger(__name__) @@ -34,17 +40,21 @@ def flow_schema(dps): vol.Coerce(float), vol.Range(min=-1000000.0, max=1000000.0), ), - vol.Required(CONF_STEPSIZE_VALUE, default=DEFAULT_STEP): vol.All( - vol.Coerce(float), - vol.Range(min=0.0, max=1000000.0), + vol.Required(CONF_STEPSIZE, default=DEFAULT_STEP): vol.All( + vol.Coerce(float), vol.Range(min=0.0, max=1000000.0) ), - vol.Required(CONF_RESTORE_ON_RECONNECT): bool, - vol.Required(CONF_PASSIVE_ENTITY): bool, + vol.Optional(CONF_RESTORE_ON_RECONNECT, default=False): bool, + vol.Optional(CONF_PASSIVE_ENTITY, default=False): bool, vol.Optional(CONF_DEFAULT_VALUE): str, + vol.Optional(CONF_DEVICE_CLASS): DEVICE_CLASSES_SCHEMA, + vol.Optional(CONF_UNIT_OF_MEASUREMENT): vol.Any(None, str), + vol.Optional(CONF_SCALING): vol.All( + vol.Coerce(float), vol.Range(min=-1000000.0, max=1000000.0) + ), } -class LocaltuyaNumber(LocalTuyaEntity, NumberEntity): +class LocalTuyaNumber(LocalTuyaEntity, NumberEntity): """Representation of a Tuya Number.""" def __init__( @@ -58,17 +68,9 @@ def __init__( super().__init__(device, config_entry, sensorid, _LOGGER, **kwargs) self._state = STATE_UNKNOWN - self._min_value = DEFAULT_MIN - if CONF_MIN_VALUE in self._config: - self._min_value = self._config.get(CONF_MIN_VALUE) - - self._max_value = DEFAULT_MAX - if CONF_MAX_VALUE in self._config: - self._max_value = self._config.get(CONF_MAX_VALUE) - - self._step_size = DEFAULT_STEP - if CONF_STEPSIZE_VALUE in self._config: - self._step_size = self._config.get(CONF_STEPSIZE_VALUE) + self._min_value = self.scale(self._config.get(CONF_MIN_VALUE, DEFAULT_MIN)) + self._max_value = self.scale(self._config.get(CONF_MAX_VALUE, DEFAULT_MAX)) + self._step_size = self.scale(self._config.get(CONF_STEPSIZE, DEFAULT_STEP)) # Override standard default value handling to cast to a float default_value = self._config.get(CONF_DEFAULT_VALUE) @@ -78,6 +80,7 @@ def __init__( @property def native_value(self) -> float: """Return sensor state.""" + self._state = self.scale(self._state) return self._state @property @@ -95,6 +98,11 @@ def native_step(self) -> float: """Return the maximum value.""" return self._step_size + @property + def native_unit_of_measurement(self): + """Return the unit of measurement of this entity, if any.""" + return self._config.get(CONF_UNIT_OF_MEASUREMENT) + @property def device_class(self): """Return the class of this device.""" @@ -102,7 +110,10 @@ def device_class(self): async def async_set_native_value(self, value: float) -> None: """Update the current value.""" - await self._device.set_dp(value, self._dp_id) + if scale_factor := self._config.get(CONF_SCALING): + value = value / float(scale_factor) + + await self._device.set_dp(int(value), self._dp_id) # Default value is the minimum value def entity_default_value(self): @@ -110,4 +121,4 @@ def entity_default_value(self): return self._min_value -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaNumber, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaNumber, flow_schema) diff --git a/custom_components/localtuya/pytuya/__init__.py b/custom_components/localtuya/pytuya/__init__.py deleted file mode 100644 index 67aabb24..00000000 --- a/custom_components/localtuya/pytuya/__init__.py +++ /dev/null @@ -1,1196 +0,0 @@ -# PyTuya Module -# -*- coding: utf-8 -*- -""" -Python module to interface with Tuya WiFi smart devices. - -Author: clach04, postlund -Maintained by: rospogrigio - -For more information see https://github.com/clach04/python-tuya - -Classes - TuyaInterface(dev_id, address, local_key=None) - dev_id (str): Device ID e.g. 01234567891234567890 - address (str): Device Network IP Address e.g. 10.0.1.99 - local_key (str, optional): The encryption key. Defaults to None. - -Functions - json = status() # returns json payload - set_version(version) # 3.1 [default], 3.2, 3.3 or 3.4 - detect_available_dps() # returns a list of available dps provided by the device - update_dps(dps) # sends update dps command - add_dps_to_request(dp_index) # adds dp_index to the list of dps used by the - # device (to be queried in the payload) - set_dp(on, dp_index) # Set value of any dps index. - - - Credits - * TuyaAPI https://github.com/codetheweb/tuyapi by codetheweb and blackrozes - For protocol reverse engineering - * PyTuya https://github.com/clach04/python-tuya by clach04 - The origin of this python module (now abandoned) - * Tuya Protocol 3.4 Support by uzlonewolf - Enhancement to TuyaMessage logic for multi-payload messages and Tuya Protocol 3.4 support - * TinyTuya https://github.com/jasonacox/tinytuya by jasonacox - Several CLI tools and code for Tuya devices -""" - -import asyncio -import base64 -import binascii -import hmac -import json -import logging -import struct -import time -import weakref -from abc import ABC, abstractmethod -from collections import namedtuple -from hashlib import md5, sha256 - -from cryptography.hazmat.backends import default_backend -from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes - -version_tuple = (10, 0, 0) -version = version_string = __version__ = "%d.%d.%d" % version_tuple -__author__ = "rospogrigio" - -_LOGGER = logging.getLogger(__name__) - -# Tuya Packet Format -TuyaHeader = namedtuple("TuyaHeader", "prefix seqno cmd length") -MessagePayload = namedtuple("MessagePayload", "cmd payload") -try: - TuyaMessage = namedtuple( - "TuyaMessage", "seqno cmd retcode payload crc crc_good", defaults=(True,) - ) -except Exception: - TuyaMessage = namedtuple("TuyaMessage", "seqno cmd retcode payload crc crc_good") - -# TinyTuya Error Response Codes -ERR_JSON = 900 -ERR_CONNECT = 901 -ERR_TIMEOUT = 902 -ERR_RANGE = 903 -ERR_PAYLOAD = 904 -ERR_OFFLINE = 905 -ERR_STATE = 906 -ERR_FUNCTION = 907 -ERR_DEVTYPE = 908 -ERR_CLOUDKEY = 909 -ERR_CLOUDRESP = 910 -ERR_CLOUDTOKEN = 911 -ERR_PARAMS = 912 -ERR_CLOUD = 913 - -error_codes = { - ERR_JSON: "Invalid JSON Response from Device", - ERR_CONNECT: "Network Error: Unable to Connect", - ERR_TIMEOUT: "Timeout Waiting for Device", - ERR_RANGE: "Specified Value Out of Range", - ERR_PAYLOAD: "Unexpected Payload from Device", - ERR_OFFLINE: "Network Error: Device Unreachable", - ERR_STATE: "Device in Unknown State", - ERR_FUNCTION: "Function Not Supported by Device", - ERR_DEVTYPE: "Device22 Detected: Retry Command", - ERR_CLOUDKEY: "Missing Tuya Cloud Key and Secret", - ERR_CLOUDRESP: "Invalid JSON Response from Cloud", - ERR_CLOUDTOKEN: "Unable to Get Cloud Token", - ERR_PARAMS: "Missing Function Parameters", - ERR_CLOUD: "Error Response from Tuya Cloud", - None: "Unknown Error", -} - - -class DecodeError(Exception): - """Specific Exception caused by decoding error.""" - - pass - - -# Tuya Command Types -# Reference: -# https://github.com/tuya/tuya-iotos-embeded-sdk-wifi-ble-bk7231n/blob/master/sdk/include/lan_protocol.h -AP_CONFIG = 0x01 # FRM_TP_CFG_WF # only used for ap 3.0 network config -ACTIVE = 0x02 # FRM_TP_ACTV (discard) # WORK_MODE_CMD -SESS_KEY_NEG_START = 0x03 # FRM_SECURITY_TYPE3 # negotiate session key -SESS_KEY_NEG_RESP = 0x04 # FRM_SECURITY_TYPE4 # negotiate session key response -SESS_KEY_NEG_FINISH = 0x05 # FRM_SECURITY_TYPE5 # finalize session key negotiation -UNBIND = 0x06 # FRM_TP_UNBIND_DEV # DATA_QUERT_CMD - issue command -CONTROL = 0x07 # FRM_TP_CMD # STATE_UPLOAD_CMD -STATUS = 0x08 # FRM_TP_STAT_REPORT # STATE_QUERY_CMD -HEART_BEAT = 0x09 # FRM_TP_HB -DP_QUERY = 0x0A # 10 # FRM_QUERY_STAT # UPDATE_START_CMD - get data points -QUERY_WIFI = 0x0B # 11 # FRM_SSID_QUERY (discard) # UPDATE_TRANS_CMD -TOKEN_BIND = 0x0C # 12 # FRM_USER_BIND_REQ # GET_ONLINE_TIME_CMD - system time (GMT) -CONTROL_NEW = 0x0D # 13 # FRM_TP_NEW_CMD # FACTORY_MODE_CMD -ENABLE_WIFI = 0x0E # 14 # FRM_ADD_SUB_DEV_CMD # WIFI_TEST_CMD -WIFI_INFO = 0x0F # 15 # FRM_CFG_WIFI_INFO -DP_QUERY_NEW = 0x10 # 16 # FRM_QUERY_STAT_NEW -SCENE_EXECUTE = 0x11 # 17 # FRM_SCENE_EXEC -UPDATEDPS = 0x12 # 18 # FRM_LAN_QUERY_DP # Request refresh of DPS -UDP_NEW = 0x13 # 19 # FR_TYPE_ENCRYPTION -AP_CONFIG_NEW = 0x14 # 20 # FRM_AP_CFG_WF_V40 -BOARDCAST_LPV34 = 0x23 # 35 # FR_TYPE_BOARDCAST_LPV34 -LAN_EXT_STREAM = 0x40 # 64 # FRM_LAN_EXT_STREAM - - -PROTOCOL_VERSION_BYTES_31 = b"3.1" -PROTOCOL_VERSION_BYTES_33 = b"3.3" -PROTOCOL_VERSION_BYTES_34 = b"3.4" - -PROTOCOL_3x_HEADER = 12 * b"\x00" -PROTOCOL_33_HEADER = PROTOCOL_VERSION_BYTES_33 + PROTOCOL_3x_HEADER -PROTOCOL_34_HEADER = PROTOCOL_VERSION_BYTES_34 + PROTOCOL_3x_HEADER -MESSAGE_HEADER_FMT = ">4I" # 4*uint32: prefix, seqno, cmd, length [, retcode] -MESSAGE_RECV_HEADER_FMT = ">5I" # 4*uint32: prefix, seqno, cmd, length, retcode -MESSAGE_RETCODE_FMT = ">I" # retcode for received messages -MESSAGE_END_FMT = ">2I" # 2*uint32: crc, suffix -MESSAGE_END_FMT_HMAC = ">32sI" # 32s:hmac, uint32:suffix -PREFIX_VALUE = 0x000055AA -PREFIX_BIN = b"\x00\x00U\xaa" -SUFFIX_VALUE = 0x0000AA55 -SUFFIX_BIN = b"\x00\x00\xaaU" -NO_PROTOCOL_HEADER_CMDS = [ - DP_QUERY, - DP_QUERY_NEW, - UPDATEDPS, - HEART_BEAT, - SESS_KEY_NEG_START, - SESS_KEY_NEG_RESP, - SESS_KEY_NEG_FINISH, -] - -HEARTBEAT_INTERVAL = 10 - -# DPS that are known to be safe to use with update_dps (0x12) command -UPDATE_DPS_WHITELIST = [18, 19, 20] # Socket (Wi-Fi) - -# Tuya Device Dictionary - Command and Payload Overrides -# This is intended to match requests.json payload at -# https://github.com/codetheweb/tuyapi : -# 'type_0a' devices require the 0a command for the DP_QUERY request -# 'type_0d' devices require the 0d command for the DP_QUERY request and a list of -# dps used set to Null in the request payload -# prefix: # Next byte is command byte ("hexByte") some zero padding, then length -# of remaining payload, i.e. command + suffix (unclear if multiple bytes used for -# length, zero padding implies could be more than one byte) - -# Any command not defined in payload_dict will be sent as-is with a -# payload of {"gwId": "", "devId": "", "uid": "", "t": ""} - -payload_dict = { - # Default Device - "type_0a": { - AP_CONFIG: { # [BETA] Set Control Values on Device - "command": {"gwId": "", "devId": "", "uid": "", "t": ""}, - }, - CONTROL: { # Set Control Values on Device - "command": {"devId": "", "uid": "", "t": ""}, - }, - STATUS: { # Get Status from Device - "command": {"gwId": "", "devId": ""}, - }, - HEART_BEAT: {"command": {"gwId": "", "devId": ""}}, - DP_QUERY: { # Get Data Points from Device - "command": {"gwId": "", "devId": "", "uid": "", "t": ""}, - }, - CONTROL_NEW: {"command": {"devId": "", "uid": "", "t": ""}}, - DP_QUERY_NEW: {"command": {"devId": "", "uid": "", "t": ""}}, - UPDATEDPS: {"command": {"dpId": [18, 19, 20]}}, - }, - # Special Case Device "0d" - Some of these devices - # Require the 0d command as the DP_QUERY status request and the list of - # dps requested payload - "type_0d": { - DP_QUERY: { # Get Data Points from Device - "command_override": CONTROL_NEW, # Uses CONTROL_NEW command for some reason - "command": {"devId": "", "uid": "", "t": ""}, - }, - }, - "v3.4": { - CONTROL: { - "command_override": CONTROL_NEW, # Uses CONTROL_NEW command - "command": {"protocol": 5, "t": "int", "data": ""}, - }, - DP_QUERY: {"command_override": DP_QUERY_NEW}, - }, -} - - -class TuyaLoggingAdapter(logging.LoggerAdapter): - """Adapter that adds device id to all log points.""" - - def process(self, msg, kwargs): - """Process log point and return output.""" - dev_id = self.extra["device_id"] - return f"[{dev_id[0:3]}...{dev_id[-3:]}] {msg}", kwargs - - -class ContextualLogger: - """Contextual logger adding device id to log points.""" - - def __init__(self): - """Initialize a new ContextualLogger.""" - self._logger = None - self._enable_debug = False - - def set_logger(self, logger, device_id, enable_debug=False): - """Set base logger to use.""" - self._enable_debug = enable_debug - self._logger = TuyaLoggingAdapter(logger, {"device_id": device_id}) - - def debug(self, msg, *args): - """Debug level log.""" - if not self._enable_debug: - return - return self._logger.log(logging.DEBUG, msg, *args) - - def info(self, msg, *args): - """Info level log.""" - return self._logger.log(logging.INFO, msg, *args) - - def warning(self, msg, *args): - """Warning method log.""" - return self._logger.log(logging.WARNING, msg, *args) - - def error(self, msg, *args): - """Error level log.""" - return self._logger.log(logging.ERROR, msg, *args) - - def exception(self, msg, *args): - """Exception level log.""" - return self._logger.exception(msg, *args) - - -def pack_message(msg, hmac_key=None): - """Pack a TuyaMessage into bytes.""" - end_fmt = MESSAGE_END_FMT_HMAC if hmac_key else MESSAGE_END_FMT - # Create full message excluding CRC and suffix - buffer = ( - struct.pack( - MESSAGE_HEADER_FMT, - PREFIX_VALUE, - msg.seqno, - msg.cmd, - len(msg.payload) + struct.calcsize(end_fmt), - ) - + msg.payload - ) - if hmac_key: - crc = hmac.new(hmac_key, buffer, sha256).digest() - else: - crc = binascii.crc32(buffer) & 0xFFFFFFFF - # Calculate CRC, add it together with suffix - buffer += struct.pack(end_fmt, crc, SUFFIX_VALUE) - return buffer - - -def unpack_message(data, hmac_key=None, header=None, no_retcode=False, logger=None): - """Unpack bytes into a TuyaMessage.""" - end_fmt = MESSAGE_END_FMT_HMAC if hmac_key else MESSAGE_END_FMT - # 4-word header plus return code - header_len = struct.calcsize(MESSAGE_HEADER_FMT) - retcode_len = 0 if no_retcode else struct.calcsize(MESSAGE_RETCODE_FMT) - end_len = struct.calcsize(end_fmt) - headret_len = header_len + retcode_len - - if len(data) < headret_len + end_len: - logger.debug( - "unpack_message(): not enough data to unpack header! need %d but only have %d", - headret_len + end_len, - len(data), - ) - raise DecodeError("Not enough data to unpack header") - - if header is None: - header = parse_header(data) - - if len(data) < header_len + header.length: - logger.debug( - "unpack_message(): not enough data to unpack payload! need %d but only have %d", - header_len + header.length, - len(data), - ) - raise DecodeError("Not enough data to unpack payload") - - retcode = ( - 0 - if no_retcode - else struct.unpack(MESSAGE_RETCODE_FMT, data[header_len:headret_len])[0] - ) - # the retcode is technically part of the payload, but strip it as we do not want it here - payload = data[header_len + retcode_len : header_len + header.length] - crc, suffix = struct.unpack(end_fmt, payload[-end_len:]) - - if hmac_key: - have_crc = hmac.new( - hmac_key, data[: (header_len + header.length) - end_len], sha256 - ).digest() - else: - have_crc = ( - binascii.crc32(data[: (header_len + header.length) - end_len]) & 0xFFFFFFFF - ) - - if suffix != SUFFIX_VALUE: - logger.debug("Suffix prefix wrong! %08X != %08X", suffix, SUFFIX_VALUE) - - if crc != have_crc: - if hmac_key: - logger.debug( - "HMAC checksum wrong! %r != %r", - binascii.hexlify(have_crc), - binascii.hexlify(crc), - ) - else: - logger.debug("CRC wrong! %08X != %08X", have_crc, crc) - - return TuyaMessage( - header.seqno, header.cmd, retcode, payload[:-end_len], crc, crc == have_crc - ) - - -def parse_header(data): - """Unpack bytes into a TuyaHeader.""" - header_len = struct.calcsize(MESSAGE_HEADER_FMT) - - if len(data) < header_len: - raise DecodeError("Not enough data to unpack header") - - prefix, seqno, cmd, payload_len = struct.unpack( - MESSAGE_HEADER_FMT, data[:header_len] - ) - - if prefix != PREFIX_VALUE: - # self.debug('Header prefix wrong! %08X != %08X', prefix, PREFIX_VALUE) - raise DecodeError("Header prefix wrong! %08X != %08X" % (prefix, PREFIX_VALUE)) - - # sanity check. currently the max payload length is somewhere around 300 bytes - if payload_len > 1000: - raise DecodeError( - "Header claims the packet size is over 1000 bytes! It is most likely corrupt. Claimed size: %d bytes" - % payload_len - ) - - return TuyaHeader(prefix, seqno, cmd, payload_len) - - -class AESCipher: - """Cipher module for Tuya communication.""" - - def __init__(self, key): - """Initialize a new AESCipher.""" - self.block_size = 16 - self.cipher = Cipher(algorithms.AES(key), modes.ECB(), default_backend()) - - def encrypt(self, raw, use_base64=True, pad=True): - """Encrypt data to be sent to device.""" - encryptor = self.cipher.encryptor() - if pad: - raw = self._pad(raw) - crypted_text = encryptor.update(raw) + encryptor.finalize() - return base64.b64encode(crypted_text) if use_base64 else crypted_text - - def decrypt(self, enc, use_base64=True, decode_text=True): - """Decrypt data from device.""" - if use_base64: - enc = base64.b64decode(enc) - - decryptor = self.cipher.decryptor() - raw = self._unpad(decryptor.update(enc) + decryptor.finalize()) - return raw.decode("utf-8") if decode_text else raw - - def _pad(self, data): - padnum = self.block_size - len(data) % self.block_size - return data + padnum * chr(padnum).encode() - - @staticmethod - def _unpad(data): - return data[: -ord(data[len(data) - 1 :])] - - -class MessageDispatcher(ContextualLogger): - """Buffer and dispatcher for Tuya messages.""" - - # Heartbeats on protocols < 3.3 respond with sequence number 0, - # so they can't be waited for like other messages. - # This is a hack to allow waiting for heartbeats. - HEARTBEAT_SEQNO = -100 - RESET_SEQNO = -101 - SESS_KEY_SEQNO = -102 - - def __init__(self, dev_id, listener, protocol_version, local_key, enable_debug): - """Initialize a new MessageBuffer.""" - super().__init__() - self.buffer = b"" - self.listeners = {} - self.listener = listener - self.version = protocol_version - self.local_key = local_key - self.set_logger(_LOGGER, dev_id, enable_debug) - - def abort(self): - """Abort all waiting clients.""" - for key in self.listeners: - sem = self.listeners[key] - self.listeners[key] = None - - # TODO: Received data and semahore should be stored separately - if isinstance(sem, asyncio.Semaphore): - sem.release() - - async def wait_for(self, seqno, cmd, timeout=5): - """Wait for response to a sequence number to be received and return it.""" - if seqno in self.listeners: - raise Exception(f"listener exists for {seqno}") - - self.debug("Command %d waiting for seq. number %d", cmd, seqno) - self.listeners[seqno] = asyncio.Semaphore(0) - try: - await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout) - except asyncio.TimeoutError: - self.debug( - "Command %d timed out waiting for sequence number %d", cmd, seqno - ) - del self.listeners[seqno] - raise - - return self.listeners.pop(seqno) - - def add_data(self, data): - """Add new data to the buffer and try to parse messages.""" - self.buffer += data - header_len = struct.calcsize(MESSAGE_RECV_HEADER_FMT) - - while self.buffer: - # Check if enough data for measage header - if len(self.buffer) < header_len: - break - - header = parse_header(self.buffer) - hmac_key = self.local_key if self.version == 3.4 else None - msg = unpack_message( - self.buffer, header=header, hmac_key=hmac_key, logger=self - ) - self.buffer = self.buffer[header_len - 4 + header.length :] - self._dispatch(msg) - - def _dispatch(self, msg): - """Dispatch a message to someone that is listening.""" - self.debug("Dispatching message CMD %r %s", msg.cmd, msg) - if msg.seqno in self.listeners: - # self.debug("Dispatching sequence number %d", msg.seqno) - sem = self.listeners[msg.seqno] - if isinstance(sem, asyncio.Semaphore): - self.listeners[msg.seqno] = msg - sem.release() - else: - self.debug("Got additional message without request - skipping: %s", sem) - elif msg.cmd == HEART_BEAT: - self.debug("Got heartbeat response") - if self.HEARTBEAT_SEQNO in self.listeners: - sem = self.listeners[self.HEARTBEAT_SEQNO] - self.listeners[self.HEARTBEAT_SEQNO] = msg - sem.release() - elif msg.cmd == UPDATEDPS: - self.debug("Got normal updatedps response") - if self.RESET_SEQNO in self.listeners: - sem = self.listeners[self.RESET_SEQNO] - self.listeners[self.RESET_SEQNO] = msg - sem.release() - elif msg.cmd == SESS_KEY_NEG_RESP: - self.debug("Got key negotiation response") - if self.SESS_KEY_SEQNO in self.listeners: - sem = self.listeners[self.SESS_KEY_SEQNO] - self.listeners[self.SESS_KEY_SEQNO] = msg - sem.release() - elif msg.cmd == STATUS: - if self.RESET_SEQNO in self.listeners: - self.debug("Got reset status update") - sem = self.listeners[self.RESET_SEQNO] - self.listeners[self.RESET_SEQNO] = msg - sem.release() - else: - self.debug("Got status update") - self.listener(msg) - else: - if msg.cmd == CONTROL_NEW: - self.debug("Got ACK message for command %d: will ignore it", msg.cmd) - else: - self.debug( - "Got message type %d for unknown listener %d: %s", - msg.cmd, - msg.seqno, - msg, - ) - - -class TuyaListener(ABC): - """Listener interface for Tuya device changes.""" - - @abstractmethod - def status_updated(self, status): - """Device updated status.""" - - @abstractmethod - def disconnected(self): - """Device disconnected.""" - - -class EmptyListener(TuyaListener): - """Listener doing nothing.""" - - def status_updated(self, status): - """Device updated status.""" - - def disconnected(self): - """Device disconnected.""" - - -class TuyaProtocol(asyncio.Protocol, ContextualLogger): - """Implementation of the Tuya protocol.""" - - def __init__( - self, dev_id, local_key, protocol_version, enable_debug, on_connected, listener - ): - """ - Initialize a new TuyaInterface. - - Args: - dev_id (str): The device id. - address (str): The network address. - local_key (str, optional): The encryption key. Defaults to None. - - Attributes: - port (int): The port to connect to. - """ - super().__init__() - self.loop = asyncio.get_running_loop() - self.set_logger(_LOGGER, dev_id, enable_debug) - self.id = dev_id - self.local_key = local_key.encode("latin1") - self.real_local_key = self.local_key - self.dev_type = "type_0a" - self.dps_to_request = {} - - if protocol_version: - self.set_version(float(protocol_version)) - else: - # make sure we call our set_version() and not a subclass since some of - # them (such as BulbDevice) make connections when called - TuyaProtocol.set_version(self, 3.1) - - self.cipher = AESCipher(self.local_key) - self.seqno = 1 - self.transport = None - self.listener = weakref.ref(listener) - self.dispatcher = self._setup_dispatcher(enable_debug) - self.on_connected = on_connected - self.heartbeater = None - self.dps_cache = {} - self.local_nonce = b"0123456789abcdef" # not-so-random random key - self.remote_nonce = b"" - - def set_version(self, protocol_version): - """Set the device version and eventually start available DPs detection.""" - self.version = protocol_version - self.version_bytes = str(protocol_version).encode("latin1") - self.version_header = self.version_bytes + PROTOCOL_3x_HEADER - if protocol_version == 3.2: # 3.2 behaves like 3.3 with type_0d - # self.version = 3.3 - self.dev_type = "type_0d" - elif protocol_version == 3.4: - self.dev_type = "v3.4" - - def error_json(self, number=None, payload=None): - """Return error details in JSON.""" - try: - spayload = json.dumps(payload) - # spayload = payload.replace('\"','').replace('\'','') - except Exception: - spayload = '""' - - vals = (error_codes[number], str(number), spayload) - self.debug("ERROR %s - %s - payload: %s", *vals) - - return json.loads('{ "Error":"%s", "Err":"%s", "Payload":%s }' % vals) - - def _setup_dispatcher(self, enable_debug): - def _status_update(msg): - if msg.seqno > 0: - self.seqno = msg.seqno + 1 - decoded_message = self._decode_payload(msg.payload) - if "dps" in decoded_message: - self.dps_cache.update(decoded_message["dps"]) - - listener = self.listener and self.listener() - if listener is not None: - listener.status_updated(self.dps_cache) - - return MessageDispatcher( - self.id, _status_update, self.version, self.local_key, enable_debug - ) - - def connection_made(self, transport): - """Did connect to the device.""" - self.transport = transport - self.on_connected.set_result(True) - - def start_heartbeat(self): - """Start the heartbeat transmissions with the device.""" - - async def heartbeat_loop(): - """Continuously send heart beat updates.""" - self.debug("Started heartbeat loop") - while True: - try: - await self.heartbeat() - await asyncio.sleep(HEARTBEAT_INTERVAL) - except asyncio.CancelledError: - self.debug("Stopped heartbeat loop") - raise - except asyncio.TimeoutError: - self.debug("Heartbeat failed due to timeout, disconnecting") - break - except Exception as ex: # pylint: disable=broad-except - self.exception("Heartbeat failed (%s), disconnecting", ex) - break - - transport = self.transport - self.transport = None - transport.close() - - self.heartbeater = self.loop.create_task(heartbeat_loop()) - - def data_received(self, data): - """Received data from device.""" - # self.debug("received data=%r", binascii.hexlify(data)) - self.dispatcher.add_data(data) - - def connection_lost(self, exc): - """Disconnected from device.""" - self.debug("Connection lost: %s", exc) - self.real_local_key = self.local_key - try: - listener = self.listener and self.listener() - if listener is not None: - listener.disconnected() - except Exception: # pylint: disable=broad-except - self.exception("Failed to call disconnected callback") - - async def close(self): - """Close connection and abort all outstanding listeners.""" - self.debug("Closing connection") - self.real_local_key = self.local_key - if self.heartbeater is not None: - self.heartbeater.cancel() - try: - await self.heartbeater - except asyncio.CancelledError: - pass - self.heartbeater = None - if self.dispatcher is not None: - self.dispatcher.abort() - self.dispatcher = None - if self.transport is not None: - transport = self.transport - self.transport = None - transport.close() - - async def exchange_quick(self, payload, recv_retries): - """Similar to exchange() but never retries sending and does not decode the response.""" - if not self.transport: - self.debug( - "[" + self.id + "] send quick failed, could not get socket: %s", payload - ) - return None - enc_payload = ( - self._encode_message(payload) - if isinstance(payload, MessagePayload) - else payload - ) - # self.debug("Quick-dispatching message %s, seqno %s", binascii.hexlify(enc_payload), self.seqno) - - try: - self.transport.write(enc_payload) - except Exception: - # self._check_socket_close(True) - self.close() - return None - while recv_retries: - try: - seqno = MessageDispatcher.SESS_KEY_SEQNO - msg = await self.dispatcher.wait_for(seqno, payload.cmd) - # for 3.4 devices, we get the starting seqno with the SESS_KEY_NEG_RESP message - self.seqno = msg.seqno - except Exception: - msg = None - if msg and len(msg.payload) != 0: - return msg - recv_retries -= 1 - if recv_retries == 0: - self.debug( - "received null payload (%r) but out of recv retries, giving up", msg - ) - else: - self.debug( - "received null payload (%r), fetch new one - %s retries remaining", - msg, - recv_retries, - ) - return None - - async def exchange(self, command, dps=None): - """Send and receive a message, returning response from device.""" - if self.version == 3.4 and self.real_local_key == self.local_key: - self.debug("3.4 device: negotiating a new session key") - await self._negotiate_session_key() - - self.debug( - "Sending command %s (device type: %s)", - command, - self.dev_type, - ) - payload = self._generate_payload(command, dps) - real_cmd = payload.cmd - dev_type = self.dev_type - # self.debug("Exchange: payload %r %r", payload.cmd, payload.payload) - - # Wait for special sequence number if heartbeat or reset - seqno = self.seqno - - if payload.cmd == HEART_BEAT: - seqno = MessageDispatcher.HEARTBEAT_SEQNO - elif payload.cmd == UPDATEDPS: - seqno = MessageDispatcher.RESET_SEQNO - - enc_payload = self._encode_message(payload) - self.transport.write(enc_payload) - msg = await self.dispatcher.wait_for(seqno, payload.cmd) - if msg is None: - self.debug("Wait was aborted for seqno %d", seqno) - return None - - # TODO: Verify stuff, e.g. CRC sequence number? - if real_cmd in [HEART_BEAT, CONTROL, CONTROL_NEW] and len(msg.payload) == 0: - # device may send messages with empty payload in response - # to a HEART_BEAT or CONTROL or CONTROL_NEW command: consider them an ACK - self.debug("ACK received for command %d: ignoring it", real_cmd) - return None - payload = self._decode_payload(msg.payload) - - # Perform a new exchange (once) if we switched device type - if dev_type != self.dev_type: - self.debug( - "Re-send %s due to device type change (%s -> %s)", - command, - dev_type, - self.dev_type, - ) - return await self.exchange(command, dps) - return payload - - async def status(self): - """Return device status.""" - status = await self.exchange(DP_QUERY) - if status and "dps" in status: - self.dps_cache.update(status["dps"]) - return self.dps_cache - - async def heartbeat(self): - """Send a heartbeat message.""" - return await self.exchange(HEART_BEAT) - - async def reset(self, dpIds=None): - """Send a reset message (3.3 only).""" - if self.version == 3.3: - self.dev_type = "type_0a" - self.debug("reset switching to dev_type %s", self.dev_type) - return await self.exchange(UPDATEDPS, dpIds) - - return True - - async def update_dps(self, dps=None): - """ - Request device to update index. - - Args: - dps([int]): list of dps to update, default=detected&whitelisted - """ - if self.version in [3.2, 3.3, 3.4]: # 3.2 behaves like 3.3 with type_0d - if dps is None: - if not self.dps_cache: - await self.detect_available_dps() - if self.dps_cache: - dps = [int(dp) for dp in self.dps_cache] - # filter non whitelisted dps - dps = list(set(dps).intersection(set(UPDATE_DPS_WHITELIST))) - self.debug("updatedps() entry (dps %s, dps_cache %s)", dps, self.dps_cache) - payload = self._generate_payload(UPDATEDPS, dps) - enc_payload = self._encode_message(payload) - self.transport.write(enc_payload) - return True - - async def set_dp(self, value, dp_index): - """ - Set value (may be any type: bool, int or string) of any dps index. - - Args: - dp_index(int): dps index to set - value: new value for the dps index - """ - return await self.exchange(CONTROL, {str(dp_index): value}) - - async def set_dps(self, dps): - """Set values for a set of datapoints.""" - return await self.exchange(CONTROL, dps) - - async def detect_available_dps(self): - """Return which datapoints are supported by the device.""" - # type_0d devices need a sort of bruteforce querying in order to detect the - # list of available dps experience shows that the dps available are usually - # in the ranges [1-25] and [100-110] need to split the bruteforcing in - # different steps due to request payload limitation (max. length = 255) - self.dps_cache = {} - ranges = [(2, 11), (11, 21), (21, 31), (100, 111)] - - for dps_range in ranges: - # dps 1 must always be sent, otherwise it might fail in case no dps is found - # in the requested range - self.dps_to_request = {"1": None} - self.add_dps_to_request(range(*dps_range)) - try: - data = await self.status() - except Exception as ex: - self.exception("Failed to get status: %s", ex) - raise - if "dps" in data: - self.dps_cache.update(data["dps"]) - - if self.dev_type == "type_0a": - return self.dps_cache - self.debug("Detected dps: %s", self.dps_cache) - return self.dps_cache - - def add_dps_to_request(self, dp_indicies): - """Add a datapoint (DP) to be included in requests.""" - if isinstance(dp_indicies, int): - self.dps_to_request[str(dp_indicies)] = None - else: - self.dps_to_request.update({str(index): None for index in dp_indicies}) - - def _decode_payload(self, payload): - cipher = AESCipher(self.local_key) - - if self.version == 3.4: - # 3.4 devices encrypt the version header in addition to the payload - try: - # self.debug("decrypting=%r", payload) - payload = cipher.decrypt(payload, False, decode_text=False) - except Exception as ex: - self.debug( - "incomplete payload=%r with len:%d (%s)", payload, len(payload), ex - ) - return self.error_json(ERR_PAYLOAD) - - # self.debug("decrypted 3.x payload=%r", payload) - - if payload.startswith(PROTOCOL_VERSION_BYTES_31): - # Received an encrypted payload - # Remove version header - payload = payload[len(PROTOCOL_VERSION_BYTES_31) :] - # Decrypt payload - # Remove 16-bytes of MD5 hexdigest of payload - payload = cipher.decrypt(payload[16:]) - elif self.version >= 3.2: # 3.2 or 3.3 or 3.4 - # Trim header for non-default device type - if payload.startswith(self.version_bytes): - payload = payload[len(self.version_header) :] - # self.debug("removing 3.x=%r", payload) - elif self.dev_type == "type_0d" and (len(payload) & 0x0F) != 0: - payload = payload[len(self.version_header) :] - # self.debug("removing type_0d 3.x header=%r", payload) - - if self.version != 3.4: - try: - # self.debug("decrypting=%r", payload) - payload = cipher.decrypt(payload, False) - except Exception as ex: - self.debug( - "incomplete payload=%r with len:%d (%s)", - payload, - len(payload), - ex, - ) - return self.error_json(ERR_PAYLOAD) - - # self.debug("decrypted 3.x payload=%r", payload) - # Try to detect if type_0d found - - if not isinstance(payload, str): - try: - payload = payload.decode() - except Exception as ex: - self.debug("payload was not string type and decoding failed") - raise DecodeError("payload was not a string: %s" % ex) - # return self.error_json(ERR_JSON, payload) - - if "data unvalid" in payload: - self.dev_type = "type_0d" - self.debug( - "'data unvalid' error detected: switching to dev_type %r", - self.dev_type, - ) - return None - elif not payload.startswith(b"{"): - self.debug("Unexpected payload=%r", payload) - return self.error_json(ERR_PAYLOAD, payload) - - if not isinstance(payload, str): - payload = payload.decode() - self.debug("Deciphered data = %r", payload) - try: - json_payload = json.loads(payload) - except Exception as ex: - raise DecodeError( - "could not decrypt data: wrong local_key? (exception: %s)" % ex - ) - # json_payload = self.error_json(ERR_JSON, payload) - - # v3.4 stuffs it into {"data":{"dps":{"1":true}}, ...} - if ( - "dps" not in json_payload - and "data" in json_payload - and "dps" in json_payload["data"] - ): - json_payload["dps"] = json_payload["data"]["dps"] - - return json_payload - - async def _negotiate_session_key(self): - self.local_key = self.real_local_key - - rkey = await self.exchange_quick( - MessagePayload(SESS_KEY_NEG_START, self.local_nonce), 2 - ) - if not rkey or not isinstance(rkey, TuyaMessage) or len(rkey.payload) < 48: - # error - self.debug("session key negotiation failed on step 1") - return False - - if rkey.cmd != SESS_KEY_NEG_RESP: - self.debug( - "session key negotiation step 2 returned wrong command: %d", rkey.cmd - ) - return False - - payload = rkey.payload - try: - # self.debug("decrypting %r using %r", payload, self.real_local_key) - cipher = AESCipher(self.real_local_key) - payload = cipher.decrypt(payload, False, decode_text=False) - except Exception as ex: - self.debug( - "session key step 2 decrypt failed, payload=%r with len:%d (%s)", - payload, - len(payload), - ex, - ) - return False - - self.debug("decrypted session key negotiation step 2: payload=%r", payload) - - if len(payload) < 48: - self.debug("session key negotiation step 2 failed, too short response") - return False - - self.remote_nonce = payload[:16] - hmac_check = hmac.new(self.local_key, self.local_nonce, sha256).digest() - - if hmac_check != payload[16:48]: - self.debug( - "session key negotiation step 2 failed HMAC check! wanted=%r but got=%r", - binascii.hexlify(hmac_check), - binascii.hexlify(payload[16:48]), - ) - - # self.debug("session local nonce: %r remote nonce: %r", self.local_nonce, self.remote_nonce) - rkey_hmac = hmac.new(self.local_key, self.remote_nonce, sha256).digest() - await self.exchange_quick(MessagePayload(SESS_KEY_NEG_FINISH, rkey_hmac), None) - - self.local_key = bytes( - [a ^ b for (a, b) in zip(self.local_nonce, self.remote_nonce)] - ) - # self.debug("Session nonce XOR'd: %r" % self.local_key) - - cipher = AESCipher(self.real_local_key) - self.local_key = self.dispatcher.local_key = cipher.encrypt( - self.local_key, False, pad=False - ) - self.debug("Session key negotiate success! session key: %r", self.local_key) - return True - - # adds protocol header (if needed) and encrypts - def _encode_message(self, msg): - hmac_key = None - payload = msg.payload - self.cipher = AESCipher(self.local_key) - if self.version == 3.4: - hmac_key = self.local_key - if msg.cmd not in NO_PROTOCOL_HEADER_CMDS: - # add the 3.x header - payload = self.version_header + payload - self.debug("final payload for cmd %r: %r", msg.cmd, payload) - payload = self.cipher.encrypt(payload, False) - elif self.version >= 3.2: - # expect to connect and then disconnect to set new - payload = self.cipher.encrypt(payload, False) - if msg.cmd not in NO_PROTOCOL_HEADER_CMDS: - # add the 3.x header - payload = self.version_header + payload - elif msg.cmd == CONTROL: - # need to encrypt - payload = self.cipher.encrypt(payload) - preMd5String = ( - b"data=" - + payload - + b"||lpv=" - + PROTOCOL_VERSION_BYTES_31 - + b"||" - + self.local_key - ) - m = md5() - m.update(preMd5String) - hexdigest = m.hexdigest() - # some tuya libraries strip 8: to :24 - payload = ( - PROTOCOL_VERSION_BYTES_31 - + hexdigest[8:][:16].encode("latin1") - + payload - ) - - self.cipher = None - msg = TuyaMessage(self.seqno, msg.cmd, 0, payload, 0, True) - self.seqno += 1 # increase message sequence number - buffer = pack_message(msg, hmac_key=hmac_key) - # self.debug("payload encrypted with key %r => %r", self.local_key, binascii.hexlify(buffer)) - return buffer - - def _generate_payload(self, command, data=None, gwId=None, devId=None, uid=None): - """ - Generate the payload to send. - - Args: - command(str): The type of command. - This is one of the entries from payload_dict - data(dict, optional): The data to be send. - This is what will be passed via the 'dps' entry - gwId(str, optional): Will be used for gwId - devId(str, optional): Will be used for devId - uid(str, optional): Will be used for uid - """ - json_data = command_override = None - - if command in payload_dict[self.dev_type]: - if "command" in payload_dict[self.dev_type][command]: - json_data = payload_dict[self.dev_type][command]["command"] - if "command_override" in payload_dict[self.dev_type][command]: - command_override = payload_dict[self.dev_type][command][ - "command_override" - ] - - if self.dev_type != "type_0a": - if ( - json_data is None - and command in payload_dict["type_0a"] - and "command" in payload_dict["type_0a"][command] - ): - json_data = payload_dict["type_0a"][command]["command"] - if ( - command_override is None - and command in payload_dict["type_0a"] - and "command_override" in payload_dict["type_0a"][command] - ): - command_override = payload_dict["type_0a"][command]["command_override"] - - if command_override is None: - command_override = command - if json_data is None: - # I have yet to see a device complain about included but unneeded attribs, but they *will* - # complain about missing attribs, so just include them all unless otherwise specified - json_data = {"gwId": "", "devId": "", "uid": "", "t": ""} - - if "gwId" in json_data: - if gwId is not None: - json_data["gwId"] = gwId - else: - json_data["gwId"] = self.id - if "devId" in json_data: - if devId is not None: - json_data["devId"] = devId - else: - json_data["devId"] = self.id - if "uid" in json_data: - if uid is not None: - json_data["uid"] = uid - else: - json_data["uid"] = self.id - if "t" in json_data: - if json_data["t"] == "int": - json_data["t"] = int(time.time()) - else: - json_data["t"] = str(int(time.time())) - - if data is not None: - if "dpId" in json_data: - json_data["dpId"] = data - elif "data" in json_data: - json_data["data"] = {"dps": data} - else: - json_data["dps"] = data - elif self.dev_type == "type_0d" and command == DP_QUERY: - json_data["dps"] = self.dps_to_request - - if json_data == "": - payload = "" - else: - payload = json.dumps(json_data) - # if spaces are not removed device does not respond! - payload = payload.replace(" ", "").encode("utf-8") - self.debug("Sending payload: %s", payload) - - return MessagePayload(command_override, payload) - - def __repr__(self): - """Return internal string representation of object.""" - return self.id - - -async def connect( - address, - device_id, - local_key, - protocol_version, - enable_debug, - listener=None, - port=6668, - timeout=5, -): - """Connect to a device.""" - loop = asyncio.get_running_loop() - on_connected = loop.create_future() - _, protocol = await loop.create_connection( - lambda: TuyaProtocol( - device_id, - local_key, - protocol_version, - enable_debug, - on_connected, - listener or EmptyListener(), - ), - address, - port, - ) - - await asyncio.wait_for(on_connected, timeout=timeout) - return protocol diff --git a/custom_components/localtuya/pytuya/__pycache__/__init__.cpython-312.pyc b/custom_components/localtuya/pytuya/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index c33bda90..00000000 Binary files a/custom_components/localtuya/pytuya/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/localtuya/pytuya/__pycache__/__init__.cpython-313.pyc b/custom_components/localtuya/pytuya/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 0ea2cf3b..00000000 Binary files a/custom_components/localtuya/pytuya/__pycache__/__init__.cpython-313.pyc and /dev/null differ diff --git a/custom_components/localtuya/remote.py b/custom_components/localtuya/remote.py new file mode 100644 index 00000000..0aa177e0 --- /dev/null +++ b/custom_components/localtuya/remote.py @@ -0,0 +1,364 @@ +"""Platform to present any Tuya DP as a remote.""" + +import asyncio +import json +import base64 +import logging +from functools import partial +import struct +from enum import StrEnum +from typing import Any, Iterable +from .config_flow import col_to_select + +import voluptuous as vol +from homeassistant.components.remote import ( + ATTR_ACTIVITY, + ATTR_COMMAND, + ATTR_COMMAND_TYPE, + ATTR_NUM_REPEATS, + ATTR_DELAY_SECS, + ATTR_DEVICE, + ATTR_TIMEOUT, + DOMAIN, + RemoteEntity, + RemoteEntityFeature, +) +from homeassistant.components import persistent_notification +from homeassistant.const import CONF_DEVICE_ID, STATE_OFF +from homeassistant.core import HomeAssistant, State +from homeassistant.exceptions import ServiceValidationError +from homeassistant.helpers.storage import Store + +from .entity import LocalTuyaEntity, async_setup_entry +from .const import CONF_RECEIVE_DP, CONF_KEY_STUDY_DP + +NSDP_CONTROL = "control" # The control commands +NSDP_TYPE = "type" # The identifier of an IR library +NSDP_HEAD = "head" # Actually used but not documented +NSDP_KEY1 = "key1" # Actually used but not documented + +_LOGGER = logging.getLogger(__name__) + + +class ControlType(StrEnum): + ENUM = "Enum" + JSON = "Json" + + +class ControlMode(StrEnum): + SEND_IR = "send_ir" + STUDY = "study" + STUDY_EXIT = "study_exit" + STUDY_KEY = "study_key" + + +class RemoteDP(StrEnum): + DP_SEND = "201" + DP_RECIEVE = "202" + + +CODE_STORAGE_VERSION = 1 +SOTRAGE_KEY = "localtuya_remotes_codes" + + +def flow_schema(dps): + """Return schema used in config flow.""" + return { + vol.Optional(CONF_RECEIVE_DP, default=RemoteDP.DP_RECIEVE.value): col_to_select( + dps, is_dps=True + ), + vol.Optional(CONF_KEY_STUDY_DP): col_to_select(dps, is_dps=True), + } + + +class LocalTuyaRemote(LocalTuyaEntity, RemoteEntity): + """Representation of a Tuya remote.""" + + def __init__( + self, + device, + config_entry, + remoteid, + **kwargs, + ): + """Initialize the Tuya remote.""" + super().__init__(device, config_entry, remoteid, _LOGGER, **kwargs) + + self._dp_send = str(self._config.get(self._dp_id, RemoteDP.DP_SEND)) + self._dp_recieve = str(self._config.get(CONF_RECEIVE_DP, RemoteDP.DP_RECIEVE)) + self._dp_key_study = self._config.get(CONF_KEY_STUDY_DP) + + self._device_id = self._device_config.id + self._lock = asyncio.Lock() + + # self._attr_activity_list: list = [] + # self._attr_current_activity: str | None = None + + self._last_code = None + + self._codes = {} # Contains only device commands. + self._global_codes = {} # contains all devices commands. + + self._codes_storage = Store(self._hass, CODE_STORAGE_VERSION, SOTRAGE_KEY) + + self._storage_loaded = False + + self._attr_supported_features = ( + RemoteEntityFeature.LEARN_COMMAND | RemoteEntityFeature.DELETE_COMMAND + ) + + @property + def _ir_control_type(self): + if self.has_config(CONF_KEY_STUDY_DP): + return ControlType.ENUM + else: + return ControlType.JSON + + async def async_turn_on(self, **kwargs: Any) -> None: + """Turn on the remote.""" + self._attr_is_on = True + self.async_write_ha_state() + + async def async_turn_off(self, **kwargs: Any) -> None: + """Turn off the remote.""" + self._attr_is_on = False + self.async_write_ha_state() + + async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> None: + """Send commands to a device.""" + if not self._attr_is_on: + raise ServiceValidationError(f"Remote {self.entity_id} is turned off") + + commands = command + device = kwargs.get(ATTR_DEVICE) + + repeats: int = kwargs.get(ATTR_NUM_REPEATS) + repeats_delay: float = kwargs.get(ATTR_DELAY_SECS) + + for req in [device, commands]: + if not req: + raise ServiceValidationError("Missing required fields") + + if not self._storage_loaded: + await self._async_load_storage() + + # base64_code = "" + # if base64_code is None: + # option_value = "" + # _LOGGER.debug("Sending Option: -> " + option_value) + + # pulses = self.pronto_to_pulses(option_value) + # base64_code = "1" + self.pulses_to_base64(pulses) + for command in commands: + code = self._get_code(device, command) + + base64_code = "1" + code + if repeats: + current_repeat = 0 + while current_repeat < repeats: + await self.send_signal(ControlMode.SEND_IR, base64_code) + if repeats_delay: + await asyncio.sleep(repeats_delay) + current_repeat += 1 + continue + + await self.send_signal(ControlMode.SEND_IR, base64_code) + + async def async_learn_command(self, **kwargs: Any) -> None: + """Learn a command from a device.""" + if not self._attr_is_on: + raise ServiceValidationError(f"Remote {self.entity_id} is turned off") + + now, timeout = 0, kwargs.get(ATTR_TIMEOUT, 30) + sucess = False + + device = kwargs.get(ATTR_DEVICE) + commands = kwargs.get(ATTR_COMMAND) + # command_type = kwargs.get(ATTR_COMMAND_TYPE) + for req in [device, commands]: + if not req: + raise ServiceValidationError("Missing required fields") + + if not self._storage_loaded: + await self._async_load_storage() + + if self._lock.locked(): + return self.debug("The device is already in learning mode.") + + async with self._lock: + for command in commands: + last_code = self._last_code + await self.send_signal(ControlMode.STUDY) + persistent_notification.async_create( + self.hass, + f"Press the '{command}' button.", + title="Learn command", + notification_id="learn_command", + ) + + try: + self.debug(f"Waiting for code from DP: {self._dp_recieve}") + while now < timeout: + if ( + last_code != (dp_code := self.dp_value(self._dp_recieve)) + and dp_code is not None + ): + self._last_code = dp_code + sucess = True + await self.send_signal(ControlMode.STUDY_EXIT) + break + + now += 1 + await asyncio.sleep(1) + + if not sucess: + await self.send_signal(ControlMode.STUDY_EXIT) + raise ServiceValidationError(f"Failed to learn: {command}") + + finally: + persistent_notification.async_dismiss( + self.hass, notification_id="learn_command" + ) + + # code retrive sucess and it's sotred in self._last_code + # we will store the codes. + await self._save_new_command(device, command, self._last_code) + + if command != commands[-1]: + await asyncio.sleep(1) + + async def async_delete_command(self, **kwargs: Any) -> None: + """Delete commands from the database.""" + device = kwargs.get(ATTR_DEVICE) + commands = kwargs.get(ATTR_COMMAND) + + for req in [device, commands]: + if not req: + raise ServiceValidationError("Missing required fields") + + if not self._storage_loaded: + await self._async_load_storage() + + for command in commands: + await self._delete_command(device, command) + + async def send_signal(self, control, base64_code=None): + if self._ir_control_type == ControlType.ENUM: + command = {self._dp_id: control} + if control == ControlMode.SEND_IR: + command[self._dp_id] = ControlMode.STUDY_KEY.value + command[self._dp_key_study] = base64_code + command["13"] = 0 + else: + command = {NSDP_CONTROL: control} + if control == ControlMode.SEND_IR: + command[NSDP_TYPE] = 0 + command[NSDP_HEAD] = "" # also known as ir_code + command[NSDP_KEY1] = base64_code # also code: key_code + command = {self._dp_id: json.dumps(command)} + + self.debug(f"Sending IR Command: {command}") + await self._device.set_dps(command) + + async def _delete_command(self, device, command) -> None: + """Store new code into stoarge.""" + codes_data = self._codes + ir_controller = self._device_id + devices_data = self._global_codes + + if ir_controller in codes_data: + devices_data = codes_data[ir_controller] + + if device not in devices_data: + raise ServiceValidationError( + f"Couldn't find the device: {device} available devices is on this IR Remote is: {list(devices_data)}." + ) + + commands = devices_data[device] + if command not in commands: + raise ServiceValidationError( + f"Couldn't find the command {command} for in {device} device. the available commands for this device is: {list(commands)}" + ) + + # For now this only works if the command is in the list of commands of this device. + devices_data[device].pop(command) + if device in self._global_codes: + self._global_codes.pop(device) + await self._codes_storage.async_save(codes_data) + + async def _save_new_command(self, device, command, code) -> None: + """Store new code into stoarge.""" + device_unqiue_id = self._device_id + codes = self._codes + + if device_unqiue_id not in codes: + codes[device_unqiue_id] = {} + + # device_data = {command: {ATTR_COMMAND: code, ATTR_COMMAND_TYPE: command_type}} + device_data = {command: code} + + if device in codes[device_unqiue_id]: + codes[device_unqiue_id][device].update(device_data) + else: + codes[device_unqiue_id][device] = device_data + + self._global_codes[device] = device_data + await self._codes_storage.async_save(codes) + + async def _async_load_storage(self): + """Load code and flag storage from disk.""" + # Exception is intentionally not trapped to + # provide feedback if something fails. + # await self._codes_storage._async_migrate_func(1, 1, self._codes) + self._codes.update(await self._codes_storage.async_load() or {}) + + if self._codes: + for dev in self._codes.keys(): + self._global_codes.update(self._codes[dev]) + + self._storage_loaded = True + + # No need to restore state for a remote + async def restore_state_when_connected(self): + """Do nothing for a remote.""" + return + + def _get_code(self, device, command): + """Get the code of command from database.""" + codes_data = self._codes + ir_controller = self._device_id + devices_data = self._global_codes + + if ir_controller in codes_data: + devices_data = codes_data[ir_controller] + + if device not in devices_data: + raise ServiceValidationError( + f"Couldn't find the device: {device} available devices is on this IR Remote is: {list(devices_data)}." + ) + + commands = devices_data[device] + if command not in commands: + raise ServiceValidationError( + f"Couldn't find the command {command} for in {device} device. the available commands for this device is: {list(commands)}" + ) + + command = devices_data[device][command] + + return command + + async def _async_migrate_func(self, old_major_version, old_minor_version, old_data): + """Migrate to the new version.""" + raise NotImplementedError + + def status_updated(self): + """Device status was updated.""" + state = self.dp_value(self._dp_id) + + def status_restored(self, stored_state: State) -> None: + """Device status was restored..""" + state = stored_state + self._attr_is_on = state is None or state.state != STATE_OFF + + +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaRemote, flow_schema) diff --git a/custom_components/localtuya/select.py b/custom_components/localtuya/select.py index c9b1d1c6..44997156 100644 --- a/custom_components/localtuya/select.py +++ b/custom_components/localtuya/select.py @@ -1,16 +1,17 @@ """Platform to present any Tuya DP as an enumeration.""" + import logging from functools import partial import voluptuous as vol from homeassistant.components.select import DOMAIN, SelectEntity from homeassistant.const import CONF_DEVICE_CLASS, STATE_UNKNOWN +from homeassistant.helpers import selector -from .common import LocalTuyaEntity, async_setup_entry +from .entity import LocalTuyaEntity, async_setup_entry from .const import ( CONF_DEFAULT_VALUE, CONF_OPTIONS, - CONF_OPTIONS_FRIENDLY, CONF_PASSIVE_ENTITY, CONF_RESTORE_ON_RECONNECT, ) @@ -19,8 +20,7 @@ def flow_schema(dps): """Return schema used in config flow.""" return { - vol.Required(CONF_OPTIONS): str, - vol.Optional(CONF_OPTIONS_FRIENDLY): str, + vol.Required(CONF_OPTIONS, default={}): selector.ObjectSelector(), vol.Required(CONF_RESTORE_ON_RECONNECT): bool, vol.Required(CONF_PASSIVE_ENTITY): bool, vol.Optional(CONF_DEFAULT_VALUE): str, @@ -30,7 +30,7 @@ def flow_schema(dps): _LOGGER = logging.getLogger(__name__) -class LocaltuyaSelect(LocalTuyaEntity, SelectEntity): +class LocalTuyaSelect(LocalTuyaEntity, SelectEntity): """Representation of a Tuya Enumeration.""" def __init__( @@ -44,38 +44,30 @@ def __init__( super().__init__(device, config_entry, sensorid, _LOGGER, **kwargs) self._state = STATE_UNKNOWN self._state_friendly = "" - self._valid_options = self._config.get(CONF_OPTIONS).split(";") # Set Display options - self._display_options = [] - display_options_str = "" - if CONF_OPTIONS_FRIENDLY in self._config: - display_options_str = self._config.get(CONF_OPTIONS_FRIENDLY).strip() - _LOGGER.debug("Display Options Configured: %s", display_options_str) - - if display_options_str.find(";") >= 0: - self._display_options = display_options_str.split(";") - elif len(display_options_str.strip()) > 0: - self._display_options.append(display_options_str) - else: - # Default display string to raw string - _LOGGER.debug("No Display options configured - defaulting to raw values") - self._display_options = self._valid_options + options_values, options_display_name = [], [] + config_options: dict = self._config.get(CONF_OPTIONS) + if not isinstance(config_options, dict): + # Warn the user in-case he used the wrong format. + self.error( + f"{self.name} DPiD: {self._dp_id}: Options configured incorrectly! It must be in the format of key-value pairs, where each line follows the structure [device_value: friendly name]" + ) + config_options = {} + for k, v in config_options.items(): + options_values.append(k) + options_display_name.append(v if v else k.replace("_", "").capitalize()) + + self._valid_options = options_values + self._display_options = options_display_name + + _LOGGER.debug("Display Options Configured: %s", options_display_name) _LOGGER.debug( "Total Raw Options: %s - Total Display Options: %s", str(len(self._valid_options)), str(len(self._display_options)), ) - if len(self._valid_options) > len(self._display_options): - # If list of display items smaller than list of valid items, - # then default remaining items to be the raw value - _LOGGER.debug( - "Valid options is larger than display options - \ - filling up with raw values" - ) - for i in range(len(self._display_options), len(self._valid_options)): - self._display_options.append(self._valid_options[i]) @property def current_option(self) -> str: @@ -102,7 +94,7 @@ def status_updated(self): """Device status was updated.""" super().status_updated() - state = self.dps(self._dp_id) + state = self.dp_value(self._dp_id) # Check that received status update for this entity. if state is not None: @@ -120,4 +112,4 @@ def entity_default_value(self): return self._valid_options[0] -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaSelect, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaSelect, flow_schema) diff --git a/custom_components/localtuya/sensor.py b/custom_components/localtuya/sensor.py index 0eb0ae4e..1b650e93 100644 --- a/custom_components/localtuya/sensor.py +++ b/custom_components/localtuya/sensor.py @@ -1,17 +1,25 @@ """Platform to present any Tuya DP as a sensor.""" + import logging from functools import partial +from .config_flow import col_to_select import voluptuous as vol -from homeassistant.components.sensor import DEVICE_CLASSES, DOMAIN +from homeassistant.components.sensor import ( + DEVICE_CLASSES_SCHEMA, + DOMAIN, + STATE_CLASSES_SCHEMA, + SensorStateClass, + SensorEntity, +) from homeassistant.const import ( CONF_DEVICE_CLASS, CONF_UNIT_OF_MEASUREMENT, STATE_UNKNOWN, ) -from .common import LocalTuyaEntity, async_setup_entry -from .const import CONF_SCALING +from .entity import LocalTuyaEntity, async_setup_entry +from .const import CONF_SCALING, CONF_STATE_CLASS _LOGGER = logging.getLogger(__name__) @@ -22,14 +30,17 @@ def flow_schema(dps): """Return schema used in config flow.""" return { vol.Optional(CONF_UNIT_OF_MEASUREMENT): str, - vol.Optional(CONF_DEVICE_CLASS): vol.In(DEVICE_CLASSES), + vol.Optional(CONF_DEVICE_CLASS): DEVICE_CLASSES_SCHEMA, + vol.Optional(CONF_STATE_CLASS): col_to_select( + [sc.value for sc in SensorStateClass] + ), vol.Optional(CONF_SCALING): vol.All( vol.Coerce(float), vol.Range(min=-1000000.0, max=1000000.0) ), } -class LocaltuyaSensor(LocalTuyaEntity): +class LocalTuyaSensor(LocalTuyaEntity, SensorEntity): """Representation of a Tuya sensor.""" def __init__( @@ -41,10 +52,10 @@ def __init__( ): """Initialize the Tuya sensor.""" super().__init__(device, config_entry, sensorid, _LOGGER, **kwargs) - self._state = STATE_UNKNOWN + self._state = None @property - def state(self): + def native_value(self): """Return sensor state.""" return self._state @@ -54,17 +65,20 @@ def device_class(self): return self._config.get(CONF_DEVICE_CLASS) @property - def unit_of_measurement(self): + def state_class(self) -> str | None: + """Return state class.""" + return self._config.get(CONF_STATE_CLASS) + + @property + def native_unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._config.get(CONF_UNIT_OF_MEASUREMENT) def status_updated(self): """Device status was updated.""" - state = self.dps(self._dp_id) - scale_factor = self._config.get(CONF_SCALING) - if scale_factor is not None and isinstance(state, (int, float)): - state = round(state * scale_factor, DEFAULT_PRECISION) - self._state = state + state = self.dp_value(self._dp_id) + + self._state = self.scale(state) # No need to restore state for a sensor async def restore_state_when_connected(self): @@ -72,4 +86,4 @@ async def restore_state_when_connected(self): return -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaSensor, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaSensor, flow_schema) diff --git a/custom_components/localtuya/services.yaml b/custom_components/localtuya/services.yaml index f10af4a6..c62353d8 100644 --- a/custom_components/localtuya/services.yaml +++ b/custom_components/localtuya/services.yaml @@ -1,15 +1,30 @@ reload: + name: "Reload" description: Reload localtuya and reconnect to all devices. set_dp: + name: "Set DP Value" description: Change the value of a datapoint (DP) fields: device_id: + name: "Device ID" description: Device ID of device to change datapoint value for + required: true example: 11100118278aab4de001 + selector: + text: dp: - description: Datapoint index + name: "DP" + description: Target DP, Datapoint index + required: false example: 1 + selector: + number: + mode: box value: - description: New value to set - example: False + name: "Value" + description: "New value to set or list of dp: value, If value is list target dp will be ignored" + required: true + example: '{ "1": True, "2": True }' + selector: + object: diff --git a/custom_components/localtuya/siren.py b/custom_components/localtuya/siren.py new file mode 100644 index 00000000..d96d0b52 --- /dev/null +++ b/custom_components/localtuya/siren.py @@ -0,0 +1,70 @@ +"""Platform to present any Tuya DP as a siren.""" + +import logging +from functools import partial + +import voluptuous as vol +from homeassistant.components.siren import DOMAIN, SirenEntity, SirenEntityFeature + +from .entity import LocalTuyaEntity, async_setup_entry +from .const import CONF_STATE_ON + +_LOGGER = logging.getLogger(__name__) + +# CONF_STATE_MAP = ["True and False", "ON and OFF"] + + +def flow_schema(dps): + """Return schema used in config flow.""" + return { + vol.Required(CONF_STATE_ON, default="true"): str, + # vol.Required(CONF_STATE_OFF, default="False"): str, + } + + +class LocalTuyaSiren(LocalTuyaEntity, SirenEntity): + """Representation of a Tuya siren.""" + + _attr_supported_features = SirenEntityFeature.TURN_ON | SirenEntityFeature.TURN_OFF + + def __init__( + self, + device, + config_entry, + sirenid, + **kwargs, + ): + """Initialize the Tuya siren.""" + super().__init__(device, config_entry, sirenid, _LOGGER, **kwargs) + self._is_on = False + + @property + def is_on(self): + """Return siren state.""" + return self._is_on + + async def async_turn_on(self, **kwargs): + """Turn Tuya siren on.""" + await self._device.set_dp(True, self._dp_id) + + async def async_turn_off(self, **kwargs): + """Turn Tuya siren off.""" + await self._device.set_dp(False, self._dp_id) + + # No need to restore state for a siren + async def restore_state_when_connected(self): + """Do nothing for a siren.""" + return + + def status_updated(self): + """Device status was updated.""" + super().status_updated() + + state = str(self.dp_value(self._dp_id)).lower() + if state == self._config[CONF_STATE_ON].lower() or state == "true": + self._is_on = True + else: + self._is_on = False + + +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaSiren, flow_schema) diff --git a/custom_components/localtuya/strings.json b/custom_components/localtuya/strings.json index 32f60400..db2e3561 100644 --- a/custom_components/localtuya/strings.json +++ b/custom_components/localtuya/strings.json @@ -1,7 +1,7 @@ { "config": { "abort": { - "already_configured": "Device has already been configured.", + "already_configured": "This Account ID has already been configured.", "unsupported_device_type": "Unsupported device type!" }, "error": { @@ -23,7 +23,7 @@ }, "power_outlet": { "title": "Add subswitch", - "description": "You are about to add subswitch number `{number}`. If you want to add another, tick `Add another switch` before continuing.", + "description": "You are about to add subswitch number `{number}`. If you want to add another, tick `Add another switch` before continuing.", "data": { "id": "ID", "name": "Name", @@ -96,12 +96,14 @@ "color_temp_max_kelvin": "Maximum Color Temperature in K", "music_mode": "Music mode available", "scene": "Scene", + "scene_values": "Scene values, separate entries by a ;", + "scene_values_friendly": "User friendly scene values, separate entries by a ;", "fan_speed_control": "Fan Speed Control dps", "fan_oscillating_control": "Fan Oscillating Control dps", "fan_speed_min": "minimum fan speed integer", "fan_speed_max": "maximum fan speed integer", "fan_speed_ordered_list": "Fan speed modes list (overrides speed min/max)", - "fan_direction": "fan direction dps", + "fan_direction":"fan direction dps", "fan_direction_forward": "forward dps string", "fan_direction_reverse": "reverse dps string", "fan_dps_type": "DP value type", @@ -136,4 +138,4 @@ } }, "title": "LocalTuya" -} \ No newline at end of file +} diff --git a/custom_components/localtuya/switch.py b/custom_components/localtuya/switch.py index 3776836e..7cc7ad3e 100644 --- a/custom_components/localtuya/switch.py +++ b/custom_components/localtuya/switch.py @@ -1,11 +1,19 @@ """Platform to locally control Tuya-based switch devices.""" + import logging from functools import partial +from .config_flow import col_to_select import voluptuous as vol -from homeassistant.components.switch import DOMAIN, SwitchEntity +from homeassistant.components.switch import ( + DOMAIN, + SwitchEntity, + DEVICE_CLASSES_SCHEMA, + SwitchDeviceClass, +) +from homeassistant.const import CONF_DEVICE_CLASS -from .common import LocalTuyaEntity, async_setup_entry +from .entity import LocalTuyaEntity, async_setup_entry from .const import ( ATTR_CURRENT, ATTR_CURRENT_CONSUMPTION, @@ -25,18 +33,23 @@ def flow_schema(dps): """Return schema used in config flow.""" return { - vol.Optional(CONF_CURRENT): vol.In(dps), - vol.Optional(CONF_CURRENT_CONSUMPTION): vol.In(dps), - vol.Optional(CONF_VOLTAGE): vol.In(dps), + vol.Optional(CONF_CURRENT): col_to_select(dps, is_dps=True), + vol.Optional(CONF_CURRENT_CONSUMPTION): col_to_select(dps, is_dps=True), + vol.Optional(CONF_VOLTAGE): col_to_select(dps, is_dps=True), vol.Required(CONF_RESTORE_ON_RECONNECT): bool, vol.Required(CONF_PASSIVE_ENTITY): bool, vol.Optional(CONF_DEFAULT_VALUE): str, + vol.Optional(CONF_DEVICE_CLASS): col_to_select( + [sc.value for sc in SwitchDeviceClass] + ), } -class LocaltuyaSwitch(LocalTuyaEntity, SwitchEntity): +class LocalTuyaSwitch(LocalTuyaEntity, SwitchEntity): """Representation of a Tuya switch.""" + _attr_device_class = SwitchDeviceClass.SWITCH + def __init__( self, device, @@ -47,7 +60,6 @@ def __init__( """Initialize the Tuya switch.""" super().__init__(device, config_entry, switchid, _LOGGER, **kwargs) self._state = None - _LOGGER.debug("Initialized switch [%s]", self.name) @property def is_on(self): @@ -59,13 +71,13 @@ def extra_state_attributes(self): """Return device state attributes.""" attrs = {} if self.has_config(CONF_CURRENT): - attrs[ATTR_CURRENT] = self.dps(self._config[CONF_CURRENT]) + attrs[ATTR_CURRENT] = self.dp_value(self._config[CONF_CURRENT]) if self.has_config(CONF_CURRENT_CONSUMPTION): - attrs[ATTR_CURRENT_CONSUMPTION] = ( - self.dps(self._config[CONF_CURRENT_CONSUMPTION]) / 10 - ) + val_cc = self.dp_value(self._config[CONF_CURRENT_CONSUMPTION]) + attrs[ATTR_CURRENT_CONSUMPTION] = None if val_cc is None else val_cc / 10 if self.has_config(CONF_VOLTAGE): - attrs[ATTR_VOLTAGE] = self.dps(self._config[CONF_VOLTAGE]) / 10 + val_vol = self.dp_value(self._config[CONF_VOLTAGE]) + attrs[ATTR_VOLTAGE] = None if val_vol is None else val_vol / 10 # Store the state if self._state is not None: @@ -88,4 +100,4 @@ def entity_default_value(self): return False -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaSwitch, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaSwitch, flow_schema) diff --git a/custom_components/localtuya/templates/__init__.py b/custom_components/localtuya/templates/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/custom_components/localtuya/templates/__pycache__/__init__.cpython-313.pyc b/custom_components/localtuya/templates/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..8ba502b9 Binary files /dev/null and b/custom_components/localtuya/templates/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/localtuya/templates/sample_2g_switch.yaml b/custom_components/localtuya/templates/sample_2g_switch.yaml new file mode 100644 index 00000000..c808c5b9 --- /dev/null +++ b/custom_components/localtuya/templates/sample_2g_switch.yaml @@ -0,0 +1,43 @@ +# Simple 2 Switches config example +- switch: + id: "1" + friendly_name: "2G Local Switch 1" + entity_category: None + restore_on_reconnect: false + is_passive_entity: false + platform: "switch" + +- switch: + id: "2" + friendly_name: "2G Local Switch 2" + entity_category: None + is_passive_entity: false + platform: "switch" +#################################################### +#---# Templates Guide #---# +#################################################### +# Templates: +# The template is basically ready to go configs can be imported instead of choosing configs DPs names etc... + +# IMPORTANT: +# there is now valid check atm config so make sure you're importing correct configs. + +# the configs depends on the platform and what input does platform support read bottom. + +# THERE Is 2 ways to make template: +# - 1st is write the yaml ur self: +# --[ Keep in mind there is no valid check atm ] + +# - 2st is to export ur device file from config flow. [ Recommended ]: +# -- in HA Dashboard go to [ Devices -> localtuya -> Configure -> Edit Device * choose the device u want to export +# --- Export the device config then submit] + +# Templates DIR: +# the configs will be exported in [custom_components/localtuya/templates] + +# How to import: +# -- When u add new device when the form [ Pick Entity type selection ] +# --- Import template Form will show up showing avaliable templates in templates folder. + +# -- templates in [custom_components/localtuya/templates] +# -- Templates files will load up with HA so adding files will require restarting HA to show up. diff --git a/custom_components/localtuya/templates/sample_lights_bulb.yaml b/custom_components/localtuya/templates/sample_lights_bulb.yaml new file mode 100644 index 00000000..16f289c8 --- /dev/null +++ b/custom_components/localtuya/templates/sample_lights_bulb.yaml @@ -0,0 +1,16 @@ +- light: + brightness: '22' + brightness_lower: 29 + brightness_upper: 1000 + color: '24' + color_mode: '21' + color_temp: '23' + color_temp_max_kelvin: 6500 + color_temp_min_kelvin: 2700 + color_temp_reverse: false + entity_category: None + friendly_name: test_light_35 + id: '20' + music_mode: true + platform: light + scene: '25' diff --git a/custom_components/localtuya/translations/ar.json b/custom_components/localtuya/translations/ar.json new file mode 100644 index 00000000..cbabc511 --- /dev/null +++ b/custom_components/localtuya/translations/ar.json @@ -0,0 +1,146 @@ +{ + "config": { + "abort": { + "already_configured": "تم تكوين هذا الحساب بالفعل.", + "device_updated": "تم تحديث تكوين الجهاز." + }, + "error": { + "authentication_failed": "فشلت عملية المصادقة.\n{msg}", + "cannot_connect": "لا يمكن الاتصال بالجهاز. تحقق من صحة عنوان IP ثم حاول مرة أخرى.", + "device_list_failed": "فشل استرجاع قائمة الأجهزة.\n{msg}", + "invalid_auth": "فشلت عملية المصادقة مع الجهاز. تأكد من صحة معرّف الجهاز والمفتاح المحلي.", + "unknown": "حدث خطأ غير معروف.\n{ex}.", + "entity_already_configured": "تم تكوين هذه الكيان بالفعل.", + "address_in_use": "منفذ TCP 6668 (المستخدم للاكتشاف) قيد الاستخدام بالفعل. تحقق من عدم استخدام أي تكامل آخر له.", + "discovery_failed": "حدث خطأ عند اكتشاف الأجهزة. انظر إلى السجل للتفاصيل. إذا استمرت المشكلة، قم بإنشاء مشكلة جديدة (بما في ذلك السجلات التصحيحية).", + "empty_dps": "نجح الاتصال بالجهاز ولكن لم يتم العثور على نقاط البيانات. يُرجى المحاولة مرة أخرى. إذا استمرت المشكلة، قم بإنشاء مشكلة جديدة (بما في ذلك السجلات التصحيحية)." + }, + "step": { + "user": { + "title": "تكوين حساب Cloud API", + "description": "قم بتكوين بيانات الاعتماد المستخدمة للاتصال بـ Tuya Cloud API.", + "data": { + "region": "منطقة مركز البيانات", + "client_id": "معرف العميل (Client ID)", + "client_secret": "المعرف السري العميل (Client Secret)", + "user_id": "معرف المستخدم (UID)", + "username": "اسم المستخدم", + "no_cloud": "هل تريد تعطيل Cloud API؟" + } + } + } + }, + "options": { + "abort": { + "already_configured": "تم تكوين هذا الحساب بالفعل.", + "device_success": "تم {action} الجهاز {dev_name} بنجاح.", + "no_entities": "لا يمكن حذف كل الكيانات من الجهاز.\nإذا كنت ترغب في حذف الجهاز: انتقل إلى القائمة 'الأجهزة والخدمات'، ابحث عن جهازك في علامة التبويب 'الأجهزة'، انقر على 3 نقاط في الإطار 'معلومات الجهاز'، واضغط على زر 'حذف'." + }, + "error": { + "authentication_failed": "فشلت عملية المصادقة.\n{msg}", + "cannot_connect": "لا يمكن الاتصال بالجهاز. تحقق من صحة عنوان IP ثم حاول مرة أخرى.", + "device_list_failed": "فشل استرجاع قائمة الأجهزة.\n{msg}", + "invalid_auth": "فشلت عملية المصادقة مع الجهاز. تأكد من صحة معرّف الجهاز والمفتاح المحلي.", + "unknown": "حدث خطأ غير معروف. \n{ex}.", + "entity_already_configured": "تم تكوين هذه الكيان بالفعل.", + "address_in_use": "منفذ TCP 6668 (المستخدم للاكتشاف) قيد الاستخدام بالفعل. تحقق من عدم استخدام أي تكامل آخر له.", + "discovery_failed": "حدث خطأ عند اكتشاف الأجهزة. انظر إلى السجل للتفاصيل. إذا استمرت المشكلة، قم بإنشاء مشكلة جديدة (بما في ذلك السجلات التصحيحية).", + "empty_dps": "نجح الاتصال بالجهاز ولكن لم يتم العثور على نقاط البيانات. يُرجى المحاولة مرة أخرى. إذا استمرت المشكلة، قم بإنشاء مشكلة جديدة (بما في ذلك السجلات التصحيحية)." + }, + "step": { + "yaml_import": { + "title": "غير معتمد", + "description": "الأجهزة المكونة باستخدام `YAML` لا يمكن تكوينها في واجهة المستخدم. احذف جهازك من `YAML` وأعِد إنشاؤه في واجهة المستخدم أو قم بتعديل تكوين `YAML` الخاص بك." + }, + "init": { + "title": "التكوين", + "description": "حدد خيارًا للمتابعة.", + "menu_options": { + "add_device": "إضافة جهاز جديد", + "edit_device": "إعادة تكوين الجهاز موجود", + "configure_cloud": "إدارة حساب Cloud API" + } + }, + "add_device": { + "title": "اختيار الجهاز للتكوين", + "description": "يتم اكتشاف الأجهزة المتوافقة مع Tuya على شبكتك المحلية تلقائيًا بمجرد إعدادها في تطبيق Tuya. إذا لم تر الجهاز الذي تتوقعه، اختر `إضافة الجهاز يدويًا` من القائمة المنسدلة.", + "data": { + "selected_device": "الأجهزة المكتشفة", + "mass_configure": "ضبط جميع الأجهزة المتعرف عليها تلقائيًا" + } + }, + "edit_device": { + "title": "إعادة تكوين الجهاز الموجود", + "description": "حدد الجهاز الذي ترغب في إعادة تكوينه.", + "data": { + "selected_device": "الأجهزة المكونة" + } + }, + "configure_cloud": { + "title": "إدارة حساب Cloud API", + "description": "قم بتكوين بيانات الاعتماد المستخدمة للاتصال بـ Tuya Cloud API.", + "data": { + "region": "منطقة مركز البيانات", + "client_id": "معرف العميل (Client ID)", + "client_secret": "المعرف السري العميل (Client Secret)", + "user_id": "معرف المستخدم (UID)", + "username": "اسم للحساب", + "no_cloud": "هل تريد تعطيل Cloud API؟" + } + }, + "configure_device": { + "title": "تكوين اتصال الجهاز", + "description": "قم بتكوين أي تفاصيل جهاز {for_device} فارغة (إن وجدت) للسماح لـ LocalTuya بالاتصال بالجهاز.", + "data": { + "friendly_name": "اسم الجهاز", + "host": "عنوان IP", + "device_id": "معرف الجهاز", + "local_key": "المفتاح المحلي (Local Key)", + "node_id": "(اختياري) معرف الأجهزة الفرعية", + "protocol_version": "إصدار البروتوكول", + "enable_debug": "تمكين التصحيح (يجب تمكينه يدويًا في `configuration.yaml` أيضًا)", + "scan_interval": "(اختياري) الفاصل الزمني للمسح بالثواني، إذا كان الجهاز لا يمسح تلقائيًا", + "entities": "الكيانات التي تم تكوينها (قم بإلغاء التحديد للحذف)", + "add_entities": "إضافة كيان (كيانات) جديدة", + "manual_dps_strings": "(اختياري) دليل DPS، إذا لم يتم اكتشافه تلقائيًا (مفصولاً بفواصل)", + "reset_dpids": "(اختياري) معرفات DPID لإرسالها في أمر RESET، إذا لم يستجب الجهاز لطلبات الحالة بعد التشغيل (مفصولة بفواصل)", + "device_sleep_time": "(اختياري) وقت سبات الجهاز بالثواني: في حالة أن الجهاز يقوم بإرسال الحالة ثم يدخل في وضع السكون", + "export_config": "احفظ تكوين الكيان كقالب" + } + }, + "device_setup_method": { + "title": "تكوين كيانات الجهاز", + "description": "سيحاول LocalTuya اكتشاف بقية التكوين تلقائيًا. ", + "menu_options": { + "auto_configure_device": "اكتشف كيانات الجهاز تلقائيًا", + "pick_entity_type": "قم بتكوين كيانات الجهاز يدويًا", + "choose_template": "استخدم القالب المحفوظ" + } + }, + "auto_configure_device": { + "title": "التكوين التلقائي", + "description": "حدث خطأ: {err_msg}. ", + "menu_options": { + "device_setup_method": "العودة إلى طريقة الإعداد" + } + }, + "pick_entity_type": { + "title": "اختيار نوع الكيان", + "description": "اختر نوع الكيان الذي تريد إضافته.", + "data": { + "platform_to_add": "اختر الكيان", + "no_additional_entities": "الانتهاء من تكوين الكيانات", + "use_template": "استيراد ملف القالب" + } + }, + "choose_template": { + "title": "استيراد ملف القالب", + "description": "توجد ملفات القالب في المجلد `templates` ([لمعلومات أكثر](https://github.com/xZetsubou/hass-localtuya/discussions/13)).", + "data": { + "templates": "اختيار القالب" + } + } +} +}, +"title": "LocalTuya" +} \ No newline at end of file diff --git a/custom_components/localtuya/translations/en.json b/custom_components/localtuya/translations/en.json index 8fdbb609..ff80b2cc 100644 --- a/custom_components/localtuya/translations/en.json +++ b/custom_components/localtuya/translations/en.json @@ -1,129 +1,155 @@ { "config": { "abort": { - "already_configured": "Device has already been configured.", - "device_updated": "Device configuration has been updated!" + "already_configured": "This account has already been configured.", + "device_updated": "Device configuration has been updated." }, "error": { "authentication_failed": "Failed to authenticate.\n{msg}", - "cannot_connect": "Cannot connect to device. Verify that address is correct and try again.", + "cannot_connect": "Cannot connect to device. Confirm the IP Address is correct then try again.", "device_list_failed": "Failed to retrieve device list.\n{msg}", - "invalid_auth": "Failed to authenticate with device. Verify that device id and local key are correct.", - "unknown": "An unknown error occurred. See log for details.", - "entity_already_configured": "Entity with this ID has already been configured.", - "address_in_use": "Address used for discovery is already in use. Make sure no other application is using it (TCP port 6668).", - "discovery_failed": "Something failed when discovering devices. See log for details.", - "empty_dps": "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists." + "invalid_auth": "Failed to authenticate with device. Confirm the Device Id and Local Key are correct.", + "unknown": "An unknown error occurred.\n{ex}.", + "entity_already_configured": "This entity has already been configured.", + "address_in_use": "TCP port 6668 (used for discovery) is already in use. Check no other integration is using it.", + "discovery_failed": "Something failed when discovering devices. See log for details. If problem persists, create a new issue (including debug logs).", + "empty_dps": "Connection to device succeeded but no datapoints could be found. Please try set-up again. If problem persists, create a new issue (including debug logs)." }, "step": { "user": { "title": "Cloud API account configuration", - "description": "Input the credentials for Tuya Cloud API.", + "description": "Configure the credentials used to connect to the Tuya Cloud API.", "data": { - "region": "API server region", + "region": "Data Center Region", "client_id": "Client ID", - "client_secret": "Secret", + "client_secret": "Client Secret", "user_id": "User ID", - "user_name": "Username", - "no_cloud": "Do not configure a Cloud API account" + "username": "Username", + "no_cloud": "Disable Cloud API?" } } } }, "options": { "abort": { - "already_configured": "Device has already been configured.", + "already_configured": "This account has already been configured.", "device_success": "Device {dev_name} successfully {action}.", - "no_entities": "Cannot remove all entities from a device.\nIf you want to delete a device, enter it in the Devices menu, click the 3 dots in the 'Device info' frame, and press the Delete button." + "no_entities": "Cannot remove all entities from a device.\nIf you want to delete a device: Browse to `Devices & services` menu, search for your device in `Devices` tab, click the 3 dots in the `Device info` frame, and press the `Delete` button." }, "error": { "authentication_failed": "Failed to authenticate.\n{msg}", - "cannot_connect": "Cannot connect to device. Verify that address is correct and try again.", + "cannot_connect": "Cannot connect to device. Confirm the IP Address is correct then try again.", "device_list_failed": "Failed to retrieve device list.\n{msg}", - "invalid_auth": "Failed to authenticate with device. Verify that device id and local key are correct.", - "unknown": "An unknown error occurred. See log for details.", - "entity_already_configured": "Entity with this ID has already been configured.", - "address_in_use": "Address used for discovery is already in use. Make sure no other application is using it (TCP port 6668).", - "discovery_failed": "Something failed when discovering devices. See log for details.", - "empty_dps": "Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists." + "invalid_auth": "Failed to authenticate with device. Confirm the Device Id and Local Key are correct.", + "unknown": "An unknown error occurred. \n{ex}.", + "entity_already_configured": "This entity has already been configured.", + "address_in_use": "TCP port 6668 (used for discovery) is already in use. Check no other integration is using it.", + "discovery_failed": "Something failed when discovering devices. See log for details. If problem persists, create a new issue (including debug logs).", + "empty_dps": "Connection to device succeeded but no datapoints could be found. Please try set-up again. If problem persists, create a new issue (including debug logs)." }, "step": { "yaml_import": { - "title": "Not Supported", - "description": "Options cannot be edited when configured via YAML." + "title": "Not supported", + "description": "Devices configured using `YAML` cannot be configured in the UI. Delete your device from `YAML` and re-create it in the UI or modify your `YAML` configuration." }, "init": { - "title": "LocalTuya Configuration", - "description": "Please select the desired action.", - "data": { - "add_device": "Add a new device", - "edit_device": "Edit a device", - "setup_cloud": "Reconfigure Cloud API account" + "title": "Configuration", + "description": "Select an option to proceed.", + "menu_options": { + "add_device": "Add new device", + "edit_device": "Reconfigure existing device", + "configure_cloud": "Manage Cloud API account" } }, "add_device": { - "title": "Add a new device", - "description": "Pick one of the automatically discovered devices or `...` to manually to add a device.", + "title": "Choose device to configure", + "description": "Compatible Tuya devices on your local network are discovered automatically once they have been set-up in the Tuya app. If you can't see the device you expected, choose `Add device manually` from the dropdown.", "data": { - "selected_device": "Discovered Devices" + "selected_device": "Discovered devices", + "mass_configure": "Configure all recognized devices automatically" } }, "edit_device": { - "title": "Edit a new device", - "description": "Pick the configured device you wish to edit.", + "title": "Reconfigure existing device", + "description": "Select the device you wish to re-configure.", "data": { - "selected_device": "Configured Devices", - "max_temperature_const": "Max Temperature Constant (optional)", - "min_temperature_const": "Min Temperature Constant (optional)", - "hvac_fan_mode_dp": "HVAC Fan Mode DP (optional)", - "hvac_fan_mode_set": "HVAC Fan Mode Set (optional)", - "hvac_swing_mode_dp": "HVAC Swing Mode DP (optional)", - "hvac_swing_mode_set": "HVAC Swing Mode Set (optional)" + "selected_device": "Configured devices" } }, - "cloud_setup": { - "title": "Cloud API account configuration", - "description": "Input the credentials for Tuya Cloud API.", + "configure_cloud": { + "title": "Manage Cloud API account", + "description": "Configure the credentials used to connect to the Tuya Cloud API.", "data": { - "region": "API server region", + "region": "Data Center Region", "client_id": "Client ID", - "client_secret": "Secret", + "client_secret": "Client Secret", "user_id": "User ID", - "user_name": "Username", - "no_cloud": "Do not configure Cloud API account" + "username": "Username", + "no_cloud": "Disable Cloud API?" } }, + "confirm": { + "title": "Confirmation", + "description": "{message}" + }, "configure_device": { - "title": "Configure Tuya device", - "description": "Fill in the device details{for_device}.", + "title": "Configure device connectivity", + "description": "Configure any device details{for_device} that are empty (if any) to allow LocalTuya to connect to the device.", "data": { - "friendly_name": "Name", - "host": "Host", + "friendly_name": "Device Name", + "host": "IP Address", "device_id": "Device ID", - "local_key": "Local key", + "local_key": "Local Key", + "node_id": "(Optional) Sub-devices Node Id", "protocol_version": "Protocol Version", - "enable_debug": "Enable debugging for this device (debug must be enabled also in configuration.yaml)", - "scan_interval": "Scan interval (seconds, only when not updating automatically)", - "entities": "Entities (uncheck an entity to remove it)", - "add_entities": "Add more entities in 'edit device' mode", - "manual_dps_strings": "Manual DPS to add (separated by commas ',') - used when detection is not working (optional)", - "reset_dpids": "DPIDs to send in RESET command (separated by commas ',')- Used when device does not respond to status requests after turning on (optional)" + "enable_debug": "Enable debug (must be manually enabled in `configuration.yaml` too)", + "scan_interval": "(Optional) Scan interval in seconds, if not scanning automatically", + "entities": "Configured entities (uncheck to delete)", + "add_entities": "Add new entity(s)", + "manual_dps_strings": "(Optional) Manual DPS's, if not detected automatically (separated by commas)", + "reset_dpids": "(Optional) DPIDs to send in RESET command, if device does not respond to status requests after turning on (separated by commas)", + "device_sleep_time": "(Optional) Device sleep time in seconds: If the device reports its state, then it goes into sleep", + "export_config": "Save entity configuration as template" + } + }, + "device_setup_method": { + "title": "Configure device entities", + "description": "LocalTuya will try to discover the rest of the configuration automatically. However, if this does not work for your device or you would like to tweak settings, choose the `manual` option.", + "menu_options": { + "auto_configure_device":"Discover device entities automatically", + "pick_entity_type": "Configure device entities manually", + "choose_template":"Use saved template" + } + }, + "auto_configure_device": { + "title": "Auto configure", + "description": "An error occurred: {err_msg}. If reason isn't showing, check logs.", + "menu_options": { + "device_setup_method":"Return to Setup method" } }, "pick_entity_type": { "title": "Entity type selection", - "description": "Please pick the type of entity you want to add.", + "description": "Choose the type of entity you want to add.", + "data": { + "platform_to_add": "Choose entity", + "no_additional_entities": "Finish configuring entities", + "use_template" : "Import template file" + } + }, + "choose_template":{ + "title": "Import template file", + "description": "Template files are located in the `templates` directory ([More Info](https://github.com/xZetsubou/hass-localtuya/discussions/13)).", "data": { - "platform_to_add": "Platform", - "no_additional_entities": "Do not add any more entities" + "templates": "Choose template" } }, "configure_entity": { "title": "Configure entity", - "description": "Please fill out the details for {entity} with type `{platform}`. All settings except for `ID` can be changed from the Options page later.", + "description": "Please fill out the details for {entity} with type {platform}. All settings (except for `Type` and `ID`) can be changed from the `Configure` page later.", "data": { - "id": "ID", - "friendly_name": "Friendly name", + "id": "DP ID", + "friendly_name": "Friendly name for Entity", "current": "Current", "current_consumption": "Current Consumption", "voltage": "Voltage", @@ -131,105 +157,106 @@ "positioning_mode": "Positioning mode", "current_position_dp": "Current Position (for *position* mode only)", "set_position_dp": "Set Position (for *position* mode only)", + "stop_switch_dp": "(Optional) Stop switch (if the cover has continue command?)", "position_inverted": "Invert 0-100 position (for *position* mode only)", "span_time": "Full opening time, in secs. (for *timed* mode only)", - "unit_of_measurement": "Unit of Measurement", - "device_class": "Device Class", - "scaling": "Scaling Factor", + "unit_of_measurement": "(Optional) Unit of Measurement", + "device_class": "(Optional) Device Class", + "state_class": "(Optional) State Class", + "scaling": "(Optional) Scaling Factor", "state_on": "On Value", "state_off": "Off Value", - "powergo_dp": "Power DP (Usually 25 or 2)", + "powergo_dp": "Power DP (usually 25 or 2)", "idle_status_value": "Idle Status (comma-separated)", - "returning_status_value": "Returning Status", + "returning_status_value": "Returning Status (comma-separated)", "docked_status_value": "Docked Status (comma-separated)", - "fault_dp": "Fault DP (Usually 11)", - "battery_dp": "Battery status DP (Usually 14)", - "mode_dp": "Mode DP (Usually 27)", + "fault_dp": "Fault DP (usually 11)", + "battery_dp": "Battery status DP (usually 14)", + "mode_dp": "Mode DP", "modes": "Modes list", "return_mode": "Return home mode", - "fan_speed_dp": "Fan speeds DP (Usually 30)", + "fan_speed_dp": "(Optional) Fan speeds DP", "fan_speeds": "Fan speeds list (comma-separated)", - "clean_time_dp": "Clean Time DP (Usually 33)", - "clean_area_dp": "Clean Area DP (Usually 32)", - "clean_record_dp": "Clean Record DP (Usually 34)", - "locate_dp": "Locate DP (Usually 31)", + "clean_time_dp": "Clean Time DP (usually 33)", + "clean_area_dp": "Clean Area DP (usually 32)", + "clean_record_dp": "Clean Record DP (usually 34)", + "locate_dp": "Locate DP (usually 31)", + "pause_dp":"Pause DP", "paused_state": "Pause state (pause, paused, etc)", "stop_status": "Stop status", "brightness": "Brightness (only for white color)", "brightness_lower": "Brightness Lower Value", "brightness_upper": "Brightness Upper Value", "color_temp": "Color Temperature", - "color_temp_reverse": "Color Temperature Reverse", + "color_temp_reverse": "Reverse Color Temperature?", "color": "Color", - "color_mode": "Color Mode", + "color_mode": "Color Mode aka Work Mode", "color_temp_min_kelvin": "Minimum Color Temperature in K", "color_temp_max_kelvin": "Maximum Color Temperature in K", - "music_mode": "Music mode available", + "music_mode": "Music mode available?", "scene": "Scene", - "select_options": "Valid entries, separate entries by a ;", - "select_options_friendly": "User Friendly options, separate entries by a ;", - "fan_speed_control": "Fan Speed Control dps", - "fan_oscillating_control": "Fan Oscillating Control dps", + "scene_values": "(Optional) Scene values", + "select_options": "Select options values", + "fan_speed_control": "Fan Speed Control DP", + "fan_oscillating_control": "Fan Oscillating Control DP", "fan_speed_min": "minimum fan speed integer", "fan_speed_max": "maximum fan speed integer", - "fan_speed_ordered_list": "Fan speed modes list (overrides speed min/max)", - "fan_direction": "fan direction dps", - "fan_direction_forward": "forward dps string", - "fan_direction_reverse": "reverse dps string", + "fan_speed_ordered_list": "Fan speed list (overrides speed min/max), separate entries by comma ','", + "fan_direction":"Fan Direction DP", + "fan_direction_forward": "Forward DP string", + "fan_direction_reverse": "Reverse DP string", "fan_dps_type": "DP value type", "current_temperature_dp": "Current Temperature", "target_temperature_dp": "Target Temperature", - "temperature_step": "Temperature Step (optional)", - "max_temperature_dp": "Max Temperature DP (optional)", - "min_temperature_dp": "Min Temperature DP (optional)", - "max_temperature_const": "Max Temperature Constant (optional)", - "min_temperature_const": "Min Temperature Constant (optional)", + "temperature_step": "(Optional) Temperature Step", + "min_temperature": "Min Temperature", + "max_temperature": "Max Temperature", "precision": "Precision (optional, for DPs values)", - "target_precision": "Target Precision (optional, for DPs values)", - "temperature_unit": "Temperature Unit (optional)", - "hvac_mode_dp": "HVAC Mode DP (optional)", - "hvac_mode_set": "HVAC Mode Set (optional)", - "hvac_fan_mode_dp": "HVAC Fan Mode DP (optional)", - "hvac_fan_mode_set": "HVAC Fan Mode Set (optional)", - "hvac_swing_mode_dp": "HVAC Swing Mode DP (optional)", - "hvac_swing_mode_set": "HVAC Swing Mode Set (optional)", - "hvac_action_dp": "HVAC Current Action DP (optional)", - "hvac_action_set": "HVAC Current Action Set (optional)", - "preset_dp": "Presets DP (optional)", - "preset_set": "Presets Set (optional)", - "eco_dp": "Eco DP (optional)", - "eco_value": "Eco value (optional)", - "heuristic_action": "Enable heuristic action (optional)", - "dps_default_value": "Default value when un-initialised (optional)", - "restore_on_reconnect": "Restore the last set value in HomeAssistant after a lost connection", + "target_precision": "Target Precision (optional, for DP values)", + "temperature_unit": "(Optional) Temperature Unit", + "hvac_mode_dp": "(Optional) HVAC Mode DP", + "hvac_mode_set": "(Optional) HVAC Modes", + "hvac_add_off": "(Optional) Include `OFF` in HVAC Modes", + "hvac_action_dp": "(Optional) HVAC Current Action DP", + "hvac_action_set": "(Optional) HVAC Actions", + "preset_dp": "(Optional) Presets DP", + "preset_set": "(Optional) Presets", + "fan_speed_list": "(Optional) Fan supported speeds, separate entries by comma ','", + "eco_dp": "(Optional) Eco DP", + "eco_value": "(Optional) Eco value", + "heuristic_action": "(Optional) Enable heuristic action", + "dps_default_value": "(Optional) Default value when un-initialised", + "restore_on_reconnect": "Restore the last value set in Home Assistant after lost connection?", "min_value": "Minimum Value", "max_value": "Maximum Value", "step_size": "Minimum increment between numbers", - "is_passive_entity": "Passive entity - requires integration to send initialisation value" - } - } - } - }, - "services": { - "reload": { - "name": "Reload", - "description": "Reload localtuya and reconnect to all devices." - }, - "set_dp": { - "name": "Set datapoint", - "description": "Change the value of a datapoint (DP)", - "fields": { - "device_id": { - "name": "Device ID", - "description": "Device ID of device to change datapoint value for" - }, - "dp": { - "name": "DP", - "description": "Datapoint index" + "is_passive_entity": "Passive entity? (requires integration to send initialisation value)", + "entity_category": "Show the entity in this category", + "humidifier_available_modes": "(Optional) Available modes in the device", + "humidifier_current_humidity_dp": "(Optional) Current Humidity DP", + "humidifier_mode_dp": "(Optional) Set mode DP", + "humidifier_set_humidity_dp": "(Optional) Set Humidity DP", + "min_humidity": "Set the minimum supported humidity", + "max_humidity": "Set the maximum supported humidity", + "alarm_supported_states": "States supported by the device", + "receive_dp":"Receiving signals DP. (default is 202)", + "key_study_dp":"(Optional) Key Study DP (usually 7)", + "lock_state_dp":"(Optional) Lock state DP", + "jammed_dp":"(Optional) Jam DP", + "target_temperature_high_dp":"(Optional) Target Temperature High DP", + "target_temperature_low_dp":"(Optional) Target Temperature Low DP", + "color_mode_set":"Supported modes set (Leave as default if you aren't sure)" }, - "value": { - "name": "Value", - "description": "New value to set" + "data_description": { + "hvac_mode_set":"Each line represents [ hvac_mode: device_value ] [Supported HVAC Modes](https://developers.home-assistant.io/docs/core/entity/climate/#hvac-modes)", + "hvac_action_set":"Each line represents [ hvac_action: device_value ] [Supported HVAC Actions](https://developers.home-assistant.io/docs/core/entity/climate/#hvac-action)", + "preset_set":"Each line represents [ device_value: friendly name ]", + "scene_values":"Each line represents [ device_value: friendly name ]", + "select_options":"Each line represents [ device_value: friendly name ]", + "alarm_supported_states":"Each line represents [ supported state: device value ] [Supported States](https://developers.home-assistant.io/docs/core/entity/alarm-control-panel/#states)", + "humidifier_available_modes":"Each line represents [ device_value: friendly name ]", + "device_class": "Find out more about [Device Classes](https://www.home-assistant.io/integrations/homeassistant/#device-class)", + "state_class": "Find out more about [State Classes](https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes)" } } } diff --git a/custom_components/localtuya/translations/it.json b/custom_components/localtuya/translations/it.json index 264bb97f..0addbb05 100644 --- a/custom_components/localtuya/translations/it.json +++ b/custom_components/localtuya/translations/it.json @@ -1,216 +1,255 @@ { "config": { "abort": { - "already_configured": "Il dispositivo è già stato configurato.", + "already_configured": "Questo account è già stato configurato.", "device_updated": "La configurazione del dispositivo è stata aggiornata." }, "error": { - "authentication_failed": "Autenticazione fallita. Errore:\n{msg}", - "cannot_connect": "Impossibile connettersi al dispositivo. Verifica che l'indirizzo sia corretto e riprova.", - "device_list_failed": "Impossibile recuperare l'elenco dei dispositivi.\n{msg}", - "invalid_auth": "Impossibile autenticarsi con il dispositivo. Verificare che device_id e local_key siano corretti.", - "unknown": "Si è verificato un errore sconosciuto. Vedere registro per i dettagli.", - "entity_already_configured": "L'entity con questo ID è già stata configurata.", - "address_in_use": "L'indirizzo utilizzato per il discovery è già in uso. Assicurarsi che nessun'altra applicazione lo stia utilizzando (porta TCP 6668).", - "discovery_failed": "Qualcosa è fallito nella discovery dei dispositivi. Vedi registro per i dettagli.", - "empty_dps": "La connessione al dispositivo è riuscita ma non sono stati trovati i datapoint, riprova. Crea un nuovo Issue e includi i log di debug se il problema persiste." + "authentication_failed": "Autenticazione fallita.\n{msg}", + "cannot_connect": "Impossibile connettersi al dispositivo. Conferma che l'indirizzo IP sia corretto e riprova.", + "device_list_failed": "Recupero elenco dispositivi fallito.\n{msg}", + "invalid_auth": "Autenticazione fallita con il dispositivo. Conferma che l'ID dispositivo e la chiave locale siano corretti.", + "unknown": "Si è verificato un errore sconosciuto.\n{ex}.", + "entity_already_configured": "Questa entità è già stata configurata.", + "address_in_use": "La porta TCP 6668 (usata per la scoperta) è già in uso. Controlla che nessun'altra integrazione la stia utilizzando.", + "discovery_failed": "Qualcosa è andato storto durante la scoperta dei dispositivi. Consulta il registro per i dettagli. Se il problema persiste, crea una nuova segnalazione (includendo i log di debug).", + "empty_dps": "Connessione al dispositivo riuscita ma non è stato possibile trovare datapoint. Si prega di riprovare la configurazione. Se il problema persiste, crea una nuova segnalazione (includendo i log di debug)." }, "step": { "user": { - "title": "Configurazione dell'account Cloud API", - "description": "Inserisci le credenziali per l'account Cloud API Tuya.", + "title": "Configurazione dell'account dell'API cloud", + "description": "Configura le credenziali utilizzate per connettersi all'API Cloud di Tuya.", "data": { - "region": "Regione del server API", - "client_id": "Client ID", - "client_secret": "Secret", - "user_id": "User ID", - "user_name": "Username", - "no_cloud": "Non configurare un account Cloud API" + "region": "Regione del Data Center", + "client_id": "ID client", + "client_secret": "Segreto client", + "user_id": "ID utente", + "username": "Nome utente", + "no_cloud": "Disabilitare l'API Cloud?" } } } }, "options": { "abort": { - "already_configured": "Il dispositivo è già stato configurato.", - "device_success": "Dispositivo {dev_name} {action} con successo.", - "no_entities": "Non si possono rimuovere tutte le entities da un device.\nPer rimuovere un device, entrarci nel menu Devices, premere sui 3 punti nel riquadro 'Device info', e premere il pulsante Delete." + "already_configured": "Questo account è già stato configurato.", + "device_success": "Dispositivo {dev_name} configurato con successo {action}.", + "no_entities": "Impossibile rimuovere tutte le entità da un dispositivo.\nSe desideri eliminare un dispositivo: Vai al menu 'Dispositivi e servizi', cerca il tuo dispositivo nella scheda 'Dispositivi', fai clic sui 3 puntini nel riquadro 'Informazioni sul dispositivo' e premi il pulsante 'Elimina'." }, "error": { - "authentication_failed": "Autenticazione fallita. Errore:\n{msg}", - "cannot_connect": "Impossibile connettersi al dispositivo. Verifica che l'indirizzo sia corretto e riprova.", - "device_list_failed": "Impossibile recuperare l'elenco dei dispositivi.\n{msg}", - "invalid_auth": "Impossibile autenticarsi con il dispositivo. Verificare che device_id e local_key siano corretti.", - "unknown": "Si è verificato un errore sconosciuto. Vedere registro per i dettagli.", - "entity_already_configured": "L'entity con questo ID è già stata configurata.", - "address_in_use": "L'indirizzo utilizzato per il discovery è già in uso. Assicurarsi che nessun'altra applicazione lo stia utilizzando (porta TCP 6668).", - "discovery_failed": "Qualcosa è fallito nella discovery dei dispositivi. Vedi registro per i dettagli.", - "empty_dps": "La connessione al dispositivo è riuscita ma non sono stati trovati i datapoint, riprova. Crea un nuovo Issue e includi i log di debug se il problema persiste." + "authentication_failed": "Autenticazione fallita.\n{msg}", + "cannot_connect": "Impossibile connettersi al dispositivo. Conferma che l'indirizzo IP sia corretto e riprova.", + "device_list_failed": "Recupero elenco dispositivi fallito.\n{msg}", + "invalid_auth": "Autenticazione fallita con il dispositivo. Conferma che l'ID dispositivo e la chiave locale siano corretti.", + "unknown": "Si è verificato un errore sconosciuto. \n{ex}.", + "entity_already_configured": "Questa entità è già stata configurata.", + "address_in_use": "La porta TCP 6668 (usata per la scoperta) è già in uso. Controlla che nessun'altra integrazione la stia utilizzando.", + "discovery_failed": "Qualcosa è andato storto durante la scoperta dei dispositivi. Consulta il registro per i dettagli. Se il problema persiste, crea una nuova segnalazione (includendo i log di debug).", + "empty_dps": "Connessione al dispositivo riuscita ma non è stato possibile trovare datapoint. Si prega di riprovare la configurazione. Se il problema persiste, crea una nuova segnalazione (includendo i log di debug)." }, "step": { "yaml_import": { "title": "Non supportato", - "description": "Le impostazioni non possono essere configurate tramite file YAML." + "description": "I dispositivi configurati utilizzando `YAML` non possono essere configurati nell'interfaccia utente. Elimina il dispositivo da `YAML` e ricrealo nell'interfaccia utente o modifica la tua configurazione `YAML`." }, "init": { - "title": "Configurazione LocalTuya", - "description": "Seleziona l'azione desiderata.", - "data": { - "add_device": "Aggiungi un nuovo dispositivo", - "edit_device": "Modifica un dispositivo", - "setup_cloud": "Riconfigurare l'account Cloud API" + "title": "Configurazione", + "description": "Seleziona un'opzione per procedere.", + "menu_options": { + "add_device": "Aggiungi nuovo dispositivo", + "edit_device": "Riconfigura dispositivo esistente", + "configure_cloud": "Gestisci account dell'API Cloud" } }, "add_device": { - "title": "Aggiungi un nuovo dispositivo", - "description": "Scegli uno dei dispositivi trovati automaticamente o `...` per aggiungere manualmente un dispositivo.", + "title": "Scegli il dispositivo da configurare", + "description": "I dispositivi Tuya compatibili nella tua rete locale vengono scoperti automaticamente una volta configurati nell'app Tuya. Se non vedi il dispositivo previsto, scegli `Add Device Manually` dal menu a discesa.", "data": { "selected_device": "Dispositivi trovati" } }, "edit_device": { - "title": "Modifica un dispositivo", - "description": "Scegli il dispositivo configurato che si desidera modificare.", + "title": "Riconfigura dispositivo esistente", + "description": "Seleziona il dispositivo che desideri riconfigurare.", "data": { "selected_device": "Dispositivi configurati" } }, - "cloud_setup": { - "title": "Configurazione dell'account Cloud API", - "description": "Inserisci le credenziali per l'account Cloud API Tuya.", + "configure_cloud": { + "title": "Gestisci account dell'API Cloud", + "description": "Configura le credenziali utilizzate per connettersi all'API Cloud di Tuya.", "data": { - "region": "Regione del server API", - "client_id": "Client ID", - "client_secret": "Secret", - "user_id": "User ID", - "user_name": "Username", - "no_cloud": "Non configurare l'account Cloud API" + "region": "Regione del Data Center", + "client_id": "ID client", + "client_secret": "Segreto client", + "user_id": "ID utente", + "username": "Nome utente", + "no_cloud": "Disabilitare l'API Cloud?" } }, "configure_device": { - "title": "Configura il dispositivo", - "description": "Compila i dettagli del dispositivo {for_device}.", + "title": "Configura la connettività del dispositivo", + "description": "Configura eventuali dettagli del dispositivo {for_device} vuoti (se presenti) per consentire a LocalTuya di connettersi al dispositivo.", "data": { - "friendly_name": "Nome", - "host": "Host", - "device_id": "ID del dispositivo", + "friendly_name": "Nome dispositivo", + "host": "Indirizzo IP", + "device_id": "ID dispositivo", "local_key": "Chiave locale", + "node_id": "(Opzionale) ID nodo sottodispositivi", "protocol_version": "Versione del protocollo", - "enable_debug": "Abilita il debugging per questo device (il debug va abilitato anche in configuration.yaml)", - "scan_interval": "Intervallo di scansione (secondi, solo quando non si aggiorna automaticamente)", - "entities": "Entities (deseleziona un'entity per rimuoverla)" + "enable_debug": "Abilita debug (deve essere abilitato manualmente anche in `configuration.yaml`)", + "scan_interval": "(Opzionale) Intervallo di scansione in secondi, se la scansione automatica non è attiva", + "entities": "Entità configurate (deseleziona per eliminare)", + "add_entities": "Aggiungi nuove entità", + "manual_dps_strings": "(Opzionale) DPS manuali, se non rilevati automaticamente (separati da virgole)", + "reset_dpids": "(Opzionale) DPID da inviare nel comando RESET, se il dispositivo non risponde alle richieste di stato dopo l'accensione (separati da virgole)", + "device_sleep_time": "(Optional) Device sleep time in seconds: If the device reports its state, then it goes into sleep", + "export_config": "Salva configurazione entità come modello" + } + }, + "device_setup_method": { + "title": "Configura entità del dispositivo", + "description": "LocalTuya cercherà di scoprire automaticamente il resto della configurazione. Tuttavia, se ciò non funziona per il tuo dispositivo o se desideri regolare le impostazioni, scegli l'opzione `manuale`.", + "menu_options": { + "auto_configure_device": "Scopri entità del dispositivo automaticamente", + "pick_entity_type": "Configura manualmente entità del dispositivo", + "choose_template": "Usa modello salvato" + } + }, + "auto_configure_device": { + "title": "Configurazione automatica", + "description": "Si è verificato un errore: {err_msg}. Se il motivo non viene mostrato, controlla i log.", + "menu_options": { + "device_setup_method": "Torna al metodo di configurazione" } }, "pick_entity_type": { - "title": "Selezione del tipo di entity", - "description": "Scegli il tipo di entity che desideri aggiungere.", + "title": "Selezione tipo di entità", + "description": "Scegli il tipo di entità che desideri aggiungere.", "data": { - "platform_to_add": "piattaforma", - "no_additional_entities": "Non aggiungere altre entity" + "platform_to_add": "Scegli entità", + "no_additional_entities": "Termina configurazione entità", + "use_template": "Importa file modello" } }, - "configure_entity": { - "title": "Configurare entity", - "description": "Compila i dettagli per {entity} con tipo `{platform}`.Tutte le impostazioni ad eccezione di `id` possono essere modificate dalla pagina delle opzioni in seguito.", + "choose_template": { + "title": "Importa file modello", + "description": "I file modello si trovano nella directory `templates` ([Maggiori informazioni](https://github.com/xZetsubou/hass-localtuya/discussions/13)).", "data": { - "id": "ID", - "friendly_name": "Nome amichevole", - "current": "Corrente", - "current_consumption": "Potenza", - "voltage": "Tensione", - "commands_set": "Set di comandi Aperto_Chiuso_Stop", - "positioning_mode": "Modalità di posizionamento", - "current_position_dp": "Posizione attuale (solo per la modalità *posizione*)", - "set_position_dp": "Imposta posizione (solo per modalità *posizione*)", - "position_inverted": "Inverti posizione 0-100 (solo per modalità *posizione*)", - "span_time": "Tempo di apertura totale, in sec. (solo per modalità *a tempo*)", - "unit_of_measurement": "Unità di misura", - "device_class": "Classe del dispositivo", - "scaling": "Fattore di scala", - "state_on": "Valore di ON", - "state_off": "Valore di OFF", - "powergo_dp": "Potenza DP (di solito 25 o 2)", - "idle_status_value": "Stato di inattività (separato da virgole)", - "returning_status_value": "Stato di ritorno alla base", - "docked_status_value": "Stato di tornato alla base (separato da virgole)", - "fault_dp": "DP di guasto (di solito 11)", - "battery_dp": "DP di stato batteria (di solito 14)", - "mode_dp": "DP di modalità (di solito 27)", - "modes": "Elenco delle modalità", - "return_mode": "Ritorno in modalità home", - "fan_speed_dp": "DP di velocità del ventilatore (di solito 30)", - "fan_speeds": "DP di elenco delle velocità del ventilatore (separato da virgola)", - "clean_time_dp": "DP di tempo di pulizia (di solito 33)", - "clean_area_dp": "DP di area pulita (di solito 32)", - "clean_record_dp": "DP di record delle pulizie (di solito 34)", - "locate_dp": "DP di individuazione (di solito 31)", - "paused_state": "Stato di pausa (pausa, pausa, ecc.)", - "stop_status": "Stato di stop", - "brightness": "Luminosità (solo per il colore bianco)", - "brightness_lower": "Limite inferiore per la luminosità", - "brightness_upper": "Limite superiore per la luminosità", - "color_temp": "Temperatura di colore", - "color_temp_reverse": "Temperatura di colore invertita", - "color": "Colore", - "color_mode": "Modalità colore", - "color_temp_min_kelvin": "Minima temperatura di colore in K", - "color_temp_max_kelvin": "Massima temperatura di colore in k", - "music_mode": "Modalità musicale disponibile", - "scene": "Scena", - "select_options": "Opzioni valide, voci separate da una vigola (;)", - "select_options_friendly": "Opzioni intuitive, voci separate da una virgola", - "fan_speed_control": "DP di controllo di velocità del ventilatore", - "fan_oscillating_control": "DP di controllo dell'oscillazione del ventilatore", - "fan_speed_min": "Velocità del ventilatore minima", - "fan_speed_max": "Velocità del ventilatore massima", - "fan_speed_ordered_list": "Elenco delle modalità di velocità del ventilatore (sovrascrive velocità min/max)", - "fan_direction":"DP di direzione del ventilatore", - "fan_direction_forward": "Stringa del DP per avanti", - "fan_direction_reverse": "Stringa del DP per indietro", - "current_temperature_dp": "Temperatura attuale", - "target_temperature_dp": "Temperatura target", - "temperature_step": "Intervalli di temperatura (facoltativo)", - "max_temperature_dp": "Temperatura massima (opzionale)", - "min_temperature_dp": "Temperatura minima (opzionale)", - "precision": "Precisione (opzionale, per valori DP)", - "target_precision": "Precisione del target (opzionale, per valori DP)", - "temperature_unit": "Unità di temperatura (opzionale)", - "hvac_mode_dp": "Modalità HVAC attuale (opzionale)", - "hvac_mode_set": "Impostazione modalità HVAC (opzionale)", - "hvac_action_dp": "Azione HVAC attuale (opzionale)", - "hvac_action_set": "Impostazione azione HVAC (opzionale)", - "preset_dp": "Preset DP (opzionale)", - "preset_set": "Set di preset (opzionale)", - "eco_dp": "DP per Eco (opzionale)", - "eco_value": "Valore Eco (opzionale)", - "heuristic_action": "Abilita azione euristica (opzionale)" + "templates": "Scegli modello" } - } - } - }, - "services": { - "reload": { - "name": "Reload", - "description": "Reload localtuya and reconnect to all devices." - }, - "set_dp": { - "name": "Set datapoint", - "description": "Change the value of a datapoint (DP)", - "fields": { - "device_id": { - "name": "Device ID", - "description": "Device ID of device to change datapoint value for" - }, - "dp": { - "name": "DP", - "description": "Datapoint index" + }, + "configure_entity": { + "title": "Configure entity", + "description": "Please fill out the details for {entity} with type {platform}. All settings (except for `Type` and `ID`) can be changed from the `Configure` page later.", + "data": { + "id": "DP ID", + "friendly_name": "Friendly name for Entity", + "current": "Current", + "current_consumption": "Current Consumption", + "voltage": "Voltage", + "commands_set": "Open_Close_Stop Commands Set", + "positioning_mode": "Positioning mode", + "current_position_dp": "Current Position (for *position* mode only)", + "set_position_dp": "Set Position (for *position* mode only)", + "stop_switch_dp": "(Optional) Stop switch (if the cover has continue command?)", + "position_inverted": "Invert 0-100 position (for *position* mode only)", + "span_time": "Full opening time, in secs. (for *timed* mode only)", + "unit_of_measurement": "(Optional) Unit of Measurement", + "device_class": "(Optional) Device Class", + "state_class": "(Optional) State Class", + "scaling": "(Optional) Scaling Factor", + "state_on": "On Value", + "state_off": "Off Value", + "powergo_dp": "Power DP (usually 25 or 2)", + "idle_status_value": "Idle Status (comma-separated)", + "returning_status_value": "Returning Status (comma-separated)", + "docked_status_value": "Docked Status (comma-separated)", + "fault_dp": "Fault DP (usually 11)", + "battery_dp": "Battery status DP (usually 14)", + "mode_dp": "Mode DP", + "modes": "Modes list", + "return_mode": "Return home mode", + "fan_speed_dp": "(Optional) Fan speeds DP", + "fan_speeds": "Fan speeds list (comma-separated)", + "clean_time_dp": "Clean Time DP (usually 33)", + "clean_area_dp": "Clean Area DP (usually 32)", + "clean_record_dp": "Clean Record DP (usually 34)", + "locate_dp": "Locate DP (usually 31)", + "pause_dp":"Pause DP", + "paused_state": "Pause state (pause, paused, etc)", + "stop_status": "Stop status", + "brightness": "Brightness (only for white color)", + "brightness_lower": "Brightness Lower Value", + "brightness_upper": "Brightness Upper Value", + "color_temp": "Color Temperature", + "color_temp_reverse": "Reverse Color Temperature?", + "color": "Color", + "color_mode": "Color Mode aka Work Mode", + "color_temp_min_kelvin": "Minimum Color Temperature in K", + "color_temp_max_kelvin": "Maximum Color Temperature in K", + "music_mode": "Music mode available?", + "scene": "Scene", + "scene_values": "(Optional) Scene values", + "select_options": "Select options values", + "fan_speed_control": "Fan Speed Control DP", + "fan_oscillating_control": "Fan Oscillating Control DP", + "fan_speed_min": "minimum fan speed integer", + "fan_speed_max": "maximum fan speed integer", + "fan_speed_ordered_list": "Fan speed list (overrides speed min/max), separate entries by comma ','", + "fan_direction":"Fan Direction DP", + "fan_direction_forward": "Forward DP string", + "fan_direction_reverse": "Reverse DP string", + "fan_dps_type": "DP value type", + "current_temperature_dp": "Current Temperature", + "target_temperature_dp": "Target Temperature", + "temperature_step": "(Optional) Temperature Step", + "min_temperature": "Min Temperature", + "max_temperature": "Max Temperature", + "precision": "Precision (optional, for DPs values)", + "target_precision": "Target Precision (optional, for DP values)", + "temperature_unit": "(Optional) Temperature Unit", + "hvac_mode_dp": "(Optional) HVAC Mode DP", + "hvac_mode_set": "(Optional) HVAC Modes", + "hvac_add_off": "(Optional) Include `OFF` in HVAC Modes", + "hvac_action_dp": "(Optional) HVAC Current Action DP", + "hvac_action_set": "(Optional) HVAC Actions", + "preset_dp": "(Optional) Presets DP", + "preset_set": "(Optional) Presets", + "fan_speed_list": "(Optional) Fan supported speeds, separate entries by comma ','", + "eco_dp": "(Optional) Eco DP", + "eco_value": "(Optional) Eco value", + "heuristic_action": "(Optional) Enable heuristic action", + "dps_default_value": "(Optional) Default value when un-initialised", + "restore_on_reconnect": "Restore the last value set in Home Assistant after lost connection?", + "min_value": "Minimum Value", + "max_value": "Maximum Value", + "step_size": "Minimum increment between numbers", + "is_passive_entity": "Passive entity? (requires integration to send initialisation value)", + "entity_category": "Show the entity in this category", + "humidifier_available_modes": "(Optional) Available modes in the device", + "humidifier_current_humidity_dp": "(Optional) Current Humidity DP", + "humidifier_mode_dp": "(Optional) Set mode DP", + "humidifier_set_humidity_dp": "(Optional) Set Humidity DP", + "min_humidity": "Set the minimum supported humidity", + "max_humidity": "Set the maximum supported humidity", + "alarm_supported_states": "States supported by the device", + "receive_dp":"Receiving signals DP. (default is 202)", + "key_study_dp":"(Optional) Key Study DP (usually 7)" }, - "value": { - "name": "Value", - "description": "New value to set" + "data_description": { + "hvac_mode_set":"Each line represents [ hvac_mode: device_value ] [Supported HVAC Modes](https://developers.home-assistant.io/docs/core/entity/climate/#hvac-modes)", + "hvac_action_set":"Each line represents [ hvac_action: device_value ] [Supported HVAC Actions](https://developers.home-assistant.io/docs/core/entity/climate/#hvac-action)", + "preset_set":"Each line represents [ device_value: friendly name ]", + "scene_values":"Each line represents [ device_value: friendly name ]", + "select_options":"Each line represents [ device_value: friendly name ]", + "alarm_supported_states":"Each line represents [ supported state: device value ] [Supported States](https://developers.home-assistant.io/docs/core/entity/alarm-control-panel/#states)", + "humidifier_available_modes":"Each line represents [ device_value: friendly name ]", + "device_class": "Find out more about [Device Classes](https://www.home-assistant.io/integrations/homeassistant/#device-class)", + "state_class": "Find out more about [State Classes](https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes)" } } } }, "title": "LocalTuya" -} +} \ No newline at end of file diff --git a/custom_components/localtuya/translations/pl.json b/custom_components/localtuya/translations/pl.json new file mode 100644 index 00000000..6854090c --- /dev/null +++ b/custom_components/localtuya/translations/pl.json @@ -0,0 +1,260 @@ +{ + "config": { + "abort": { + "already_configured": "To konto zostało już skonfigurowane.", + "device_updated": "Konfiguracja urządzenia została zaktualizowana." + }, + "error": { + "authentication_failed": "Nie udało się uwierzytelnić.\n{msg}", + "cannot_connect": "Nie można połączyć się z urządzeniem. Potwierdź, że adres IP jest poprawny, a następnie spróbuj ponownie.", + "device_list_failed": "Nie udało się pobrać listy urządzeń.\n{msg}", + "invalid_auth": "Nie udało się uwierzytelnić z urządzeniem. Upewnij się, że identyfikator urządzenia i klucz lokalny są prawidłowe.", + "unknown": "Wystąpił nieznany błąd.\n{ex}.", + "entity_already_configured": "Ta encja została już skonfigurowana.", + "address_in_use": "Port TCP 6668 (używany do wykrywania) jest już używany. Sprawdź, czy nie używa go żadna inna integracja.", + "discovery_failed": "Coś nie powiodło się podczas wykrywania urządzeń. Szczegóły znajdziesz w logu. Jeśli problem będzie się powtarzał, utwórz nowy problem (w tym dzienniki debugowania).", + "empty_dps": "Połączenie z urządzeniem powiodło się, ale nie znaleziono żadnych punktów danych. Spróbuj ponownie dokonać konfiguracji. Jeśli problem będzie się powtarzał, utwórz nowy problem (w tym dzienniki debugowania)." + }, + "step": { + "user": { + "title": "Konfiguracja konta Cloud API", + "description": "Skonfiguruj dane uwierzytelniające używane do łączenia się z API Tuya Cloud.", + "data": { + "region": "Region centrum danych", + "client_id": "ID Klienta", + "client_secret": "Hasło klienta", + "user_id": "ID Użytkownika", + "username": "Nazwa użytkownika", + "no_cloud": "Wyłączyć interfejs Cloud API?" + } + } + } + }, + "options": { + "abort": { + "already_configured": "To konto zostało już skonfigurowane.", + "device_success": "Urządzenie {dev_name} pomyślnie wykonało {action}.", + "no_entities": "Nie można usunąć wszystkich elementów z urządzenia.\nJeśli chcesz usunąć urządzenie: Przejdź do menu „Urządzenia oraz usługi”, wyszukaj swoje urządzenie w zakładce „Urządzenia”, kliknij trzy kropki w ramce „Informacje o urządzeniu” i naciśnij przycisk „Usuń”." + }, + "error": { + "authentication_failed": "Nie udało się uwierzytelnić.\n{msg}", + "cannot_connect": "Nie można połączyć się z urządzeniem. Potwierdź, że adres IP jest poprawny, a następnie spróbuj ponownie.", + "device_list_failed": "Nie udało się pobrać listy urządzeń.\n{msg}", + "invalid_auth": "Nie udało się uwierzytelnić z urządzeniem. Upewnij się, że identyfikator urządzenia i klucz lokalny są prawidłowe.", + "unknown": "Wystąpił nieznany błąd. \n{ex}.", + "entity_already_configured": "Ta encja została już skonfigurowana.", + "address_in_use": "Port TCP 6668 (używany do wykrywania) jest już używany. Sprawdź, czy nie używa go żadna inna integracja.", + "discovery_failed": "Coś nie powiodło się podczas wykrywania urządzeń. Szczegóły znajdziesz w logu. Jeśli problem będzie się powtarzał, utwórz nowy problem (w tym dzienniki debugowania)..", + "empty_dps": "Połączenie z urządzeniem powiodło się, ale nie znaleziono żadnych punktów danych. Spróbuj ponownie dokonać konfiguracji. Jeśli problem będzie się powtarzał, utwórz nowy problem (w tym dzienniki debugowania)." + }, + "step": { + "yaml_import": { + "title": "Nieobsługiwany", + "description": "Urządzenia skonfigurowane przy użyciu konfiguracji `YAML` nie mogą być konfigurowane w interfejsie użytkownika. Usuń swoje urządzenie z konfiguracji `YAML` i utwórz je ponownie w interfejsie użytkownika lub zmodyfikuj konfigurację `YAML`." + }, + "init": { + "title": "Konfiguracja", + "description": "Wybierz opcję, aby kontynuować.", + "menu_options": { + "add_device": "Dodaj nowe urządzenie", + "edit_device": "Skonfiguruj ponownie istniejące urządzenie", + "configure_cloud": "Zarządzaj kontem Cloud API" + } + }, + "add_device": { + "title": "Wybierz urządzenie do skonfigurowania", + "description": "Kompatybilne urządzenia Tuya w Twojej sieci lokalnej są wykrywane automatycznie po skonfigurowaniu ich w aplikacji Tuya. Jeśli nie widzisz oczekiwanego urządzenia, wybierz z menu rozwijanego opcję „Dodaj urządzenie ręcznie”.", + "data": { + "selected_device": "Znalezione urządzenia", + "mass_configure": "Skonfiguruj automatycznie wszystkie rozpoznane urządzenia" + } + }, + "edit_device": { + "title": "Skonfiguruj ponownie istniejące urządzenie", + "description": "Wybierz urządzenie, które chcesz ponownie skonfigurować.", + "data": { + "selected_device": "Skonfigurowane urządzenia" + } + }, + "configure_cloud": { + "title": "Zarządzaj kontem Cloud API", + "description": "Skonfiguruj dane uwierzytelniające używane do łączenia się z API Tuya Cloud.", + "data": { + "region": "Region centrum danych", + "client_id": "ID Klienta", + "client_secret": "Hasło klienta", + "user_id": "ID Użytkownika", + "username": "Nazwa użytkownika", + "no_cloud": "Wyłączyć interfejs Cloud API?" + } + }, + "confirm": { + "title": "Confirmation", + "description": "{message}" + }, + "configure_device": { + "title": "Skonfiguruj łączność urządzenia", + "description": "Skonfiguruj wszystkie szczegóły urządzenia{for_device}, które są puste (jeśli istnieją), aby umożliwić LocalTuya połączenie się z urządzeniem.", + "data": { + "friendly_name": "Nazwa Urządzenia", + "host": "Adres IP", + "device_id": "ID Urządzenia", + "local_key": "Klucz Lokalny", + "node_id": "(Opcjonalnie) Id Node urządzenia podrzędnego", + "protocol_version": "Wersja Protokołu", + "enable_debug": "Włącz debugowanie (należy włączyć również ręcznie w pliku `configuration.yaml`)", + "scan_interval": "(Opcjonalnie) Interwał skanowania w sekundach, jeśli nie skanuje się automatycznie", + "entities": "Skonfigurowane encje (odznacz, aby usunąć)", + "add_entities": "Dodaj nowe encje", + "manual_dps_strings": "(Opcjonalnie) Ręczne DPS, jeśli nie zostaną wykryte automatycznie (oddzielone przecinkami)", + "reset_dpids": "(Opcjonalnie) Identyfikatory DPID do wysłania polecenia RESET, jeśli urządzenie nie odpowiada na żądania statusu po włączeniu (oddzielone przecinkami)", + "device_sleep_time": "(Optional) Device sleep time in seconds: If the device reports its state, then it goes into sleep", + "export_config": "Zapisz konfigurację encji jako szablon" + } + }, + "device_setup_method": { + "title": "Skonfiguruj encje urządzenia", + "description": "LocalTuya spróbuje automatycznie znaleść resztę konfiguracji. Jeśli jednak to nie zadziała na Twoim urządzeniu lub chcesz dostosować ustawienia, wybierz opcję „ręczną”.", + "menu_options": { + "auto_configure_device":"Automatycznie wykrywaj encje urządzenia", + "pick_entity_type": "Skonfiguruj ręcznie enje urządzenia", + "choose_template":"Użyj zapisanego szablonu" + } + }, + "auto_configure_device": { + "title": "Automatyczna konfiguracja", + "description": "Wystąpił błąd: {err_msg}. Jeśli przyczyna nie jest widoczna, sprawdź dzienniki.", + "menu_options": { + "device_setup_method":"Wróć do metody konfiguracji" + } + }, + "pick_entity_type": { + "title": "Wybór typu encji", + "description": "Wybierz typ encji, którą chcesz dodać.", + "data": { + "platform_to_add": "Wybierz encję", + "no_additional_entities": "Zakończ konfigurowanie encji", + "use_template" : "Importuj plik szablonu" + } + }, + "choose_template":{ + "title": "Importuj plik szablonu", + "description": "Pliki szablonów znajdują się w katalogu `templates` ([Więcej informacji](https://github.com/xZetsubou/hass-localtuya/discussions/13)).", + "data": { + "templates": "Wybierz szablon" + } + }, + "configure_entity": { + "title": "Skonfiguruj encje", + "description": "Podaj szczegóły dotyczące elementu {entity}, wpisując typ {platform}. Wszystkie ustawienia (z wyjątkiem „Typu” i „ID”) można później zmienić na stronie „Konfiguruj”.", + "data": { + "id": "DP ID", + "friendly_name": "Przyjazna nazwa dla encji", + "current": "Prąd", + "current_consumption": "Obecne zużycie", + "voltage": "Napięcie", + "commands_set": "Zestaw poleceń Otwórz_Zamknij_zatrzymaj", + "positioning_mode": "Tryb pozycjonowania", + "current_position_dp": "Bieżąca pozycja (tylko dla trybu *pozycjonowania*)", + "set_position_dp": "Ustaw pozycję (tylko dla trybu *pozycjonowania*)", + "stop_switch_dp": "(Optional) Stop switch (if the cover has continue command?)", + "position_inverted": "Odwróć pozycję 0-100 (tylko dla trybu *pozycjonowania*)", + "span_time": "Pełny czas otwarcia, w sekundach. (tylko dla trybu *czasowego*)", + "unit_of_measurement": "Jednostka miary (opcjonalnie)", + "device_class": "(Opcjonalnie) Klasa urządzenia", + "state_class": "(Opcjonalnie) Klasa stanu", + "scaling": "Współczynnik skalowania", + "state_on": "Wartość włączenia", + "state_off": "Wartość wyłączenia", + "powergo_dp": "DP mocy (zazwyczaj 25 or 2)", + "idle_status_value": "Stan bezczynności (oddzielone przecinkami)", + "returning_status_value": "Stan powrotu (oddzielone przecinkami)", + "docked_status_value": "Stan zadokowania (oddzielone przecinkami)", + "fault_dp": "DP błędu (zazwyczaj 11)", + "battery_dp": "DP statusu baterii (zazwyczaj 14)", + "mode_dp": "DP trybu", + "modes": "Lista trybów", + "return_mode": "Tryb powrotu do domu", + "fan_speed_dp": "(Opcjonalnie) DP prędkości wentylatora", + "fan_speeds": "Lista prędkości wentylatorów (oddzielone przecinkami)", + "clean_time_dp": "DP czasu czyszczenia(zazwyczaj 33)", + "clean_area_dp": "DP obszaru czyszczenia (zazwyczaj 32)", + "clean_record_dp": "DP zapisu czyszczenia (zazwyczaj 34)", + "locate_dp": "DP lokalizacji (zazwyczaj 31)", + "pause_dp":"Pause DP", + "paused_state": "Stan pauzy (pauza, itp)", + "stop_status": "Status zatrzymania", + "brightness": "Jasność (tylko dla koloru białego)", + "brightness_lower": "Najniższa wartość jasności", + "brightness_upper": "Najwyższa wartość jasności", + "color_temp": "Temperatura barwy", + "color_temp_reverse": "Odwrócona temperatura barwy", + "color": "Kolor", + "color_mode": "Tryb koloru, czyli tryb pracy", + "color_temp_min_kelvin": "Minimalna temperatura barwowa w K", + "color_temp_max_kelvin": "Maksymalna temperatura barwowa w K", + "music_mode": "Dostępny tryb muzyczny", + "scene": "Scena", + "scene_values": "Wartości scen", + "select_options": "Prawidłowe wpisy", + "fan_speed_control": "DP Kontroli prędkości wentylatora", + "fan_oscillating_control": "DP Sterowania oscylacyjnego wentylatora", + "fan_speed_min": "minimalna prędkość wentylatora", + "fan_speed_max": "maksymalna prędkośc wentylatora", + "fan_speed_ordered_list": "Lista trybów prędkości wentylatora (zastępuje prędkość min./maks.), wpisy oddzielaj przecinkami ','", + "fan_direction":"DP kierunku wentylatora", + "fan_direction_forward": "DP do przodu", + "fan_direction_reverse": "DP do tyłu", + "fan_dps_type": "DP typu", + "current_temperature_dp": "Obecna temperatura", + "target_temperature_dp": "Docelowa temperatura", + "temperature_step": "Krok temperatury (opcjonalnie)", + "max_temp": "Maksymalna temperatura (liczba)", + "min_temp": "Minimalna temperatura (liczba)", + "precision": "Precyzja (opcjonalnie, dla wartości DPs)", + "target_precision": "Dokładność docelowa (opcjonalnie, dla wartości DP)", + "temperature_unit": "(opcjonalnie) Jednostka temperatury", + "hvac_mode_dp": "(opcjonalnie) DP trybu HVAC", + "hvac_mode_set": "(opcjonalnie) Ustawiony tryb HVAC", + "hvac_add_off": "(Opcjonalnie) Dodaj `OFF` do trybów HVAC", + "hvac_action_dp": "(opcjonalnie) Bieżące działanie HVAC DP", + "hvac_action_set": "(opcjonalnie) Zestaw bieżących działań HVAC", + "preset_dp": "(opcjonalnie) DP ustawień wstępnych", + "preset_set": "(opcjonalnie) Zestaw ustawień wstępnych", + "fan_speed_list": "(Optional) Fan supported speeds, separate entries by comma ','", + "eco_dp": "(opcjonalnie) DP trybu eco", + "eco_value": "(opcjonalnie) Tryb eco", + "heuristic_action": "(opcjonalnie) Włącz działanie heurystyczne", + "dps_default_value": "(opcjonalnie) Wartość domyślna w przypadku niezainicjowania", + "restore_on_reconnect": "Przywróć ostatnią wartość ustawioną w Home Assistant po utracie połączenia", + "min_value": "Minimalna wartość", + "max_value": "Maksymalna wartość", + "step_size": "Minimalny odstęp między liczbami", + "is_passive_entity": "Jednostka pasywna? (wymaga integracji w celu przesłania wartości inicjalizacyjnej)", + "entity_category": "Pokaż encje w tej kategorii", + "humidifier_available_modes": "(opcjonalnie) Dostępne tryby w urządzeniu", + "humidifier_current_humidity_dp": "(opcjonalnie) DP aktualnej wilgotności", + "humidifier_mode_dp": "(opcjonalnie) DP ustawienia trybu", + "humidifier_set_humidity_dp": "(opcjonalnie) DP ustawienia wilgotności", + "min_humidity": "Ustaw minimalną obsługiwaną wilgotność", + "max_humidity": "Ustaw maksymalną obsługiwaną wilgotność", + "alarm_supported_states": "States supported by the device", + "receive_dp":"Receiving signals DP. (default is 202)", + "key_study_dp":"(Optional) Key Study DP (usually 7)" + }, + "data_description": { + "hvac_mode_set":"Każda linia reprezentuje [ hvac_mode: device_value ] [Obsługiwane tryby HVAC](https://developers.home-assistant.io/docs/core/entity/climate/#hvac-modes)", + "hvac_action_set":"Każda linia reprezentuje [ hvac_action: device_value ] [Obsługiwane działania HVAC](https://developers.home-assistant.io/docs/core/entity/climate/#hvac-action)", + "preset_set":"Każda linia reprezentuje [ device_value: friendly name ]", + "scene_values":"Każda linia reprezentuje [ device_value: friendly name ]", + "select_options":"Każda linia reprezentuje [ device_value: friendly name ]", + "alarm_supported_states":"Each line represents [ supported state: device value ] [Supported States](https://developers.home-assistant.io/docs/core/entity/alarm-control-panel/#states)", + "humidifier_available_modes":"Każda linia reprezentuje [ device_value: friendly name ]", + "device_class": "Dowiedz się więcej o [Klasach urządzeń](https://www.home-assistant.io/integrations/homeassistant/#device-class)", + "state_class": "Dowiedz się więcej o [Klasach stanów](https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes)" + } + } + } + }, + "title": "LocalTuya" +} \ No newline at end of file diff --git a/custom_components/localtuya/translations/pt-BR.json b/custom_components/localtuya/translations/pt-BR.json index 74884ee6..e9fd7723 100644 --- a/custom_components/localtuya/translations/pt-BR.json +++ b/custom_components/localtuya/translations/pt-BR.json @@ -1,216 +1,255 @@ { "config": { "abort": { - "already_configured": "O dispositivo já foi configurado.", - "device_updated": "A configuração do dispositivo foi atualizada!" + "already_configured": "Esta conta já foi configurada.", + "device_updated": "A configuração do dispositivo foi atualizada." }, "error": { - "authentication_failed": "Falha ao autenticar.\n{msg}", - "cannot_connect": "Não é possível se conectar ao dispositivo. Verifique se o endereço está correto e tente novamente", + "authentication_failed": "Falha na autenticação.\n{msg}", + "cannot_connect": "Não é possível se conectar ao dispositivo. Confirme se o Endereço IP está correto e tente novamente.", "device_list_failed": "Falha ao recuperar a lista de dispositivos.\n{msg}", - "invalid_auth": "Falha ao autenticar com o dispositivo. Verifique se o ID do dispositivo e a chave local estão corretos.", - "unknown": "Ocorreu um erro desconhecido. Consulte o registro para obter detalhes.", - "entity_already_configured": "A entidade com este ID já foi configurada.", - "address_in_use": "AddresO endereço usado para descoberta já está em uso. Certifique-se de que nenhum outro aplicativo o esteja usando (porta TCP 6668).s used for discovery is already in use. Make sure no other application is using it (TCP port 6668).", - "discovery_failed": "Algo falhou ao descobrir dispositivos. Consulte o registro para obter detalhes.", - "empty_dps": "A conexão com o dispositivo foi bem-sucedida, mas nenhum ponto de dados foi encontrado. Tente novamente. Crie um novo issue e inclua os logs de depuração se o problema persistir." + "invalid_auth": "Falha na autenticação do dispositivo. Confirme se o ID do Dispositivo e a Chave Local estão corretos.", + "unknown": "Ocorreu um erro desconhecido.\n{ex}.", + "entity_already_configured": "Esta entidade já foi configurada.", + "address_in_use": "A porta TCP 6668 (usada para descoberta) já está em uso. Verifique se nenhuma outra integração a está utilizando.", + "discovery_failed": "Algo falhou ao descobrir dispositivos. Consulte o registro para detalhes. Se o problema persistir, crie um novo problema (incluindo registros de depuração).", + "empty_dps": "A conexão com o dispositivo foi bem-sucedida, mas nenhum ponto de dados pôde ser encontrado. Tente configurar novamente. Se o problema persistir, crie um novo problema (incluindo registros de depuração)." }, "step": { "user": { - "title": "Configuração da conta da API do Cloud", - "description": "Insira as credenciais para a API Tuya Cloud.", + "title": "Configuração da conta da API de Nuvem", + "description": "Configure as credenciais usadas para se conectar à API de Nuvem Tuya.", "data": { - "region": "Região do servidor de API", - "client_id": "ID do cliente", - "client_secret": "Secret", - "user_id": "ID de usuário", - "user_name": "Nome de usuário", - "no_cloud": "Não configure uma conta de API da Cloud" + "region": "Região do Centro de Dados", + "client_id": "ID do Cliente", + "client_secret": "Segredo do Cliente", + "user_id": "ID do Usuário", + "username": "Nome de Usuário", + "no_cloud": "Desativar a API de Nuvem?" } } } }, "options": { "abort": { - "already_configured": "O dispositivo já foi configurado.", - "device_success": "Dispositivo {dev_name} {action} com sucesso.", - "no_entities": "Não é possível remover todas as entidades de um dispositivo.\nSe você deseja excluir um dispositivo, insira-o no menu Dispositivos, clique nos 3 pontos no quadro 'Informações do dispositivo' e pressione o botão Excluir." + "already_configured": "Esta conta já foi configurada.", + "device_success": "Dispositivo {dev_name} configurado com sucesso {action}.", + "no_entities": "Não é possível remover todas as entidades de um dispositivo.\nSe deseja excluir um dispositivo: Acesse o menu 'Dispositivos e serviços', procure seu dispositivo na guia 'Dispositivos', clique nos 3 pontos no quadro 'Informações do Dispositivo' e pressione o botão 'Excluir'." }, "error": { - "authentication_failed": "Falha ao autenticar.\n{msg}", - "cannot_connect": "Não é possível se conectar ao dispositivo. Verifique se o endereço está correto e tente novamente", + "authentication_failed": "Falha na autenticação.\n{msg}", + "cannot_connect": "Não é possível se conectar ao dispositivo. Confirme se o Endereço IP está correto e tente novamente.", "device_list_failed": "Falha ao recuperar a lista de dispositivos.\n{msg}", - "invalid_auth": "Falha ao autenticar com o dispositivo. Verifique se o ID do dispositivo e a chave local estão corretos.", - "unknown": "Ocorreu um erro desconhecido. Consulte o registro para obter detalhes.", - "entity_already_configured": "A entidade com este ID já foi configurada.", - "address_in_use": "O endereço usado para descoberta já está em uso. Certifique-se de que nenhum outro aplicativo o esteja usando (porta TCP 6668).", - "discovery_failed": "Algo falhou ao descobrir dispositivos. Consulte o registro para obter detalhes.", - "empty_dps": "A conexão com o dispositivo foi bem-sucedida, mas nenhum ponto de dados foi encontrado. Tente novamente. Crie um novo issue e inclua os logs de depuração se o problema persistir." + "invalid_auth": "Falha na autenticação do dispositivo. Confirme se o ID do Dispositivo e a Chave Local estão corretos.", + "unknown": "Ocorreu um erro desconhecido.\n{ex}.", + "entity_already_configured": "Esta entidade já foi configurada.", + "address_in_use": "A porta TCP 6668 (usada para descoberta) já está em uso. Verifique se nenhuma outra integração a está utilizando.", + "discovery_failed": "Algo falhou ao descobrir dispositivos. Consulte o registro para detalhes. Se o problema persistir, crie um novo problema (incluindo registros de depuração).", + "empty_dps": "A conexão com o dispositivo foi bem-sucedida, mas nenhum ponto de dados pôde ser encontrado. Tente configurar novamente. Se o problema persistir, crie um novo problema (incluindo registros de depuração)." }, "step": { "yaml_import": { "title": "Não suportado", - "description": "As opções não podem ser editadas quando configuradas via YAML." + "description": "Dispositivos configurados usando `YAML` não podem ser configurados na interface do usuário. Exclua seu dispositivo do `YAML` e recrie-o na interface do usuário ou modifique sua configuração `YAML`." }, "init": { - "title": "Configuração LocalTuya", - "description": "Selecione a ação desejada.", - "data": { - "add_device": "Adicionar um novo dispositivo", - "edit_device": "Editar um dispositivo", - "setup_cloud": "Reconfigurar a conta da API da Cloud" + "title": "Configuração", + "description": "Selecione uma opção para prosseguir.", + "menu_options": { + "add_device": "Adicionar novo dispositivo", + "edit_device": "Reconfigurar dispositivo existente", + "configure_cloud": "Gerenciar conta da API de Nuvem" } }, "add_device": { - "title": "Adicionar um novo dispositivo", - "description": "Escolha um dos dispositivos descobertos automaticamente ou `...` para adicionar um dispositivo manualmente.", + "title": "Escolha o dispositivo para configurar", + "description": "Os dispositivos Tuya compatíveis na sua rede local são descobertos automaticamente depois de configurados no aplicativo Tuya. Se você não conseguir ver o dispositivo esperado, escolha `Add Device Manually` no menu suspenso.", "data": { "selected_device": "Dispositivos descobertos" } }, "edit_device": { - "title": "Editar um novo dispositivo", - "description": "Escolha o dispositivo configurado que você deseja editar.", + "title": "Reconfigurar dispositivo existente", + "description": "Selecione o dispositivo que deseja reconfigurar.", "data": { "selected_device": "Dispositivos configurados" } }, - "cloud_setup": { - "title": "Configuração da conta da API da Cloud", - "description": "Insira as credenciais para a API Tuya Cloud.", + "configure_cloud": { + "title": "Gerenciar conta da API de Nuvem", + "description": "Configure as credenciais usadas para se conectar à API de Nuvem Tuya.", "data": { - "region": "Região do servidor de API", + "region": "Região do Centro de Dados", "client_id": "ID do Cliente", - "client_secret": "Secret", - "user_id": "ID do usuário", - "user_name": "Nome de usuário", - "no_cloud": "Não configure a conta da API da Cloud" + "client_secret": "Segredo do Cliente", + "user_id": "ID do Usuário", + "username": "Nome de Usuário", + "no_cloud": "Desativar a API de Nuvem?" } }, "configure_device": { - "title": "Configurar dispositivo Tuya", - "description": "Preencha os detalhes do dispositivo {for_device}.", + "title": "Configurar conectividade do dispositivo", + "description": "Configure quaisquer detalhes do dispositivo{for_device} que estejam vazios (se houver) para permitir que o LocalTuya se conecte ao dispositivo.", "data": { - "friendly_name": "Nome", - "host": "Host", - "device_id": "ID do dispositivo", - "local_key": "Local key", - "protocol_version": "Versão do protocolo", - "enable_debug": "Ative a depuração para este dispositivo (a depuração também deve ser ativada em configuration.yaml)", - "scan_interval": "Intervalo de escaneamento (segundos, somente quando não estiver atualizando automaticamente)", - "entities": "Entidades (desmarque uma entidade para removê-la)" + "friendly_name": "Nome do Dispositivo", + "host": "Endereço IP", + "device_id": "ID do Dispositivo (device id)", + "local_key": "Chave Local (local key)", + "node_id": "(Opcional) ID do nó de subdispositivos", + "protocol_version": "Versão do Protocolo", + "enable_debug": "Habilitar depuração (deve ser habilitado manualmente em `configuration.yaml` também)", + "scan_interval": "(Opcional) Intervalo de varredura em segundos, se não estiver escaneando automaticamente", + "entities": "Entidades configuradas (desmarque para excluir)", + "add_entities": "Adicionar nova(s) entidade(s)", + "manual_dps_strings": "(Opcional) DPS's Manuais, se não detectados automaticamente (separados por vírgulas)", + "reset_dpids": "(Opcional) DPIDs a serem enviados no comando RESET, se o dispositivo não responder a solicitações de status após ligar (separados por vírgulas)", + "device_sleep_time": "(Optional) Device sleep time in seconds: If the device reports its state, then it goes into sleep", + "export_config": "Salvar configuração de entidade como modelo" + } + }, + "device_setup_method": { + "title": "Configurar entidades do dispositivo", + "description": "O LocalTuya tentará descobrir o restante da configuração automaticamente. No entanto, se isso não funcionar para o seu dispositivo ou se desejar ajustar configurações, escolha a opção `manual`.", + "menu_options": { + "auto_configure_device":"Descobrir entidades do dispositivo automaticamente", + "pick_entity_type": "Configurar entidades do dispositivo manualmente", + "choose_template":"Usar modelo salvo" + } + }, + "auto_configure_device": { + "title": "Configuração automática", + "description": "Ocorreu um erro: {err_msg}. Se o motivo não estiver sendo exibido, verifique os registros.", + "menu_options": { + "device_setup_method":"Voltar ao método de configuração" } }, "pick_entity_type": { "title": "Seleção do tipo de entidade", "description": "Escolha o tipo de entidade que deseja adicionar.", "data": { - "platform_to_add": "Plataforma", - "no_additional_entities": "Não adicione mais entidades" + "platform_to_add": "Escolher entidade", + "no_additional_entities": "Terminar de configurar as entidades", + "use_template" : "Importar arquivo de modelo" } }, - "configure_entity": { - "title": "Configurar entidade", - "description": "Por favor, preencha os detalhes de {entity} com o tipo `{platform}`. Todas as configurações, exceto `ID`, podem ser alteradas na página Opções posteriormente.", + "choose_template":{ + "title": "Importar arquivo de modelo", + "description": "Os arquivos de modelo estão localizados no diretório 'templates' ([Mais Informações](https://github.com/xZetsubou/hass-localtuya/discussions/13)).", "data": { - "id": "ID", - "friendly_name": "Nome fantasia", - "current": "Atual", - "current_consumption": "Consumo atual", - "voltage": "Voltagem", - "commands_set": "Conjunto de comandos Abrir_Fechar_Parar", - "positioning_mode": "Modo de posicionamento", - "current_position_dp": "Posição atual (somente para o modo *posição*)", - "set_position_dp": "Definir posição (somente para o modo *posição*)", - "position_inverted": "Inverter 0-100 posição (somente para o modo *posição*)", - "span_time": "Tempo de abertura completo, em segundos. (somente para o modo *temporizado*)", - "unit_of_measurement": "Unidade de medida", - "device_class": "Classe do dispositivo", - "scaling": "Fator de escala", - "state_on": "Valor ligado", - "state_off": "Valor desligado", - "powergo_dp": "Potência DP (Geralmente 25 ou 2)", - "idle_status_value": "Status ocioso (separado por vírgula)", - "returning_status_value": "Status de retorno", - "docked_status_value": "Status encaixado (separado por vírgula)", - "fault_dp": "Falha DP (Geralmente 11)", - "battery_dp": "Status da bateria DP (normalmente 14)", - "mode_dp": "Modo DP (Geralmente 27)", - "modes": "Lista de modos", - "return_mode": "Modo de retorno para casa", - "fan_speed_dp": "Velocidades do ventilador DP (normalmente 30)", - "fan_speeds": "Lista de velocidades do ventilador (separadas por vírgulas)", - "clean_time_dp": "Tempo Limpo DP (Geralmente 33)", - "clean_area_dp": "Área Limpa DP (Geralmente 32)", - "clean_record_dp": "Limpar Registro DP (Geralmente 34)", - "locate_dp": "Localize DP (Geralmente 31)", - "paused_state": "Estado de pausa (pausa, pausado, etc)", - "stop_status": "Status de parada", - "brightness": "Brilho (somente para cor branca)", - "brightness_lower": "Valor mais baixo de brilho", - "brightness_upper": "Valor superior de brilho", - "color_temp": "Temperatura da cor", - "color_temp_reverse": "Temperatura da cor reversa", - "color": "Cor", - "color_mode": "Modo de cor", - "color_temp_min_kelvin": "Temperatura de cor mínima em K", - "color_temp_max_kelvin": "Temperatura máxima de cor em K", - "music_mode": "Modo de música disponível", - "scene": "Cena", - "select_options": "Entradas válidas, entradas separadas por um ;", - "select_options_friendly": "Opções fantasia ​​ao usuário, entradas separadas por um ;", - "fan_speed_control": "Dps de controle de velocidade do ventilador", - "fan_oscillating_control": "Dps de controle oscilante do ventilador", - "fan_speed_min": "Velocidade mínima do ventilador inteiro", - "fan_speed_max": "Velocidade máxima do ventilador inteiro", - "fan_speed_ordered_list": "Lista de modos de velocidade do ventilador (substitui a velocidade min/max)", - "fan_direction":"Direção do ventilador dps", - "fan_direction_forward": "Seqüência de dps para frente", - "fan_direction_reverse": "String dps reversa", - "current_temperature_dp": "Temperatura atual", - "target_temperature_dp": "Temperatura alvo", - "temperature_step": "Etapa de temperatura (opcional)", - "max_temperature_dp": "Temperatura máxima (opcional)", - "min_temperature_dp": "Temperatura mínima (opcional)", - "precision": "Precisão (opcional, para valores de DPs)", - "target_precision": "Precisão do alvo (opcional, para valores de DPs)", - "temperature_unit": "Unidade de Temperatura (opcional)", - "hvac_mode_dp": "Modo HVAC DP (opcional)", - "hvac_mode_set": "Conjunto de modo HVAC (opcional)", - "hvac_action_dp": "Ação atual de HVAC DP (opcional)", - "hvac_action_set": "Conjunto de ação atual HVAC (opcional)", - "preset_dp": "Predefinições DP (opcional)", - "preset_set": "Conjunto de predefinições (opcional)", - "eco_dp": "Eco DP (opcional)", - "eco_value": "Valor eco (opcional)", - "heuristic_action": "Ativar ação heurística (opcional)" + "templates": "Escolher modelo" } - } - } - }, - "services": { - "reload": { - "name": "Reload", - "description": "Reload localtuya and reconnect to all devices." - }, - "set_dp": { - "name": "Set datapoint", - "description": "Change the value of a datapoint (DP)", - "fields": { - "device_id": { - "name": "Device ID", - "description": "Device ID of device to change datapoint value for" - }, - "dp": { - "name": "DP", - "description": "Datapoint index" + }, + "configure_entity": { + "title": "Configure entity", + "description": "Please fill out the details for {entity} with type {platform}. All settings (except for `Type` and `ID`) can be changed from the `Configure` page later.", + "data": { + "id": "DP ID", + "friendly_name": "Friendly name for Entity", + "current": "Current", + "current_consumption": "Current Consumption", + "voltage": "Voltage", + "commands_set": "Open_Close_Stop Commands Set", + "positioning_mode": "Positioning mode", + "current_position_dp": "Current Position (for *position* mode only)", + "set_position_dp": "Set Position (for *position* mode only)", + "stop_switch_dp": "(Optional) Stop switch (if the cover has continue command?)", + "position_inverted": "Invert 0-100 position (for *position* mode only)", + "span_time": "Full opening time, in secs. (for *timed* mode only)", + "unit_of_measurement": "(Optional) Unit of Measurement", + "device_class": "(Optional) Device Class", + "state_class": "(Optional) State Class", + "scaling": "(Optional) Scaling Factor", + "state_on": "On Value", + "state_off": "Off Value", + "powergo_dp": "Power DP (usually 25 or 2)", + "idle_status_value": "Idle Status (comma-separated)", + "returning_status_value": "Returning Status (comma-separated)", + "docked_status_value": "Docked Status (comma-separated)", + "fault_dp": "Fault DP (usually 11)", + "battery_dp": "Battery status DP (usually 14)", + "mode_dp": "Mode DP ", + "modes": "Modes list", + "return_mode": "Return home mode", + "fan_speed_dp": "(Optional) Fan speeds DP", + "fan_speeds": "Fan speeds list (comma-separated)", + "clean_time_dp": "Clean Time DP (usually 33)", + "clean_area_dp": "Clean Area DP (usually 32)", + "clean_record_dp": "Clean Record DP (usually 34)", + "locate_dp": "Locate DP (usually 31)", + "pause_dp":"Pause DP", + "paused_state": "Pause state (pause, paused, etc)", + "stop_status": "Stop status", + "brightness": "Brightness (only for white color)", + "brightness_lower": "Brightness Lower Value", + "brightness_upper": "Brightness Upper Value", + "color_temp": "Color Temperature", + "color_temp_reverse": "Reverse Color Temperature?", + "color": "Color", + "color_mode": "Color Mode aka Work Mode", + "color_temp_min_kelvin": "Minimum Color Temperature in K", + "color_temp_max_kelvin": "Maximum Color Temperature in K", + "music_mode": "Music mode available?", + "scene": "Scene", + "scene_values": "(Optional) Scene values", + "select_options": "Select options values", + "fan_speed_control": "Fan Speed Control DP", + "fan_oscillating_control": "Fan Oscillating Control DP", + "fan_speed_min": "minimum fan speed integer", + "fan_speed_max": "maximum fan speed integer", + "fan_speed_ordered_list": "Fan speed list (overrides speed min/max), separate entries by comma ','", + "fan_direction":"Fan Direction DP", + "fan_direction_forward": "Forward DP string", + "fan_direction_reverse": "Reverse DP string", + "fan_dps_type": "DP value type", + "current_temperature_dp": "Current Temperature", + "target_temperature_dp": "Target Temperature", + "temperature_step": "(Optional) Temperature Step", + "min_temperature": "Min Temperature", + "max_temperature": "Max Temperature", + "precision": "Precision (optional, for DPs values)", + "target_precision": "Target Precision (optional, for DP values)", + "temperature_unit": "(Optional) Temperature Unit", + "hvac_mode_dp": "(Optional) HVAC Mode DP", + "hvac_mode_set": "(Optional) HVAC Modes", + "hvac_add_off": "(Optional) Include `OFF` in HVAC Modes", + "hvac_action_dp": "(Optional) HVAC Current Action DP", + "hvac_action_set": "(Optional) HVAC Actions", + "preset_dp": "(Optional) Presets DP", + "preset_set": "(Optional) Presets", + "fan_speed_list": "(Optional) Fan supported speeds, separate entries by comma ','", + "eco_dp": "(Optional) Eco DP", + "eco_value": "(Optional) Eco value", + "heuristic_action": "(Optional) Enable heuristic action", + "dps_default_value": "(Optional) Default value when un-initialised", + "restore_on_reconnect": "Restore the last value set in Home Assistant after lost connection?", + "min_value": "Minimum Value", + "max_value": "Maximum Value", + "step_size": "Minimum increment between numbers", + "is_passive_entity": "Passive entity? (requires integration to send initialisation value)", + "entity_category": "Show the entity in this category", + "humidifier_available_modes": "(Optional) Available modes in the device", + "humidifier_current_humidity_dp": "(Optional) Current Humidity DP", + "humidifier_mode_dp": "(Optional) Set mode DP", + "humidifier_set_humidity_dp": "(Optional) Set Humidity DP", + "min_humidity": "Set the minimum supported humidity", + "max_humidity": "Set the maximum supported humidity", + "alarm_supported_states": "States supported by the device", + "receive_dp":"Receiving signals DP. (default is 202)", + "key_study_dp":"(Optional) Key Study DP (usually 7)" }, - "value": { - "name": "Value", - "description": "New value to set" + "data_description": { + "hvac_mode_set":"Each line represents [ hvac_mode: device_value ] [Supported HVAC Modes](https://developers.home-assistant.io/docs/core/entity/climate/#hvac-modes)", + "hvac_action_set":"Each line represents [ hvac_action: device_value ] [Supported HVAC Actions](https://developers.home-assistant.io/docs/core/entity/climate/#hvac-action)", + "preset_set":"Each line represents [ device_value: friendly name ]", + "scene_values":"Each line represents [ device_value: friendly name ]", + "select_options":"Each line represents [ device_value: friendly name ]", + "alarm_supported_states":"Each line represents [ supported state: device value ] [Supported States](https://developers.home-assistant.io/docs/core/entity/alarm-control-panel/#states)", + "humidifier_available_modes":"Each line represents [ device_value: friendly name ]", + "device_class": "Find out more about [Device Classes](https://www.home-assistant.io/integrations/homeassistant/#device-class)", + "state_class": "Find out more about [State Classes](https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes)" } } } }, "title": "LocalTuya" -} +} \ No newline at end of file diff --git a/custom_components/localtuya/vacuum.py b/custom_components/localtuya/vacuum.py index 11e7a61e..330588c1 100644 --- a/custom_components/localtuya/vacuum.py +++ b/custom_components/localtuya/vacuum.py @@ -1,6 +1,8 @@ """Platform to locally control Tuya-based vacuum devices.""" + import logging from functools import partial +from .config_flow import col_to_select import voluptuous as vol from homeassistant.components.vacuum import ( @@ -11,10 +13,11 @@ STATE_IDLE, STATE_PAUSED, STATE_RETURNING, - StateVacuumEntity, VacuumEntityFeature, + VacuumEntityFeature, + StateVacuumEntity, ) -from .common import LocalTuyaEntity, async_setup_entry +from .entity import LocalTuyaEntity, async_setup_entry from .const import ( CONF_BATTERY_DP, CONF_CLEAN_AREA_DP, @@ -33,6 +36,7 @@ CONF_RETURN_MODE, CONF_RETURNING_STATUS_VALUE, CONF_STOP_STATUS, + CONF_PAUSE_DP, ) _LOGGER = logging.getLogger(__name__) @@ -45,8 +49,8 @@ FAULT = "fault" DEFAULT_IDLE_STATUS = "standby,sleep" -DEFAULT_RETURNING_STATUS = "docking" -DEFAULT_DOCKED_STATUS = "charging,chargecompleted" +DEFAULT_RETURNING_STATUS = "docking,to_charge,goto_charge" +DEFAULT_DOCKED_STATUS = "charging,chargecompleted,charge_done" DEFAULT_MODES = "smart,wall_follow,spiral,single" DEFAULT_FAN_SPEEDS = "low,normal,high" DEFAULT_PAUSED_STATE = "paused" @@ -57,33 +61,34 @@ def flow_schema(dps): """Return schema used in config flow.""" return { + vol.Required(CONF_POWERGO_DP): col_to_select(dps, is_dps=True), vol.Required(CONF_IDLE_STATUS_VALUE, default=DEFAULT_IDLE_STATUS): str, - vol.Required(CONF_POWERGO_DP): vol.In(dps), vol.Required(CONF_DOCKED_STATUS_VALUE, default=DEFAULT_DOCKED_STATUS): str, vol.Optional( CONF_RETURNING_STATUS_VALUE, default=DEFAULT_RETURNING_STATUS ): str, - vol.Optional(CONF_BATTERY_DP): vol.In(dps), - vol.Optional(CONF_MODE_DP): vol.In(dps), + vol.Optional(CONF_PAUSED_STATE, default=DEFAULT_PAUSED_STATE): str, + vol.Optional(CONF_STOP_STATUS, default=DEFAULT_STOP_STATUS): str, + vol.Optional(CONF_PAUSE_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_BATTERY_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_MODE_DP): col_to_select(dps, is_dps=True), vol.Optional(CONF_MODES, default=DEFAULT_MODES): str, vol.Optional(CONF_RETURN_MODE, default=DEFAULT_RETURN_MODE): str, - vol.Optional(CONF_FAN_SPEED_DP): vol.In(dps), + vol.Optional(CONF_FAN_SPEED_DP): col_to_select(dps, is_dps=True), vol.Optional(CONF_FAN_SPEEDS, default=DEFAULT_FAN_SPEEDS): str, - vol.Optional(CONF_CLEAN_TIME_DP): vol.In(dps), - vol.Optional(CONF_CLEAN_AREA_DP): vol.In(dps), - vol.Optional(CONF_CLEAN_RECORD_DP): vol.In(dps), - vol.Optional(CONF_LOCATE_DP): vol.In(dps), - vol.Optional(CONF_FAULT_DP): vol.In(dps), - vol.Optional(CONF_PAUSED_STATE, default=DEFAULT_PAUSED_STATE): str, - vol.Optional(CONF_STOP_STATUS, default=DEFAULT_STOP_STATUS): str, + vol.Optional(CONF_CLEAN_TIME_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_CLEAN_AREA_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_CLEAN_RECORD_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_LOCATE_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_FAULT_DP): col_to_select(dps, is_dps=True), } -class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity): +class LocalTuyaVacuum(LocalTuyaEntity, StateVacuumEntity): """Tuya vacuum device.""" def __init__(self, device, config_entry, switchid, **kwargs): - """Initialize a new LocaltuyaVacuum.""" + """Initialize a new LocalTuyaVacuum.""" super().__init__(device, config_entry, switchid, _LOGGER, **kwargs) self._state = None self._battery_level = None @@ -91,27 +96,35 @@ def __init__(self, device, config_entry, switchid, **kwargs): self._idle_status_list = [] if self.has_config(CONF_IDLE_STATUS_VALUE): - self._idle_status_list = self._config[CONF_IDLE_STATUS_VALUE].split(",") + status = self._config[CONF_IDLE_STATUS_VALUE].split(",") + self._idle_status_list = [state.lstrip() for state in status] self._modes_list = [] if self.has_config(CONF_MODES): - self._modes_list = self._config[CONF_MODES].split(",") + modes_list = self._config[CONF_MODES].split(",") + self._modes_list = [mode.lstrip() for mode in modes_list] self._attrs[MODES_LIST] = self._modes_list + self._returning_status_list = [] + if self.has_config(CONF_RETURNING_STATUS_VALUE): + returning_status = self._config[CONF_RETURNING_STATUS_VALUE].split(",") + self._returning_status_list = [state.lstrip() for state in returning_status] + self._docked_status_list = [] if self.has_config(CONF_DOCKED_STATUS_VALUE): - self._docked_status_list = self._config[CONF_DOCKED_STATUS_VALUE].split(",") + docked_status = self._config[CONF_DOCKED_STATUS_VALUE].split(",") + self._docked_status_list = [state.lstrip() for state in docked_status] self._fan_speed_list = [] if self.has_config(CONF_FAN_SPEEDS): - self._fan_speed_list = self._config[CONF_FAN_SPEEDS].split(",") + fan_speeds = self._config[CONF_FAN_SPEEDS].split(",") + self._fan_speed_list = [speed.lstrip() for speed in fan_speeds] self._fan_speed = "" self._cleaning_mode = "" - _LOGGER.debug("Initialized vacuum [%s]", self.name) @property - def supported_features(self): + def supported_features(self) -> VacuumEntityFeature: """Flag supported features.""" supported_features = ( VacuumEntityFeature.START @@ -121,14 +134,17 @@ def supported_features(self): | VacuumEntityFeature.STATE ) - if self.has_config(CONF_RETURN_MODE): - supported_features = supported_features | VacuumEntityFeature.RETURN_HOME + if ( + self.has_config(CONF_RETURN_MODE) + and self._config[CONF_RETURN_MODE] in self._modes_list + ): + supported_features |= VacuumEntityFeature.RETURN_HOME if self.has_config(CONF_FAN_SPEED_DP): - supported_features = supported_features | VacuumEntityFeature.FAN_SPEED + supported_features |= VacuumEntityFeature.FAN_SPEED if self.has_config(CONF_BATTERY_DP): - supported_features = supported_features | VacuumEntityFeature.BATTERY + supported_features |= VacuumEntityFeature.BATTERY if self.has_config(CONF_LOCATE_DP): - supported_features = supported_features | VacuumEntityFeature.LOCATE + supported_features |= VacuumEntityFeature.LOCATE return supported_features @@ -161,9 +177,25 @@ async def async_start(self, **kwargs): """Turn the vacuum on and start cleaning.""" await self._device.set_dp(True, self._config[CONF_POWERGO_DP]) + async def async_stop(self, **kwargs): + """Turn the vacuum off stopping the cleaning.""" + if ( + self.has_config(CONF_STOP_STATUS) + and self._config[CONF_STOP_STATUS] in self._modes_list + ): + await self._device.set_dp( + self._config[CONF_STOP_STATUS], self._config[CONF_MODE_DP] + ) + else: + await self._device.set_dp(False, self._config[CONF_POWERGO_DP]) + # _LOGGER.error("Missing command for stop in commands set.") + async def async_pause(self, **kwargs): """Stop the vacuum cleaner, do not return to base.""" - await self._device.set_dp(False, self._config[CONF_POWERGO_DP]) + if self.has_config(CONF_PAUSE_DP): + return await self._device.set_dp(True, self._config[CONF_PAUSE_DP]) + + await self.async_stop() async def async_return_to_base(self, **kwargs): """Set the vacuum cleaner to return to the dock.""" @@ -174,15 +206,6 @@ async def async_return_to_base(self, **kwargs): else: _LOGGER.error("Missing command for return home in commands set.") - async def async_stop(self, **kwargs): - """Turn the vacuum off stopping the cleaning.""" - if self.has_config(CONF_STOP_STATUS): - await self._device.set_dp( - self._config[CONF_STOP_STATUS], self._config[CONF_MODE_DP] - ) - else: - _LOGGER.error("Missing command for stop in commands set.") - async def async_clean_spot(self, **kwargs): """Perform a spot clean-up.""" return None @@ -190,7 +213,7 @@ async def async_clean_spot(self, **kwargs): async def async_locate(self, **kwargs): """Locate the vacuum cleaner.""" if self.has_config(CONF_LOCATE_DP): - await self._device.set_dp("", self._config[CONF_LOCATE_DP]) + await self._device.set_dp(True, self._config[CONF_LOCATE_DP]) async def async_set_fan_speed(self, fan_speed, **kwargs): """Set the fan speed.""" @@ -204,44 +227,48 @@ async def async_send_command(self, command, params=None, **kwargs): def status_updated(self): """Device status was updated.""" - state_value = str(self.dps(self._dp_id)) + state_value = str(self.dp_value(self._dp_id)) - if state_value in self._idle_status_list: + if state_value == "None": + self._state = None + elif state_value in self._idle_status_list: self._state = STATE_IDLE elif state_value in self._docked_status_list: self._state = STATE_DOCKED - elif state_value == self._config[CONF_RETURNING_STATUS_VALUE]: + elif state_value in self._returning_status_list: self._state = STATE_RETURNING - elif state_value == self._config[CONF_PAUSED_STATE]: + elif state_value in [self._config[CONF_PAUSED_STATE], "pause"] or ( + not state_value and self.dp_value(CONF_PAUSE_DP) is True + ): self._state = STATE_PAUSED else: self._state = STATE_CLEANING if self.has_config(CONF_BATTERY_DP): - self._battery_level = self.dps_conf(CONF_BATTERY_DP) + self._battery_level = self.dp_value(CONF_BATTERY_DP) self._cleaning_mode = "" if self.has_config(CONF_MODES): - self._cleaning_mode = self.dps_conf(CONF_MODE_DP) + self._cleaning_mode = self.dp_value(CONF_MODE_DP) self._attrs[MODE] = self._cleaning_mode self._fan_speed = "" if self.has_config(CONF_FAN_SPEEDS): - self._fan_speed = self.dps_conf(CONF_FAN_SPEED_DP) + self._fan_speed = self.dp_value(CONF_FAN_SPEED_DP) if self.has_config(CONF_CLEAN_TIME_DP): - self._attrs[CLEAN_TIME] = self.dps_conf(CONF_CLEAN_TIME_DP) + self._attrs[CLEAN_TIME] = self.dp_value(CONF_CLEAN_TIME_DP) if self.has_config(CONF_CLEAN_AREA_DP): - self._attrs[CLEAN_AREA] = self.dps_conf(CONF_CLEAN_AREA_DP) + self._attrs[CLEAN_AREA] = self.dp_value(CONF_CLEAN_AREA_DP) if self.has_config(CONF_CLEAN_RECORD_DP): - self._attrs[CLEAN_RECORD] = self.dps_conf(CONF_CLEAN_RECORD_DP) + self._attrs[CLEAN_RECORD] = self.dp_value(CONF_CLEAN_RECORD_DP) if self.has_config(CONF_FAULT_DP): - self._attrs[FAULT] = self.dps_conf(CONF_FAULT_DP) + self._attrs[FAULT] = self.dp_value(CONF_FAULT_DP) if self._attrs[FAULT] != 0: self._state = STATE_ERROR -async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaVacuum, flow_schema) +async_setup_entry = partial(async_setup_entry, DOMAIN, LocalTuyaVacuum, flow_schema) diff --git a/custom_components/localtuya/water_heater.py b/custom_components/localtuya/water_heater.py new file mode 100644 index 00000000..f2624a4f --- /dev/null +++ b/custom_components/localtuya/water_heater.py @@ -0,0 +1,243 @@ +"""Platform to locally control Tuya-based WaterHeater devices.""" + +import logging +from functools import partial +from .config_flow import col_to_select +from homeassistant.helpers import selector + +import voluptuous as vol +from homeassistant.components.water_heater import ( + DEFAULT_MIN_TEMP, + DEFAULT_MAX_TEMP, + DOMAIN, + WaterHeaterEntity, + WaterHeaterEntityFeature, +) +from homeassistant.components.water_heater.const import ( + STATE_ECO, + STATE_ELECTRIC, + STATE_PERFORMANCE, + STATE_HIGH_DEMAND, + STATE_HEAT_PUMP, + STATE_GAS, +) +from homeassistant.const import ( + ATTR_TEMPERATURE, + CONF_TEMPERATURE_UNIT, + PRECISION_HALVES, + PRECISION_TENTHS, + PRECISION_WHOLE, + UnitOfTemperature, +) +from .entity import LocalTuyaEntity, async_setup_entry +from .const import ( + CONF_TARGET_TEMPERATURE_DP, + CONF_CURRENT_TEMPERATURE_DP, + CONF_MIN_TEMP, + CONF_MAX_TEMP, + CONF_PRECISION, + CONF_TARGET_PRECISION, + CONF_MODE_DP, + CONF_MODES, + CONF_TARGET_TEMPERATURE_LOW_DP, + CONF_TARGET_TEMPERATURE_HIGH_DP, +) + +_LOGGER = logging.getLogger(__name__) + + +TEMPERATURE_CELSIUS = "celsius" +TEMPERATURE_FAHRENHEIT = "fahrenheit" + +DEFAULT_TEMPERATURE_UNIT = TEMPERATURE_CELSIUS +DEFAULT_PRECISION = PRECISION_TENTHS +DEFAULT_TEMPERATURE_STEP = PRECISION_HALVES +PERCISION_SET = [PRECISION_WHOLE, PRECISION_HALVES, PRECISION_TENTHS] + +OFF_MODE = "Off" + + +def flow_schema(dps): + """Return schema used in config flow.""" + return { + vol.Optional(CONF_TARGET_TEMPERATURE_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_TARGET_TEMPERATURE_LOW_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_TARGET_TEMPERATURE_HIGH_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_CURRENT_TEMPERATURE_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_MIN_TEMP, default=DEFAULT_MIN_TEMP): vol.Coerce(float), + vol.Optional(CONF_MAX_TEMP, default=DEFAULT_MAX_TEMP): vol.Coerce(float), + vol.Optional(CONF_PRECISION, default=str(DEFAULT_PRECISION)): col_to_select( + PERCISION_SET + ), + vol.Optional( + CONF_TARGET_PRECISION, default=str(DEFAULT_PRECISION) + ): col_to_select(PERCISION_SET), + vol.Optional(CONF_MODE_DP): col_to_select(dps, is_dps=True), + vol.Optional(CONF_MODES, default={}): selector.ObjectSelector(), + vol.Optional(CONF_TEMPERATURE_UNIT): col_to_select( + [TEMPERATURE_CELSIUS, TEMPERATURE_FAHRENHEIT] + ), + } + + +def config_unit(unit): + if unit == TEMPERATURE_FAHRENHEIT: + return UnitOfTemperature.FAHRENHEIT + else: + return UnitOfTemperature.CELSIUS + + +class LocalTuyaWaterHeater(LocalTuyaEntity, WaterHeaterEntity): + """Tuya WaterHeater device.""" + + _enable_turn_on_off_backwards_compatibility = False + + def __init__( + self, + device, + config_entry, + switchid, + **kwargs, + ): + """Initialize a new LocalTuyaWaterHeater.""" + super().__init__(device, config_entry, switchid, _LOGGER, **kwargs) + self._state = None + self._target_temperature = None + self._current_temperature = None + self._dp_mode = self._config.get(CONF_MODE_DP, None) + + self._available_modes = self._config.get(CONF_MODES, {}) + self._modes_name_to_value = {v: k for k, v in self._available_modes.items()} + + self._precision = float(self._config.get(CONF_PRECISION, DEFAULT_PRECISION)) + self._precision_target = float( + self._config.get(CONF_TARGET_PRECISION, DEFAULT_PRECISION) + ) + + @property + def supported_features(self): + """Flag supported features.""" + supported_features = WaterHeaterEntityFeature(0) + if self.has_config(CONF_TARGET_TEMPERATURE_DP): + supported_features |= WaterHeaterEntityFeature.TARGET_TEMPERATURE + if self.has_config(CONF_MODE_DP): + supported_features |= WaterHeaterEntityFeature.OPERATION_MODE + + supported_features |= WaterHeaterEntityFeature.ON_OFF + + return supported_features + + @property + def precision(self): + """Return the precision of the system.""" + return self._precision + + @property + def temperature_unit(self): + """Return the unit of measurement used by the platform.""" + return config_unit(self._config.get(CONF_TEMPERATURE_UNIT)) + + @property + def min_temp(self): + """Return the minimum temperature.""" + return self._config.get(CONF_MIN_TEMP, DEFAULT_MIN_TEMP) + + @property + def max_temp(self): + """Return the maximum temperature.""" + return self._config.get(CONF_MAX_TEMP, DEFAULT_MAX_TEMP) + + @property + def operation_list(self) -> list[str] | None: + """Return the list of available operation modes.""" + return list(self._modes_name_to_value) + [OFF_MODE] + + @property + def current_temperature(self): + """Return the current temperature.""" + return self._current_temperature + + @property + def target_temperature(self): + """Return the temperature we try to reach.""" + return self._target_temperature + + @property + def target_temperature_high(self) -> float | None: + """Return the highbound target temperature we try to reach.""" + return self._attr_target_temperature_high + + @property + def target_temperature_low(self) -> float | None: + """Return the lowbound target temperature we try to reach.""" + return self._attr_target_temperature_low + + async def async_set_temperature(self, **kwargs): + """Set new target temperature.""" + if ATTR_TEMPERATURE in kwargs and self.has_config(CONF_TARGET_TEMPERATURE_DP): + temperature = kwargs[ATTR_TEMPERATURE] + + temperature = round(temperature / self._precision_target) + await self._device.set_dp( + temperature, self._config[CONF_TARGET_TEMPERATURE_DP] + ) + + async def async_set_operation_mode(self, operation_mode: str) -> None: + """Set new target operation mode.""" + status = {} + if operation_mode == OFF_MODE: + return await self.async_turn_off() + elif not self._state: + status[self._dp_id] = True + + mode = self._modes_name_to_value.get(operation_mode) + status[self._dp_mode] = mode + + await self._device.set_dps(status) + + async def async_turn_on(self) -> None: + """Turn the entity on.""" + await self._device.set_dp(True, self._dp_id) + + async def async_turn_off(self) -> None: + """Turn the entity off.""" + await self._device.set_dp(False, self._dp_id) + + def status_updated(self): + """Device status was updated.""" + self._state = self.dp_value(self._dp_id) + + # Update target temperature + if self.has_config(CONF_TARGET_TEMPERATURE_DP): + self._target_temperature = ( + self.dp_value(CONF_TARGET_TEMPERATURE_DP) * self._precision_target + ) + + # Update current temperature + if self.has_config(CONF_CURRENT_TEMPERATURE_DP): + self._current_temperature = ( + self.dp_value(CONF_CURRENT_TEMPERATURE_DP) * self._precision + ) + + # Update modes states + if not self._state: + self._attr_current_operation = OFF_MODE + elif self._dp_mode is not None: + for mode_value, mode_name in self._available_modes.items(): + if str(self.dp_value(CONF_MODE_DP)) == str(mode_value): + self._attr_current_operation = mode_name + + if ( + target_high := self.dp_value(CONF_TARGET_TEMPERATURE_HIGH_DP) + ) or target_high is not None: + self._attr_target_temperature_high = target_high + + if ( + target_low := self.dp_value(CONF_TARGET_TEMPERATURE_LOW_DP) + ) or target_low is not None: + self._attr_target_temperature_low = target_low + + +async_setup_entry = partial( + async_setup_entry, DOMAIN, LocalTuyaWaterHeater, flow_schema +) diff --git a/custom_components/mediabrowser/__pycache__/__init__.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 248bbc03..00000000 Binary files a/custom_components/mediabrowser/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/__init__.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/__init__.cpython-313.pyc index e3ec1e49..f502951f 100644 Binary files a/custom_components/mediabrowser/__pycache__/__init__.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/browse.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/browse.cpython-312.pyc deleted file mode 100644 index 2152dd41..00000000 Binary files a/custom_components/mediabrowser/__pycache__/browse.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/browse.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/browse.cpython-313.pyc index f1005821..5049e16d 100644 Binary files a/custom_components/mediabrowser/__pycache__/browse.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/browse.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/browse_media.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/browse_media.cpython-312.pyc deleted file mode 100644 index 40d7fd8c..00000000 Binary files a/custom_components/mediabrowser/__pycache__/browse_media.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/browse_media.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/browse_media.cpython-313.pyc index 2fecb940..02c4c399 100644 Binary files a/custom_components/mediabrowser/__pycache__/browse_media.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/browse_media.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/button.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/button.cpython-312.pyc deleted file mode 100644 index 715efa3d..00000000 Binary files a/custom_components/mediabrowser/__pycache__/button.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/button.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/button.cpython-313.pyc index 32acb34b..c48792d4 100644 Binary files a/custom_components/mediabrowser/__pycache__/button.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/button.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/config_flow.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index e749f0fd..00000000 Binary files a/custom_components/mediabrowser/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/config_flow.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/config_flow.cpython-313.pyc index ae0241a3..6533a0bd 100644 Binary files a/custom_components/mediabrowser/__pycache__/config_flow.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/const.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/const.cpython-312.pyc deleted file mode 100644 index d8f242e9..00000000 Binary files a/custom_components/mediabrowser/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/const.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/const.cpython-313.pyc index 44c330ec..3bb60c59 100644 Binary files a/custom_components/mediabrowser/__pycache__/const.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/const.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/discovery.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/discovery.cpython-312.pyc deleted file mode 100644 index 87b7c89d..00000000 Binary files a/custom_components/mediabrowser/__pycache__/discovery.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/discovery.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/discovery.cpython-313.pyc index c7498c1f..618bddac 100644 Binary files a/custom_components/mediabrowser/__pycache__/discovery.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/discovery.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/entity.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index a23ff6ae..00000000 Binary files a/custom_components/mediabrowser/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/entity.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/entity.cpython-313.pyc index 1960dc9c..19e83716 100644 Binary files a/custom_components/mediabrowser/__pycache__/entity.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/entity.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/errors.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/errors.cpython-312.pyc deleted file mode 100644 index 45b95a39..00000000 Binary files a/custom_components/mediabrowser/__pycache__/errors.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/errors.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/errors.cpython-313.pyc index 1f649f76..d0c8bba7 100644 Binary files a/custom_components/mediabrowser/__pycache__/errors.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/errors.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/helpers.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/helpers.cpython-312.pyc deleted file mode 100644 index 7718646d..00000000 Binary files a/custom_components/mediabrowser/__pycache__/helpers.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/helpers.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/helpers.cpython-313.pyc index a7922b30..92af8a42 100644 Binary files a/custom_components/mediabrowser/__pycache__/helpers.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/helpers.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/hub.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/hub.cpython-312.pyc deleted file mode 100644 index 5f6fc4eb..00000000 Binary files a/custom_components/mediabrowser/__pycache__/hub.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/hub.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/hub.cpython-313.pyc index a2eec1a8..82d11058 100644 Binary files a/custom_components/mediabrowser/__pycache__/hub.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/hub.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/icons.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/icons.cpython-312.pyc deleted file mode 100644 index e29ce054..00000000 Binary files a/custom_components/mediabrowser/__pycache__/icons.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/icons.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/icons.cpython-313.pyc index aff5705f..ecad8849 100644 Binary files a/custom_components/mediabrowser/__pycache__/icons.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/icons.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/media_player.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/media_player.cpython-312.pyc deleted file mode 100644 index 27a20914..00000000 Binary files a/custom_components/mediabrowser/__pycache__/media_player.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/media_player.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/media_player.cpython-313.pyc index bcf754c6..d9d76471 100644 Binary files a/custom_components/mediabrowser/__pycache__/media_player.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/media_player.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/media_source.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/media_source.cpython-312.pyc deleted file mode 100644 index 5b8d2c5a..00000000 Binary files a/custom_components/mediabrowser/__pycache__/media_source.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/media_source.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/media_source.cpython-313.pyc index 9c10c8d1..16e1e00e 100644 Binary files a/custom_components/mediabrowser/__pycache__/media_source.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/media_source.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/__pycache__/sensor.cpython-312.pyc b/custom_components/mediabrowser/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index c97a3810..00000000 Binary files a/custom_components/mediabrowser/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/mediabrowser/__pycache__/sensor.cpython-313.pyc b/custom_components/mediabrowser/__pycache__/sensor.cpython-313.pyc index 30d3dcb7..40bb040c 100644 Binary files a/custom_components/mediabrowser/__pycache__/sensor.cpython-313.pyc and b/custom_components/mediabrowser/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/mediabrowser/browse.py b/custom_components/mediabrowser/browse.py index 6a818efa..c854fdda 100644 --- a/custom_components/mediabrowser/browse.py +++ b/custom_components/mediabrowser/browse.py @@ -606,10 +606,7 @@ async def get_stream_url( mime_type = ( f"{item_media_type.lower()}/{best.get(MediaSource.CONTAINER)}" ) - if best.get(MediaSource.DIRECT_STREAM_URL): - url = f"{hub.server_url}{best[MediaSource.DIRECT_STREAM_URL]}" - else: - url = f"{hub.server_url}/Videos/{best['Id']}/stream?static=true&DeviceId={hub.device_id}" + url = f"{hub.server_url}{best[MediaSource.DIRECT_STREAM_URL]}" elif best.get(MediaSource.SUPPORTS_TRANSCODING, False): url = f"{hub.server_url}{best[MediaSource.TRANSCODING_URL]}" mime_type = "/".join( diff --git a/custom_components/monitor_docker/__pycache__/__init__.cpython-312.pyc b/custom_components/monitor_docker/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 86167987..00000000 Binary files a/custom_components/monitor_docker/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/monitor_docker/__pycache__/button.cpython-312.pyc b/custom_components/monitor_docker/__pycache__/button.cpython-312.pyc deleted file mode 100644 index 93e7361d..00000000 Binary files a/custom_components/monitor_docker/__pycache__/button.cpython-312.pyc and /dev/null differ diff --git a/custom_components/monitor_docker/__pycache__/const.cpython-312.pyc b/custom_components/monitor_docker/__pycache__/const.cpython-312.pyc deleted file mode 100644 index d91c70cc..00000000 Binary files a/custom_components/monitor_docker/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/monitor_docker/__pycache__/helpers.cpython-312.pyc b/custom_components/monitor_docker/__pycache__/helpers.cpython-312.pyc deleted file mode 100644 index 94a6ceea..00000000 Binary files a/custom_components/monitor_docker/__pycache__/helpers.cpython-312.pyc and /dev/null differ diff --git a/custom_components/monitor_docker/__pycache__/sensor.cpython-312.pyc b/custom_components/monitor_docker/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index efb6279d..00000000 Binary files a/custom_components/monitor_docker/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/monitor_docker/__pycache__/sensor.cpython-313.pyc b/custom_components/monitor_docker/__pycache__/sensor.cpython-313.pyc index 65b90f8e..42596cd9 100644 Binary files a/custom_components/monitor_docker/__pycache__/sensor.cpython-313.pyc and b/custom_components/monitor_docker/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/monitor_docker/__pycache__/switch.cpython-312.pyc b/custom_components/monitor_docker/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index 35413c0d..00000000 Binary files a/custom_components/monitor_docker/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/__init__.cpython-312.pyc b/custom_components/pyscript/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index be2ca6b9..00000000 Binary files a/custom_components/pyscript/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/__init__.cpython-313.pyc b/custom_components/pyscript/__pycache__/__init__.cpython-313.pyc index fc1c9636..3b604efe 100644 Binary files a/custom_components/pyscript/__pycache__/__init__.cpython-313.pyc and b/custom_components/pyscript/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/pyscript/__pycache__/config_flow.cpython-312.pyc b/custom_components/pyscript/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 829fdafc..00000000 Binary files a/custom_components/pyscript/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/config_flow.cpython-313.pyc b/custom_components/pyscript/__pycache__/config_flow.cpython-313.pyc index 23c1cc69..da6b904b 100644 Binary files a/custom_components/pyscript/__pycache__/config_flow.cpython-313.pyc and b/custom_components/pyscript/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/pyscript/__pycache__/const.cpython-312.pyc b/custom_components/pyscript/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 08d8b6ac..00000000 Binary files a/custom_components/pyscript/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/entity.cpython-312.pyc b/custom_components/pyscript/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index 92e735a2..00000000 Binary files a/custom_components/pyscript/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/eval.cpython-312.pyc b/custom_components/pyscript/__pycache__/eval.cpython-312.pyc deleted file mode 100644 index 48b1a530..00000000 Binary files a/custom_components/pyscript/__pycache__/eval.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/eval.cpython-313.pyc b/custom_components/pyscript/__pycache__/eval.cpython-313.pyc index 7982358f..18966bf2 100644 Binary files a/custom_components/pyscript/__pycache__/eval.cpython-313.pyc and b/custom_components/pyscript/__pycache__/eval.cpython-313.pyc differ diff --git a/custom_components/pyscript/__pycache__/event.cpython-312.pyc b/custom_components/pyscript/__pycache__/event.cpython-312.pyc deleted file mode 100644 index 454304bb..00000000 Binary files a/custom_components/pyscript/__pycache__/event.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/function.cpython-312.pyc b/custom_components/pyscript/__pycache__/function.cpython-312.pyc deleted file mode 100644 index b2ac93c1..00000000 Binary files a/custom_components/pyscript/__pycache__/function.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/function.cpython-313.pyc b/custom_components/pyscript/__pycache__/function.cpython-313.pyc index eeb5b000..fb72a600 100644 Binary files a/custom_components/pyscript/__pycache__/function.cpython-313.pyc and b/custom_components/pyscript/__pycache__/function.cpython-313.pyc differ diff --git a/custom_components/pyscript/__pycache__/global_ctx.cpython-312.pyc b/custom_components/pyscript/__pycache__/global_ctx.cpython-312.pyc deleted file mode 100644 index fee9cfd6..00000000 Binary files a/custom_components/pyscript/__pycache__/global_ctx.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/jupyter_kernel.cpython-312.pyc b/custom_components/pyscript/__pycache__/jupyter_kernel.cpython-312.pyc deleted file mode 100644 index 92abd449..00000000 Binary files a/custom_components/pyscript/__pycache__/jupyter_kernel.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/logbook.cpython-312.pyc b/custom_components/pyscript/__pycache__/logbook.cpython-312.pyc deleted file mode 100644 index ab4f8303..00000000 Binary files a/custom_components/pyscript/__pycache__/logbook.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/mqtt.cpython-312.pyc b/custom_components/pyscript/__pycache__/mqtt.cpython-312.pyc deleted file mode 100644 index e51cc439..00000000 Binary files a/custom_components/pyscript/__pycache__/mqtt.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/requirements.cpython-312.pyc b/custom_components/pyscript/__pycache__/requirements.cpython-312.pyc deleted file mode 100644 index 0df4ae25..00000000 Binary files a/custom_components/pyscript/__pycache__/requirements.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/requirements.cpython-313.pyc b/custom_components/pyscript/__pycache__/requirements.cpython-313.pyc index 8b10c853..1b553cbd 100644 Binary files a/custom_components/pyscript/__pycache__/requirements.cpython-313.pyc and b/custom_components/pyscript/__pycache__/requirements.cpython-313.pyc differ diff --git a/custom_components/pyscript/__pycache__/state.cpython-312.pyc b/custom_components/pyscript/__pycache__/state.cpython-312.pyc deleted file mode 100644 index e0b03f7a..00000000 Binary files a/custom_components/pyscript/__pycache__/state.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/state.cpython-313.pyc b/custom_components/pyscript/__pycache__/state.cpython-313.pyc index 2fecc685..9cc85b65 100644 Binary files a/custom_components/pyscript/__pycache__/state.cpython-313.pyc and b/custom_components/pyscript/__pycache__/state.cpython-313.pyc differ diff --git a/custom_components/pyscript/__pycache__/trigger.cpython-312.pyc b/custom_components/pyscript/__pycache__/trigger.cpython-312.pyc deleted file mode 100644 index d2c892c3..00000000 Binary files a/custom_components/pyscript/__pycache__/trigger.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/webhook.cpython-312.pyc b/custom_components/pyscript/__pycache__/webhook.cpython-312.pyc deleted file mode 100644 index 15b2b521..00000000 Binary files a/custom_components/pyscript/__pycache__/webhook.cpython-312.pyc and /dev/null differ diff --git a/custom_components/pyscript/__pycache__/webhook.cpython-313.pyc b/custom_components/pyscript/__pycache__/webhook.cpython-313.pyc index c7d94332..ffe2744a 100644 Binary files a/custom_components/pyscript/__pycache__/webhook.cpython-313.pyc and b/custom_components/pyscript/__pycache__/webhook.cpython-313.pyc differ diff --git a/custom_components/scheduler/__pycache__/__init__.cpython-312.pyc b/custom_components/scheduler/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index bcfdbe2f..00000000 Binary files a/custom_components/scheduler/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/scheduler/__pycache__/__init__.cpython-313.pyc b/custom_components/scheduler/__pycache__/__init__.cpython-313.pyc index 2403f861..023704e5 100644 Binary files a/custom_components/scheduler/__pycache__/__init__.cpython-313.pyc and b/custom_components/scheduler/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/scheduler/__pycache__/actions.cpython-312.pyc b/custom_components/scheduler/__pycache__/actions.cpython-312.pyc deleted file mode 100644 index 38ade4cf..00000000 Binary files a/custom_components/scheduler/__pycache__/actions.cpython-312.pyc and /dev/null differ diff --git a/custom_components/scheduler/__pycache__/actions.cpython-313.pyc b/custom_components/scheduler/__pycache__/actions.cpython-313.pyc index 98969904..beba5238 100644 Binary files a/custom_components/scheduler/__pycache__/actions.cpython-313.pyc and b/custom_components/scheduler/__pycache__/actions.cpython-313.pyc differ diff --git a/custom_components/scheduler/__pycache__/config_flow.cpython-312.pyc b/custom_components/scheduler/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 648718dc..00000000 Binary files a/custom_components/scheduler/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/scheduler/__pycache__/const.cpython-312.pyc b/custom_components/scheduler/__pycache__/const.cpython-312.pyc deleted file mode 100644 index d71f01c8..00000000 Binary files a/custom_components/scheduler/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/scheduler/__pycache__/store.cpython-312.pyc b/custom_components/scheduler/__pycache__/store.cpython-312.pyc deleted file mode 100644 index 421fbaaf..00000000 Binary files a/custom_components/scheduler/__pycache__/store.cpython-312.pyc and /dev/null differ diff --git a/custom_components/scheduler/__pycache__/store.cpython-313.pyc b/custom_components/scheduler/__pycache__/store.cpython-313.pyc index b9da5897..66952595 100644 Binary files a/custom_components/scheduler/__pycache__/store.cpython-313.pyc and b/custom_components/scheduler/__pycache__/store.cpython-313.pyc differ diff --git a/custom_components/scheduler/__pycache__/switch.cpython-312.pyc b/custom_components/scheduler/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index 31eb6000..00000000 Binary files a/custom_components/scheduler/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/scheduler/__pycache__/switch.cpython-313.pyc b/custom_components/scheduler/__pycache__/switch.cpython-313.pyc index 01a1cffc..18752936 100644 Binary files a/custom_components/scheduler/__pycache__/switch.cpython-313.pyc and b/custom_components/scheduler/__pycache__/switch.cpython-313.pyc differ diff --git a/custom_components/scheduler/__pycache__/timer.cpython-312.pyc b/custom_components/scheduler/__pycache__/timer.cpython-312.pyc deleted file mode 100644 index ef92334c..00000000 Binary files a/custom_components/scheduler/__pycache__/timer.cpython-312.pyc and /dev/null differ diff --git a/custom_components/scheduler/__pycache__/timer.cpython-313.pyc b/custom_components/scheduler/__pycache__/timer.cpython-313.pyc index 7ce9dc16..2be652f9 100644 Binary files a/custom_components/scheduler/__pycache__/timer.cpython-313.pyc and b/custom_components/scheduler/__pycache__/timer.cpython-313.pyc differ diff --git a/custom_components/scheduler/__pycache__/websockets.cpython-312.pyc b/custom_components/scheduler/__pycache__/websockets.cpython-312.pyc deleted file mode 100644 index 38e42a02..00000000 Binary files a/custom_components/scheduler/__pycache__/websockets.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index ee9017f1..00000000 Binary files a/custom_components/spook/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/binary_sensor.cpython-312.pyc b/custom_components/spook/__pycache__/binary_sensor.cpython-312.pyc deleted file mode 100644 index 9c80038e..00000000 Binary files a/custom_components/spook/__pycache__/binary_sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/button.cpython-312.pyc b/custom_components/spook/__pycache__/button.cpython-312.pyc deleted file mode 100644 index ebe69b05..00000000 Binary files a/custom_components/spook/__pycache__/button.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/config_flow.cpython-312.pyc b/custom_components/spook/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index ad2cc3eb..00000000 Binary files a/custom_components/spook/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/const.cpython-312.pyc b/custom_components/spook/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 01361b79..00000000 Binary files a/custom_components/spook/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/entity.cpython-312.pyc b/custom_components/spook/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index ff692653..00000000 Binary files a/custom_components/spook/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/event.cpython-312.pyc b/custom_components/spook/__pycache__/event.cpython-312.pyc deleted file mode 100644 index 511f75a2..00000000 Binary files a/custom_components/spook/__pycache__/event.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/number.cpython-312.pyc b/custom_components/spook/__pycache__/number.cpython-312.pyc deleted file mode 100644 index fad2a297..00000000 Binary files a/custom_components/spook/__pycache__/number.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/repairs.cpython-312.pyc b/custom_components/spook/__pycache__/repairs.cpython-312.pyc deleted file mode 100644 index 6b0de84f..00000000 Binary files a/custom_components/spook/__pycache__/repairs.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/repairs.cpython-313.pyc b/custom_components/spook/__pycache__/repairs.cpython-313.pyc index 3537bee5..5bf837d5 100644 Binary files a/custom_components/spook/__pycache__/repairs.cpython-313.pyc and b/custom_components/spook/__pycache__/repairs.cpython-313.pyc differ diff --git a/custom_components/spook/__pycache__/select.cpython-312.pyc b/custom_components/spook/__pycache__/select.cpython-312.pyc deleted file mode 100644 index 078db905..00000000 Binary files a/custom_components/spook/__pycache__/select.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/sensor.cpython-312.pyc b/custom_components/spook/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index f6ff2d20..00000000 Binary files a/custom_components/spook/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/services.cpython-312.pyc b/custom_components/spook/__pycache__/services.cpython-312.pyc deleted file mode 100644 index 5ec1378c..00000000 Binary files a/custom_components/spook/__pycache__/services.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/services.cpython-313.pyc b/custom_components/spook/__pycache__/services.cpython-313.pyc index fa4e7380..eaab6b36 100644 Binary files a/custom_components/spook/__pycache__/services.cpython-313.pyc and b/custom_components/spook/__pycache__/services.cpython-313.pyc differ diff --git a/custom_components/spook/__pycache__/switch.cpython-312.pyc b/custom_components/spook/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index 0699e433..00000000 Binary files a/custom_components/spook/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/templating.cpython-312.pyc b/custom_components/spook/__pycache__/templating.cpython-312.pyc deleted file mode 100644 index 9a043d5d..00000000 Binary files a/custom_components/spook/__pycache__/templating.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/time.cpython-312.pyc b/custom_components/spook/__pycache__/time.cpython-312.pyc deleted file mode 100644 index 2966efa0..00000000 Binary files a/custom_components/spook/__pycache__/time.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/util.cpython-312.pyc b/custom_components/spook/__pycache__/util.cpython-312.pyc deleted file mode 100644 index b0d5acb0..00000000 Binary files a/custom_components/spook/__pycache__/util.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/__pycache__/util.cpython-313.pyc b/custom_components/spook/__pycache__/util.cpython-313.pyc index 58516813..cbc11ffb 100644 Binary files a/custom_components/spook/__pycache__/util.cpython-313.pyc and b/custom_components/spook/__pycache__/util.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index f31577d5..00000000 Binary files a/custom_components/spook/ectoplasms/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/automation/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 793a4b5f..00000000 Binary files a/custom_components/spook/ectoplasms/automation/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 3d1a1114..00000000 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_area_references.cpython-312.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_area_references.cpython-312.pyc deleted file mode 100644 index 9638e0b7..00000000 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_area_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_area_references.cpython-313.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_area_references.cpython-313.pyc index c347faf6..34201412 100644 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_area_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_area_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_device_references.cpython-312.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_device_references.cpython-312.pyc deleted file mode 100644 index e2b39773..00000000 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_device_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_device_references.cpython-313.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_device_references.cpython-313.pyc index b642879a..10973a46 100644 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_device_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_device_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_entity_references.cpython-312.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_entity_references.cpython-312.pyc deleted file mode 100644 index 3b582788..00000000 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_entity_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_entity_references.cpython-313.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_entity_references.cpython-313.pyc index 2b4817d1..e8d7f19c 100644 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_entity_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_entity_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_floor_references.cpython-312.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_floor_references.cpython-312.pyc deleted file mode 100644 index c238ca6d..00000000 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_floor_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_floor_references.cpython-313.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_floor_references.cpython-313.pyc index 12c7ecb8..613631de 100644 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_floor_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_floor_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_label_references.cpython-312.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_label_references.cpython-312.pyc deleted file mode 100644 index 3806871b..00000000 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_label_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_label_references.cpython-313.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_label_references.cpython-313.pyc index 7c345207..18bc3208 100644 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_label_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_label_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_service_references.cpython-312.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_service_references.cpython-312.pyc deleted file mode 100644 index 7757d072..00000000 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_service_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_service_references.cpython-313.pyc b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_service_references.cpython-313.pyc index e3dac993..a1800d99 100644 Binary files a/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_service_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/automation/repairs/__pycache__/unknown_service_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/blueprint/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/blueprint/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 13a8932d..00000000 Binary files a/custom_components/spook/ectoplasms/blueprint/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/blueprint/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/blueprint/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 898adc47..00000000 Binary files a/custom_components/spook/ectoplasms/blueprint/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/blueprint/services/__pycache__/importer.cpython-312.pyc b/custom_components/spook/ectoplasms/blueprint/services/__pycache__/importer.cpython-312.pyc deleted file mode 100644 index 7a1e9204..00000000 Binary files a/custom_components/spook/ectoplasms/blueprint/services/__pycache__/importer.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/cloud/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/cloud/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 3111d9f8..00000000 Binary files a/custom_components/spook/ectoplasms/cloud/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/cloud/__pycache__/entity.cpython-312.pyc b/custom_components/spook/ectoplasms/cloud/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index e71c3e84..00000000 Binary files a/custom_components/spook/ectoplasms/cloud/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/cloud/__pycache__/switch.cpython-312.pyc b/custom_components/spook/ectoplasms/cloud/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index 524d3d93..00000000 Binary files a/custom_components/spook/ectoplasms/cloud/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/cloud/__pycache__/switch.cpython-313.pyc b/custom_components/spook/ectoplasms/cloud/__pycache__/switch.cpython-313.pyc index b13380dd..1902b699 100644 Binary files a/custom_components/spook/ectoplasms/cloud/__pycache__/switch.cpython-313.pyc and b/custom_components/spook/ectoplasms/cloud/__pycache__/switch.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/group/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/group/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 1ca46743..00000000 Binary files a/custom_components/spook/ectoplasms/group/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/group/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/group/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index ffc41f57..00000000 Binary files a/custom_components/spook/ectoplasms/group/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/group/repairs/__pycache__/unknown_members.cpython-312.pyc b/custom_components/spook/ectoplasms/group/repairs/__pycache__/unknown_members.cpython-312.pyc deleted file mode 100644 index 965f70a3..00000000 Binary files a/custom_components/spook/ectoplasms/group/repairs/__pycache__/unknown_members.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/group/repairs/__pycache__/unknown_members.cpython-313.pyc b/custom_components/spook/ectoplasms/group/repairs/__pycache__/unknown_members.cpython-313.pyc index a4e7cb70..5e872bc8 100644 Binary files a/custom_components/spook/ectoplasms/group/repairs/__pycache__/unknown_members.cpython-313.pyc and b/custom_components/spook/ectoplasms/group/repairs/__pycache__/unknown_members.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/homeassistant/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a6948a5f..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/__pycache__/button.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/__pycache__/button.cpython-312.pyc deleted file mode 100644 index ebea5752..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/__pycache__/button.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/__pycache__/button.cpython-313.pyc b/custom_components/spook/ectoplasms/homeassistant/__pycache__/button.cpython-313.pyc index 764b928e..5dc5e7c6 100644 Binary files a/custom_components/spook/ectoplasms/homeassistant/__pycache__/button.cpython-313.pyc and b/custom_components/spook/ectoplasms/homeassistant/__pycache__/button.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/homeassistant/__pycache__/entity.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index ecc3fa68..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/__pycache__/sensor.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index a462403c..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/__pycache__/sensor.cpython-313.pyc b/custom_components/spook/ectoplasms/homeassistant/__pycache__/sensor.cpython-313.pyc index 67c7ee4e..531bd721 100644 Binary files a/custom_components/spook/ectoplasms/homeassistant/__pycache__/sensor.cpython-313.pyc and b/custom_components/spook/ectoplasms/homeassistant/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index b14c617f..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_alias_to_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_alias_to_area.cpython-312.pyc deleted file mode 100644 index 8eac8faf..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_alias_to_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_alias_to_floor.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_alias_to_floor.cpython-312.pyc deleted file mode 100644 index 9311d1a1..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_alias_to_floor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_area_to_floor.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_area_to_floor.cpython-312.pyc deleted file mode 100644 index 5751f27f..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_area_to_floor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_device_to_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_device_to_area.cpython-312.pyc deleted file mode 100644 index 5960f0c5..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_device_to_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_entity_to_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_entity_to_area.cpython-312.pyc deleted file mode 100644 index 80653c2d..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_entity_to_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_area.cpython-312.pyc deleted file mode 100644 index 17078250..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_device.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_device.cpython-312.pyc deleted file mode 100644 index e5605dd9..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_device.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_entity.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_entity.cpython-312.pyc deleted file mode 100644 index 3ee1d014..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/add_label_to_entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_area.cpython-312.pyc deleted file mode 100644 index bb030465..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_floor.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_floor.cpython-312.pyc deleted file mode 100644 index 1c114fba..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_floor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_label.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_label.cpython-312.pyc deleted file mode 100644 index a0ec69e7..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/create_label.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_all_orphaned_entities.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_all_orphaned_entities.cpython-312.pyc deleted file mode 100644 index 546be2d9..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_all_orphaned_entities.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_area.cpython-312.pyc deleted file mode 100644 index ab863859..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_floor.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_floor.cpython-312.pyc deleted file mode 100644 index d2582787..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_floor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_label.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_label.cpython-312.pyc deleted file mode 100644 index 4b0ca5d2..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/delete_label.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_config_entry.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_config_entry.cpython-312.pyc deleted file mode 100644 index 0c26831f..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_config_entry.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_device.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_device.cpython-312.pyc deleted file mode 100644 index 093bd347..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_device.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_entity.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_entity.cpython-312.pyc deleted file mode 100644 index 3d619eda..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_polling.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_polling.cpython-312.pyc deleted file mode 100644 index 50311f11..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/disable_polling.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_config_entry.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_config_entry.cpython-312.pyc deleted file mode 100644 index 65235336..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_config_entry.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_device.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_device.cpython-312.pyc deleted file mode 100644 index dddb1615..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_device.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_entity.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_entity.cpython-312.pyc deleted file mode 100644 index 8271bc92..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_polling.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_polling.cpython-312.pyc deleted file mode 100644 index e3d60a0c..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/enable_polling.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/hide_entity.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/hide_entity.cpython-312.pyc deleted file mode 100644 index 01ff8e70..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/hide_entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/ignore_all_discovered.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/ignore_all_discovered.cpython-312.pyc deleted file mode 100644 index 96dd9a5f..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/ignore_all_discovered.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/ignore_all_discovered.cpython-313.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/ignore_all_discovered.cpython-313.pyc index df879e37..23d684e0 100644 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/ignore_all_discovered.cpython-313.pyc and b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/ignore_all_discovered.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/list_orphaned_database_entities.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/list_orphaned_database_entities.cpython-312.pyc deleted file mode 100644 index 8f96af8a..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/list_orphaned_database_entities.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/list_orphaned_database_entities.cpython-313.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/list_orphaned_database_entities.cpython-313.pyc index 97b49a46..aecba9b7 100644 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/list_orphaned_database_entities.cpython-313.pyc and b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/list_orphaned_database_entities.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_alias_from_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_alias_from_area.cpython-312.pyc deleted file mode 100644 index c11f1cb4..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_alias_from_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_alias_from_floor.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_alias_from_floor.cpython-312.pyc deleted file mode 100644 index b758fabf..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_alias_from_floor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_area_from_floor.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_area_from_floor.cpython-312.pyc deleted file mode 100644 index 60a06a2e..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_area_from_floor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_device_from_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_device_from_area.cpython-312.pyc deleted file mode 100644 index fb28c663..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_device_from_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_entity_from_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_entity_from_area.cpython-312.pyc deleted file mode 100644 index 66ede64f..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_entity_from_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_area.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_area.cpython-312.pyc deleted file mode 100644 index 3a20cf2f..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_area.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_device.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_device.cpython-312.pyc deleted file mode 100644 index 2d701a17..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_device.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_entity.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_entity.cpython-312.pyc deleted file mode 100644 index 95a7ce28..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/remove_label_from_entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/restart.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/restart.cpython-312.pyc deleted file mode 100644 index 1215f05e..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/restart.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/set_area_aliases.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/set_area_aliases.cpython-312.pyc deleted file mode 100644 index ab28a82c..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/set_area_aliases.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/set_floor_aliases.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/set_floor_aliases.cpython-312.pyc deleted file mode 100644 index c243e50d..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/set_floor_aliases.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/unhide_entity.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/unhide_entity.cpython-312.pyc deleted file mode 100644 index 4a8330b3..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/unhide_entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/update_entity_id.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/update_entity_id.cpython-312.pyc deleted file mode 100644 index 84edfde0..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/services/__pycache__/update_entity_id.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a6c84776..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/flatten.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/flatten.cpython-312.pyc deleted file mode 100644 index 2431eefa..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/flatten.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch.cpython-312.pyc deleted file mode 100644 index 851ce694..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch.cpython-313.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch.cpython-313.pyc index 7984740b..4c6135dd 100644 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch.cpython-313.pyc and b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch_filter.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch_filter.cpython-312.pyc deleted file mode 100644 index 5be430fe..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch_filter.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch_filter.cpython-313.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch_filter.cpython-313.pyc index 678fbe2b..0f5410e0 100644 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch_filter.cpython-313.pyc and b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/fnmatch_filter.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/md5.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/md5.cpython-312.pyc deleted file mode 100644 index e390366f..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/md5.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha1.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha1.cpython-312.pyc deleted file mode 100644 index f56108e0..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha1.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha256.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha256.cpython-312.pyc deleted file mode 100644 index ea448696..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha256.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha512.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha512.cpython-312.pyc deleted file mode 100644 index 42e11dab..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/sha512.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/shuffle.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/shuffle.cpython-312.pyc deleted file mode 100644 index c1166173..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/shuffle.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/typeof.cpython-312.pyc b/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/typeof.cpython-312.pyc deleted file mode 100644 index 67823eb7..00000000 Binary files a/custom_components/spook/ectoplasms/homeassistant/templating/__pycache__/typeof.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_number/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/input_number/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 07fa1233..00000000 Binary files a/custom_components/spook/ectoplasms/input_number/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_number/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/input_number/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 4b4585e5..00000000 Binary files a/custom_components/spook/ectoplasms/input_number/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_number/services/__pycache__/decrement.cpython-312.pyc b/custom_components/spook/ectoplasms/input_number/services/__pycache__/decrement.cpython-312.pyc deleted file mode 100644 index 0d55a582..00000000 Binary files a/custom_components/spook/ectoplasms/input_number/services/__pycache__/decrement.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_number/services/__pycache__/increment.cpython-312.pyc b/custom_components/spook/ectoplasms/input_number/services/__pycache__/increment.cpython-312.pyc deleted file mode 100644 index c846ec76..00000000 Binary files a/custom_components/spook/ectoplasms/input_number/services/__pycache__/increment.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_number/services/__pycache__/max.cpython-312.pyc b/custom_components/spook/ectoplasms/input_number/services/__pycache__/max.cpython-312.pyc deleted file mode 100644 index 11166061..00000000 Binary files a/custom_components/spook/ectoplasms/input_number/services/__pycache__/max.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_number/services/__pycache__/min.cpython-312.pyc b/custom_components/spook/ectoplasms/input_number/services/__pycache__/min.cpython-312.pyc deleted file mode 100644 index b11bab40..00000000 Binary files a/custom_components/spook/ectoplasms/input_number/services/__pycache__/min.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_select/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/input_select/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 276577d9..00000000 Binary files a/custom_components/spook/ectoplasms/input_select/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_select/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/input_select/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 023fb011..00000000 Binary files a/custom_components/spook/ectoplasms/input_select/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_select/services/__pycache__/random.cpython-312.pyc b/custom_components/spook/ectoplasms/input_select/services/__pycache__/random.cpython-312.pyc deleted file mode 100644 index fd6f7976..00000000 Binary files a/custom_components/spook/ectoplasms/input_select/services/__pycache__/random.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_select/services/__pycache__/shuffle.cpython-312.pyc b/custom_components/spook/ectoplasms/input_select/services/__pycache__/shuffle.cpython-312.pyc deleted file mode 100644 index 7a40a5d3..00000000 Binary files a/custom_components/spook/ectoplasms/input_select/services/__pycache__/shuffle.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/input_select/services/__pycache__/sort.cpython-312.pyc b/custom_components/spook/ectoplasms/input_select/services/__pycache__/sort.cpython-312.pyc deleted file mode 100644 index 562f8c38..00000000 Binary files a/custom_components/spook/ectoplasms/input_select/services/__pycache__/sort.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/integration/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/integration/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 8e03b804..00000000 Binary files a/custom_components/spook/ectoplasms/integration/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/integration/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/integration/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 5f01a22e..00000000 Binary files a/custom_components/spook/ectoplasms/integration/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/integration/repairs/__pycache__/unknown_source.cpython-312.pyc b/custom_components/spook/ectoplasms/integration/repairs/__pycache__/unknown_source.cpython-312.pyc deleted file mode 100644 index 973c5d3e..00000000 Binary files a/custom_components/spook/ectoplasms/integration/repairs/__pycache__/unknown_source.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/lovelace/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/lovelace/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index e3cd5b67..00000000 Binary files a/custom_components/spook/ectoplasms/lovelace/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 9c1bf010..00000000 Binary files a/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/unknown_entity_references.cpython-312.pyc b/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/unknown_entity_references.cpython-312.pyc deleted file mode 100644 index 43f428e1..00000000 Binary files a/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/unknown_entity_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/unknown_entity_references.cpython-313.pyc b/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/unknown_entity_references.cpython-313.pyc index 78985c55..3a8e1cf1 100644 Binary files a/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/unknown_entity_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/lovelace/repairs/__pycache__/unknown_entity_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/number/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/number/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index cabfdf46..00000000 Binary files a/custom_components/spook/ectoplasms/number/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/number/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/number/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index e50aed7a..00000000 Binary files a/custom_components/spook/ectoplasms/number/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/number/services/__pycache__/decrement.cpython-312.pyc b/custom_components/spook/ectoplasms/number/services/__pycache__/decrement.cpython-312.pyc deleted file mode 100644 index e218317e..00000000 Binary files a/custom_components/spook/ectoplasms/number/services/__pycache__/decrement.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/number/services/__pycache__/increment.cpython-312.pyc b/custom_components/spook/ectoplasms/number/services/__pycache__/increment.cpython-312.pyc deleted file mode 100644 index cf7b5ea6..00000000 Binary files a/custom_components/spook/ectoplasms/number/services/__pycache__/increment.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/number/services/__pycache__/max.cpython-312.pyc b/custom_components/spook/ectoplasms/number/services/__pycache__/max.cpython-312.pyc deleted file mode 100644 index 5048694c..00000000 Binary files a/custom_components/spook/ectoplasms/number/services/__pycache__/max.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/number/services/__pycache__/min.cpython-312.pyc b/custom_components/spook/ectoplasms/number/services/__pycache__/min.cpython-312.pyc deleted file mode 100644 index 1f9da99e..00000000 Binary files a/custom_components/spook/ectoplasms/number/services/__pycache__/min.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/person/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/person/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index c2848922..00000000 Binary files a/custom_components/spook/ectoplasms/person/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/person/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/person/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 6f225901..00000000 Binary files a/custom_components/spook/ectoplasms/person/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/person/services/__pycache__/add_device_tracker.cpython-312.pyc b/custom_components/spook/ectoplasms/person/services/__pycache__/add_device_tracker.cpython-312.pyc deleted file mode 100644 index e7460a67..00000000 Binary files a/custom_components/spook/ectoplasms/person/services/__pycache__/add_device_tracker.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/person/services/__pycache__/remove_device_tracker.cpython-312.pyc b/custom_components/spook/ectoplasms/person/services/__pycache__/remove_device_tracker.cpython-312.pyc deleted file mode 100644 index 4462a403..00000000 Binary files a/custom_components/spook/ectoplasms/person/services/__pycache__/remove_device_tracker.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/proximity/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/proximity/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 48e02190..00000000 Binary files a/custom_components/spook/ectoplasms/proximity/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a07370a5..00000000 Binary files a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_ignored_zones.cpython-312.pyc b/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_ignored_zones.cpython-312.pyc deleted file mode 100644 index d965b79a..00000000 Binary files a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_ignored_zones.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_ignored_zones.cpython-313.pyc b/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_ignored_zones.cpython-313.pyc index e219afd0..28a1752b 100644 Binary files a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_ignored_zones.cpython-313.pyc and b/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_ignored_zones.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_tracked_entities.cpython-312.pyc b/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_tracked_entities.cpython-312.pyc deleted file mode 100644 index ec88d40e..00000000 Binary files a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_tracked_entities.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_tracked_entities.cpython-313.pyc b/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_tracked_entities.cpython-313.pyc index d72de645..386ac1f3 100644 Binary files a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_tracked_entities.cpython-313.pyc and b/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_tracked_entities.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_zone.cpython-312.pyc b/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_zone.cpython-312.pyc deleted file mode 100644 index 613aee60..00000000 Binary files a/custom_components/spook/ectoplasms/proximity/repairs/__pycache__/unknown_zone.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/recorder/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/recorder/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 2ec19b43..00000000 Binary files a/custom_components/spook/ectoplasms/recorder/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/recorder/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/recorder/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index a2ab045f..00000000 Binary files a/custom_components/spook/ectoplasms/recorder/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/recorder/services/__pycache__/import_statistics.cpython-312.pyc b/custom_components/spook/ectoplasms/recorder/services/__pycache__/import_statistics.cpython-312.pyc deleted file mode 100644 index bbadf8fd..00000000 Binary files a/custom_components/spook/ectoplasms/recorder/services/__pycache__/import_statistics.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 751b2067..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/__pycache__/button.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/__pycache__/button.cpython-312.pyc deleted file mode 100644 index 11b33572..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/__pycache__/button.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/__pycache__/button.cpython-313.pyc b/custom_components/spook/ectoplasms/repairs/__pycache__/button.cpython-313.pyc index 026e6dfb..7250dc71 100644 Binary files a/custom_components/spook/ectoplasms/repairs/__pycache__/button.cpython-313.pyc and b/custom_components/spook/ectoplasms/repairs/__pycache__/button.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/repairs/__pycache__/entity.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index 60b555e8..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/__pycache__/event.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/__pycache__/event.cpython-312.pyc deleted file mode 100644 index f4dedad8..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/__pycache__/event.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/__pycache__/sensor.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index 9756497a..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/__pycache__/sensor.cpython-313.pyc b/custom_components/spook/ectoplasms/repairs/__pycache__/sensor.cpython-313.pyc index d6546ad9..9ca45634 100644 Binary files a/custom_components/spook/ectoplasms/repairs/__pycache__/sensor.cpython-313.pyc and b/custom_components/spook/ectoplasms/repairs/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/repairs/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 44ab07f2..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/services/__pycache__/create.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/services/__pycache__/create.cpython-312.pyc deleted file mode 100644 index 2a7b1801..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/services/__pycache__/create.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/services/__pycache__/ignore_all.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/services/__pycache__/ignore_all.cpython-312.pyc deleted file mode 100644 index 3b60df44..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/services/__pycache__/ignore_all.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/services/__pycache__/remove.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/services/__pycache__/remove.cpython-312.pyc deleted file mode 100644 index 7ead2be9..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/services/__pycache__/remove.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/repairs/services/__pycache__/unignore_all.cpython-312.pyc b/custom_components/spook/ectoplasms/repairs/services/__pycache__/unignore_all.cpython-312.pyc deleted file mode 100644 index 57444ed8..00000000 Binary files a/custom_components/spook/ectoplasms/repairs/services/__pycache__/unignore_all.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/scene/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/scene/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 39a62d94..00000000 Binary files a/custom_components/spook/ectoplasms/scene/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/scene/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/scene/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 77ebd30c..00000000 Binary files a/custom_components/spook/ectoplasms/scene/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/scene/repairs/__pycache__/unknown_entity_references.cpython-312.pyc b/custom_components/spook/ectoplasms/scene/repairs/__pycache__/unknown_entity_references.cpython-312.pyc deleted file mode 100644 index 82837242..00000000 Binary files a/custom_components/spook/ectoplasms/scene/repairs/__pycache__/unknown_entity_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/scene/repairs/__pycache__/unknown_entity_references.cpython-313.pyc b/custom_components/spook/ectoplasms/scene/repairs/__pycache__/unknown_entity_references.cpython-313.pyc index 4b6016ca..bc0767e6 100644 Binary files a/custom_components/spook/ectoplasms/scene/repairs/__pycache__/unknown_entity_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/scene/repairs/__pycache__/unknown_entity_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/script/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/script/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 90cf6977..00000000 Binary files a/custom_components/spook/ectoplasms/script/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 1e48dec8..00000000 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_area_references.cpython-312.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_area_references.cpython-312.pyc deleted file mode 100644 index d56115e1..00000000 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_area_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_area_references.cpython-313.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_area_references.cpython-313.pyc index 5b5fa562..274238da 100644 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_area_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_area_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_device_references.cpython-312.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_device_references.cpython-312.pyc deleted file mode 100644 index 8589df5b..00000000 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_device_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_device_references.cpython-313.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_device_references.cpython-313.pyc index 62d32c9e..8e78d4fc 100644 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_device_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_device_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_entity_references.cpython-312.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_entity_references.cpython-312.pyc deleted file mode 100644 index 799a439f..00000000 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_entity_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_entity_references.cpython-313.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_entity_references.cpython-313.pyc index 6d0bbca0..8ff7b875 100644 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_entity_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_entity_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_floor_references.cpython-312.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_floor_references.cpython-312.pyc deleted file mode 100644 index edc42209..00000000 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_floor_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_floor_references.cpython-313.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_floor_references.cpython-313.pyc index 0e499c6d..1d4997c0 100644 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_floor_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_floor_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_label_references.cpython-312.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_label_references.cpython-312.pyc deleted file mode 100644 index 384b2248..00000000 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_label_references.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_label_references.cpython-313.pyc b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_label_references.cpython-313.pyc index cc132489..6606e443 100644 Binary files a/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_label_references.cpython-313.pyc and b/custom_components/spook/ectoplasms/script/repairs/__pycache__/unknown_label_references.cpython-313.pyc differ diff --git a/custom_components/spook/ectoplasms/select/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/select/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 772b7223..00000000 Binary files a/custom_components/spook/ectoplasms/select/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/select/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/select/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 1a0fe662..00000000 Binary files a/custom_components/spook/ectoplasms/select/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/select/services/__pycache__/random.cpython-312.pyc b/custom_components/spook/ectoplasms/select/services/__pycache__/random.cpython-312.pyc deleted file mode 100644 index b975b0a8..00000000 Binary files a/custom_components/spook/ectoplasms/select/services/__pycache__/random.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/spook/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/spook/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 3f035e58..00000000 Binary files a/custom_components/spook/ectoplasms/spook/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/spook/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/spook/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 4ab00bac..00000000 Binary files a/custom_components/spook/ectoplasms/spook/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/spook/services/__pycache__/boo.cpython-312.pyc b/custom_components/spook/ectoplasms/spook/services/__pycache__/boo.cpython-312.pyc deleted file mode 100644 index d2a2f23c..00000000 Binary files a/custom_components/spook/ectoplasms/spook/services/__pycache__/boo.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/spook/services/__pycache__/random_fail.cpython-312.pyc b/custom_components/spook/ectoplasms/spook/services/__pycache__/random_fail.cpython-312.pyc deleted file mode 100644 index f2ca80be..00000000 Binary files a/custom_components/spook/ectoplasms/spook/services/__pycache__/random_fail.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/switch_as_x/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/switch_as_x/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index bb0995de..00000000 Binary files a/custom_components/spook/ectoplasms/switch_as_x/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/switch_as_x/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/switch_as_x/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index bb65ab64..00000000 Binary files a/custom_components/spook/ectoplasms/switch_as_x/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/switch_as_x/repairs/__pycache__/unknown_source.cpython-312.pyc b/custom_components/spook/ectoplasms/switch_as_x/repairs/__pycache__/unknown_source.cpython-312.pyc deleted file mode 100644 index 7bde55f0..00000000 Binary files a/custom_components/spook/ectoplasms/switch_as_x/repairs/__pycache__/unknown_source.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/timer/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/timer/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 8cc5f056..00000000 Binary files a/custom_components/spook/ectoplasms/timer/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/timer/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/timer/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 6bf10789..00000000 Binary files a/custom_components/spook/ectoplasms/timer/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/timer/services/__pycache__/set_duration.cpython-312.pyc b/custom_components/spook/ectoplasms/timer/services/__pycache__/set_duration.cpython-312.pyc deleted file mode 100644 index c5d186c8..00000000 Binary files a/custom_components/spook/ectoplasms/timer/services/__pycache__/set_duration.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/trend/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/trend/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index f33f00da..00000000 Binary files a/custom_components/spook/ectoplasms/trend/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/trend/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/trend/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index acfb2f70..00000000 Binary files a/custom_components/spook/ectoplasms/trend/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/trend/repairs/__pycache__/unknown_source.cpython-312.pyc b/custom_components/spook/ectoplasms/trend/repairs/__pycache__/unknown_source.cpython-312.pyc deleted file mode 100644 index d55f09d7..00000000 Binary files a/custom_components/spook/ectoplasms/trend/repairs/__pycache__/unknown_source.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/utility_meter/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/utility_meter/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 7b69b0c6..00000000 Binary files a/custom_components/spook/ectoplasms/utility_meter/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/utility_meter/repairs/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/utility_meter/repairs/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 43bb900c..00000000 Binary files a/custom_components/spook/ectoplasms/utility_meter/repairs/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/utility_meter/repairs/__pycache__/unknown_source.cpython-312.pyc b/custom_components/spook/ectoplasms/utility_meter/repairs/__pycache__/unknown_source.cpython-312.pyc deleted file mode 100644 index 48303c18..00000000 Binary files a/custom_components/spook/ectoplasms/utility_meter/repairs/__pycache__/unknown_source.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/zone/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/zone/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 340d24c7..00000000 Binary files a/custom_components/spook/ectoplasms/zone/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/zone/services/__pycache__/__init__.cpython-312.pyc b/custom_components/spook/ectoplasms/zone/services/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 865f0fd0..00000000 Binary files a/custom_components/spook/ectoplasms/zone/services/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/zone/services/__pycache__/create.cpython-312.pyc b/custom_components/spook/ectoplasms/zone/services/__pycache__/create.cpython-312.pyc deleted file mode 100644 index c3302654..00000000 Binary files a/custom_components/spook/ectoplasms/zone/services/__pycache__/create.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/zone/services/__pycache__/delete.cpython-312.pyc b/custom_components/spook/ectoplasms/zone/services/__pycache__/delete.cpython-312.pyc deleted file mode 100644 index 1acd1473..00000000 Binary files a/custom_components/spook/ectoplasms/zone/services/__pycache__/delete.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spook/ectoplasms/zone/services/__pycache__/update.cpython-312.pyc b/custom_components/spook/ectoplasms/zone/services/__pycache__/update.cpython-312.pyc deleted file mode 100644 index 3fd3c9f7..00000000 Binary files a/custom_components/spook/ectoplasms/zone/services/__pycache__/update.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spotcast/__pycache__/__init__.cpython-312.pyc b/custom_components/spotcast/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 6d4759c9..00000000 Binary files a/custom_components/spotcast/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spotcast/__pycache__/__init__.cpython-313.pyc b/custom_components/spotcast/__pycache__/__init__.cpython-313.pyc index bca93e74..bb2e00d9 100644 Binary files a/custom_components/spotcast/__pycache__/__init__.cpython-313.pyc and b/custom_components/spotcast/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/spotcast/__pycache__/cast.cpython-312.pyc b/custom_components/spotcast/__pycache__/cast.cpython-312.pyc deleted file mode 100644 index 8cce1da9..00000000 Binary files a/custom_components/spotcast/__pycache__/cast.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spotcast/__pycache__/const.cpython-312.pyc b/custom_components/spotcast/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 2604674e..00000000 Binary files a/custom_components/spotcast/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spotcast/__pycache__/error.cpython-312.pyc b/custom_components/spotcast/__pycache__/error.cpython-312.pyc deleted file mode 100644 index 71726f8b..00000000 Binary files a/custom_components/spotcast/__pycache__/error.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spotcast/__pycache__/helpers.cpython-312.pyc b/custom_components/spotcast/__pycache__/helpers.cpython-312.pyc deleted file mode 100644 index 5310b5f8..00000000 Binary files a/custom_components/spotcast/__pycache__/helpers.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spotcast/__pycache__/spotcast_controller.cpython-312.pyc b/custom_components/spotcast/__pycache__/spotcast_controller.cpython-312.pyc deleted file mode 100644 index 1b72b09c..00000000 Binary files a/custom_components/spotcast/__pycache__/spotcast_controller.cpython-312.pyc and /dev/null differ diff --git a/custom_components/spotcast/__pycache__/spotcast_controller.cpython-313.pyc b/custom_components/spotcast/__pycache__/spotcast_controller.cpython-313.pyc index b452e098..fd7dfd2d 100644 Binary files a/custom_components/spotcast/__pycache__/spotcast_controller.cpython-313.pyc and b/custom_components/spotcast/__pycache__/spotcast_controller.cpython-313.pyc differ diff --git a/custom_components/spotcast/__pycache__/spotify_controller.cpython-312.pyc b/custom_components/spotcast/__pycache__/spotify_controller.cpython-312.pyc deleted file mode 100644 index b278b778..00000000 Binary files a/custom_components/spotcast/__pycache__/spotify_controller.cpython-312.pyc and /dev/null differ diff --git a/custom_components/start_time/__pycache__/__init__.cpython-312.pyc b/custom_components/start_time/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index fa0498ef..00000000 Binary files a/custom_components/start_time/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/start_time/__pycache__/config_flow.cpython-312.pyc b/custom_components/start_time/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 435ebfd1..00000000 Binary files a/custom_components/start_time/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/start_time/__pycache__/sensor.cpython-312.pyc b/custom_components/start_time/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index 51417477..00000000 Binary files a/custom_components/start_time/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/start_time/__pycache__/sensor.cpython-313.pyc b/custom_components/start_time/__pycache__/sensor.cpython-313.pyc index 85b1f10f..29b08400 100644 Binary files a/custom_components/start_time/__pycache__/sensor.cpython-313.pyc and b/custom_components/start_time/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/tplink_deco/__pycache__/__init__.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index ccab066d..00000000 Binary files a/custom_components/tplink_deco/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_deco/__pycache__/api.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/api.cpython-312.pyc deleted file mode 100644 index 22c875a3..00000000 Binary files a/custom_components/tplink_deco/__pycache__/api.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_deco/__pycache__/config_flow.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 0d4db864..00000000 Binary files a/custom_components/tplink_deco/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_deco/__pycache__/const.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 9c105bb6..00000000 Binary files a/custom_components/tplink_deco/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_deco/__pycache__/coordinator.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/coordinator.cpython-312.pyc deleted file mode 100644 index 8f9df752..00000000 Binary files a/custom_components/tplink_deco/__pycache__/coordinator.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_deco/__pycache__/device.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/device.cpython-312.pyc deleted file mode 100644 index e935946c..00000000 Binary files a/custom_components/tplink_deco/__pycache__/device.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_deco/__pycache__/device_tracker.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/device_tracker.cpython-312.pyc deleted file mode 100644 index 250f04e9..00000000 Binary files a/custom_components/tplink_deco/__pycache__/device_tracker.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_deco/__pycache__/exceptions.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/exceptions.cpython-312.pyc deleted file mode 100644 index 3c99ea7e..00000000 Binary files a/custom_components/tplink_deco/__pycache__/exceptions.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_deco/__pycache__/sensor.cpython-312.pyc b/custom_components/tplink_deco/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index 54676565..00000000 Binary files a/custom_components/tplink_deco/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_router/__pycache__/__init__.cpython-312.pyc b/custom_components/tplink_router/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 29759454..00000000 Binary files a/custom_components/tplink_router/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_router/__pycache__/button.cpython-312.pyc b/custom_components/tplink_router/__pycache__/button.cpython-312.pyc deleted file mode 100644 index 1391252e..00000000 Binary files a/custom_components/tplink_router/__pycache__/button.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_router/__pycache__/config_flow.cpython-312.pyc b/custom_components/tplink_router/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index ee20f342..00000000 Binary files a/custom_components/tplink_router/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_router/__pycache__/const.cpython-312.pyc b/custom_components/tplink_router/__pycache__/const.cpython-312.pyc deleted file mode 100644 index ebdf6b2f..00000000 Binary files a/custom_components/tplink_router/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_router/__pycache__/coordinator.cpython-312.pyc b/custom_components/tplink_router/__pycache__/coordinator.cpython-312.pyc deleted file mode 100644 index aa06693e..00000000 Binary files a/custom_components/tplink_router/__pycache__/coordinator.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_router/__pycache__/device_tracker.cpython-312.pyc b/custom_components/tplink_router/__pycache__/device_tracker.cpython-312.pyc deleted file mode 100644 index 224ad21f..00000000 Binary files a/custom_components/tplink_router/__pycache__/device_tracker.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_router/__pycache__/sensor.cpython-312.pyc b/custom_components/tplink_router/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index 84421b6b..00000000 Binary files a/custom_components/tplink_router/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/tplink_router/__pycache__/switch.cpython-312.pyc b/custom_components/tplink_router/__pycache__/switch.cpython-312.pyc deleted file mode 100644 index ab387ee7..00000000 Binary files a/custom_components/tplink_router/__pycache__/switch.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/__pycache__/__init__.cpython-312.pyc b/custom_components/watchman/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 68baaf81..00000000 Binary files a/custom_components/watchman/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/__pycache__/__init__.cpython-313.pyc b/custom_components/watchman/__pycache__/__init__.cpython-313.pyc index 4e88cec1..1ea5c674 100644 Binary files a/custom_components/watchman/__pycache__/__init__.cpython-313.pyc and b/custom_components/watchman/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/watchman/__pycache__/config_flow.cpython-312.pyc b/custom_components/watchman/__pycache__/config_flow.cpython-312.pyc deleted file mode 100644 index 6b525907..00000000 Binary files a/custom_components/watchman/__pycache__/config_flow.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/__pycache__/config_flow.cpython-313.pyc b/custom_components/watchman/__pycache__/config_flow.cpython-313.pyc index 2c15614b..22468326 100644 Binary files a/custom_components/watchman/__pycache__/config_flow.cpython-313.pyc and b/custom_components/watchman/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/watchman/__pycache__/const.cpython-312.pyc b/custom_components/watchman/__pycache__/const.cpython-312.pyc deleted file mode 100644 index 3130aab0..00000000 Binary files a/custom_components/watchman/__pycache__/const.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/__pycache__/coordinator.cpython-312.pyc b/custom_components/watchman/__pycache__/coordinator.cpython-312.pyc deleted file mode 100644 index fc137fd2..00000000 Binary files a/custom_components/watchman/__pycache__/coordinator.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/__pycache__/entity.cpython-312.pyc b/custom_components/watchman/__pycache__/entity.cpython-312.pyc deleted file mode 100644 index 4a99f855..00000000 Binary files a/custom_components/watchman/__pycache__/entity.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/__pycache__/sensor.cpython-312.pyc b/custom_components/watchman/__pycache__/sensor.cpython-312.pyc deleted file mode 100644 index d8fa035e..00000000 Binary files a/custom_components/watchman/__pycache__/sensor.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/utils/__pycache__/__init__.cpython-312.pyc b/custom_components/watchman/utils/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 04551e95..00000000 Binary files a/custom_components/watchman/utils/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/utils/__pycache__/logger.cpython-312.pyc b/custom_components/watchman/utils/__pycache__/logger.cpython-312.pyc deleted file mode 100644 index 39941a01..00000000 Binary files a/custom_components/watchman/utils/__pycache__/logger.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/utils/__pycache__/utils.cpython-312.pyc b/custom_components/watchman/utils/__pycache__/utils.cpython-312.pyc deleted file mode 100644 index d5844026..00000000 Binary files a/custom_components/watchman/utils/__pycache__/utils.cpython-312.pyc and /dev/null differ diff --git a/custom_components/watchman/utils/__pycache__/utils.cpython-313.pyc b/custom_components/watchman/utils/__pycache__/utils.cpython-313.pyc index 3264877a..a18258b1 100644 Binary files a/custom_components/watchman/utils/__pycache__/utils.cpython-313.pyc and b/custom_components/watchman/utils/__pycache__/utils.cpython-313.pyc differ diff --git a/custom_components/ytube_music_player/__init__.py b/custom_components/ytube_music_player/__init__.py new file mode 100644 index 00000000..dc44641b --- /dev/null +++ b/custom_components/ytube_music_player/__init__.py @@ -0,0 +1,44 @@ +"""Provide the initial setup.""" +import logging +from .const import * + +_LOGGER = logging.getLogger(__name__) + + +async def async_setup(hass, config): + """Provide Setup of platform.""" + return True + + +async def async_setup_entry(hass, config_entry): + """Set up this integration using UI/YAML.""" + hass.data.setdefault(DOMAIN, {}) + hass.data[DOMAIN][config_entry.entry_id] = {} + hass.config_entries.async_update_entry(config_entry, data=ensure_config(config_entry.data)) + + if not config_entry.update_listeners: + config_entry.add_update_listener(async_update_options) + + # Add entities to HA + await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS) + return True + + + +async def async_remove_entry(hass, config_entry): + """Handle removal of an entry.""" + for platform in PLATFORMS: + try: + await hass.config_entries.async_forward_entry_unload(config_entry, platform) + _LOGGER.info( + "Successfully removed entities from the integration" + ) + except ValueError: + pass + + +async def async_update_options(hass, config_entry): + _LOGGER.debug("Config updated,reload the entities.") + for platform in PLATFORMS: + await hass.config_entries.async_forward_entry_unload(config_entry, platform) + await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS) diff --git a/custom_components/ytube_music_player/__pycache__/__init__.cpython-313.pyc b/custom_components/ytube_music_player/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..27636ba9 Binary files /dev/null and b/custom_components/ytube_music_player/__pycache__/__init__.cpython-313.pyc differ diff --git a/custom_components/ytube_music_player/__pycache__/browse_media.cpython-313.pyc b/custom_components/ytube_music_player/__pycache__/browse_media.cpython-313.pyc new file mode 100644 index 00000000..b37a8d26 Binary files /dev/null and b/custom_components/ytube_music_player/__pycache__/browse_media.cpython-313.pyc differ diff --git a/custom_components/ytube_music_player/__pycache__/config_flow.cpython-313.pyc b/custom_components/ytube_music_player/__pycache__/config_flow.cpython-313.pyc new file mode 100644 index 00000000..dbeee875 Binary files /dev/null and b/custom_components/ytube_music_player/__pycache__/config_flow.cpython-313.pyc differ diff --git a/custom_components/ytube_music_player/__pycache__/const.cpython-313.pyc b/custom_components/ytube_music_player/__pycache__/const.cpython-313.pyc new file mode 100644 index 00000000..e8892a06 Binary files /dev/null and b/custom_components/ytube_music_player/__pycache__/const.cpython-313.pyc differ diff --git a/custom_components/ytube_music_player/__pycache__/media_player.cpython-313.pyc b/custom_components/ytube_music_player/__pycache__/media_player.cpython-313.pyc new file mode 100644 index 00000000..b2840dfa Binary files /dev/null and b/custom_components/ytube_music_player/__pycache__/media_player.cpython-313.pyc differ diff --git a/custom_components/ytube_music_player/__pycache__/select.cpython-313.pyc b/custom_components/ytube_music_player/__pycache__/select.cpython-313.pyc new file mode 100644 index 00000000..d8424ec4 Binary files /dev/null and b/custom_components/ytube_music_player/__pycache__/select.cpython-313.pyc differ diff --git a/custom_components/ytube_music_player/__pycache__/sensor.cpython-313.pyc b/custom_components/ytube_music_player/__pycache__/sensor.cpython-313.pyc new file mode 100644 index 00000000..18df734e Binary files /dev/null and b/custom_components/ytube_music_player/__pycache__/sensor.cpython-313.pyc differ diff --git a/custom_components/ytube_music_player/browse_media.py b/custom_components/ytube_music_player/browse_media.py new file mode 100644 index 00000000..a9f96f01 --- /dev/null +++ b/custom_components/ytube_music_player/browse_media.py @@ -0,0 +1,684 @@ +"""Support for media browsing.""" +import logging +from homeassistant.components.media_player import BrowseError, BrowseMedia +from ytmusicapi import ytmusic +from .const import * +import random + + + +PLAYABLE_MEDIA_TYPES = [ + MediaType.ALBUM, + USER_ALBUM, + USER_ARTIST, + MediaType.TRACK, + MediaType.PLAYLIST, + LIB_TRACKS, + HISTORY, + USER_TRACKS, + ALBUM_OF_TRACK +] + +CONTAINER_TYPES_SPECIFIC_MEDIA_CLASS = { + MediaType.ALBUM: MediaClass.ALBUM, + LIB_ALBUM: MediaClass.ALBUM, + MediaType.ARTIST: MediaClass.ARTIST, + MediaType.PLAYLIST: MediaClass.PLAYLIST, + LIB_PLAYLIST: MediaClass.PLAYLIST, + HISTORY: MediaClass.PLAYLIST, + USER_TRACKS: MediaClass.PLAYLIST, + MediaType.SEASON: MediaClass.SEASON, + MediaType.TVSHOW: MediaClass.TV_SHOW, +} + +CHILD_TYPE_MEDIA_CLASS = { + MediaType.SEASON: MediaClass.SEASON, + MediaType.ALBUM: MediaClass.ALBUM, + MediaType.ARTIST: MediaClass.ARTIST, + MediaType.MOVIE: MediaClass.MOVIE, + MediaType.PLAYLIST: MediaClass.PLAYLIST, + MediaType.TRACK: MediaClass.TRACK, + MediaType.TVSHOW: MediaClass.TV_SHOW, + MediaType.CHANNEL: MediaClass.CHANNEL, + MediaType.EPISODE: MediaClass.EPISODE, +} + +_LOGGER = logging.getLogger(__name__) + + +class UnknownMediaType(BrowseError): + """Unknown media type.""" + + +async def build_item_response(ytmusicplayer, payload): + """Create response payload for the provided media query.""" + search_id = payload[SEARCH_ID] + search_type = payload[SEARCH_TYPE] + media_library = ytmusicplayer._api + hass = ytmusicplayer.hass + children = [] + header_thumbnail = None + header_title = None + media = None + sort_list = ytmusicplayer._sortBrowser + p1 = datetime.datetime.now() + + # the only static source is the ytmusicplayer, to store content over multiple calls + # is this the smartest way to figure out if the var exists? probably not, but the only i found :) + try: + lastHomeMedia = ytmusicplayer.lastHomeMedia + except: + lastHomeMedia = "" + + _LOGGER.debug("- build_item_response for: " + search_type) + + if search_type == LIB_PLAYLIST: # playlist OVERVIEW -> lists playlists + media = await hass.async_add_executor_job(media_library.get_library_playlists, BROWSER_LIMIT) + header_title = LIB_PLAYLIST_TITLE # single playlist + + for item in media: + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.PLAYLIST, # noqa: E251 + media_content_type = MediaType.PLAYLIST, # noqa: E251 + media_content_id = f"{item['playlistId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == HOME_CAT: + sort_list = False + header_title = HOME_TITLE + media = await hass.async_add_executor_job(media_library.get_home, 20) + ytmusicplayer.lastHomeMedia = media # store for next round, to keep the same respnse, two seperate calls lead to different data + + for item in media: + #_LOGGER.debug(item) + #_LOGGER.debug("") + if(("contents" in item) and ("title" in item)): + if(item["contents"][0] != None): + thumbnail = find_thumbnail(item["contents"][int(random.random()*len(item["contents"]))]) + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.PLAYLIST, # noqa: E251 + media_content_type = HOME_CAT_2, # noqa: E251 + media_content_id = f"{item['title']}", # noqa: E251 + can_play = False, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = thumbnail # noqa: E251 + )) + + elif search_type == HOME_CAT_2: + sort_list = False + # try to run with the same session as HOME_CAT had in the first call + media = lastHomeMedia + header_title = search_id + # backup if this fails (e.g. direct URL call that jumped the HOME_CAT) + if(media == ""): + media = await hass.async_add_executor_job(media_library.get_home, 20) + for item in media: + if(item['title'] == search_id): + for content in item['contents']: + if(content != None): + play_id = "" + item_title = "" + #_LOGGER.debug(content) + #_LOGGER.debug("") + if('videoId' in content): + item_title = content["title"] + if("artists" in content): + for artist in content["artists"]: + if(artist["id"] != None): + item_title += " - "+artist["name"] + break + play_id = f"{content['videoId']}" + play_type = MediaClass.TRACK + playable = True + browsable = False + #_LOGGER.debug("1") + elif('browseId' in content): + # ok, this can be an Artist or and Album + # album start with MPRE + if(content['browseId'].startswith('MPREb_')): + item_title = content["title"] + if("year" in content): # WTF YT, why is the artist stored in 'year'? + item_title += " - "+content["year"] + play_id = f"{content['browseId']}" + play_type = MediaClass.ALBUM + playable = True + browsable = True + #_LOGGER.debug("2") + #else: + #_LOGGER.debug("2.2") + elif('playlistId' in content): + # RDAMPL - playlist / album radio + # RDAMVL - track radio + item_title = content["title"] + play_id = f"{content['playlistId']}" + play_type = MediaClass.PLAYLIST + playable = True + browsable = True + #_LOGGER.debug("3") + else: + _LOGGER.debug("didn't get this item:") + _LOGGER.debug(content) + _LOGGER.debug("") + + if(play_id!=""): + children.append(BrowseMedia( + title = item_title, # noqa: E251 + media_class = MediaClass.PLAYLIST, # noqa: E251 + media_content_type = play_type, # noqa: E251 + media_content_id = play_id, # noqa: E251 + can_play = playable, # noqa: E251 + can_expand = browsable, # noqa: E251 + thumbnail = find_thumbnail(content) # noqa: E251 + )) + break + + elif search_type == MediaType.PLAYLIST: # single playlist -> lists tracks + media = await hass.async_add_executor_job(media_library.get_playlist, search_id, BROWSER_LIMIT) + header_title = media['title'] + header_thumbnail = find_thumbnail(media) + + for item in media['tracks']: + item_title = f"{item['title']}" + if("artists" in item): + artist = "" + if(isinstance(item["artists"], str)): + artist = item["artists"] + elif(isinstance(item["artists"], list)): + artist = item["artists"][0]["name"] + if(artist): + item_title = artist + " - " + item_title + + children.append(BrowseMedia( + title = item_title, # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = f"{item['videoId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == LIB_ALBUM: # LIB! album OVERVIEW, not uploaded -> lists albums + media = await hass.async_add_executor_job(media_library.get_library_albums, BROWSER_LIMIT) + header_title = LIB_ALBUM_TITLE + + for item in media: + item_title = item['title'] + if("artists" in item): + artist = "" + if(isinstance(item["artists"], str)): + artist = item["artists"] + elif(isinstance(item["artists"], list)): + artist = item["artists"][0]["name"] + if(artist): + item_title = item['title'] + " - " + artist + + children.append(BrowseMedia( + title = item_title, # noqa: E251 + media_class = MediaClass.ALBUM, # noqa: E251 + media_content_type = MediaType.ALBUM, # noqa: E251 + media_content_id = f"{item['browseId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == MediaType.ALBUM: # single album (NOT uploaded) -> lists tracks + res = await hass.async_add_executor_job(media_library.get_album, search_id) + media = res['tracks'] + header_title = res['title'] + header_thumbnail = find_thumbnail(res) + + for item in media: + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = f"{item['videoId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(res) # noqa: E251 + )) + + elif search_type == LIB_TRACKS: # liked songs (direct list, NOT uploaded) -> lists tracks + media = await hass.async_add_executor_job(lambda: media_library.get_library_songs(limit=BROWSER_LIMIT)) + header_title = LIB_TRACKS_TITLE + + for item in media: + item_title = f"{item['title']}" + if("artists" in item): + artist = "" + if(isinstance(item["artists"], str)): + artist = item["artists"] + elif(isinstance(item["artists"], list)): + artist = item["artists"][0]["name"] + if(artist): + item_title = artist + " - " + item_title + + children.append(BrowseMedia( + title = item_title, # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = f"{item['videoId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == HISTORY: # history songs (direct list) -> lists tracks + media = await hass.async_add_executor_job(media_library.get_history) + search_id = HISTORY + header_title = HISTORY_TITLE + + for item in media: + item_title = f"{item['title']}" + if("artists" in item): + artist = "" + if(isinstance(item["artists"], str)): + artist = item["artists"] + elif(isinstance(item["artists"], list)): + artist = item["artists"][0]["name"] + if(artist): + item_title = artist + " - " + item_title + + children.append(BrowseMedia( + title = item_title, # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = f"{item['videoId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == USER_TRACKS: # list all uploaded songs -> lists tracks + media = await hass.async_add_executor_job(media_library.get_library_upload_songs, BROWSER_LIMIT) + search_id = USER_TRACKS + header_title = USER_TRACKS_TITLE + + for item in media: + item_title = f"{item['title']}" + if("artist" in item): + artist = "" + if(isinstance(item["artist"], str)): + artist = item["artist"] + elif(isinstance(item["artist"], list)): + artist = item["artist"][0]["name"] + if(artist): + item_title = artist + " - " + item_title + + children.append(BrowseMedia( + title = item_title, # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = f"{item['videoId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == USER_ALBUMS: # uploaded album overview!! -> lists user albums + media = await hass.async_add_executor_job(media_library.get_library_upload_albums, BROWSER_LIMIT) + header_title = USER_ALBUMS_TITLE + + for item in media: + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.ALBUM, # noqa: E251 + media_content_type = USER_ALBUM, # noqa: E251 + media_content_id = f"{item['browseId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == USER_ALBUM: # single uploaded album -> lists tracks + res = await hass.async_add_executor_job(media_library.get_library_upload_album, search_id) + media = res['tracks'] + header_title = res['title'] + + for item in media: + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = f"{item['videoId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == USER_ARTISTS: # with S + media = await hass.async_add_executor_job(media_library.get_library_upload_artists, BROWSER_LIMIT) + header_title = USER_ARTISTS_TITLE + + for item in media: + children.append(BrowseMedia( + title = f"{item['artist']}", # noqa: E251 + media_class = MediaClass.ARTIST, # noqa: E251 + media_content_type = USER_ARTIST, # noqa: E251 + media_content_id = f"{item['browseId']}", # noqa: E251 + can_play = False, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == USER_ARTISTS_2: # list all artists now, but follow up will be the albums of that artist + media = await hass.async_add_executor_job(media_library.get_library_upload_artists, BROWSER_LIMIT) + header_title = USER_ARTISTS_2_TITLE + + for item in media: + children.append(BrowseMedia( + title = f"{item['artist']}", # noqa: E251 + media_class = MediaClass.ARTIST, # noqa: E251 + media_content_type = USER_ARTIST_2, # noqa: E251 + media_content_id = f"{item['browseId']}", # noqa: E251 + can_play = False, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == USER_ARTIST: # without S + media = await hass.async_add_executor_job(media_library.get_library_upload_artist, search_id, BROWSER_LIMIT) + header_title = USER_ARTIST_TITLE + if(isinstance(media, list)): + if('artist' in media[0]): + if(isinstance(media[0]['artist'], list)): + if('name' in media[0]['artist'][0]): + header_title = media[0]['artist'][0]['name'] + elif('artists' in media[0]): + if(isinstance(media[0]['artists'], list)): + if('name' in media[0]['artists'][0]): + header_title = media[0]['artists'][0]['name'] + + for item in media: + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = f"{item['videoId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == USER_ARTIST_2: # list each album of an uploaded artists only once .. next will be uploaded album view 'USER_ALBUM' + media_all = await hass.async_add_executor_job(media_library.get_library_upload_artist, search_id, BROWSER_LIMIT) + header_title = USER_ARTIST_2_TITLE + media = list() + for item in media_all: + if('album' in item): + if('name' in item['album']): + if(all(item['album']['name'] != a['title'] for a in media)): + media.append({ + 'type': 'user_album', + 'browseId': item['album']['id'], + 'title': item['album']['name'], + 'thumbnails': item['thumbnails'] + }) + if('artist' in media_all[0]): + if(isinstance(media_all[0]['artist'], list)): + if('name' in media_all[0]['artist'][0]): + title = "Uploaded albums of " + media_all[0]['artist'][0]['name'] + + + for item in media: + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.ALBUM, # noqa: E251 + media_content_type = USER_ALBUM, # noqa: E251 + media_content_id = f"{item['browseId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + + elif search_type == SEARCH: + header_title = SEARCH_TITLE + if ytmusicplayer._search is not None: + media_all = await hass.async_add_executor_job(lambda: media_library.search(query=ytmusicplayer._search.get('query', ""), filter=ytmusicplayer._search.get('filter', None), limit=int(ytmusicplayer._search.get('limit', 20)))) + + if(ytmusicplayer._search.get('filter', None) is not None): + helper = {} + else: + helper = {'song': "Track: ", 'playlist': "Playlist: ", 'album': "Album: ", 'artist': "Artist: "} + + for a in media_all: + if(a['category'] in ["Top result", "Podcast"]): + continue + + if(a['resultType'] == 'song'): + artists = "" + if("artist" in a): + artists = a["artist"] + if("artists" in a): + artists = ', '.join(artist["name"] for artist in a["artists"] if "name" in artist) + children.append(BrowseMedia( + title = helper.get(a['resultType'], "") + artists + " - " + a['title'], # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = a['videoId'], # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(a) # noqa: E251 + )) + elif(a['resultType'] == 'playlist'): + children.append(BrowseMedia( + title = helper.get(a['resultType'], "") + a['title'], # noqa: E251 + media_class = MediaClass.PLAYLIST, # noqa: E251 + media_content_type = MediaType.PLAYLIST, # noqa: E251 + media_content_id = f"{a['browseId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(a) # noqa: E251 + )) + elif(a['resultType'] == 'album'): + children.append(BrowseMedia( + title = helper.get(a['resultType'], "") + a['title'], # noqa: E251 + media_class = MediaClass.ALBUM, # noqa: E251 + media_content_type = MediaType.ALBUM, # noqa: E251 + media_content_id = f"{a['browseId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(a) # noqa: E251 + )) + elif(a['resultType'] == 'artist'): + _LOGGER.debug("a: %s", a) + if not('artist' in a): + a['artist'] = a['artists'][0]['name'] # Fix Top result + a['browseId'] = a['artists'][0]['id'] # Fix Top result + children.append(BrowseMedia( + title = helper.get(a['resultType'], "") + a['artist'], # noqa: E251 + media_class = MediaClass.ARTIST, # noqa: E251 + media_content_type = MediaType.ARTIST, # noqa: E251 + media_content_id = f"{a['browseId']}", # noqa: E251 + can_play = False, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(a) # noqa: E251 + )) + else: # video / artists / uploads are currently ignored + continue + + # _LOGGER.debug("search entry end") + elif search_type == MediaType.ARTIST: + media_all = await hass.async_add_executor_job(media_library.get_artist, search_id) + helper = {'song': "Track: ", 'playlist': "Playlist: ", 'album': "Album: ", 'artist': "Artist"} + + if('singles' in media_all): + for a in media_all['singles']['results']: + children.append(BrowseMedia( + title = helper.get('song', "") + a['title'], # noqa: E251 + media_class = MediaClass.ALBUM, # noqa: E251 + media_content_type = MediaType.ALBUM, # noqa: E251 + media_content_id = a['browseId'], # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(a) # noqa: E251 + )) + if('albums' in media_all): + for a in media_all['albums']['results']: + children.append(BrowseMedia( + title = helper.get('album', "") + a['title'], # noqa: E251 + media_class = MediaClass.ALBUM, # noqa: E251 + media_content_type = MediaType.ALBUM, # noqa: E251 + media_content_id = f"{a['browseId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(a) # noqa: E251 + )) + + elif search_type == MOOD_OVERVIEW: + media_all = await hass.async_add_executor_job(lambda: media_library.get_mood_categories()) + header_title = MOOD_TITLE + for cap in media_all: + for e in media_all[cap]: + children.append(BrowseMedia( + title = f"{cap} - {e['title']}", # noqa: E251 + media_class = MediaClass.PLAYLIST, # noqa: E251 + media_content_type = MOOD_PLAYLISTS, # noqa: E251 + media_content_id = e['params'], # noqa: E251 + can_play = False, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = "", # noqa: E251 + )) + + elif search_type == MOOD_PLAYLISTS: + media = await hass.async_add_executor_job(lambda: media_library.get_mood_playlists(search_id)) + header_title = MOOD_TITLE + for item in media: + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.PLAYLIST, # noqa: E251 + media_content_type = MediaType.PLAYLIST, # noqa: E251 + media_content_id = f"{item['playlistId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = True, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + + elif search_type == CONF_RECEIVERS: + header_title = PLAYER_TITLE + for e, f in ytmusicplayer._friendly_speakersList.items(): + children.append(BrowseMedia( + title = f, # noqa: E251 + media_class = MediaClass.TV_SHOW, # noqa: E251 + media_content_type = CONF_RECEIVERS, # noqa: E251 + media_content_id = e, # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = "", # noqa: E251 + )) + elif search_type == CUR_PLAYLIST: + header_title = CUR_PLAYLIST_TITLE + sort_list = False + i = 1 + for item in ytmusicplayer._tracks: + item_title = item["title"] + if("artists" in item): + artist = "" + if(isinstance(item["artists"], str)): + artist = item["artists"] + elif(isinstance(item["artists"], list)): + artist = item["artists"][0]["name"] + if(artist): + item_title = artist + " - " + item_title + + children.append(BrowseMedia( + title = item_title, # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = CUR_PLAYLIST_COMMAND, # noqa: E251 + media_content_id = i, # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + i += 1 + + elif search_type == ALBUM_OF_TRACK: + try: + res = await hass.async_add_executor_job(lambda: media_library.get_album(ytmusicplayer._track_album_id)) + sort_list = False + media = res['tracks'] + header_title = res['title'] + + for item in media: + children.append(BrowseMedia( + title = f"{item['title']}", # noqa: E251 + media_class = MediaClass.TRACK, # noqa: E251 + media_content_type = MediaType.TRACK, # noqa: E251 + media_content_id = f"{item['videoId']}", # noqa: E251 + can_play = True, # noqa: E251 + can_expand = False, # noqa: E251 + thumbnail = find_thumbnail(item) # noqa: E251 + )) + except: + pass + + + # ########################################### END ############### + if sort_list: + children.sort(key=lambda x: x.title, reverse=False) + response = BrowseMedia( + media_class = CONTAINER_TYPES_SPECIFIC_MEDIA_CLASS.get(search_type, MediaClass.DIRECTORY), + media_content_id = search_id, + media_content_type = search_type, + title = header_title, + can_play = search_type in PLAYABLE_MEDIA_TYPES and search_id, + can_expand = True, + children = children, + thumbnail = header_thumbnail, + ) + + if search_type == "library_music": + response.children_media_class = MediaClass.MUSIC + elif len(children) > 0: + response.calculate_children_class() + t = (datetime.datetime.now() - p1).total_seconds() + _LOGGER.debug("- Calc / grab time: " + str(t) + " sec") + return response + + + +def library_payload(ytmusicplayer): + # Create response payload to describe contents of a specific library. + # Used by async_browse_media. + library_info = BrowseMedia(media_class=MediaClass.DIRECTORY, media_content_id="library", media_content_type="library", title="Media Library", can_play=False, can_expand=True, children=[]) + + library_info.children.append(BrowseMedia(title=HOME_TITLE, media_class=MediaClass.PLAYLIST, media_content_type=HOME_CAT, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=LIB_PLAYLIST_TITLE, media_class=MediaClass.PLAYLIST, media_content_type=LIB_PLAYLIST, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=LIB_ALBUM_TITLE, media_class=MediaClass.ALBUM, media_content_type=LIB_ALBUM, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=LIB_TRACKS_TITLE, media_class=MediaClass.TRACK, media_content_type=LIB_TRACKS, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=HISTORY_TITLE, media_class=MediaClass.TRACK, media_content_type=HISTORY, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=USER_TRACKS_TITLE, media_class=MediaClass.TRACK, media_content_type=USER_TRACKS, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=USER_ALBUMS_TITLE, media_class=MediaClass.ALBUM, media_content_type=USER_ALBUMS, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=USER_ARTISTS_TITLE, media_class=MediaClass.ARTIST, media_content_type=USER_ARTISTS, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=USER_ARTISTS_2_TITLE, media_class=MediaClass.ARTIST, media_content_type=USER_ARTISTS_2, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=MOOD_TITLE, media_class=MediaClass.PLAYLIST, media_content_type=MOOD_OVERVIEW, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=PLAYER_TITLE, media_class=MediaClass.TV_SHOW, media_content_type=CONF_RECEIVERS, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + library_info.children.append(BrowseMedia(title=CUR_PLAYLIST_TITLE, media_class=MediaClass.PLAYLIST, media_content_type=CUR_PLAYLIST, media_content_id="", can_play=False, can_expand=True, thumbnail="")) # noqa: E241 + + # add search button if possible + if(ytmusicplayer._search.get("query", "") != ""): + library_info.children.append( + BrowseMedia(title="Results for \"" + str(ytmusicplayer._search.get("query", "No search")) + "\"", media_class=MediaClass.DIRECTORY, media_content_type=SEARCH, media_content_id="", can_play=False, can_expand=True, thumbnail="") + ) + + # add "go to album of track" if possible + if(ytmusicplayer._track_album_id not in ["", None] and ytmusicplayer._track_name not in ["", None]): + library_info.children.append( + BrowseMedia(title="Album of \"" + str(ytmusicplayer._track_name) + "\"", media_class=MediaClass.ALBUM, media_content_type=ALBUM_OF_TRACK, media_content_id="1", can_play=True, can_expand=True, thumbnail=ytmusicplayer._track_album_cover) + ) + + # add "radio of track" if possible + if(ytmusicplayer._attributes['videoId'] != ""): + library_info.children.append( + BrowseMedia(title="Radio of \"" + str(ytmusicplayer._track_name) + "\"", media_class=MediaClass.PLAYLIST, media_content_type=CHANNEL_VID, media_content_id=ytmusicplayer._attributes['videoId'], can_play=True, can_expand=False, thumbnail="") + ) + + return library_info diff --git a/custom_components/ytube_music_player/config_flow.py b/custom_components/ytube_music_player/config_flow.py new file mode 100644 index 00000000..a144e420 --- /dev/null +++ b/custom_components/ytube_music_player/config_flow.py @@ -0,0 +1,288 @@ +"""Provide the config flow.""" +from homeassistant.core import callback +from homeassistant import config_entries +import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.selector import selector +import voluptuous as vol +import logging +from .const import * +import os +import os.path +from homeassistant.helpers.storage import STORAGE_DIR +import ytmusicapi +from ytmusicapi.helpers import SUPPORTED_LANGUAGES +import requests +#from ytmusicapi.auth.oauth import OAuthCredentials, RefreshingToken + + +import traceback +import asyncio +from collections import OrderedDict + +_LOGGER = logging.getLogger(__name__) + + +@config_entries.HANDLERS.register(DOMAIN) +class yTubeMusicFlowHandler(config_entries.ConfigFlow): + """Provide the initial setup.""" + + CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL + VERSION = 1 + + def __init__(self): + """Provide the init function of the config flow.""" + # Called once the flow is started by the user + self._errors = {} + + # entry point from config start + async def async_step_user(self, user_input=None): # pylint: disable=unused-argument + """Call this as first page.""" + self._errors = {} + + user_input = dict() + user_input[CONF_NAME] = DOMAIN + +# OAUTH +# session = requests.Session() +# self.oauth = OAuthCredentials("","",session,"") +# self.code = await self.hass.async_add_executor_job(self.oauth.get_code) +# user_input[CONF_CODE] = self.code +# OAUTH + return self.async_show_form(step_id="oauth", data_schema=vol.Schema(await async_create_form(self.hass,user_input,1)), errors=self._errors) + + # we get here after the user click submit on the oauth screem + # lets check if oauth worked + async def async_step_oauth(self, user_input=None): # pylint: disable=unused-argument + self._errors = {} + if user_input is not None: + user_input[CONF_NAME] = user_input[CONF_NAME].replace(DOMAIN_MP+".","") # make sure to erase "media_player.bla" -> bla + self.data = user_input +# OAUTH +# try: +# self.token = await self.hass.async_add_executor_job(lambda: self.oauth.token_from_code(self.code["device_code"])) +# self.refresh_token = RefreshingToken(credentials=self.oauth, **self.token) +# self.refresh_token.update(self.refresh_token.as_dict()) +# except: +# self._errors["base"] = ERROR_GENERIC +# user_input[CONF_CODE] = self.code +# return self.async_show_form(step_id="oauth", data_schema=vol.Schema(await async_create_form(self.hass,user_input,1)), errors=self._errors) +# # if we get here then Oauth worked, right? +# user_input[CONF_HEADER_PATH] = os.path.join(self.hass.config.path(STORAGE_DIR),DEFAULT_HEADER_FILENAME+user_input[CONF_NAME].replace(' ','_')+'.json') +# OAUTH + self._errors = await async_check_data(self.hass,user_input) + if self._errors == {}: + user_input[CONF_HEADER_PATH] = os.path.join(self.hass.config.path(STORAGE_DIR),DEFAULT_HEADER_FILENAME+user_input[CONF_NAME].replace(' ','_')+'.json') + self.data = user_input + return self.async_show_form(step_id="finish", data_schema=vol.Schema(await async_create_form(self.hass,user_input,2)), errors=self._errors) + return self.async_show_form(step_id="oauth", data_schema=vol.Schema(await async_create_form(self.hass,user_input,1)), errors=self._errors) + + + # will be called by sending the form, until configuration is done + async def async_step_finish(self,user_input=None): + self._errors = {} + if user_input is not None: + self.data.update(user_input) +# OAUTH +# await self.hass.async_add_executor_job(lambda: self.refresh_token.store_token(self.data[CONF_HEADER_PATH])) +# OAUTH + if(self.data[CONF_ADVANCE_CONFIG]): + return self.async_show_form(step_id="adv_finish", data_schema=vol.Schema(await async_create_form(self.hass,user_input,3)), errors=self._errors) + else: + return self.async_create_entry(title="yTubeMusic "+self.data[CONF_NAME].replace(DOMAIN,''), data=self.data) + # we should never get below here + return self.async_show_form(step_id="finish", data_schema=vol.Schema(await async_create_form(self.hass,user_input,2)), errors=self._errors) + + + async def async_step_adv_finish(self,user_input=None): + self._errors = {} + self.data.update(user_input) + return self.async_create_entry(title="yTubeMusic "+self.data[CONF_NAME].replace(DOMAIN,''), data=self.data) + + + # TODO .. what is this good for? + async def async_step_import(self, user_input): # pylint: disable=unused-argument + """Import a config entry. + + Special type of import, we're not actually going to store any data. + Instead, we're going to rely on the values that are in config file. + """ + if self._async_current_entries(): + return self.async_abort(reason="single_instance_allowed") + + return self.async_create_entry(title="configuration.yaml", data={}) + + @staticmethod + @callback + def async_get_options_flow(config_entry): + """Call back to start the change flow.""" + return OptionsFlowHandler(config_entry) + + +class OptionsFlowHandler(config_entries.OptionsFlow): + """Change an entity via GUI.""" + + def __init__(self, config_entry): + """Set initial parameter to grab them later on.""" + # store old entry for later + self.config_entry = config_entry + self.data = {} + self.data.update(config_entry.data.items()) + + # will be called by sending the form, until configuration is done + async def async_step_init(self, user_input=None): # pylint: disable=unused-argument + """Call this as first page.""" + self._errors = {} + # sync data and user input + user_input = self.data + return self.async_show_form(step_id="oauth", data_schema=vol.Schema(await async_create_form(self.hass,user_input,1)), errors=self._errors) + + async def async_step_oauth(self, user_input=None): # pylint: disable=unused-argument + self._errors = {} + # sync data and user input again + self.data.update(user_input) + user_input = self.data + + if user_input is not None: + user_input[CONF_NAME] = user_input[CONF_NAME].replace(DOMAIN_MP+".","") # make sure to erase "media_player.bla" -> bla + self.data.update(user_input) + self._errors = await async_check_data(self.hass,user_input) + if self._errors == {}: + user_input[CONF_HEADER_PATH] = os.path.join(self.hass.config.path(STORAGE_DIR),DEFAULT_HEADER_FILENAME+user_input[CONF_NAME].replace(' ','_')+'.json') + self.data.update(user_input) + return self.async_show_form(step_id="finish", data_schema=vol.Schema(await async_create_form(self.hass,user_input,2)), errors=self._errors) + return self.async_show_form(step_id="oauth", data_schema=vol.Schema(await async_create_form(self.hass,user_input,1)), errors=self._errors) + + + # will be called by sending the form, until configuration is done + async def async_step_finish(self,user_input=None): + self._errors = {} + if user_input is not None: + # sync data and user input again + self.data.update(user_input) + user_input = self.data +# OAUTH +# await self.hass.async_add_executor_job(lambda: self.refresh_token.store_token(self.data[CONF_HEADER_PATH])) +# OAUTH + if(self.data[CONF_ADVANCE_CONFIG]): + return self.async_show_form(step_id="adv_finish", data_schema=vol.Schema(await async_create_form(self.hass,user_input,3)), errors=self._errors) + else: + return self.async_create_entry(title="yTubeMusic "+self.data[CONF_NAME].replace(DOMAIN,''), data=self.data) + # we should never get below here + return self.async_show_form(step_id="finish", data_schema=vol.Schema(await async_create_form(self.hass,user_input,2)), errors=self._errors) + + + async def async_step_adv_finish(self,user_input=None): + self._errors = {} + self.data.update(user_input) + self.hass.config_entries.async_update_entry(self.config_entry, data=ensure_config(self.data)) + return self.async_create_entry(title='', data={}) + +async def async_create_form(hass, user_input, page=1): + """Create form for UI setup.""" + user_input = ensure_config(user_input) + data_schema = OrderedDict() + languages = list(SUPPORTED_LANGUAGES) + + if(page == 1): +# data_schema[vol.Required(CONF_CODE+"TT", default="https://www.google.com/device?user_code="+user_input[CONF_CODE]["user_code"])] = str # name of the component without domain + data_schema[vol.Required(CONF_NAME, default=user_input[CONF_NAME])] = str # name of the component without domain + data_schema[vol.Required(CONF_COOKIE, default=user_input[CONF_COOKIE])] = str # configuration of the cookie + if(page == 2): + # Generate a list of excluded entities. + # This method is more reliable because it won't become invalid + # if users modify entity IDs, and it supports multiple instances. + _exclude_entities = [] + if (_ytm := hass.data.get(DOMAIN)) is not None: + for _ytm_player in _ytm.values(): + _exclude_entities.append(_ytm_player[DOMAIN_MP].entity_id) + + data_schema[vol.Required(CONF_RECEIVERS,default=user_input[CONF_RECEIVERS])] = selector({ + "entity": { + "multiple": "true", + "filter": [{"domain": DOMAIN_MP}], + "exclude_entities": _exclude_entities + } + }) + data_schema[vol.Required(CONF_API_LANGUAGE, default=user_input[CONF_API_LANGUAGE])] = selector({ + "select": { + "options": languages, + "mode": "dropdown", + "sort": True + } + }) + data_schema[vol.Required(CONF_HEADER_PATH, default=user_input[CONF_HEADER_PATH])] = str # file path of the header + data_schema[vol.Required(CONF_ADVANCE_CONFIG, default=user_input[CONF_ADVANCE_CONFIG])] = vol.Coerce(bool) # show page 2 + + elif(page == 3): + data_schema[vol.Optional(CONF_SHUFFLE, default=user_input[CONF_SHUFFLE])] = vol.Coerce(bool) # default shuffle, TRUE/FALSE + data_schema[vol.Optional(CONF_SHUFFLE_MODE, default=user_input[CONF_SHUFFLE_MODE])] = selector({ # choose default shuffle mode + "select": { + "options": ALL_SHUFFLE_MODES, + "mode": "dropdown" + } + }) + data_schema[vol.Optional(CONF_LIKE_IN_NAME, default=user_input[CONF_LIKE_IN_NAME])] = vol.Coerce(bool) # default like_in_name, TRUE/FALSE + data_schema[vol.Optional(CONF_DEBUG_AS_ERROR, default=user_input[CONF_DEBUG_AS_ERROR])] = vol.Coerce(bool) # debug_as_error, TRUE/FALSE + data_schema[vol.Optional(CONF_LEGACY_RADIO, default=user_input[CONF_LEGACY_RADIO])] = vol.Coerce(bool) # default radio generation typ + data_schema[vol.Optional(CONF_SORT_BROWSER, default=user_input[CONF_SORT_BROWSER])] = vol.Coerce(bool) # sort browser results + data_schema[vol.Optional(CONF_INIT_EXTRA_SENSOR, default=user_input[CONF_INIT_EXTRA_SENSOR])] = vol.Coerce(bool) # default radio generation typ + data_schema[vol.Optional(CONF_INIT_DROPDOWNS,default=user_input[CONF_INIT_DROPDOWNS])] = selector({ # choose dropdown(s) + "select": { + "options": ALL_DROPDOWNS, + "multiple": "true" + } + }) + # add for the old inputs. + for _old_conf_input in OLD_INPUTS.values(): + if user_input.get(_old_conf_input) is not None: + data_schema[vol.Optional(_old_conf_input, default=user_input[_old_conf_input])] = str + + data_schema[vol.Optional(CONF_TRACK_LIMIT, default=user_input[CONF_TRACK_LIMIT])] = vol.Coerce(int) + data_schema[vol.Optional(CONF_MAX_DATARATE, default=user_input[CONF_MAX_DATARATE])] = vol.Coerce(int) + data_schema[vol.Optional(CONF_BRAND_ID, default=user_input[CONF_BRAND_ID])] = str # brand id + + data_schema[vol.Optional(CONF_PROXY_PATH, default=user_input[CONF_PROXY_PATH])] = str # select of input_boolean -> continuous on/off + data_schema[vol.Optional(CONF_PROXY_URL, default=user_input[CONF_PROXY_URL])] = str # select of input_boolean -> continuous on/off + + return data_schema + + +async def async_check_data(hass, user_input): + """Check validity of the provided date.""" + ret = {} + if(CONF_COOKIE in user_input and CONF_HEADER_PATH in user_input): + # sadly config flow will not allow to have a multiline text field + # we get a looong string that we've to rearrange into multiline for ytmusic + + # so the fields are written like 'identifier': 'value', but some values actually have ':' inside, bummer. + # we'll split after every ': ', and try to parse the key + value + cs = user_input[CONF_COOKIE].split(": ") + key = [] + value = [] + c = "" # reset + remove_keys = {":authority", ":method", ":path", ":scheme"} # ytubemusic api doesn't like the google chrome arguments + for i in range(0,len(cs)-1): # we're grabbing [i] and [i+1], so skip the last and go only to len()-1 + key.append(cs[i][cs[i].rfind(' ')+1:]) # find the last STRING in the current element + value.append(cs[i+1]) # add the next element as value. This will contain the NEXT key which we're erasing later + if(i>0): # once we have more then one value + value[i-1] = value[i-1].replace(' '+key[i],'') # remove the current key from the last value + if(key[i-1] not in remove_keys): + c += key[i-1]+": "+value[i-1]+'\n' # re-join and add missing line break + if(i==len(cs)-2): # add last key value pair + c += key[i]+": "+value[i]+'\n' + + try: + ytmusicapi.setup(filepath = user_input[CONF_HEADER_PATH], headers_raw = c) + except: + ret["base"] = ERROR_GENERIC + formatted_lines = traceback.format_exc().splitlines() + for i in formatted_lines: + if(i.startswith('Exception: ')): + if(i.find('The following entries are missing in your headers: Cookie')>=0): + ret["base"] = ERROR_COOKIE + elif(i.find('The following entries are missing in your headers: X-Goog-AuthUser')>=0): + ret["base"] = ERROR_AUTH_USER + _LOGGER.error(traceback.format_exc()) + return ret + [ret, msg, api] = await async_try_login(hass,user_input[CONF_HEADER_PATH],"") + return ret \ No newline at end of file diff --git a/custom_components/ytube_music_player/const.py b/custom_components/ytube_music_player/const.py new file mode 100644 index 00000000..f72acd9d --- /dev/null +++ b/custom_components/ytube_music_player/const.py @@ -0,0 +1,386 @@ +from homeassistant.components.sensor import PLATFORM_SCHEMA, ENTITY_ID_FORMAT +import homeassistant.helpers.config_validation as cv +from homeassistant.components.media_player import MediaPlayerState, MediaPlayerEntityFeature +from homeassistant.components.media_player.const import MediaClass, MediaType, RepeatMode +import voluptuous as vol +import logging +import datetime +import traceback +import asyncio +from collections import OrderedDict +from ytmusicapi import YTMusic + + +from homeassistant.const import ( + EVENT_HOMEASSISTANT_START, + ATTR_ENTITY_ID, + CONF_DEVICE_ID, + CONF_NAME, + CONF_USERNAME, + CONF_PASSWORD, + STATE_PLAYING, + STATE_PAUSED, + STATE_ON, + STATE_OFF, + STATE_IDLE, + ATTR_COMMAND, +) + +from homeassistant.components.media_player import ( + MediaPlayerEntity, + PLATFORM_SCHEMA, + SERVICE_TURN_ON, + SERVICE_TURN_OFF, + SERVICE_PLAY_MEDIA, + SERVICE_MEDIA_PAUSE, + SERVICE_VOLUME_UP, + SERVICE_VOLUME_DOWN, + SERVICE_VOLUME_SET, + ATTR_MEDIA_VOLUME_LEVEL, + ATTR_MEDIA_CONTENT_ID, + ATTR_MEDIA_CONTENT_TYPE, + DOMAIN as DOMAIN_MP, +) + +# add for old settings +from homeassistant.components.input_boolean import ( + SERVICE_TURN_OFF as IB_OFF, + SERVICE_TURN_ON as IB_ON, + DOMAIN as DOMAIN_IB, +) + +import homeassistant.components.select as select +import homeassistant.components.input_select as input_select # add for old settings +import homeassistant.components.input_boolean as input_boolean # add for old settings + +# Should be equal to the name of your component. +PLATFORMS = {"sensor", "select", "media_player" } +DOMAIN = "ytube_music_player" + +SUPPORT_YTUBEMUSIC_PLAYER = ( + MediaPlayerEntityFeature.TURN_ON + | MediaPlayerEntityFeature.TURN_OFF + | MediaPlayerEntityFeature.PLAY + | MediaPlayerEntityFeature.PLAY_MEDIA + | MediaPlayerEntityFeature.PAUSE + | MediaPlayerEntityFeature.STOP + | MediaPlayerEntityFeature.VOLUME_SET + | MediaPlayerEntityFeature.VOLUME_STEP + | MediaPlayerEntityFeature.VOLUME_MUTE + | MediaPlayerEntityFeature.PREVIOUS_TRACK + | MediaPlayerEntityFeature.NEXT_TRACK + | MediaPlayerEntityFeature.SHUFFLE_SET + | MediaPlayerEntityFeature.REPEAT_SET + | MediaPlayerEntityFeature.BROWSE_MEDIA + | MediaPlayerEntityFeature.SELECT_SOURCE + | MediaPlayerEntityFeature.SEEK +) + +SERVICE_SEARCH = "search" +SERVICE_ADD_TO_PLAYLIST = "add_to_playlist" +SERVICE_REMOVE_FROM_PLAYLIST = "remove_from_playlist" +SERVICE_LIMIT_COUNT = "limit_count" +SERVICE_RADIO = "start_radio" +ATTR_PARAMETERS = "parameters" +ATTR_QUERY = "query" +ATTR_FILTER = "filter" +ATTR_LIMIT = "limit" +ATTR_SONG_ID = "song_id" +ATTR_PLAYLIST_ID = "playlist_id" +ATTR_RATING = "rating" +ATTR_INTERRUPT = "interrupt" +SERVICE_CALL_METHOD = "call_method" +SERVICE_CALL_RATE_TRACK = "rate_track" +SERVICE_CALL_THUMB_UP = "thumb_up" +SERVICE_CALL_THUMB_DOWN = "thumb_down" +SERVICE_CALL_THUMB_MIDDLE = "thumb_middle" +SERVICE_CALL_TOGGLE_THUMB_UP_MIDDLE = "thumb_toggle_up_middle" +SERVICE_CALL_INTERRUPT_START = "interrupt_start" +SERVICE_CALL_INTERRUPT_RESUME = "interrupt_resume" +SERVICE_CALL_RELOAD_DROPDOWNS = "reload_dropdowns" +SERVICE_CALL_OFF_IS_IDLE = "off_is_idle" +SERVICE_CALL_PAUSED_IS_IDLE = "paused_is_idle" +SERVICE_CALL_IGNORE_PAUSED_ON_MEDIA_CHANGE = "ignore_paused_on_media_change" +SERVICE_CALL_DO_NOT_IGNORE_PAUSED_ON_MEDIA_CHANGE = "do_not_ignore_paused_on_media_change" +SERVICE_CALL_IDLE_IS_IDLE = "idle_is_idle" +SERIVCE_CALL_DEBUG_AS_ERROR = "debug_as_error" +SERVICE_CALL_LIKE_IN_NAME = "like_in_name" +SERVICE_CALL_GOTO_TRACK = "goto_track" +SERVICE_CALL_MOVE_TRACK = "move_track_within_queue" +SERVICE_CALL_APPEND_TRACK = "append_track_to_queue" + +CONF_RECEIVERS = 'speakers' # list of speakers (media_players) +CONF_HEADER_PATH = 'header_path' +CONF_API_LANGUAGE = 'api_language' +CONF_SHUFFLE = 'shuffle' +CONF_SHUFFLE_MODE = 'shuffle_mode' +CONF_COOKIE = 'cookie' +CONF_CODE = 'code' +CONF_BRAND_ID = 'brand_id' +CONF_ADVANCE_CONFIG = 'advance_config' +CONF_LIKE_IN_NAME = 'like_in_name' +CONF_DEBUG_AS_ERROR = 'debug_as_error' +CONF_LEGACY_RADIO = 'legacy_radio' +CONF_SORT_BROWSER = 'sort_browser' +CONF_INIT_EXTRA_SENSOR = 'extra_sensor' +CONF_INIT_DROPDOWNS = 'dropdowns' +ALL_DROPDOWNS = ["playlists","speakers","playmode","radiomode","repeatmode"] +DEFAULT_INIT_DROPDOWNS = ["playlists","speakers","playmode"] +CONF_MAX_DATARATE = 'max_datarate' + +CONF_TRACK_LIMIT = 'track_limit' +CONF_PROXY_URL = 'proxy_url' +CONF_PROXY_PATH = 'proxy_path' + +# add for old settings +CONF_SELECT_SOURCE = 'select_source' +CONF_SELECT_PLAYLIST = 'select_playlist' +CONF_SELECT_SPEAKERS = 'select_speakers' +CONF_SELECT_PLAYMODE = 'select_playmode' +CONF_SELECT_PLAYCONTINUOUS = 'select_playcontinuous' +OLD_INPUTS = { + "playlists": CONF_SELECT_PLAYLIST, + "speakers": CONF_SELECT_SPEAKERS, + "playmode": CONF_SELECT_PLAYMODE, + "radiomode": CONF_SELECT_SOURCE, + "repeatmode": CONF_SELECT_PLAYCONTINUOUS +} +DEFAULT_SELECT_PLAYCONTINUOUS = "" +DEFAULT_SELECT_SOURCE = "" +DEFAULT_SELECT_PLAYLIST = "" +DEFAULT_SELECT_PLAYMODE = "" +DEFAULT_SELECT_SPEAKERS = "" + +DEFAULT_HEADER_FILENAME = 'header_' +DEFAULT_API_LANGUAGE = 'en' +DEFAULT_LIKE_IN_NAME = False +DEFAULT_DEBUG_AS_ERROR = False +DEFAULT_INIT_EXTRA_SENSOR = False +PROXY_FILENAME = "ytube_proxy.mp4" + +DEFAULT_TRACK_LIMIT = 25 +DEFAULT_MAX_DATARATE = 129000 +DEFAULT_LEGACY_RADIO = True +DEFAULT_SORT_BROWSER = True + +ERROR_COOKIE = 'ERROR_COOKIE' +ERROR_AUTH_USER = 'ERROR_AUTH_USER' +ERROR_GENERIC = 'ERROR_GENERIC' +ERROR_CONTENTS = 'ERROR_CONTENTS' +ERROR_FORMAT = 'ERROR_FORMAT' +ERROR_NONE = 'ERROR_NONE' +ERROR_FORBIDDEN = 'ERROR_FORBIDDEN' + +PLAYMODE_SHUFFLE = "Shuffle" +PLAYMODE_RANDOM = "Random" +PLAYMODE_SHUFFLE_RANDOM = "Shuffle Random" +PLAYMODE_DIRECT = "Direct" + +ALL_SHUFFLE_MODES = [PLAYMODE_SHUFFLE, PLAYMODE_RANDOM, PLAYMODE_SHUFFLE_RANDOM, PLAYMODE_DIRECT] +DEFAULT_SHUFFLE_MODE = PLAYMODE_SHUFFLE_RANDOM +DEFAULT_SHUFFLE = True + +SEARCH_ID = "search_id" +SEARCH_TYPE = "search_type" +LIB_PLAYLIST = 'library_playlists' +LIB_PLAYLIST_TITLE = "Library Playlists" + +HOME_TITLE = "Home" +HOME_CAT = "home" +HOME_CAT_2 = "home2" + +LIB_ALBUM = 'library_albums' +LIB_ALBUM_TITLE = "Library Albums" + +LIB_TRACKS = 'library_tracks' +LIB_TRACKS_TITLE = "Library Songs" +ALL_LIB_TRACKS = 'all_library_tracks' +ALL_LIB_TRACKS_TITLE = 'All library tracks' + +HISTORY = 'history' +HISTORY_TITLE = "Last played songs" + +USER_TRACKS = 'user_tracks' +USER_TRACKS_TITLE = "Uploaded songs" + +USER_ALBUMS = 'user_albums' +USER_ALBUMS_TITLE = "Uploaded Albums" +USER_ALBUM = 'user_album' + +USER_ARTISTS = 'user_artists' +USER_ARTISTS_TITLE = "Uploaded Artists" + +USER_ARTISTS_2 = 'user_artists2' +USER_ARTISTS_2_TITLE = "Uploaded Artists -> Album" + +USER_ARTIST = 'user_artist' +USER_ARTIST_TITLE = "Uploaded Artist" + +USER_ARTIST_2 = 'user_artist2' +USER_ARTIST_2_TITLE = "Uploaded Album" + +SEARCH = 'search' +SEARCH_TITLE = "Search results" + +ALBUM_OF_TRACK = 'album_of_track' +ALBUM_OF_TRACK_TITLE = 'Album of current Track' + +PLAYER_TITLE = "Playback device" + +MOOD_OVERVIEW = 'mood_overview' +MOOD_PLAYLISTS = 'mood_playlists' +MOOD_TITLE = 'Moods & Genres' + +CUR_PLAYLIST = 'cur_playlists' +CUR_PLAYLIST_TITLE = "Current Playlists" +CUR_PLAYLIST_COMMAND = "PLAYLIST_GOTO_TRACK" + +CHANNEL = 'channel' +CHANNEL_VID = 'vid_channel' +CHANNEL_VID_NO_INTERRUPT = 'vid_no_interrupt_channel' +STATE_OFF_1X = 'OFF_1X' +BROWSER_LIMIT = 500 + + +PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend = vol.Schema({ + DOMAIN: vol.Schema({ + vol.Optional(CONF_RECEIVERS): cv.string, + vol.Optional(CONF_HEADER_PATH, default=DEFAULT_HEADER_FILENAME): cv.string, + }) +}, extra=vol.ALLOW_EXTRA) + +# Shortcut for the logger +_LOGGER = logging.getLogger(__name__) + + + +async def async_try_login(hass, path, brand_id, language='en'): + ret = {} + api = None + msg = "" + #### try to init object ##### + try: + if(brand_id!=""): + _LOGGER.debug("- using brand ID: "+brand_id) + api = await hass.async_add_executor_job(YTMusic,path,brand_id,None,None,language) + else: + _LOGGER.debug("- login without brand ID and credential at path "+path) + api = await hass.async_add_executor_job(YTMusic,path,None,None,None,language) + except KeyError as err: + _LOGGER.debug("- Key exception") + if(str(err)=="'contents'"): + msg = "Format of cookie is OK, found '__Secure-3PAPISID' and '__Secure-3PSID' but can't retrieve any data with this settings, maybe you didn't copy all data?" + _LOGGER.error(msg) + ret["base"] = ERROR_CONTENTS + elif(str(err)=="'Cookie'"): + msg = "Format of cookie is NOT OK, Field 'Cookie' not found!" + _LOGGER.error(msg) + ret["base"] = ERROR_COOKIE + elif(str(err)=="'__Secure-3PAPISID'" or str(err)=="'__Secure-3PSID'"): + msg = "Format of cookie is NOT OK, likely missing '__Secure-3PAPISID' or '__Secure-3PSID'" + _LOGGER.error(msg) + ret["base"] = ERROR_FORMAT + else: + msg = "Some unknown error occured during the cookies usage, key is: "+str(err) + _LOGGER.error(msg) + _LOGGER.error("please see below") + _LOGGER.error(traceback.format_exc()) + ret["base"] = ERROR_GENERIC + except: + _LOGGER.debug("- Generic exception") + msg = "Format of cookie is NOT OK, missing e.g. AuthUser or Cookie" + _LOGGER.error(msg) + ret["base"] = ERROR_FORMAT + + #### try to grab library data ##### + if(api == None and ret == {}): + msg = "Format of cookie seams OK, but the returned sub API object is None" + _LOGGER.error(msg) + ret["base"] = ERROR_NONE + elif(not(api == None) and ret == {}): + try: + await hass.async_add_executor_job(api.get_library_songs) + except KeyError as err: + if(str(err)=="'contents'"): + msg = "Format of cookie is OK, found '__Secure-3PAPISID' and '__Secure-3PSID' but can't retrieve any data with this settings, maybe you didn't copy all data? Or did you log-out?" + _LOGGER.error(msg) + ret["base"] = ERROR_CONTENTS + except Exception as e: + if hasattr(e, 'args'): + if(len(e.args)>0): + if(isinstance(e.args[0],str)): + if(e.args[0].startswith("Server returned HTTP 403: Forbidden")): + msg = "The entered information has the correct format, but returned an error 403 (access forbidden). You don't have access with this data (anymore?). Please update the cookie" + _LOGGER.error(msg) + ret["base"] = ERROR_FORBIDDEN + else: + msg = "Running get_library_songs resulted in an exception, no idea why.. honestly" + _LOGGER.error(msg) + _LOGGER.error("Please see below") + _LOGGER.error(traceback.format_exc()) + ret["base"] = ERROR_GENERIC + return [ret, msg, api] + +def ensure_config(user_input): + """Make sure that needed Parameter exist and are filled with default if not.""" + out = {} + out[CONF_NAME] = DOMAIN + out[CONF_API_LANGUAGE] = DEFAULT_API_LANGUAGE + out[CONF_RECEIVERS] = '' + out[CONF_SHUFFLE] = DEFAULT_SHUFFLE + out[CONF_SHUFFLE_MODE] = DEFAULT_SHUFFLE_MODE + out[CONF_PROXY_PATH] = "" + out[CONF_PROXY_URL] = "" + out[CONF_BRAND_ID] = "" + out[CONF_COOKIE] = "" + out[CONF_ADVANCE_CONFIG] = False + out[CONF_LIKE_IN_NAME] = DEFAULT_LIKE_IN_NAME + out[CONF_DEBUG_AS_ERROR] = DEFAULT_DEBUG_AS_ERROR + out[CONF_TRACK_LIMIT] = DEFAULT_TRACK_LIMIT + out[CONF_LEGACY_RADIO] = DEFAULT_LEGACY_RADIO + out[CONF_SORT_BROWSER] = DEFAULT_SORT_BROWSER + out[CONF_INIT_EXTRA_SENSOR] = DEFAULT_INIT_EXTRA_SENSOR + out[CONF_INIT_DROPDOWNS] = DEFAULT_INIT_DROPDOWNS + out[CONF_MAX_DATARATE] = DEFAULT_MAX_DATARATE + + if user_input is not None: + # for the old shuffle_mode setting. + out.update(user_input) + if isinstance(_shuffle_mode := out[CONF_SHUFFLE_MODE], int): + if _shuffle_mode >= 1: + out[CONF_SHUFFLE_MODE] = ALL_SHUFFLE_MODES[_shuffle_mode - 1] + else: + out[CONF_SHUFFLE_MODE] = PLAYMODE_DIRECT + _LOGGER.debug(f"shuffle_mode: {_shuffle_mode} is a deprecated value and has been replaced with '{out[CONF_SHUFFLE_MODE]}'.") + + # If old input(s) exists,uncheck the new corresponding select(s). + # If the old input is set to a blank space character, then permanently delete this field. + for dropdown in ALL_DROPDOWNS: + if (_old_conf_input := out.get(OLD_INPUTS[dropdown])) is not None: + if _old_conf_input.replace(" ","") == "": + del out[OLD_INPUTS[dropdown]] + else: + if dropdown in out[CONF_INIT_DROPDOWNS]: + out[CONF_INIT_DROPDOWNS].remove(dropdown) + _LOGGER.debug(f"old {dropdown} input_select: {_old_conf_input} exists,uncheck the corresponding new select.") + return out + + +def find_thumbnail(item): + item_thumbnail = "" + try: + thumbnail_list = "" + if 'thumbnails' in item: + if 'thumbnail' in item['thumbnails']: + thumbnail_list = item['thumbnails']['thumbnail'] + else: + thumbnail_list = item['thumbnails'] + elif 'thumbnail' in item: + thumbnail_list = item['thumbnail'] + + if isinstance(thumbnail_list, list): + if 'url' in thumbnail_list[-1]: + item_thumbnail = thumbnail_list[-1]['url'] + except: + pass + return item_thumbnail diff --git a/custom_components/ytube_music_player/manifest.json b/custom_components/ytube_music_player/manifest.json new file mode 100644 index 00000000..e9c88909 --- /dev/null +++ b/custom_components/ytube_music_player/manifest.json @@ -0,0 +1,21 @@ +{ + "domain": "ytube_music_player", + "name": "YouTube Music Player", + "codeowners": [ + "@KoljaWindeler", + "@mang1985" + ], + "config_flow": true, + "dependencies": [ + "persistent_notification" + ], + "documentation": "https://github.com/KoljaWindeler/ytube_music_player", + "iot_class": "cloud_polling", + "issue_tracker": "https://github.com/KoljaWindeler/ytube_music_player/issues", + "requirements": [ + "ytmusicapi==1.9.1", + "pytubefix==v8.8.5", + "integrationhelper==0.2.2" + ], + "version": "20241229.01" +} diff --git a/custom_components/ytube_music_player/media_player.py b/custom_components/ytube_music_player/media_player.py new file mode 100644 index 00000000..19a6525a --- /dev/null +++ b/custom_components/ytube_music_player/media_player.py @@ -0,0 +1,2176 @@ + +# Attempting to support yTube Music in Home Assistant # +import logging +import random +import os.path +import datetime +from urllib.request import urlopen, Request +from urllib.parse import unquote +import requests +from typing import Any, Callable, Dict, List, Optional, Tuple + +import voluptuous as vol +from homeassistant.components.media_player import BrowseError +from homeassistant.helpers import config_validation as cv, entity_platform +from homeassistant.helpers.event import async_track_state_change_event +from homeassistant.core import Event +from homeassistant.helpers.event import async_call_later +from homeassistant.helpers.storage import STORAGE_DIR + +from homeassistant.const import ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME +import homeassistant.components.media_player as media_player + +from pytubefix import YouTube # to generate cipher +from pytubefix import request # to generate cipher +from pytubefix import extract # to generate cipher + +import ytmusicapi +from pytubefix.exceptions import RegexMatchError +# use this to work with local version +# and make sure that the local package is also only loading local files +# from .ytmusicapi import YTMusic +from .browse_media import build_item_response, library_payload +from .const import * + + +################### Temp FIX remove me! ############################### +################### Temp FIX remove me! ############################### +import pytubefix, re + +_LOGGER = logging.getLogger(__name__) + + +async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): + # Run setup via YAML + _LOGGER.debug("Config via YAML") + if(config is not None): + async_add_entities([yTubeMusicComponent(hass, config, "_yaml")], update_before_add=True) + + +async def async_setup_entry(hass, config, async_add_entities): + # Run setup via Storage + _LOGGER.debug("Config via Storage/UI") + if(len(config.data) > 0): + async_add_entities([yTubeMusicComponent(hass, config, "")], update_before_add=True) + + +class yTubeMusicComponent(MediaPlayerEntity): + def __init__(self, hass, config, name_add): + self.hass = hass + self._attr_unique_id = config.entry_id + self.hass.data[DOMAIN][self._attr_unique_id][DOMAIN_MP] = self + self._debug_log_concat = "" + self._debug_as_error = config.data.get(CONF_DEBUG_AS_ERROR, DEFAULT_DEBUG_AS_ERROR) + self._org_name = config.data.get(CONF_NAME, DOMAIN + name_add) + self._attr_name = self._org_name + self._api_language = config.data.get(CONF_API_LANGUAGE, DEFAULT_API_LANGUAGE) + self._init_extra_sensor = config.data.get(CONF_INIT_EXTRA_SENSOR, DEFAULT_INIT_EXTRA_SENSOR) + self._init_dropdowns = config.data.get(CONF_INIT_DROPDOWNS, DEFAULT_INIT_DROPDOWNS) + self._maxDatarate = config.data.get(CONF_MAX_DATARATE,DEFAULT_MAX_DATARATE) + + # All entities are now automatically generated,will be registered in the async_update_selects method later. + # This should be helpful for multiple accounts. + self._selects = dict() # use a dict to store the dropdown entity_id should be more convenient. + # For old settings. + for k,v in OLD_INPUTS.items(): + if v == CONF_SELECT_PLAYCONTINUOUS: + _domain = input_boolean.DOMAIN + else: + _domain = input_select.DOMAIN + try: + self._selects[k] = config.data.get(v) + except: + pass + if self._selects[k] is not None and self._selects[k].replace(" ","") != "": + self._selects[k] = _domain + "." + self._selects[k].replace(_domain + ".", "") + self.log_me('debug', "Found old {} {}: {},please consider using the new select entities.".format(_domain, k, self._selects[k] )) + + self._like_in_name = config.data.get(CONF_LIKE_IN_NAME, DEFAULT_LIKE_IN_NAME) + + self._attr_shuffle = config.data.get(CONF_SHUFFLE, DEFAULT_SHUFFLE) + self._shuffle_mode = config.data.get(CONF_SHUFFLE_MODE, DEFAULT_SHUFFLE_MODE) + + default_header_file = os.path.join(hass.config.path(STORAGE_DIR), DEFAULT_HEADER_FILENAME) + self._header_file = config.data.get(CONF_HEADER_PATH, default_header_file) + self._speakersList = config.data.get(CONF_RECEIVERS) + self._trackLimit = config.data.get(CONF_TRACK_LIMIT) + self._legacyRadio = config.data.get(CONF_LEGACY_RADIO) + self._sortBrowser = config.data.get(CONF_SORT_BROWSER) + self._friendly_speakersList = dict() + + # proxy settings + self._proxy_url = config.data.get(CONF_PROXY_URL, "") + self._proxy_path = config.data.get(CONF_PROXY_PATH, "") + + + self.log_me('debug', "YtubeMediaPlayer config: ") + self.log_me('debug', "- Header path: " + self._header_file) + self.log_me('debug', "- speakerlist: " + str(self._speakersList)) + self.log_me('debug', "- shuffle: " + str(self._attr_shuffle)) + self.log_me('debug', "- shuffle_mode: " + str(self._shuffle_mode)) + self.log_me('debug', "- like_in_name: " + str(self._like_in_name)) + self.log_me('debug', "- track_limit: " + str(self._trackLimit)) + self.log_me('debug', "- legacy_radio: " + str(self._legacyRadio)) + self.log_me('debug', "- max_dataRate: " + str(self._maxDatarate)) + + self._brand_id = str(config.data.get(CONF_BRAND_ID, "")) + self._api = None + self._js = "" + self._update_needed = False + + self._remote_player = "" + self._untrack_remote_player = None + self._untrack_remote_player_selector = None + self._playlists = [] + self._playlist_to_index = {} + self._tracks = [] + self._trackLimitUser = -1 + self._attributes = {} + self._playing = False + self._state = STATE_OFF + self._track_name = None + self._track_artist = None + self._track_album_name = None + self._track_album_cover = None + self._track_artist_cover = None + self._track_album_id = None + self._media_duration = None + self._media_position = None + self._media_position_updated = None + self._attributes['remote_player_state'] = STATE_OFF + self._attributes['likeStatus'] = "" + self._attributes['current_playlist_title'] = "" + self._attributes['videoId'] = "" + self._attributes['_media_type'] = "" + self._attributes['_media_id'] = "" + self._attributes['current_track'] = 0 + self._attributes['_media_type'] = None + self._attributes['_media_id'] = None + self._next_track_no = 0 + self._allow_next = False + self._last_auto_advance = datetime.datetime.now() + self._started_by = None + self._interrupt_data = None + self._attributes['remote_player_id'] = None + self._volume = 0.0 + self._is_mute = False + self._attr_repeat = RepeatMode.ALL + self._signatureTimestamp = 0 + self._x_to_idle = None # Some Mediaplayer don't transition to 'idle' but to 'off' on track end. This re-routes off to idle + self._ignore_paused_on_media_change = False # RobinR1, OwnTone compatibility + self._ignore_next_remote_pause_state = False # RobinR1, OwnTone compatibility: Some Mediaplayers temporarely switches to 'paused' during media changes (next/prev/seek) + self._search = {"query": "", "filter": None, "limit": 20} + self.reset_attributs() + + # register "call_method" + if(name_add == ""): + platform = entity_platform.current_platform.get() + platform.async_register_entity_service( + SERVICE_CALL_METHOD, + { + vol.Required(ATTR_COMMAND): cv.string, + vol.Optional(ATTR_PARAMETERS): vol.All( + cv.ensure_list, vol.Length(min=1), [cv.string] + ), + }, + "async_call_method", + ) + platform.async_register_entity_service( + SERVICE_SEARCH, + { + vol.Required(ATTR_QUERY): cv.string, + vol.Optional(ATTR_FILTER): cv.string, + vol.Optional(ATTR_LIMIT): vol.Coerce(int) + }, + "async_search", + ) + platform.async_register_entity_service( + SERVICE_ADD_TO_PLAYLIST, + { + vol.Optional(ATTR_SONG_ID): cv.string, + vol.Optional(ATTR_PLAYLIST_ID): cv.string + }, + "async_add_to_playlist", + ) + platform.async_register_entity_service( + SERVICE_REMOVE_FROM_PLAYLIST, + { + vol.Optional(ATTR_SONG_ID): cv.string, + vol.Optional(ATTR_PLAYLIST_ID): cv.string + }, + "async_remove_from_playlist", + ) + platform.async_register_entity_service( + SERVICE_CALL_RATE_TRACK, + { + vol.Required(ATTR_RATING): cv.string, + vol.Optional(ATTR_SONG_ID): cv.string + }, + "async_rate_track", + ) + platform.async_register_entity_service( + SERVICE_LIMIT_COUNT, + { + vol.Required(ATTR_LIMIT): vol.Coerce(int) + }, + "async_limit_count", + ) + platform.async_register_entity_service( + SERVICE_RADIO, + { + vol.Optional(ATTR_INTERRUPT): vol.Coerce(bool) + }, + "async_start_radio", + ) + + # run the api / get_cipher / update select as soon as possible + if hass.is_running: + self._update_needed = True + else: + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, self.async_startup) + + + # user had difficulties during the debug message on, so we'll provide a workaroud to post debug as errors + def log_me(self, type, msg): + # clear buffer of _later + # see if this is just the ending message: + try: + if(isinstance(msg, str)): + if(msg.find('[E]') == 0 and self._debug_log_concat != ""): + name = msg.split('[E]')[1] + if(self._debug_log_concat.find(name) >= 0): + self._debug_log_concat += " [E]" + msg = "" + if(self._debug_log_concat != ""): + if(self._debug_as_error): + _LOGGER.error(self._debug_log_concat) + else: + _LOGGER.debug(self._debug_log_concat) + self._debug_log_concat = "" + except: + self.exc() + # send new message + if(msg != ""): + if(self._debug_as_error or type == 'error'): + _LOGGER.error(msg) + else: + _LOGGER.debug(msg) + + def log_debug_later(self, msg): + # sum up a log + if(msg.find('[S]') == 0): # a new start message + if(self._debug_log_concat != ""): # if there is something in the buffer print it now + self.log_me("", "") + self._debug_log_concat = msg # start with a new buffer + else: # not a new messsage, append it + self._debug_log_concat += " ... " + msg + if self._debug_log_concat.find('[E]') >= 0: # if the end part is in the messeage print it now + self.log_me("", "") + + + def reset_attributs(self): + # reset some common attributs + self._playing = False + self._state = STATE_OFF + self._track_name = None + self._track_artist = None + self._track_album_name = None + self._track_album_cover = None + self._track_artist_cover = None + self._track_album_id = None + self._media_duration = None + self._media_position = None + self._media_position_updated = None + self._app_id = None + self._attributes['remote_player_state'] = STATE_OFF + self._attributes['likeStatus'] = "" + self._attributes['current_playlist_title'] = "" + self._attributes['videoId'] = "" + self._attributes['_media_type'] = "" + self._attributes['_media_id'] = "" + self._attributes['current_track'] = 0 + self._attributes['_media_type'] = None + self._attributes['_media_id'] = None + + self.hass.data[DOMAIN][self._attr_unique_id]['lyrics'] = "" + # After turning off the media_player, keep the playlists and search information available + # as they may be needed forautomations. + # self.hass.data[DOMAIN][self._attr_unique_id]['search'] = "" + self.hass.data[DOMAIN][self._attr_unique_id]['tracks'] = "" + # self.hass.data[DOMAIN][self._attr_unique_id]['playlists'] = "" + self.hass.data[DOMAIN][self._attr_unique_id]['total_tracks'] = 0 + + + async def async_update(self): + # update will be called eventually BEFORE homeassistant is started completly + # therefore we should not use this method for ths init + self.log_debug_later("[S] async_update") + if(self._update_needed): + self._update_needed = False + await self.async_startup(self.hass) + self.log_me('debug', "[E] async_update") + + # either called once homeassistant started (component was configured before startup) + # or call from update(), if the component was configured AFTER homeassistant was started + async def async_startup(self, hass): + self.log_me('debug', "[S] async_startup") + try: + await self.async_get_cipher('BB2mjBuAtiQ') + except: + self.log_me('error', "async_get_cipher failed") + try: + await self.async_check_api() + except: + self.log_me('error', "async_check_api failed") + try: + await self.async_update_selects() + except: + self.log_me('error', "async_update_selects failed") + try: + await self.async_update_playmode() + except: + self.log_me('error', "async_update_playmode failed") + self.log_me('debug', "[E] async_startup") + + async def async_check_api(self): + self.log_debug_later("[S] async_check_api") + if(self._api is None): + self.log_debug_later("- no valid API, try to login") + if(os.path.exists(self._header_file)): + [ret, msg, self._api] = await async_try_login(self.hass, self._header_file, self._brand_id, self._api_language) + if(msg != ""): + self._api = None + out = "Issue during login: " + msg + data = {"title": "yTubeMediaPlayer error", "message": out} + await self.hass.services.async_call("persistent_notification", "create", data) + self.log_me('debug', "[E] (fail) async_check_api") + return False + else: + self._signatureTimestamp = await self.hass.async_add_executor_job(self._api.get_signatureTimestamp) + try: + self.log_debug_later("YouTube Api initialized ok, version: " + str(ytmusicapi.__version__)) + except: + self.log_debug_later("YouTube Api initialized ok") + else: + out = "can't find header file at " + self._header_file + _LOGGER.error(out) + data = {"title": "yTubeMediaPlayer error", "message": out} + await self.hass.services.async_call("persistent_notification", "create", data) + self.log_me('debug', "[E] (fail) async_check_api") + return False + self.log_me('debug', "[E] async_check_api") + return True + + @property + def device_info(self): + return { + 'identifiers': {(DOMAIN, self._attr_unique_id)}, + 'name': self._attr_name, + 'manufacturer': "Google Inc.", + 'model': DOMAIN + } + + @property + def name(self): + # Return the name of the player. + return self._attr_name + + @property + def icon(self): + return 'mdi:music-circle' + + @property + def supported_features(self) -> media_player.MediaPlayerEntityFeature: + # Flag media player features that are supported. + return SUPPORT_YTUBEMUSIC_PLAYER + + @property + def should_poll(self): + # No polling needed. + return False + + @property + def state(self): + # Return the state of the device. + return self._state + + @property + def extra_state_attributes(self): + # Return the device state attributes. + return self._attributes + + @property + def is_volume_muted(self): + # Return True if device is muted + return self._is_mute + + @property + def is_on(self): + # Return True if device is on. + return self._playing + + @property + def media_content_type(self): + # Content type of current playing media. + return MediaType.MUSIC + + @property + def media_title(self): + # Title of current playing media. + return self._track_name + + @property + def media_artist(self): + # Artist of current playing media + return self._track_artist + + @property + def media_album_name(self): + # Album name of current playing media + return self._track_album_name + + @property + def media_image_url(self): + # Image url of current playing media. + return self._track_album_cover + + @property + def media_image_remotely_accessible(self): + # True returns: entity_picture: http://lh3.googleusercontent.com/Ndilu... + # False returns: entity_picture: /api/media_player_proxy/media_player.gmusic_player?token=4454... + return True + + @property + def media_position(self): + # Position of current playing media in seconds. + return self._media_position + + + @property + def media_position_updated_at(self): + # When was the position of the current playing media valid. + # Returns value from homeassistant.util.dt.utcnow(). + # + return self._media_position_updated + + + @property + def media_duration(self): + # Duration of current playing media in seconds. + return self._media_duration + + + @property + def shuffle(self): + # Boolean if shuffling is enabled. + return self._attr_shuffle + + @property + def repeat(self): + # Return current repeat mode. + return self._attr_repeat + + async def async_set_repeat(self, repeat: str): + if self.repeat != repeat: + self.log_me('debug', f"[S] set_repeat: {repeat}") + # Set repeat mode. + self._attr_repeat = repeat + if(self._selects['repeatmode'] is not None): + if repeat == RepeatMode.ALL: + ib_repeat = STATE_ON + else: + ib_repeat = STATE_OFF + if (_state := self.hass.states.get(self._selects['repeatmode']).state) != repeat: + if input_boolean.DOMAIN in self._selects['repeatmode']: + if _state != ib_repeat: + data = {ATTR_ENTITY_ID: self._selects['repeatmode']} + if ib_repeat == STATE_ON: + await self.hass.services.async_call(input_boolean.DOMAIN, IB_ON, data) + else: + await self.hass.services.async_call(input_boolean.DOMAIN, IB_OFF, data) + else: + data = {select.ATTR_OPTION: repeat, ATTR_ENTITY_ID: self._selects['repeatmode']} + await self.hass.services.async_call(select.DOMAIN, select.SERVICE_SELECT_OPTION, data) + + self.log_me('debug', f"[E] set_repeat: {repeat}") + self.async_schedule_update_ha_state() + + @property + def volume_level(self): + # Volume level of the media player (0..1). + return self._volume + + + async def async_turn_on(self, *args, **kwargs): + # Turn on the selected media_player from select + self.log_me('debug', "[S] TURNON") + self._started_by = "UI" + + # exit if we don't konw what to play (the select_playlist will be set to "" if the config provided a value but the entity_id is not in homeassistant) + if self._selects['playlists'] is None: + self.log_me('debug', "no or wrong playlist select field in the config, exiting") + msg = "You have no playlist entity_id in your config, or that entity_id is not in homeassistant. I don't know what to play and will exit. Either use the media_browser or add the playlist dropdown" + data = {"title": "yTubeMediaPlayer error", "message": msg} + await self.hass.services.async_call("persistent_notification", "create", data) + await self.async_turn_off_media_player() + self.log_me('debug', "[E] (fail) TURNON") + return + + # set UI to correct playlist, or grab playlist if none was submitted + playlist = self.hass.states.get(self._selects['playlists']).state + + # exit if we don't have any playlists from the account + if(len(self._playlists) == 0): + _LOGGER.error("playlists empty") + await self.async_turn_off_media_player() + self.log_me('debug', "[E] (fail) TURNON") + return + + # load ID for playlist name + idx = self._playlist_to_index.get(playlist) + if idx is None: + _LOGGER.error("playlist to index is none!") + await self.async_turn_off_media_player() + self.log_me('debug', "[E] (fail) TURNON") + return + + # playlist or playlist_radio? + if self._selects['radiomode'] is not None: + _source = self.hass.states.get(self._selects['radiomode']) + if _source is None: + _LOGGER.error("- (%s) is not a valid select entity.", self._selects['radiomode']) + self.log_me('debug', "[E] (fail) TURNON") + return + if(_source.state == "Playlist"): + self._attributes['_media_type'] = MediaType.PLAYLIST + else: + self._attributes['_media_type'] = CHANNEL + else: + self._attributes['_media_type'] = MediaType.PLAYLIST + + # store id and start play_media + self._attributes['_media_id'] = self._playlists[idx]['playlistId'] + self.log_me('debug', "[E] TURNON") + return await self.async_play_media(media_type=self._attributes['_media_type'], media_id=self._attributes['_media_id']) + + async def async_prepare_play(self): + self.log_me('debug', "[S] async_prepare_play") + if(not await self.async_check_api()): + self.log_me('debug', "[E] (fail) async_prepare_play") + return False + + # get _remote_player + if not await self.async_update_remote_player(): + self.log_me('debug', "[E] (fail) async_prepare_play") + return False + _player = self.hass.states.get(self._remote_player) + + # subscribe to changes + if self._selects['playmode'] is not None: + async_track_state_change_event(self.hass, self._selects['playmode'], self.async_update_playmode) + if self._selects['repeatmode'] is not None: + async_track_state_change_event(self.hass, self._selects['repeatmode'], self.async_update_playmode) + if self._selects['speakers'] is not None: + async_track_state_change_event(self.hass, self._selects['speakers'], self.async_select_source_helper) + + # make sure that the player, is on and idle + try: + if self._playing is True: + await self.async_media_stop() + elif self._playing is False and self._state == STATE_OFF: + if _player.state == STATE_OFF: + await self.async_turn_on_media_player() + else: + self.log_me('debug', "self._state is: (" + self._state + ").") + if(self._state == STATE_PLAYING): + await self.async_media_stop() + except: + _LOGGER.error("We hit an error during prepare play, likely related to issue 52") + _LOGGER.error("Player: " + str(_player) + ".") + _LOGGER.error("remote_player: " + str(self._remote_player) + ".") + self.exc() + + + # update cipher + await self.async_get_cipher('BB2mjBuAtiQ') + + # display imidiatly a loading state to provide feedback to the user + self._allow_next = False + self._track_album_name = "" + self._track_artist = "" + self._track_artist_cover = None + self._track_album_cover = None + self._track_name = "loading..." + self._state = STATE_PLAYING # a bit early otherwise no info will be shown + self.async_schedule_update_ha_state() + self.log_me('debug', "[E] async_prepare_play") + return True + + async def async_turn_on_media_player(self, data=None): + self.log_debug_later("[S] async_turn_on_media_player") + # Fire the on action. + if data is None: + data = {ATTR_ENTITY_ID: self._remote_player} + self._state = STATE_IDLE + self.async_schedule_update_ha_state() + self.log_me('debug', "[E] async_turn_on_media_player") + await self.hass.services.async_call(DOMAIN_MP, 'turn_on', data) + + + async def async_turn_off(self, entity_id=None, old_state=None, new_state=None, **kwargs): + # Turn off the selected media_player + self.log_me('debug', "turn_off") + self._playing = False + await self.async_turn_off_media_player() + + async def async_turn_off_media_player(self, data=None): + self.log_debug_later("[S] async_turn_off_media_player") + # Fire the off action. + self.reset_attributs() + if(self._like_in_name): + self._attr_name = self._org_name + self.async_schedule_update_ha_state() + if(self._remote_player == ""): + if(not(await self.async_update_remote_player())): + self.log_me('debug', "[E] (fail) async_turn_off_media_player") + return + if(data != 'skip_remote_player'): + data = {ATTR_ENTITY_ID: self._remote_player} + await self.hass.services.async_call(DOMAIN_MP, 'media_stop', data) + await self.hass.services.async_call(DOMAIN_MP, 'turn_off', data) + + # unsubscribe from remote media_player + if(self._untrack_remote_player is not None): + try: + self._untrack_remote_player() + except: + pass + self._untrack_remote_player = None + + self.log_me('debug', "[E] async_turn_off_media_player") + + + async def async_update_remote_player(self, remote_player=""): + self.log_debug_later("[S] async_update_remote_player(Input " + str(remote_player) + "/ current " + str(self._remote_player) + ") ") + if(remote_player == self._remote_player and remote_player != ""): + self.log_me('debug', " no change [E]") + return + + + old_remote_player = self._remote_player + # sanitize player, remove domain + remote_player = remote_player.replace(DOMAIN_MP + ".", "") + + if(remote_player != ""): + # make sure that the entity ID is complete + remote_player = DOMAIN_MP + "." + remote_player + # sets the current media_player from speaker select + elif(self._selects['speakers'] is not None and await self.async_check_entity_exists(self._selects['speakers'], unavailable_is_ok=False)): # drop down for player does exist .. double check!! + media_player_select = self.hass.states.get(self._selects['speakers']) # Example: self.hass.states.get(select.gmusic_player_speakers) + if media_player_select is None: + self.log_me('error', "(" + self._selects['speakers'] + ") is not a valid select entity to get the player.") + else: + # since we can't be sure if the MediaPlayer Domain is in the field value, add it and remove it :D + remote_player = DOMAIN_MP + "." + media_player_select.state.replace(DOMAIN_MP + ".", "") + + # ok lets check if we have a player or post an error + if(await self.async_check_entity_exists(remote_player)): + self._remote_player = remote_player + self._attributes['remote_player_id'] = self._remote_player + elif(await self.async_check_entity_exists(self._remote_player)): + self._attributes['remote_player_id'] = self._remote_player + else: + self._track_name = "Please select player first" + self.async_schedule_update_ha_state() + msg = "Please select a player before start playing, e.g. via the 'media_player.select_source' method or in the settings/config_flow" + data = {"title": "yTubeMediaPlayer error", "message": msg} + await self.hass.services.async_call("persistent_notification", "create", data) + self.log_me('error', "No player selected or the selected player isn't available (" + str(remote_player) + "/" + str(self._remote_player) + "), you will not be able to play music, please set the default player in the settings/config_flow or call media_player.select_source") + self.log_me('debug', "[E] (fail) async_update_remote_player") + return False + + # unsubscribe / resubscribe to the player, because the old subscrition was for the old player + if self._remote_player != old_remote_player: + if(self._untrack_remote_player is not None): + try: + self._untrack_remote_player() + except: + pass + self._untrack_remote_player = None + if(self._untrack_remote_player is None): + self._untrack_remote_player = async_track_state_change_event(self.hass, self._remote_player, self.async_sync_player) + self.log_me('debug', "[E] async_update_remote_player") + return True + + + async def async_get_cipher(self, videoId): + self.log_debug_later("[S] async_get_cipher") + embed_url = "https://www.youtube.com/embed/" + videoId + # this is why we need pytubefix as include + embed_html = await self.hass.async_add_executor_job(request.get, embed_url) + js_url = extract.js_url(embed_html) + self._js = await self.hass.async_add_executor_job(request.get, js_url) + self._cipher = pytubefix.cipher.Cipher(js=self._js, js_url=js_url) + # this is why we need pytubefix as include + self.log_me('debug', "[E] async_get_cipher") + + async def async_sync_player(self, event=None): + self.log_debug_later("[S] async_sync_player") + if isinstance(event,Event): + _event_data = event.data + entity_id = _event_data.get('entity_id') + old_state = _event_data.get('old_state') + new_state = _event_data.get('new_state') + else: + entity_id = None + old_state = None + new_state = None + self.log_me('debug', f"event: {event}") + + if(entity_id is not None and old_state is not None) and new_state is not None: + self.log_debug_later(entity_id + ": " + old_state.state + " -> " + new_state.state) + if(entity_id.lower() != self._remote_player.lower()): + self.log_me('debug', "- ignoring player " + str(entity_id) + " the player of interest is " + str(self._remote_player)) + return + else: + self.log_debug_later(self._remote_player) + + # Perform actions based on the state of the selected (Speakers) media_player # + if not self._playing: + self.log_debug_later("not playing [E]") + return + # _player = The selected speakers # + _player = self.hass.states.get(self._remote_player) + + # Only update the duration and especially the position if we're not in pause + # else the mini-media-player will advance during our pause state + if(self._state != STATE_PAUSED): + if('media_duration' in _player.attributes): + self._media_duration = _player.attributes['media_duration'] + if('media_position' in _player.attributes): + self._media_position = _player.attributes['media_position'] + if('media_position_updated_at' in _player.attributes): + if(isinstance(_player.attributes['media_position_updated_at'],datetime.datetime)): + self._media_position_updated = _player.attributes['media_position_updated_at'] + else: + self._media_position_updated = datetime.datetime.now(datetime.timezone.utc) + else: + self._media_position_updated = datetime.datetime.now(datetime.timezone.utc) + + # Workaround for chromecast sometimes not playing first song in a playlist + if(old_state!=None and new_state!=None): + try: + if(old_state.state == STATE_IDLE and new_state.state == STATE_PAUSED): + if(self._state == STATE_PLAYING): + self.log_me('error','chromecast in pause should be playings, '+str(old_state)) + await self.async_get_track() + except: + pass + + # detect app switch an turn off if so + if('app_id' in _player.attributes): + if(self._app_id == None): + self._app_id = _player.attributes['app_id'] + self.log_me('debug', "detected app _id, "+str(self._app_id)) + elif (_player.attributes['app_id'] != self._app_id): + self.log_me('debug', "detected different app _id, shuttiung down without interruption") + await self.async_turn_off_media_player('skip_remote_player') + return + + # entity_id of selected speakers. # + self._attributes['remote_player_id'] = _player.entity_id + + # _player state - Example [playing -or- idle]. # + self._attributes['remote_player_state'] = _player.state + + # unlock allow next, some player fail because their media_position is 'strange' catch # + found_position = False + try: + if 'media_position' in _player.attributes: + found_position = True + if(isinstance(_player.attributes['media_position'], int)): + if _player.state == 'playing' and _player.attributes['media_position'] > 0: + self._allow_next = True + except: + found_position = False + if not(found_position) and _player.state == 'playing': # fix for browser mod media_player not providing the 'media_position' + self._allow_next = True + + # auto next .. best cast: we have an old and a new state # + if(old_state is not None and new_state is not None): + # chromecast quite frequently change from playing to idle twice, so we need some kind of time guard + if(old_state.state == STATE_PLAYING and new_state.state == STATE_IDLE and (datetime.datetime.now() - self._last_auto_advance).total_seconds() > 10): + self._allow_next = False + # add track to history + try: + response = await self.hass.async_add_executor_job(lambda: self._api.get_song(self._attributes['videoId'], self._signatureTimestamp)) + await self.hass.async_add_executor_job(lambda: self._api.add_history_item(response)) + except: + self.log_me('debug', "adding "+self._attributes['videoId']+" to history failed") + + await self.async_get_track(auto_advance=True) + # turn this player off when the remote_player was shut down + elif((old_state.state == STATE_PLAYING or old_state.state == STATE_IDLE or old_state.state == STATE_PAUSED) and new_state.state == STATE_OFF): + if(self._x_to_idle == STATE_OFF or self._x_to_idle == STATE_OFF_1X): # workaround for MPD (changes to OFF at the end of a track) + self._allow_next = False + # add track to history + try: + response = await self.hass.async_add_executor_job(lambda: self._api.get_song(self._attributes['videoId'], self._signatureTimestamp)) + await self.hass.async_add_executor_job(lambda: self._api.add_history_item(response)) + except: + self.log_me('debug', "adding "+self._attributes['videoId']+" to history failed") + await self.async_get_track(auto_advance=True) + if(self._x_to_idle == STATE_OFF_1X): + self._x_to_idle = None + else: + self._state = STATE_OFF + self.log_me('debug', "media player got turned off") + await self.async_turn_off() + # workaround for SONOS (changes to PAUSED at the end of a track) + elif(old_state.state == STATE_PLAYING and new_state.state == STATE_PAUSED and # noqa: W504 + (datetime.datetime.now() - self._last_auto_advance).total_seconds() > 10 and # noqa: W504 + self._x_to_idle == STATE_PAUSED): + # add track to history + try: + response = await self.hass.async_add_executor_job(lambda: self._api.get_song(self._attributes['videoId'], self._signatureTimestamp)) + await self.hass.async_add_executor_job(lambda: self._api.add_history_item(response)) + except: + self.log_me('debug', "adding "+self._attributes['videoId']+" to history failed") + self._allow_next = False + await self.async_get_track(auto_advance=True) + # set this player in to pause state when the remote player does, or ignore when assumed it is a temporary state (as some players do while seeking/skipping track) + elif(old_state.state == STATE_PLAYING and new_state.state == STATE_PAUSED): + self.log_me('debug', "Remote Player changed from PLAYING to PAUSED.") + if(self._ignore_paused_on_media_change and self._ignore_next_remote_pause_state): # RobinR1, OwnTone compatibility + self.log_me('debug', "Ignoring state change") # RobinR1, OwnTone compatibility + self._ignore_next_remote_pause_state = False # RobinR1, OwnTone compatibility + return # RobinR1, OwnTone compatibility + else: # RobinR1, OwnTone compatibility + return await self.async_media_pause() + # resume playback when the player does + elif(old_state.state == STATE_PAUSED and new_state.state == STATE_PLAYING and self._state == STATE_PAUSED): + return await self.async_media_play() + # player changes itsself from pause -> idle (while we where in pause state) + elif(old_state.state == STATE_PAUSED and new_state.state == STATE_IDLE and self._state == STATE_PAUSED): + self.log_me('debug', "Remote Player changed from PAUSED to IDLE withouth our interaction, so likely another source is using the player now. I'll step back and swich myself off") + await self.async_turn_off_media_player('skip_remote_player') + return + # no states, lets rely on stuff like _allow_next + elif _player.state == 'idle': + if self._allow_next: + if (datetime.datetime.now() - self._last_auto_advance).total_seconds() > 10: + self._allow_next = False + await self.async_get_track(auto_advance=True) + + + # Set new volume if it has been changed on the _player # + if 'volume_level' in _player.attributes: + self._volume = round(_player.attributes['volume_level'], 2) + self.async_schedule_update_ha_state() + self.log_me('debug', "[E] async_sync_player") + + async def async_ytubemusic_play_media(self, event): + self.log_me('debug', "[S] async_ytubemusic_play_media") + _speak = event.data.get('speakers') + _source = event.data.get('source') + _media = event.data.get('name') + + if event.data['shuffle_mode']: + self._shuffle_mode = event.data.get('shuffle_mode') + _LOGGER.info("SHUFFLE_MODE: %s", self._shuffle_mode) + + if event.data['shuffle']: + self.async_set_shuffle(event.data.get('shuffle')) + _LOGGER.info("- SHUFFLE: %s", self._attr_shuffle) + + self.log_me('debug', "- Speakers: (%s) | Source: (%s) | Name: (%s)", _speak, _source, _media) + await self.async_play_media(_source, _media, _speak) + self.log_me('debug', "[E] async_ytubemusic_play_media") + + + def extract_info(self, _track): + # self.log_me('debug', "extract_info") + # If available, get track information. # + info = dict() + info['track_album_name'] = "" + info['track_artist_cover'] = "" + info['track_name'] = "" + info['track_artist'] = "" + info['track_album_cover'] = "" + info['track_album_id'] = "" + + try: + if 'title' in _track: + info['track_name'] = _track['title'] + except: + pass + + try: + if 'byline' in _track: + info['track_artist'] = _track['byline'] + elif 'artists' in _track: + info['track_artist'] = "" + if(isinstance(_track["artists"], str)): + info['track_artist'] = _track["artists"] + elif(isinstance(_track["artists"], list)): + for t in _track['artists']: + if 'name' in t: + name = t['name'] + else: + name = t + if(info['track_artist'] == ""): + info['track_artist'] = name + else: + info['track_artist'] += " / " + name + elif 'author' in _track: + info['track_artist'] = _track['author'] # use 'author' if still no artist info. + except: + pass + + try: + _album_art_ref = None + if 'thumbnail' in _track: + _album_art_ref = _track['thumbnail'] # returns a list, + if 'thumbnails' in _album_art_ref: + _album_art_ref = _album_art_ref['thumbnails'] + elif 'thumbnails' in _track: + _album_art_ref = _track['thumbnails'] # returns a list + + if isinstance(_album_art_ref, list): + th_width = 0 + for th_data in _album_art_ref: + if('width' in th_data and 'url' in th_data): + if(th_data['width'] > th_width): + th_width = th_data['width'] + info['track_album_cover'] = th_data['url'] + except: + pass + + try: + if 'album' in _track: + info['track_album_name'] = _track['album']['name'] # fix missing album info. + if 'id' in _track['album']: + info['track_album_id'] = _track['album']['id'] + except: + pass + + # make sure all extracted infos are actually strings + for key in info: + if(info[key] is None): + info[key] = "" + return info + + async def async_select_source_helper(self, event=None): + self.log_me('debug', "[S] async_select_source_helper") + # redirect call, obviously we got called by status change, so we can call it without argument and let it pick + source_entity_id = None + source = self.hass.states.get(self._selects['speakers']).state + # get entity id from friendly_name + for e, f in self._friendly_speakersList.items(): + if(f == source): + source_entity_id = e + break + if(source_entity_id is None): + self.log_me('debug', "- Couldn't find " + source + " in dropdown list, giving up") + return + else: + self.log_me('debug', 'Translated friendly name ' + source + ' to entity id ' + source_entity_id) + self.log_me('debug', "[E] async_select_source_helper") + return await self.async_select_source(source_entity_id) + + async def async_select_source(self, source=None): + self.log_me('debug', "[S] async_select_source(" + str(source) + ")") + # source should just be the NAME without DOMAIN, to select it in the dropdown + if(isinstance(source, str)): + source = source.replace(DOMAIN_MP + ".", "") + # shutdown old player if we're currently playimg + was_playing = self._playing + if(self._playing): + self.log_me('debug', "- was playing") + old_player = self.hass.states.get(self._remote_player) + await self.async_media_stop(player=self._remote_player) # important to mention the player here explictly. We're going to change it and stuff runs async + # set player + if(source is not None): + # set entity_id + await self.async_update_remote_player(remote_player=DOMAIN_MP + "." + source) + self.log_me('debug', "- Choosing " + self._remote_player + " as player") + # try to set drop down + if self._selects['speakers'] is not None: + if(not await self.async_check_entity_exists(self._selects['speakers'], unavailable_is_ok=False)): + self.log_me('debug', "- Drop down for media player: " + str(self._selects['speakers']) + " not found") + elif source in self._friendly_speakersList: + # untrack player field change (to avoid self call) + if(self._untrack_remote_player_selector is not None): + try: + self._untrack_remote_player_selector() + self._untrack_remote_player_selector = None + self.log_me('debug', "- untrack passed") + except: + self.log_me('debug', "- untrack failed") + pass + if self.hass.states.get(self._selects['speakers']).state != self._friendly_speakersList[source]: + data = {select.ATTR_OPTION: self._friendly_speakersList[source], ATTR_ENTITY_ID: self._selects['speakers']} + await self.hass.services.async_call(select.DOMAIN, select.SERVICE_SELECT_OPTION, data) + # resubscribe with 3 sec delay so the UI can settle, directly call it will trigger the change from above + async_call_later(self.hass, 3, self.async_track_select_mediaplayer_helper) + else: + self.log_me('debug', "- Selected player '" + source + "' not found in options for Drop down, skipping") + else: + # load from dropdown, if that fails, exit + if(not await self.async_update_remote_player()): + _LOGGER.error("- async_update_remote_player failed") + return + # if playing, switch player + if(was_playing): + # don't call "_play" here, as that resets the playlist position + await self.async_get_track() + # seek, if possible + new_player = self.hass.states.get(self._remote_player) + if (all(a in old_player.attributes for a in ('media_position', 'media_position_updated_at', 'media_duration')) and 'supported_features' in new_player.attributes): + if(new_player.attributes['supported_features'] | MediaPlayerEntityFeature.SEEK): + now = datetime.datetime.now(datetime.timezone.utc) + delay = now - old_player.attributes['media_position_updated_at'] + pos = delay.total_seconds() + old_player.attributes['media_position'] + if pos < old_player.attributes['media_duration']: + data = {'seek_position': pos, ATTR_ENTITY_ID: self._remote_player} + await self.hass.services.async_call(DOMAIN_MP, media_player.SERVICE_MEDIA_SEEK, data) + self.async_schedule_update_ha_state() + self.log_me('debug', "[E] async_select_source") + + + async def async_update_selects(self, now=None): + self.log_me('debug', "[S] async_update_selects") + # -- Register dropdown(s). -- # + for dropdown in self._init_dropdowns: + if not await self.async_check_entity_exists(self._selects[dropdown], unavailable_is_ok=False): + entity_id = self.hass.data[DOMAIN][self._attr_unique_id][f'select_{dropdown}'].entity_id + if await self.async_check_entity_exists(entity_id, unavailable_is_ok=False): + self._selects[dropdown] = entity_id + self.log_me('debug', f"- {dropdown} select: {str(entity_id)} registered") + + # track changes + if(self._untrack_remote_player_selector is not None): + try: + self._untrack_remote_player_selector() + except: + self.log_me('error', 'untrack failed') + if self._selects['speakers'] is not None: + self._untrack_remote_player_selector = async_track_state_change_event(self.hass, self._selects['speakers'], self.async_select_source_helper) + if self._selects['playmode'] is not None: + async_track_state_change_event(self.hass, self._selects['playmode'], self.async_update_playmode) + if self._selects['repeatmode'] is not None: + async_track_state_change_event(self.hass, self._selects['repeatmode'], self.async_update_playmode) + # ----------- speaker -----# + try: + if(isinstance(self._speakersList, str)): + speakersList = [self._speakersList] + else: + speakersList = list(self._speakersList) + for i in range(0, len(speakersList)): + speakersList[i] = speakersList[i].replace(DOMAIN_MP + ".", "") + except: + speakersList = list() + + # generate the speaker list in any case (will be needed for the media_browser) + if(len(speakersList) <= 1): # Perhaps this behavior is no longer necessary? + all_entities = await self.hass.async_add_executor_job(self.hass.states.all) + for e in all_entities: + if(e.entity_id.startswith(DOMAIN_MP) and not(e.entity_id.startswith(DOMAIN_MP + "." + DOMAIN))): + speakersList.append(e.entity_id.replace(DOMAIN_MP + ".", "")) + # create friendly speakerlist based on the current speakerLlist + self._friendly_speakersList = dict() + for a in speakersList: + state = self.hass.states.get(DOMAIN_MP + "." + a) + friendly_name = state.attributes.get(ATTR_FRIENDLY_NAME) + if(friendly_name is None): + friendly_name = a + self._friendly_speakersList.update({a: friendly_name}) + friendly_speakersList = list(self._friendly_speakersList.values()) + if self._selects['speakers'] is not None: + if input_select.DOMAIN in self._selects['speakers']: + _select = input_select + else: + _select = select + data = {_select.ATTR_OPTIONS: friendly_speakersList, ATTR_ENTITY_ID: self._selects['speakers']} + if _select == input_select: + await self.hass.services.async_call(input_select.DOMAIN, input_select.SERVICE_SET_OPTIONS, data) + else: + await self.hass.data[DOMAIN][self._attr_unique_id]['select_speakers'].async_update(friendly_speakersList) # update speaker select + + data = {_select.ATTR_OPTION: friendly_speakersList[0], ATTR_ENTITY_ID: self._selects['speakers']} # select the first one in the list as the default player + await self.hass.services.async_call(_select.DOMAIN, _select.SERVICE_SELECT_OPTION, data) + else: + # we need to set the default player here, as there is no selct field. without a select field we don't get updates from the field and will never set the default player + await self.async_select_source(speakersList[0]) + + # finally call update playlist to fill the list .. if it exists + await self.async_update_playlists() + self.log_me('debug', "[E] async_update_selects") + + async def async_check_entity_exists(self, e, unavailable_is_ok=True): + try: + r = self.hass.states.get(e) + if(r is None): + return False + if(r.state == "unavailable"): # needed, some dropdown field will report as "unavailable" although they don't exist + if(not(unavailable_is_ok)): + return False + return True + except: + return False + + async def async_update_playlists(self, now=None): + self.log_me('debug', "[S] async_update_playlists") + # Sync playlists from Google Music library # + if(self._api is None): + self.log_me('debug', "- no api, exit") + return + if self._selects['playlists'] is None: + self.log_me('debug', "- no playlist select field, exit") + return + + self._playlist_to_index = {} + playlists_to_extra = {} + try: + try: + self._playlists = await self.hass.async_add_executor_job(lambda: self._api.get_library_playlists(limit=self._trackLimit)) + self._playlists = self._playlists[:self._trackLimit] # limit function doesn't really work ... loads at least 25 + self.log_me('debug', " - " + str(len(self._playlists)) + " Playlists loaded") + except: + self._api = None + self.exc() + return + idx = -1 + for playlist in self._playlists: + idx = idx + 1 + name = playlist.get('title', '') + if len(name) < 1: + continue + self._playlist_to_index[name] = idx + # the "your likes" playlist won't return a count of tracks + if not('count' in playlist): + try: + extra_info = await self.hass.async_add_executor_job(self._api.get_playlist, playlist['playlistId']) + if('trackCount' in extra_info): + self._playlists[idx]['count'] = int(extra_info['trackCount']) + else: + self._playlists[idx]['count'] = 25 + except: + if('playlistId' in playlist): + self.log_me('debug', "- Failed to get_playlist count for playlist ID '" + str(playlist['playlistId']) + "' setting it to 25") + else: + self.log_me('debug', "- Failed to get_playlist, no playlist ID") + self.exc() + self._playlists[idx]['count'] = 25 + playlists_to_extra[playlist['title']] = playlist['playlistId'] + + if(len(self._playlists) == 0): + self._playlist_to_index["No playlists found"] = 0 + + # sort with case-ignore + playlists = sorted(list(self._playlist_to_index.keys()), key=str.casefold) + await self.async_update_extra_sensor('playlists', playlists_to_extra) # update extra sensor + if self._selects['playlists'] is not None: # update playlist select + if input_select.DOMAIN in self._selects['playlists']: + data = {input_select.ATTR_OPTIONS: list(playlists), ATTR_ENTITY_ID: self._selects["playlists"]} + await self.hass.services.async_call(input_select.DOMAIN, input_select.SERVICE_SET_OPTIONS, data) + else: + await self.hass.data[DOMAIN][self._attr_unique_id]['select_playlists'].async_update() + except: + self.exc() + msg = "Caught error while loading playlist. please log for details" + data = {"title": "yTubeMediaPlayer error", "message": msg} + await self.hass.services.async_call("persistent_notification", "create", data) + self.log_me('debug', "[E] async_update_playlists") + + + async def _tracks_to_attribute(self): + self.log_debug_later("[S] _tracks_to_attribute") + await self.async_update_extra_sensor('total_tracks', len(self._tracks)) + track_attributes = [] + for track in self._tracks: + info = self.extract_info(track) + track_attributes.append(info['track_artist'] + " - " + info['track_name']) + await self.async_update_extra_sensor('tracks', track_attributes) # update extra sensor + + # fire event to let media card know to update + event_data = { + "device_id": self._attr_unique_id, + "entity_id": self.entity_id, + "type": "reload_playlist", + } + self.hass.bus.async_fire(DOMAIN+"_event", event_data) + self.log_me('debug', "[E] _tracks_to_attribute") + + async def async_update_extra_sensor(self, attribute, value): + # update extra sensor + self.log_debug_later("[S] async_update_extra_sensor") + self.hass.data[DOMAIN][self._attr_unique_id][attribute] = value + if(self._init_extra_sensor): + try: + await self.hass.data[DOMAIN][self._attr_unique_id]['extra_sensor'].async_update() + except: + self.log_me('debug', "Update failed") + pass + self.log_me('debug', "[E] async_update_extra_sensor") + + async def async_update_playmode(self, event=None): + # called from HA when th user changes the input entry, will read selection to membervar + # Changing the shuffle_mode while music is playing will no longer cause interruptions. + # Only when shuffle_mode=true the next song will be random. + # By default, when shuffle_mode = "Shuffle", shuffle=False. However, + # the _attr_shuffle variable can be changed during playback without interrupting the music. + self.log_me('debug', "[S] async_update_playmode") + try: + if self._selects['repeatmode'] is not None: + if (_state := self.hass.states.get(self._selects['repeatmode']).state) == STATE_ON: + _state = RepeatMode.ALL + await self.async_set_repeat(_state) + except: + self.log_me('debug', "- Selection field " + self._selects['repeatmode'] + " not found, skipping") + + try: + if self._selects['playmode'] is not None: + if (_playmode := self.hass.states.get(self._selects['playmode']).state) is not None: + if _playmode in (PLAYMODE_SHUFFLE,PLAYMODE_DIRECT): + shuffle = False + else: + shuffle = True + self._shuffle_mode = _playmode + await self.async_set_shuffle(shuffle) # The non-existent set_shuffle method was incorrectly called previously. + self.log_me('debug', f"- Playmode: {_playmode}") + except: + self.log_me('debug', "- Selection field " + self._selects['playmode'] + " not found, skipping") + + self.log_me('debug', "[E] async_update_playmode") + + + async def async_play(self): + self.log_me('debug', f"_play,shuffle:{self.shuffle},shuffle_mode:{self._shuffle_mode}") + self._next_track_no = 0 + if self.shuffle: + await self.async_get_track(keep_track_no=False) + else: + await self.async_get_track() + + async def async_get_track(self, event=None, retry=3, auto_advance=False, keep_track_no=True): + self.log_me('debug', "[S] async_get_track") + # Get a track and play it from the track_queue. + # grab next track from prefetched lis + _track = None + # get next track nr (randomly or by increasing). + if auto_advance: # auto_advance=true means that the call is coming from automatic playback of the next track. + if self.repeat == RepeatMode.ONE: + self.log_me('debug', "Single track loop.") + elif self.shuffle: + self._next_track_no = random.randrange(len(self._tracks)) - 1 + self.log_me('debug', "Random track.") + else: + self._next_track_no = self._next_track_no + 1 + self.log_me('debug', "- Playing track nr " + str(self._next_track_no + 1) + " / " + str(len(self._tracks))) # technically + 1 is wrong, but is still less confusing + if self._next_track_no >= len(self._tracks): + # we've reached the end of the playlist + if(self.repeat == RepeatMode.ALL): + # call PLAY_MEDIA with the same arguments + # return await self.async_play_media(media_type=self._attributes['_media_type'], media_id=self._attributes['_media_id']) + self._next_track_no = 0 # This maybe better. + else: + _LOGGER.info("- End of playlist and repeat mode is off") + await self.async_turn_off_media_player() + return + elif keep_track_no: + self.log_me('debug', "The track_no has already been specified,do not change it.") + elif self.shuffle: + self._next_track_no = random.randrange(len(self._tracks)) - 1 + self.log_me('debug', f"auto_advance={auto_advance},keep_track_no={keep_track_no},repeat={self.repeat},shuffle_mode={self._shuffle_mode}") + self.log_me('debug', "Press the next/pref button and shuffle is true, play random track.") + else: + self.log_me('debug', f"Uncaught Situation,auto_advance={auto_advance},keep_track_no={keep_track_no},repeat={self.repeat},shuffle_mode={self._shuffle_mode}") + + + # get track from array of _trackS + try: + _track = self._tracks[self._next_track_no] + except: + _LOGGER.error("- Out of range! Number of tracks in track_queue == (%s)", len(self._tracks)) + self._api = None + await self.async_turn_off_media_player() + return + if _track is None: + _LOGGER.error("- _track is None!") + await self.async_turn_off_media_player() + return + + # make sure there is a videoId + if not('videoId' in _track): + _LOGGER.error("- Failed to get ID for track: (%s)", _track) + _LOGGER.error(_track) + if retry < 1: + await self.async_turn_off_media_player() + return + return await self.async_get_track(retry=retry - 1, auto_advance=auto_advance, keep_track_no=keep_track_no) + + # updates attributes + self._attributes['current_track'] = self._next_track_no + self._attributes['videoId'] = _track['videoId'] + if('likeStatus' in _track): + self._attributes['likeStatus'] = _track['likeStatus'] + if(self._like_in_name): + self._attr_name = self._org_name + " - " + str(_track['likeStatus']) + else: + self._attributes['likeStatus'] = "" + if(self._like_in_name): + self._attr_name = self._org_name + # this will quickly update the information although the thumbnail might not super great, we'll update that later + info = self.extract_info(_track) + self._track_album_name = info['track_album_name'] + self._track_artist_cover = info['track_artist_cover'] + self._track_name = info['track_name'] + self._track_artist = info['track_artist'] + self._track_album_cover = info['track_album_cover'] + self._track_album_id = info['track_album_id'] + self.async_schedule_update_ha_state() + + # Get the stream URL and play on media_player + _url = await self.async_get_url(_track['videoId']) + if(_url == ""): + if retry < 1: + self.log_me('debug', "- get track failed to return URL, turning off") + await self.async_turn_off_media_player() + return + else: + _LOGGER.error("- Retry with: (%i)", retry) + return await self.async_get_track(retry=retry - 1, auto_advance=auto_advance, keep_track_no=keep_track_no) + + # proxy playback, needed e.g. for sonos + try: + if(self._proxy_url != "" and self._proxy_path != "" and self._proxy_url != " " and self._proxy_path != " "): + p1 = datetime.datetime.now() + _proxy_url = await self.hass.async_add_executor_job(lambda: urlopen(Request(_url, headers={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'}))) + _proxy_file = open(os.path.join(self._proxy_path, PROXY_FILENAME), 'wb') + _proxy_url_content = await self.hass.async_add_executor_job(_proxy_url.read) + await self.hass.async_add_executor_job(_proxy_file.write, _proxy_url_content) + if(self._proxy_url.endswith('/')): + self._proxy_url = self._proxy_url[:-1] + _url = self._proxy_url + "/" + PROXY_FILENAME + t = (datetime.datetime.now() - p1).total_seconds() + self.log_me('debug', "- proxy loading time: " + str(t) + " sec") + except: + _LOGGER.error("The proxy method hit an error, turning off") + self.exc() + await self.async_turn_off_media_player() + return + + # start playback + self._state = STATE_PLAYING + self._playing = True + self.async_schedule_update_ha_state() + self._last_auto_advance = datetime.datetime.now() # avoid auto_advance + data = { + ATTR_MEDIA_CONTENT_ID: _url, + ATTR_MEDIA_CONTENT_TYPE: MediaType.MUSIC, + ATTR_ENTITY_ID: self._remote_player, + "extra": { + "metadata": { + "metadataType": 3, + "title": self._track_name, + "artist": self._track_artist, + "images": [ + { + "url": self._track_album_cover, + } + ] + } + } + } + self.log_me('debug', "- forwarding url to player " + str(self._remote_player)) + await self.hass.services.async_call(DOMAIN_MP, SERVICE_PLAY_MEDIA, data) + + # get lyrics and more info after playback started + await self.async_update_extra_sensor('lyrics', 'No lyrics available') + + + try: + l_id = await self.hass.async_add_executor_job(self._api.get_watch_playlist, _track['videoId']) + if 'lyrics' in l_id: + if(l_id['lyrics'] is not None): + lyrics = await self.hass.async_add_executor_job(self._api.get_lyrics, l_id['lyrics']) + await self.async_update_extra_sensor('lyrics', lyrics['lyrics']) + # the nice thing about this 'get_watch_playlist' is that one gets also extra info about the current track + # like a better thumbnail. The original thumbnail from get_playlist has poor quality. + for vid in l_id['tracks']: + if(('videoId' in vid) and (vid['videoId'] == _track['videoId'])): + info = self.extract_info(vid) + if(self._track_album_cover != info['track_album_cover']): + self._track_album_cover = info['track_album_cover'] + self.async_schedule_update_ha_state() + break + except: + pass + async_call_later(self.hass, 15, self.async_sync_player) + self.log_me('debug', "[E] async_get_track") + + + async def async_get_url(self, videoId=None, retry=60): + self.log_me('debug', "[S] async_get_url") + if(videoId is None): + self.log_me('debug', "videoId was None") + return "" + _url = await self.async_get_url_self(videoId,retry) + + # check url + if(_url != ""): + r = await self.hass.async_add_executor_job(requests.head, _url) + if(r.status_code == 403): + self.log_me('error', "- self decoded url return 403 status code, attempt "+str(retry)+"/60") + _url = "" + + if(_url == ""): + _url = await self.async_get_url_pytube(videoId) + + # check url + if(_url != ""): + r = await self.hass.async_add_executor_job(requests.head, _url) + if(r.status_code == 403 or r.status_code == 410): + self.log_me('error', "- self decoded url return 403 status code, attempt "+str(retry)+"/60") + _url = "" + + if(retry>0): + self._api = None + self.log_me('debug', "- relogin to fresh cookie and try again") + self.async_check_api() + return await self.async_get_url(videoId, retry-1) + else: + self.log_me('debug', "- giving up, maybe pyTube can help") + _url = "" + + self.log_me('debug', "[E] async_get_url") + return _url + + + async def async_get_url_self(self, videoId=None, retry=60): + self.log_me('debug', "[S] async_get_url_self") + _url = "" + await self.async_check_api() + try: + stop = False + self.log_me('debug', "- try to find URL on our own") + try: + response = await self.hass.async_add_executor_job(lambda: self._api.get_song(videoId, self._signatureTimestamp)) + except: + self._api = None + self.log_me('error', 'self.get_song(videoId=' + str(videoId) + ',signatureTimestamp=' + str(self._signatureTimestamp) + ')') + self.exc() + return + streamingData = [] + if 'streamingData' in response: + if('adaptiveFormats' in response['streamingData']): + streamingData += response['streamingData']['adaptiveFormats'] + if('formats' in response['streamingData']): # backup, not sure if that is ever needed, or if adaptiveFormats are always present + streamingData += response['streamingData']['formats'] + if(len(streamingData) == 0): + self.log_me('error', 'No adaptiveFormat and no formats found') + self.log_me('error', 'self.get_song(videoId=' + str(videoId) + ',signatureTimestamp=' + str(self._signatureTimestamp) + ')') + stop = True + else: + stop = True + + if(not(stop)): + streamId = 0 + found_quality = -1 + quality_mapper = {'AUDIO_QUALITY_LOW': 1, 'AUDIO_QUALITY_MEDIUM': 2, 'AUDIO_QUALITY_HIGH': 3} + # try to find valid audio streams + valid_streams = [] + for i, stream in enumerate(streamingData): + #self.log_me('debug', 'found stream') + #self.log_me('error',stream) + if('audioQuality' in stream): + # self.log_me('error', '- found stream with audioQuality ' + stream['audioQuality'] + ' (' + str(i) + ')') + # store only stream with better quality, accept 0 once + stream['audioQuality'] = quality_mapper.get(stream['audioQuality'], 0) + valid_streams.append(stream) + elif(found_quality == -1): # only search for mimetype if we didn't find a quality stream before + if('mimeType' in stream): + if(stream['mimeType'].startswith('audio/mp4')): + self.log_me('debug', '- found audio/mp4 audiostream (' + str(i) + ')') + stream['audioQuality'] = quality_mapper.get(stream['audioQuality'], 0) + valid_streams.append(stream) + elif(stream['mimeType'].startswith('audio')): + self.log_me('debug', '- found audio audiostream (' + str(i) + ')') + stream['audioQuality'] = quality_mapper.get(stream['audioQuality'], 0) + valid_streams.append(stream) + + # try to find best audio only stream, but accept lower quality if we have to + valid_streams.sort(key=lambda x: x['bitrate'], reverse=True) + self.log_me('debug', "found "+str(len(valid_streams))+" streams") + # remove all streams with too high bitrates + if(self._maxDatarate>0): + for stream in valid_streams: + if(stream['bitrate']>self._maxDatarate): + if(len(valid_streams)>1): + valid_streams.remove(stream) + self.log_me('debug', '- removed stream with too high bitrate of '+str(stream['bitrate'])) + else: + self.log_me('debug', '- preseved stream, too high quality but last available stream') + + if(retry<20): + streamId = min(3,len(valid_streams)) + elif(retry<30): + streamId = min(2,len(valid_streams)) + elif(retry<40): + streamId = min(1,len(valid_streams)) + else: + streamId = 0 + + self.log_me('debug', 'Using stream '+str(streamId)+"/"+str(len(valid_streams))+", bitrate:"+str(valid_streams[streamId]['bitrate'])) + # self.log_me('debug', '- using stream ' + str(streamId)) + if(valid_streams[streamId].get('url') is None): + sigCipher_ch = valid_streams[streamId]['signatureCipher'] + sigCipher_ex = sigCipher_ch.split('&') + res = dict({'s': '', 'url': ''}) + for sig in sigCipher_ex: + for key in res: + if(sig.find(key + "=") >= 0): + res[key] = unquote(sig[len(key + "="):]) + # I'm just not sure if the original video from the init will stay online forever + # in case it's down the player might not load and thus we won't have a javascript loaded + # so if that happens: we try with this url, might work better (at least the file should be online) + # the only trouble i could see is that this video is private and thus also won't load the player .. + if(self._js == "" or retry<60): + self.log_me('debug', "- reloading cipher from current video") + await self.async_get_cipher(videoId) + + #stream_manifest = extract.apply_descrambler(self.streaming_data) + ##try: + #extract.apply_signature(stream_manifest, self.vid_info, self.js) + ##except exceptions.ExtractError: + ## extract.apply_signature(stream_manifest, self.vid_info, self.js) + if "signature" in res['url'] or ("s" not in res and ("&sig=" in res['url'] or "&lsig=" in res['url'])): + # For certain videos, YouTube will just provide them pre-signed, in + # which case there's no real magic to download them and we can skip + # the whole signature descrambling entirely. + self.log_me('error',"signature found, skip decipher") + _url = res['url'] + else: + self.log_me('error',"signature not found, decoding") + signature = self._cipher.get_signature(ciphered_signature=res['s']) + _url = res['url'] + "&sig=" + signature + self.log_me('debug', "- self decoded URL via cipher") + + else: + _url = valid_streams[streamId]['url'] + self.log_me('debug', "- found URL in api data") + + except Exception: + _LOGGER.error("- Failed to get own(!) URL for track, further details below. Will not try YouTube method") + _LOGGER.error(traceback.format_exc()) + _LOGGER.error(videoId) + self.log_me('debug', "[E] async_get_url") + return _url + + async def async_get_url_pytube(self, videoId=None): + # backup: run youtube stack, only if we failed + self.log_me('debug', "[S] async_get_url_pytube") + _url = "" + try: + streamingData = await self.hass.async_add_executor_job(lambda: YouTube("https://www.youtube.com/watch?v=" + videoId)) + streams = await self.hass.async_add_executor_job(lambda: streamingData.streams) + streams_audio = streams.filter(only_audio=True) + if(len(streams_audio) > 0): + _url = streams_audio.order_by('abr').last().url + else: + _url = streams.order_by('abr').last().url + + except Exception as err: + # _LOGGER.error(traceback.format_exc()) + _LOGGER.error("- Failed to get URL with YouTube methode") + _LOGGER.error(err) + return "" + self.log_me('debug', "[E] async_get_url_pytube") + return _url + + + async def async_play_media(self, media_type, media_id, _player=None, **kwargs): + self.log_me('debug', "[S] play_media, media_type: " + str(media_type) + ", media_id: " + str(media_id)) + + self._started_by = "Browser" + self._attributes['_media_type'] = media_type + self._attributes['_media_id'] = media_id + + if(not(media_type in [CONF_RECEIVERS,CHANNEL_VID_NO_INTERRUPT])): # don't to this for the speaker configuration (it will fail) and also skip it for the vid no interrupt + if(not(await self.async_prepare_play())): + return + + # Update player if we got an input + if _player is not None: + await self.async_update_remote_player(remote_player=_player) + if self._selects['speakers'] is not None: + if input_select.DOMAIN in self._selects['speakers']: + _select = input_select + else: + _select = select + data = {_select.ATTR_OPTION: _player, ATTR_ENTITY_ID: self._selects['speakers']} + await self.hass.services.async_call(_select.DOMAIN, _select.SERVICE_SELECT_OPTION, data) + + # load Tracks depending on input + try: + crash_extra = '' + self._attributes['current_playlist_title'] = "" + if(media_type == MediaType.PLAYLIST): + crash_extra = 'get_playlist(playlistId=' + str(media_id) + ')' + if(media_id == ALL_LIB_TRACKS): + self._tracks = await self.hass.async_add_executor_job(lambda: self._api.get_library_songs(limit=self._trackLimit)) + self._attributes['current_playlist_title'] = ALL_LIB_TRACKS_TITLE + else: + playlist_info = await self.hass.async_add_executor_job(lambda: self._api.get_playlist(media_id, limit=self._trackLimit)) + self._tracks = playlist_info['tracks'][:self._trackLimit] # limit function doesn't really work ... seems like + self._attributes['current_playlist_title'] = str(playlist_info['title']) + elif(media_type == MediaType.ALBUM): + crash_extra = 'get_album(browseId=' + str(media_id) + ')' + if media_id[:7] == "OLAK5uy": #Sharing over Android app sends 'bad' album id. Checking and converting. + media_id = await self.hass.async_add_executor_job(self._api.get_album_browse_id, media_id) + self._tracks = await self.hass.async_add_executor_job(self._api.get_album, media_id) # no limit needed + thumbnail = find_thumbnail(self._tracks) + self._tracks = self._tracks['tracks'][:self._trackLimit] # limit function doesn't really work ... seems like + for i in range(0, len(self._tracks)): + self._tracks[i].update({'album': {'id': media_id}}) + self._tracks[i].update({'thumbnails': [{'url': thumbnail}]}) + elif(media_type == MediaType.TRACK): + crash_extra = 'get_song(videoId=' + str(media_id) + ',signatureTimestamp=' + str(self._signatureTimestamp) + ')' + self._tracks = [await self.hass.async_add_executor_job(lambda: self._api.get_song(media_id, self._signatureTimestamp))] # no limit needed + self._tracks[0] = self._tracks[0]['videoDetails'] + elif(media_id == HISTORY): + crash_extra = 'get_history()' + self._tracks = await self.hass.async_add_executor_job(self._api.get_history) # no limit needed + elif(media_id == USER_TRACKS): + crash_extra = 'get_library_upload_songs(limit=999)' + self._tracks = await self.hass.async_add_executor_job(self._api.get_library_upload_songs, self._trackLimit) + self._tracks = self._tracks[:self._trackLimit] # limit function doesn't really work ... seems like + elif(media_type == CHANNEL): + if(self._legacyRadio): + # get original playlist from the media_id + crash_extra = 'get_playlist(playlistId=' + str(media_id) + ',limit=' + str(self._trackLimit) + ')' + self._tracks = await self.hass.async_add_executor_job(lambda: self._api.get_playlist(media_id, limit=self._trackLimit)) + self._tracks = self._tracks['tracks'] + # select on track randomly + if(isinstance(self._tracks, list)): + if(len(self._tracks) > 0): + if(len(self._tracks) > 1): + r_track = self._tracks[random.randrange(0, len(self._tracks) - 1)] + info = self.extract_info(r_track) + self._attributes['_radio_based'] = info['track_artist'] + " - " + info['track_name'] + else: + r_track = self._tracks[0] + # get a 'channel' based on that random track + crash_extra += ' ... get_watch_playlist(videoId=' + str(r_track['videoId']) + ',limit=' + str(self._trackLimit) + ')' + self._tracks = await self.hass.async_add_executor_job(lambda: self._api.get_watch_playlist(r_track['videoId'], limit=self._trackLimit)) + self._tracks = self._tracks['tracks'][:self._trackLimit] # limit function doesn't really work ... seems like + else: + crash_extra = 'get_watch_playlist(playlistId=RDAMPL' + str(media_id) + ')' + self._tracks = await self.hass.async_add_executor_job(lambda: self._api.get_watch_playlist(playlistId="RDAMPL" + str(media_id), limit=self._trackLimit)) + self._tracks = self._tracks['tracks'][:self._trackLimit] # limit function doesn't really work ... seems like + self._started_by = "UI" # technically wrong, but this will enable auto-reload playlist once all tracks are played + playlist_info = await self.hass.async_add_executor_job(lambda: self._api.get_playlist(media_id, limit=self._trackLimit)) + self._attributes['current_playlist_title'] = "Radio of " + str(playlist_info['title']) + elif(media_type == CHANNEL_VID or media_type==CHANNEL_VID_NO_INTERRUPT): + crash_extra = 'get_watch_playlist(videoId=RDAMVM' + str(media_id) + ')' + self._tracks = await self.hass.async_add_executor_job(lambda: self._api.get_watch_playlist(videoId=str(media_id), limit=self._trackLimit)) + self._tracks = self._tracks['tracks'][:self._trackLimit] # limit function doesn't really work ... seems like + self._started_by = "UI" # technically wrong, but this will enable auto-reload playlist once all tracks are played + video_info = await self.hass.async_add_executor_job(lambda: self._api.get_song(media_id, self._signatureTimestamp)) # no limit needed + title = "unknown title" + if("videoDetails" in video_info): + if("title" in video_info["videoDetails"]): + title = video_info['videoDetails']['title'] + self._attributes['current_playlist_title'] = "Radio of " + str(title) + elif(media_type == USER_ALBUM): + crash_extra = 'get_library_upload_album(browseId=' + str(media_id) + ')' + self._tracks = await self.hass.async_add_executor_job(lambda: self._api.get_library_upload_album(media_id)) + self._tracks = self._tracks['tracks'][:self._trackLimit] # limit function here not supported + elif(media_type in (USER_ARTIST, USER_ARTIST_2)): # Artist -> Track or Artist [-> Album ->] Track + crash_extra = 'get_library_upload_artist(browseId=' + str(media_id) + ')' + self._tracks = await self.hass.async_add_executor_job(lambda: self._api.get_library_upload_artist(media_id, limit=self._trackLimit)) + self._tracks = self._tracks[:self._trackLimit] # limit function doesn't really work ... seems like + elif(media_type == CONF_RECEIVERS): # a bit funky, but this enables us to select the player via the media browser .. + await self.async_select_source(media_id) + elif(media_type == CUR_PLAYLIST_COMMAND): # a bit funky, but this enables us to just in the current playlist + await self.async_call_method(SERVICE_CALL_GOTO_TRACK, media_id) + return # INSTANT leave after this call to prevent any further shuffeling etc + else: + self.log_me('debug', "- error during fetching play_media, turning off") + await self.async_turn_off() + except: + self._api = None + self.log_me('debug', crash_extra) + self.exc() + await self.async_turn_off_media_player() + return + self.log_me('debug', crash_extra) + + # mode "Shuffle" and "Shuffle Random" shuffle the playlist after generation, but only if shuffle is active + if(isinstance(self._tracks, list)): + if(self._attr_shuffle): + if self._shuffle_mode in (PLAYMODE_SHUFFLE,PLAYMODE_SHUFFLE_RANDOM) and len(self._tracks) > 1: + random.shuffle(self._tracks) + self.log_me('debug', "- shuffle new tracklist") + if(len(self._tracks) == 0): + _LOGGER.error("tracklist with 0 tracks loaded, existing") + await self.async_turn_off() + return + else: + self.log_me('error', "Tracklist not a list .. turning off") + await self.async_turn_off() + return + + # limit list now + if(self._trackLimitUser > 0): + self.log_me('debug', "Limiting playlist from " + str(len(self._tracks)) + " to " + str(self._trackLimitUser) + " items") + self._tracks = self._tracks[:self._trackLimitUser] + await self._tracks_to_attribute() + + # grab track from tracks[] and forward to remote player + if(media_type != CHANNEL_VID_NO_INTERRUPT): + await self.async_play() + self.log_me('debug', "[E] play_media") + + + async def async_media_play(self, entity_id=None, old_state=None, new_state=None, **kwargs): + self.log_me('debug', "[S] media_play") + + # Send play command. + if self._state == STATE_PAUSED: + self._state = STATE_PLAYING + self.async_schedule_update_ha_state() + data = {ATTR_ENTITY_ID: self._remote_player} + await self.hass.services.async_call(DOMAIN_MP, 'media_play', data) + else: + await self.async_play() + self.log_me('debug', "[E] media_play") + + + async def async_media_pause(self, **kwargs): + self.log_me('debug', "media_pause") + # Send media pause command to media player + self._state = STATE_PAUSED + self._media_position = None # set it to none, otherwise player like mini-media-player will continue + # _LOGGER.error(" PAUSE ") + self.async_schedule_update_ha_state() + data = {ATTR_ENTITY_ID: self._remote_player} + await self.hass.services.async_call(DOMAIN_MP, 'media_pause', data) + + async def async_media_play_pause(self, **kwargs): + self.log_me('debug', "media_play_pause") + # Simulate play pause media player. + if self._state == STATE_PLAYING: + self._allow_next = False + await self.async_media_pause() + elif(self._state == STATE_PAUSED): + self._allow_next = False + await self.async_media_play() + + async def async_media_previous_track(self, **kwargs): + # Send the previous track command. + if self._playing: + self._allow_next = False + self._ignore_next_remote_pause_state = True # RobinR1, OwnTone compatibility + if self.shuffle: + await self.async_get_track(keep_track_no=False) + else: + self._next_track_no = max(self._next_track_no - 1, 0) + await self.async_get_track() + + async def async_media_next_track(self, **kwargs): + # Send next track command. + if self._playing: + self._allow_next = False + self._ignore_next_remote_pause_state = True # RobinR1, OwnTone compatibility + if self.shuffle: + await self.async_get_track(keep_track_no=False) + else: + self._next_track_no = self._next_track_no + 1 + if self._next_track_no >= len(self._tracks): + self._next_track_no = 0 + await self.async_get_track() + + async def async_media_stop(self, **kwargs): + # Send stop command. + self.log_me('debug', "async_media_stop") + self._state = STATE_IDLE + self._playing = False + self._track_artist = None + self._track_album_name = None + self._track_name = None + self._track_album_cover = None + self.async_schedule_update_ha_state() + if('player' in kwargs): + self.log_me('debug', "- player found") + data = {ATTR_ENTITY_ID: kwargs.get('player')} + else: + data = {ATTR_ENTITY_ID: self._remote_player} + await self.hass.services.async_call(DOMAIN_MP, 'media_stop', data) + self.log_me('debug', "- async_media_stop -> " + self._remote_player) + + async def async_media_seek(self, position): + # Seek the media to a specific location. + self.log_me('debug', "seek: " + str(position)) + self._ignore_next_remote_pause_state = True # RobinR1, OwnTone compatibility + data = {ATTR_ENTITY_ID: self._remote_player, 'seek_position': position} + await self.hass.services.async_call(DOMAIN_MP, 'media_seek', data) + + async def async_set_shuffle(self, shuffle): + # Only implement the function which the HA media_player entity built-in, without affecting the _shuffle_mode and dropdown options. + # if shuffle is true,the next song should be random. + # shuffle_mode="Shuffle" means that when starting a playlist, the original order is randomized, but it does not imply shuffle=true. + if self.shuffle != shuffle: + self.log_me('debug', f"set_shuffle: {str(shuffle)}") + self._attr_shuffle = shuffle # True / False + self.async_schedule_update_ha_state() + + + async def async_set_volume_level(self, volume): + # Set volume level. + self._volume = round(volume, 2) + data = {ATTR_ENTITY_ID: self._remote_player, 'volume_level': self._volume} + await self.hass.services.async_call(DOMAIN_MP, 'volume_set', data) + self.async_schedule_update_ha_state() + + async def async_volume_up(self, **kwargs): + # Volume up the media player. + newvolume = min(self._volume + 0.05, 1) + await self.async_set_volume_level(newvolume) + + async def async_volume_down(self, **kwargs): + # Volume down media player. + newvolume = max(self._volume - 0.05, 0.01) + await self.async_set_volume_level(newvolume) + + async def async_mute_volume(self, mute): + # Send mute command. + if self._is_mute is False: + self._is_mute = True + else: + self._is_mute = False + self.async_schedule_update_ha_state() + data = {ATTR_ENTITY_ID: self._remote_player, "is_volume_muted": self._is_mute} + await self.hass.services.async_call(DOMAIN_MP, 'volume_mute', data) + + async def async_call_method(self, command=None, parameters=None): + self.log_me('debug', 'START async_call_method') + all_params = [] + if parameters: + for parameter in parameters: + all_params.append(parameter) + self.log_me('debug', command) + self.log_me('debug', parameters) + if(command == SERVICE_CALL_RATE_TRACK): + if(len(all_params) >= 1): + await self.async_rate_track(rating=all_params[0]) + elif(command == SERVICE_CALL_INTERRUPT_START): + if(self._state not in (STATE_PLAYING, STATE_PAUSED)): + self._interrupt_data = None + return + await self.async_update_remote_player() + # _LOGGER.error(self._remote_player) + t = self.hass.states.get(self._remote_player) + # _LOGGER.error(t) + self._interrupt_data = dict() + if(all(a in t.attributes for a in ('media_position', 'media_position_updated_at', 'media_duration'))): + now = datetime.datetime.now(datetime.timezone.utc) + delay = now - t.attributes['media_position_updated_at'] + pos = delay.total_seconds() + t.attributes['media_position'] + if pos < t.attributes['media_duration']: + self._interrupt_data['pos'] = pos + # _LOGGER.error(self._interrupt_data) + # _LOGGER.error(self._remote_player) + self._interrupt_data['player'] = self._remote_player + # _LOGGER.error(self._interrupt_data) + await self.async_media_stop(player=self._remote_player) + if(self._untrack_remote_player is not None): + try: + # _LOGGER.error("calling untrack") + self._untrack_remote_player() + except: + # _LOGGER.error("untrack failed!!") + pass + self._untrack_remote_player = None + + elif(command == SERVICE_CALL_INTERRUPT_RESUME): + if(self._interrupt_data is None): + return + if('player' in self._interrupt_data): + await self.async_update_remote_player(remote_player=self._interrupt_data['player']) + self._untrack_remote_player = async_track_state_change_event(self.hass, self._remote_player, self.async_sync_player) + self._interrupt_data['player'] = None + await self.async_get_track() + if('pos' in self._interrupt_data): + player = self.hass.states.get(self._remote_player) + if(player.attributes['supported_features'] | MediaPlayerEntityFeature.SEEK): + data = {'seek_position': self._interrupt_data['pos'], ATTR_ENTITY_ID: self._remote_player} + await self.hass.services.async_call(DOMAIN_MP, media_player.SERVICE_MEDIA_SEEK, data) + self._interrupt_data['pos'] = None + elif(command == SERVICE_CALL_RELOAD_DROPDOWNS): + await self.async_update_selects() + elif(command == SERVICE_CALL_OFF_IS_IDLE): # needed for the MPD and OwnTone server but for nobody else + self._x_to_idle = STATE_OFF + self.log_me('debug', "Setting x_is_idle to State Off") + elif(command == SERVICE_CALL_PAUSED_IS_IDLE): # needed for the Sonos but for nobody else + self._x_to_idle = STATE_PAUSED + self.log_me('debug', "Setting x_is_idle to State Paused") + elif(command == SERVICE_CALL_IGNORE_PAUSED_ON_MEDIA_CHANGE): # RobinR1, OwnTone compatibility + self._ignore_paused_on_media_change = True # RobinR1, OwnTone compatibility + self.log_me('debug', "Setting to ignore remote player Paused state on Next/Prev track and Seek") + elif(command == SERVICE_CALL_DO_NOT_IGNORE_PAUSED_ON_MEDIA_CHANGE): # RobinR1, OwnTone compatibility + self._ignore_paused_on_media_change = False # RobinR1, OwnTone compatibility + self.log_me('debug', "Setting to NOT ignore remote player Paused state on Next/Prev track and Seek") + elif(command == SERVICE_CALL_IDLE_IS_IDLE): # reset idle detection to default behaviour + self._x_to_idle = None + self.log_me('debug', "Resetting x_is_idle") + elif(command == SERIVCE_CALL_DEBUG_AS_ERROR): + self._debug_as_error = True + self.log_me('debug', "Posting debug messages as error until restart") + elif(command == SERVICE_CALL_LIKE_IN_NAME): + self._like_in_name = True + self._attr_name = self._org_name + " - " + str(self._attributes['likeStatus']) + self.log_me('debug', "Showing like status in name until restart") + elif(command == SERVICE_CALL_GOTO_TRACK): + self.log_me('debug', "Going to Track " + str(parameters[0]) + ".") + self._next_track_no = min(max(int(parameters[0]) - 1, 0), len(self._tracks) - 1) + prev_shuffle = self._attr_shuffle # store current shuffle setting + self._attr_shuffle = False # set false, otherwise async_get_track will override next_track + await self.async_get_track() + self._attr_shuffle = prev_shuffle # restore + elif(command == SERVICE_CALL_APPEND_TRACK): + self.log_me('debug', "Adding track " + str(parameters[0]) + " at position " + str(parameters[1])) + if(len(parameters)==2 and parameters[1].isnumeric()): + add_track = await self.hass.async_add_executor_job(lambda: self._api.get_song(parameters[0], self._signatureTimestamp)) # no limit needed + else: + self.log_me('debug', str(parameters[1]) + " is not numeric, or not exactly 2 parameters given") + # how to check + # I don't know why, but the format of get_song is very differnt, so we fix at least author and thumbnail to make it lookalike + add_track['videoDetails']['artists'] = [{'name': add_track['videoDetails']['author'], 'id': ''}] + add_track['videoDetails']['thumbnails'] = add_track['videoDetails']['thumbnail']['thumbnails'] + self._tracks.insert(int(parameters[1]),add_track['videoDetails']) + + await self._tracks_to_attribute() + elif(command == SERVICE_CALL_MOVE_TRACK): + self.log_me('debug', "Moving track " + str(parameters[0]) + " to position " + str(parameters[1])) + if(parameters[0].isnumeric() and (parameters[1].isnumeric() or parameters[1]=="-1")): + add_track = self._tracks[int(parameters[0])] + self._tracks.remove(add_track) + if(parameters[1].isnumeric()): + self._tracks.insert(int(parameters[1]),add_track) + await self._tracks_to_attribute() + else: + self.log_me('debug', str(parameters[0]) + " or " + str(parameters[1]) + " is not numeric, not moving tracks") + else: + self.log_me('error', "Command " + str(command) + " not implimented") + self.log_me('debug', "[E] async_call_method") + + + async def async_search(self, query="", filter=None, limit=20): + self.log_debug_later("[S] async_search") + if(filter is None or filter in {'albums', 'playlists', 'songs', 'artists'}): + # store data for media_browser + self._search['query'] = query + self._search['filter'] = filter + self._search['limit'] = limit + + if(self._init_extra_sensor): + search_results = list() + # execute search and store informtion for the extra sensor + media_all = await self.hass.async_add_executor_job(lambda: self._api.search(query=query, filter=filter, limit=limit)) + self.log_me('debug',media_all) + supported_media = [['song', 'videoId'], ['playlist', 'browseId'], ['album', 'browseId'], ['artist','browseId']] + for media_type in supported_media: + for result in media_all: + if result['resultType'] == media_type[0]: + if not('title' in result): + if 'artist' in result: + result['title'] = result['artist'] + elif 'artists' in result: # handle top result + result['title'] = result['artists'][0]['name'] + result['browseId'] = result['artists'][0]['id'] + if ('videoId' in result) or ('browseId' in result): + search_results.append({'type': media_type[0], 'title': result['title'], 'id': result[media_type[1]], 'thumbnail': result['thumbnails'][-1]['url']}) + + try: + await self.async_update_extra_sensor('search', search_results) + except: + pass + + else: + data = {"title": "yTubeMediaPlayer error", "message": "Please use a valid filter: 'albums', 'playlists', 'songs'"} + await self.hass.services.async_call("persistent_notification", "create", data) + self.log_me('debug', "[E] async_search") + + + async def async_add_to_playlist(self, song_id="", playlist_id=""): + await self.async_modify_playlist(song_id,playlist_id,mode="add") + + async def async_remove_from_playlist(self, song_id="", playlist_id=""): + await self.async_modify_playlist(song_id,playlist_id,mode="remove") + + async def async_modify_playlist(self, song_id="", playlist_id="", mode="add"): + self.log_debug_later("[S] async_modify_playlist") + if(song_id == ""): + if(self._attributes['videoId'] != ""): + song_id = self._attributes['videoId'] + else: + self.log_me('error', "no song_id given, but also currently not playing, so I don't know what to add/remove") + if(song_id != "" and playlist_id == ""): + if(self._attributes['_media_type'] in [MediaType.PLAYLIST, CHANNEL]): + playlist_id = self._attributes['_media_id'] + else: + self.log_me('error', "No playlist Id provided and the current playmode isn't 'playlist' nor 'channel', so I don't know where to add/remove the track") + if(song_id != "" and playlist_id != ""): + # self.log_me('debug', "add_playlist_items(playlistId=" + playlist_id + ", videoIds=[" + song_id + "]))") + if(playlist_id == "LM"): + if(mode=="add"): + await self.async_call_method(command=SERVICE_CALL_RATE_TRACK, parameters=[SERVICE_CALL_THUMB_UP]) + res = 'song added by liking it' + else: + await self.async_call_method(command=SERVICE_CALL_RATE_TRACK, parameters=[SERVICE_CALL_THUMB_DOWN]) + res = 'song removed by dis-liking it' + else: + if(mode=="add"): + try: + res = await self.hass.async_add_executor_job(lambda: self._api.add_playlist_items(playlistId=str(playlist_id), videoIds=[str(song_id)])) + res = 'song added' + except: + res = 'You can\'t add songs to this playlist (are you the owner?), requrest failed' + else: + try: + extra_info = await self.hass.async_add_executor_job(self._api.get_playlist, str(playlist_id)) + res = 'song not found in playlist' + if('tracks' in extra_info): + for track in extra_info['tracks']: + if track['videoId'] == song_id: + await self.hass.async_add_executor_job(lambda: self._api.remove_playlist_items(playlistId=str(playlist_id), videos=[track])) + res = 'song removed' + break + except: + res = 'You can\'t remove songs from this playlist (are you the owner?), requrest failed' + self.log_me('debug', res) + self.log_me('debug', "[E] async_modify_playlist") + + + + + + async def async_limit_count(self, limit): + self.log_debug_later("[S] async_limit_count") + self._trackLimitUser = limit + # having a tracklimit (requests from the api) smaller than the user limit + # (limits the list AFTER generation) is pointless, so lets adjust this here as well + if(self._trackLimitUser > self._trackLimit): + self._trackLimit = self._trackLimitUser + self.log_me("debug", "New limit: " + str(self._trackLimitUser)) + self.log_me("debug", "[E] async_limit_count") + + + async def async_start_radio(self, interrupt=True): + self.log_debug_later("[S] async_start_radio") + if(self._attributes['videoId'] == ""): + self.log_me('debug', "Currently not playing anything so I don't know what to base the radio on") + else: + self.log_me('debug', "Starting radio based on " + str(self._attributes['videoId'])) + media_type = CHANNEL_VID_NO_INTERRUPT + if(interrupt): + media_type = CHANNEL_VID + await self.async_play_media(media_type, self._attributes['videoId']) + self.log_me("debug", "[E] async_start_radio") + + + async def async_rate_track(self, rating="", song_id=""): + self.log_debug_later("[S] async_rate_track") + if(rating == ""): + self.log_me('error', "No Rating given, stopping") + if(song_id == ""): + if(self._attributes['videoId'] != ""): + self.log_me('debug', "No song Id given, taking current song") + song_id = self._attributes['videoId'] + else: + self.log_me('error', "No song Id given and currently not playing, giving up") + + if(song_id != "" and rating != ""): + try: + arg = 'LIKE' + if(rating == SERVICE_CALL_THUMB_UP): + self.log_me('debug', "rate thumb up") + arg = 'LIKE' + elif(rating == SERVICE_CALL_THUMB_DOWN): + self.log_me('debug', "rate thumb down") + arg = 'DISLIKE' + elif(rating == SERVICE_CALL_THUMB_MIDDLE): + self.log_me('debug', "rate thumb middle") + arg = 'INDIFFERENT' + elif(rating == SERVICE_CALL_TOGGLE_THUMB_UP_MIDDLE): + if('likeStatus' in self._attributes): + if(self._attributes['likeStatus'] == 'LIKE'): + self.log_me('debug', "rate thumb middle") + arg = 'INDIFFERENT' + else: + self.log_me('debug', "rate thumb up") + arg = 'LIKE' + await self.hass.async_add_executor_job(self._api.rate_song, song_id, arg) + # only change arguments if the track that we're rating is the current one + if(song_id == self._attributes['videoId']): + self._attributes['likeStatus'] = arg + if(self._like_in_name): + self._attr_name = self._org_name + " - " + arg + self.async_schedule_update_ha_state() + self._tracks[self._next_track_no]['likeStatus'] = arg + except: + self.exc() + self.log_me('debug', "[E] async_rate_track") + + + def exc(self, resp="self"): + # Print nicely formated exception. + _LOGGER.error("\n\n == == == == == == = ytube_music_player Integration Error == == == == == == == == ") + if(resp == "self"): + _LOGGER.error("unfortunately we hit an error, please open a ticket at") + _LOGGER.error("https://github.com/KoljaWindeler/ytube_music_player/issues") + else: + _LOGGER.error("unfortunately we hit an error in the sub api, please open a ticket at") + _LOGGER.error("https://github.com/sigma67/ytmusicapi/issues") + _LOGGER.error("and paste the following output:\n") + _LOGGER.error(traceback.format_exc()) + _LOGGER.error("\nthanks, Kolja") + _LOGGER.error(" == == == == == == = ytube_music_player Integration Error == == == == == == == == \n\n") + + + async def async_browse_media(self, media_content_type=None, media_content_id=None): + # Implement the websocket media browsing helper. + self.log_me('debug', "async_browse_media") + await self.async_check_api() + if media_content_type in [None, "library"]: + return await self.hass.async_add_executor_job(lambda: library_payload(self)) + + payload = { + "search_type": media_content_type, + "search_id": media_content_id, + } + + response = await build_item_response(self, payload) + if response is None: + raise BrowseError( + f"Media not found: {media_content_type} / {media_content_id}" + ) + return response + + # helper to resume tracking of the select field for media player + # we have to untrack it before we change it ourself and give HA some time + # to make the change and call this resubscription delayed + async def async_track_select_mediaplayer_helper(self, args): + # this should now be needed .. but one never know + if(self._untrack_remote_player_selector is not None): + try: + self._untrack_remote_player_selector() + self.log_me('debug', "- untrack passed") + except: + self.log_me('debug', "- untrack failed") + self._untrack_remote_player_selector = None + self._untrack_remote_player_selector = async_track_state_change_event( + self.hass, self._selects['speakers'], self.async_select_source_helper) + self.log_me('debug', "- untrack resub") diff --git a/custom_components/ytube_music_player/select.py b/custom_components/ytube_music_player/select.py new file mode 100644 index 00000000..a6224a04 --- /dev/null +++ b/custom_components/ytube_music_player/select.py @@ -0,0 +1,127 @@ +"""Platform for sensor integration.""" +import logging +from homeassistant.components.select import SelectEntity +from homeassistant.exceptions import NoEntitySpecifiedError +from . import DOMAIN +from .const import * + +_LOGGER = logging.getLogger(__name__) + +async def async_setup_entry(hass, config, async_add_entities): + _LOGGER.debug("Init the dropdown(s)") + init_dropdowns = config.data.get(CONF_INIT_DROPDOWNS, DEFAULT_INIT_DROPDOWNS) + select_entities = { + "playlists": yTubeMusicPlaylistSelect(hass, config), + "speakers": yTubeMusicSpeakerSelect(hass, config), + "playmode": yTubeMusicPlayModeSelect(hass, config), + "radiomode": yTubeMusicSourceSelect(hass, config), + "repeatmode": yTubeMusicRepeatSelect(hass, config) + } + entities = [] + for dropdown,entity in select_entities.items(): + if dropdown in init_dropdowns: + entities.append(entity) + async_add_entities(entities, update_before_add=True) + +class yTubeMusicSelectEntity(SelectEntity): + def __init__(self, hass, config): + self.hass = hass + self._device_id = config.entry_id + self._device_name = config.data.get(CONF_NAME) + self._attr_has_entity_name = True + + def select_option(self, option): + """Change the selected option.""" + self._attr_current_option = option + self.schedule_update_ha_state() + @property + def device_info(self): + return { + 'identifiers': {(DOMAIN, self._device_id)}, + 'name': self._device_name, + 'manufacturer': "Google Inc.", + 'model': DOMAIN + } + + @property + def should_poll(self): + return False + + +class yTubeMusicPlaylistSelect(yTubeMusicSelectEntity): + def __init__(self, hass, config): + super().__init__(hass, config) + self._attr_unique_id = self._device_id + "_playlist" + self._attr_name = "Playlist" + self._attr_icon = 'mdi:playlist-music' + self.hass.data[DOMAIN][self._device_id]['select_playlists'] = self + self._attr_options = ["loading"] + self._attr_current_option = None + + async def async_update(self): + # update select + self._ready = True + try: + self._attr_options = list(self.hass.data[DOMAIN][self._device_id]['playlists'].keys()) + except: + pass + try: + self.async_schedule_update_ha_state() + except NoEntitySpecifiedError: + pass # we ignore this due to a harmless startup race condition + + +class yTubeMusicSpeakerSelect(yTubeMusicSelectEntity): + def __init__(self, hass, config): + super().__init__(hass, config) + self._attr_unique_id = self._device_id + "_speaker" + self._attr_name = "Speaker" + self._attr_icon = 'mdi:speaker' + self.hass.data[DOMAIN][self._device_id]['select_speakers'] = self + self._attr_options = ["loading"] + self._attr_current_option = None + + async def async_update(self, options=[]): + # update select + self._ready = True + try: + self._attr_options = options + except: + pass + try: + self.async_schedule_update_ha_state() + except NoEntitySpecifiedError: + pass # we ignore this due to a harmless startup race condition + + +class yTubeMusicPlayModeSelect(yTubeMusicSelectEntity): + def __init__(self, hass, config): + super().__init__(hass, config) + self._attr_unique_id = self._device_id + "_playmode" + self._attr_name = "Play Mode" + self._attr_icon = 'mdi:shuffle' + self.hass.data[DOMAIN][self._device_id]['select_playmode'] = self + self._attr_options = ["Shuffle","Random","Shuffle Random","Direct"] + self._attr_current_option = "Shuffle Random" + + +class yTubeMusicSourceSelect(yTubeMusicSelectEntity): + def __init__(self, hass, config): + super().__init__(hass, config) + self._attr_unique_id = self._device_id + "_radiomode" + self._attr_name = "Radio Mode" + self._attr_icon = 'mdi:music-box-multiple' + self.hass.data[DOMAIN][self._device_id]['select_radiomode'] = self + self._attr_options = ["Playlist","Playlist Radio"] # "Playlist" means not radio mode + self._attr_current_option = "Playlist" + + +class yTubeMusicRepeatSelect(yTubeMusicSelectEntity): + def __init__(self, hass, config): + super().__init__(hass, config) + self._attr_unique_id = self._device_id + "_repeat" + self._attr_name = "Repeat Mode" + self._attr_icon = 'mdi:repeat' + self.hass.data[DOMAIN][self._device_id]['select_repeatmode'] = self + self._attr_options = ["all", "one", "off"] # one for future + self._attr_current_option = "all" \ No newline at end of file diff --git a/custom_components/ytube_music_player/sensor.py b/custom_components/ytube_music_player/sensor.py new file mode 100644 index 00000000..d7039028 --- /dev/null +++ b/custom_components/ytube_music_player/sensor.py @@ -0,0 +1,82 @@ +"""Platform for sensor integration.""" +import logging +from homeassistant.helpers.entity import Entity +from homeassistant.exceptions import NoEntitySpecifiedError +from . import DOMAIN +from .const import * + + +_LOGGER = logging.getLogger(__name__) + + +async def async_setup_entry(hass, config, async_add_entities): + # Run setup via Storage + _LOGGER.debug("init ytube sensor") + if(config.data.get(CONF_INIT_EXTRA_SENSOR, DEFAULT_INIT_EXTRA_SENSOR)): + async_add_entities([yTubeMusicSensor(hass, config)], update_before_add=True) + + +class yTubeMusicSensor(Entity): + # Extra Sensor for the YouTube Music player integration + + def __init__(self,hass, config): + # Initialize the sensor. + self.hass = hass + self._state = STATE_OFF + self._device_id = config.entry_id + self._device_name = config.data.get(CONF_NAME) + self._attr_unique_id = config.entry_id + "_extra" # should be different from the media_player entity + self._attr_has_entity_name = True + self._attr_name = "Extra" + self._attr_icon = 'mdi:information-outline' + self.hass.data[DOMAIN][self._device_id]['extra_sensor'] = self + self._attr = {'tracks', 'search', 'lyrics', 'playlists', 'total_tracks'} + self._attributes = {} + for attr in self._attr: + self._attributes[attr] = "" + + _LOGGER.debug("init ytube sensor done") + + @property + def device_info(self): + return { + 'identifiers': {(DOMAIN, self._device_id)}, + 'name': self._device_name, + 'manufacturer': "Google Inc.", + 'model': DOMAIN + } + + @property + def name(self): + # Return the name of the sensor. + return self._attr_name + + @property + def state(self): + # Return the state of the sensor. + return self._state + + @property + def should_poll(self): + # No polling needed. + return False + + async def async_update(self): + # update sensor + self._ready = True + _LOGGER.debug("updating ytube sensor") + + # update all attributes from the data var + for attr in self._attr: + if attr in self.hass.data[DOMAIN][self._device_id]: + self._attributes[attr] = self.hass.data[DOMAIN][self._device_id][attr] + + try: + self.async_schedule_update_ha_state() + except NoEntitySpecifiedError: + pass # we ignore this due to a harmless startup race condition + + @property + def extra_state_attributes(self): + # Return the device state attributes. + return self._attributes \ No newline at end of file diff --git a/custom_components/ytube_music_player/services.yaml b/custom_components/ytube_music_player/services.yaml new file mode 100644 index 00000000..532d0685 --- /dev/null +++ b/custom_components/ytube_music_player/services.yaml @@ -0,0 +1,127 @@ +call_method: + fields: + entity_id: + example: "media_player.ytube_music_player" + required: true + selector: + entity: + domain: media_player + command: + example: "rate_track" + required: true + selector: + text: + parameters: + example: "thumb_up" + required: true + selector: + text: + +search: + fields: + entity_id: + example: "media_player.ytube_music_player" + required: true + selector: + entity: + domain: media_player + query: + example: "2pm tetris" + required: true + selector: + text: + filter: + required: false + selector: + text: + limit: + required: false + example: "20" + default: 20 + selector: + number: + min: 1 + max: 1000 + +add_to_playlist: + fields: + entity_id: + example: "media_player.ytube_music_player" + required: true + selector: + entity: + domain: media_player + song_id: + required: false + example: "" + selector: + text: + playlist_id: + required: false + example: "" + selector: + text: + +remove_from_playlist: + fields: + entity_id: + example: "media_player.ytube_music_player" + required: true + selector: + entity: + domain: media_player + song_id: + example: "" + playlist_id: + example: "" + +rate_track: + fields: + entity_id: + example: "media_player.ytube_music_player" + required: true + selector: + entity: + domain: media_player + rating: + example: "thumb_up" + required: true + selector: + select: + options: + - "thumb_up" + - "thumb_down" + - "thumb_middle" + - "thumb_toggle_up_middle" + song_id: + example: "" + +limit_count: + fields: + entity_id: + example: "media_player.ytube_music_player" + required: true + selector: + entity: + domain: media_player + limit: + example: "20" + required: true + selector: + number: + min: 1 + max: 1000 + +start_radio: + fields: + entity_id: + example: "media_player.ytube_music_player" + required: true + selector: + entity: + domain: media_player + interrupt: + required: true + example: "true" + selector: + boolean: diff --git a/custom_components/ytube_music_player/translations/en.json b/custom_components/ytube_music_player/translations/en.json new file mode 100644 index 00000000..da267734 --- /dev/null +++ b/custom_components/ytube_music_player/translations/en.json @@ -0,0 +1,250 @@ +{ + "title": "yTubeMediaPlayer", + "config": { + "step": { + "oauth": { + "description": "Please enter the path and the cookie data. Further information available at https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "name": "Name for the entity (without 'media_player' prefix)", + "cookie": "Enter cookie text, copied from browser", + "speakers": "Select the default output device", + "header_path": "File path for the header file", + "advance_config": "Show advance configuration" + } + }, + "finish": { + "description": "Please enter the basic data. Further information available at https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "speakers": "Select the output devices, the first one will be the default device", + "header_path": "File path for the header file", + "api_language": "The language parameter of the ytmusicapi, which determines the language of the returned results", + "advance_config": "Show advance configuration" + } + }, + "adv_finish": { + "description": "You can configure some behaviors of the player here, such as limiting data usage and setting the maximum number of tracks loaded per session.", + "data": { + "brand_id": "Enter a brand id if you are using a brand account", + "proxy_path": "Local path for proxy mode, leave blank if you don't need it", + "proxy_url": "Base URL for proxy mode, leave blank if you don't need it", + "like_in_name": "Show like status in the name", + "debug_as_error": "Show all debug output as ERROR in the log", + "shuffle": "Turn on shuffle on startup", + "shuffle_mode": "Playmode", + "track_limit": "Limit of simultaneously loaded tracks", + "max_datarate": "Limit the maximum bit rate", + "legacy_radio": "Create radio as watchlist of random playlist track", + "sort_browser": "Sort results in the media browser", + "extra_sensor": "Create sensor that provide extra information", + "dropdowns": "Create the dropdown(s) you want to use", + "select_speakers": "Entity id of input_select for speaker selection(Deprecated. Leaving a space can permanently delete this field)", + "select_playmode": "Entity id of input_select for playmode selection(Deprecated. Leaving a space can permanently delete this field)", + "select_source": "Entity id of input_select for playlist/radio selection(Deprecated. Leaving a space can permanently delete this field)", + "select_playlist": "Entity id of input_select for playlist selection(Deprecated. Leaving a space can permanently delete this field)", + "select_playcontinuous": "Entity id of input_boolean for play continuous selection(Deprecated. Leaving a space can permanently delete this field)" + } + } + }, + "error": { + "ERROR_GENERIC": "Something with your cookie wasn't right. Format and fields are ok but the login failed", + "ERROR_AUTH_USER": "Can't find the 'X-Goog-AuthUser' field, please check your input", + "ERROR_COOKIE": "Can't find the 'Cookie' field, please check your input", + "ERROR_CONTENTS": "Format of cookie is OK, found '__Secure-3PAPISID' and '__Secure-3PSID' but can't retrieve any data with this settings, maybe you didn't copy all data?", + "ERROR_FORMAT": "Format of cookie is NOT OK, likely missing '__Secure-3PAPISID' or '__Secure-3PSID'", + "ERROR_NONE": "Format of cookie seams OK, but the returned sub API object is None", + "ERROR_FORBIDDEN": "YouTube returned a 403 error, meaning that you login data are not longer valid. Please update the cookie" + } + }, + "options": { + "step": { + "oauth": { + "description": "Please enter the path and the cookie data. Further information available at https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "name": "Name for the entity (without 'media_player' prefix)", + "cookie": "Enter cookie text, copied from browser", + "speakers": "Select the default output device", + "header_path": "File path for the header file", + "advance_config": "Show advance configuration" + } + }, + "finish": { + "description": "Please enter the basic data. Further information available at https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "speakers": "Select the output devices, the first one will be the default device", + "header_path": "File path for the header file", + "api_language": "The language parameter of the ytmusicapi, which determines the language of the returned results", + "advance_config": "Show advance configuration" + } + }, + "adv_finish": { + "description": "You can configure some behaviors of the player here, such as limiting data usage and setting the maximum number of tracks loaded per session.", + "data": { + "brand_id": "Enter a brand id if you are using a brand account", + "proxy_path": "Local path for proxy mode, leave blank if you don't need it", + "proxy_url": "Base URL for proxy mode, leave blank if you don't need it", + "like_in_name": "Show like status in the name", + "debug_as_error": "Show all debug output as ERROR in the log", + "shuffle": "Turn on shuffle on startup", + "shuffle_mode": "Playmode", + "track_limit": "Limit of simultaneously loaded tracks", + "max_datarate": "Limit the maximum bit rate", + "legacy_radio": "Create radio as watchlist of random playlist track", + "sort_browser": "Sort results in the media browser", + "extra_sensor": "Create sensor that provide extra information", + "dropdowns": "Create the dropdown(s) you want to use", + "select_speakers": "Entity id of input_select for speaker selection(Deprecated. Leaving a space can permanently delete this field)", + "select_playmode": "Entity id of input_select for playmode selection(Deprecated. Leaving a space can permanently delete this field)", + "select_source": "Entity id of input_select for playlist/radio selection(Deprecated. Leaving a space can permanently delete this field)", + "select_playlist": "Entity id of input_select for playlist selection(Deprecated. Leaving a space can permanently delete this field)", + "select_playcontinuous": "Entity id of input_boolean for play continuous selection(Deprecated. Leaving a space can permanently delete this field)" + } + } + }, + "error": { + "ERROR_GENERIC": "Something with your cookie wasn't right. Format and fields are ok but the login failed", + "ERROR_AUTH_USER": "Can't find the 'X-Goog-AuthUser' field, please check your input", + "ERROR_COOKIE": "Can't find the 'Cookie' field, please check your input", + "ERROR_CONTENTS": "Format of cookie is OK, found '__Secure-3PAPISID' and '__Secure-3PSID' but can't retrieve any data with this settings, maybe you didn't copy all data?", + "ERROR_FORMAT": "Format of cookie is NOT OK, likely missing '__Secure-3PAPISID' or '__Secure-3PSID'", + "ERROR_NONE": "Format of cookie seams OK, but the returned sub API object is None", + "ERROR_FORBIDDEN": "YouTube returned a 403 error, meaning that you login data are not longer valid. Please update the cookie" + } + }, + "services": { + "add_to_playlist": { + "name": "Add song to playlist", + "description": "Adds a song to a playlist", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Entity ID of the ytube media player" + }, + "song_id": { + "name": "Song ID", + "description": "The id of the song, optional. By default the current song id is used. Only provide an argument to override this behavior." + }, + "playlist_id": { + "name": "Playlist ID", + "description": "The id of the playlist, optional. By default the current playlist is used. Only provide an argument to override this behavior." + } + } + }, + "remove_from_playlist": { + "name": "Remove song from playlist", + "description": "Removes a song from a playlist", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Entity ID of the ytube media player" + }, + "song_id": { + "name": "Song ID", + "description": "The id of the song, optional. By default the current song id is used. Only provide an argument to override this behavior." + }, + "playlist_id": { + "name": "Playlist ID", + "description": "The id of the playlist, optional. By default the current playlist is used. Only provide an argument to override this behavior." + } + } + }, + "call_method": { + "name": "Call a submethod of ytubemusic player", + "description": "Call a custom command.", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Name(s) of the yTube music player entity where to run the custom command.", + "example": "media_player.ytube_music_player" + }, + "command": { + "name": "Command", + "description": "Command to pass to LyTube music player.", + "example": "rate_track" + }, + "parameters": { + "name": "Parameter", + "description": "Array of additional parameters, optional and depends on command.", + "example": "thumb_up" + } + } + }, + "search": { + "description": "Search for music / album / etc on Ytube YouTube Music Player", + "name": "Search", + "fields":{ + "entity_id": { + "name": "Entity ID", + "description": "Name(s) of the yTube music player entity where to run the custom command.", + "example": "media_player.ytube_music_player" + }, + "query": { + "name": "Query", + "description": "The search query", + "example": "2pm tetris" + }, + "filter": { + "name": "Filter", + "description": "filter for query, values can be 'albums', 'playlists','artists' or 'songs'. Leave this out to get all types." + }, + "limit": { + "name": "Limit", + "description": "Limits the amount of resuls", + "example": "20" + } + } + }, + "rate_track": { + "name": "Rate a track", + "description": "Rates a song", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Name(s) of the yTube music player entity where to run the custom command.", + "example": "media_player.ytube_music_player" + }, + "rating": { + "name":"Rating", + "description": "The rating of the song, can be 'thumb_up' / 'thumb_down' / 'thumb_middle' / 'thumb_toggle_up_middle'.", + "example": "thumb_up" + }, + "song_id": { + "name": "Song ID", + "description": "The id of the song, optional. By default the current song id is used. Only provide an argument to override this behavior.", + "example": "" + } + } + }, + "limit_count": { + "name": "Limit song count", + "description": "Limits the count of loaded tracks", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Name(s) of the yTube music player entity where to run the custom command.", + "example": "media_player.ytube_music_player" + }, + "limit": { + "name": "Limit", + "description": "The amount of tracks, loaded per call", + "example": "20" + } + } + }, + "start_radio": { + "name": "Radio", + "description": "Creates a radio of the current track", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "Name(s) of the yTube music player entity where to run the command.", + "example": "media_player.ytube_music_player" + }, + "interrupt": { + "name": "Interrupt", + "description": "interrupt the current playback or not", + "example": "true" + } + } + } + } +} \ No newline at end of file diff --git a/custom_components/ytube_music_player/translations/fr.json b/custom_components/ytube_music_player/translations/fr.json new file mode 100644 index 00000000..6d4b435a --- /dev/null +++ b/custom_components/ytube_music_player/translations/fr.json @@ -0,0 +1,89 @@ +{ + "title": "yTubeMediaPlayer", + "config": { + "step": { + "user": { + "description": "Veuillez entrer le chemin et les données du cookie. Plus d'informations disponibles sur https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "name": "Nom de l'entité (sans le préfixe 'media_player')", + "cookie": "Saisissez le texte du cookie, copié depuis le navigateur", + "speakers": "Sélectionnez le périphérique de sortie par défaut", + "header_path": "Chemin d'accès au fichier d'en-tête", + "advance_config": "Afficher la configuration avancée" + } + }, + "finish": { + "description": "Ici, vous pouvez modifier les identifiants d'entité de certains champs, si vous n'utilisez pas les listes déroulantes, laissez-les tels quels", + "data": { + "brand_id": "Entrez un identifiant de marque si vous utilisez un compte de marque", + "select_speakers": "ID de l'entité input_select pour la sélection du haut-parleur", + "select_playmode":"ID de l'entité input_select pour la sélection du mode de lecture", + "select_source":"ID de l'entité input_select pour la sélection de playlist/radio", + "select_playlist":"ID de l'entité input_select pour la sélection de la liste de lecture", + "select_playcontinuous":"ID de l'entité input_boolean pour la sélection de lecture continue", + "proxy_path": "Chemin local pour le mode proxy, laissez vide si vous n'en avez pas besoin", + "proxy_url": "URL de base pour le mode proxy, laissez vide si vous n'en avez pas besoin", + "like_in_name": "Afficher le statut aime dans le nom", + "debug_as_error": "Afficher toutes les sorties de débogage en tant qu'erreur dans le journal", + "shuffle": "Activer la lecture aléatoire au démarrage", + "track_limit": "Limite de pistes chargées simultanément", + "legacy_radio": "Créer une radio en tant que piste dans une liste de lecture aléatoire", + "sort_browser": "Trier les résultats dans le navigateur multimédia", + "extra_sensor": "Créer un capteur qui fournit des informations supplémentaires" + } + } + }, + "error": { + "ERROR_GENERIC": "Quelque chose n'allait pas avec votre cookie. Le format et les champs sont corrects mais la connexion a échoué", + "ERROR_AUTH_USER": "Impossible de trouver le champ 'X-Goog-AuthUser', veuillez vérifier votre saisie", + "ERROR_COOKIE": "Impossible de trouver le champ 'Cookie', veuillez vérifier votre saisie", + "ERROR_CONTENTS": "Le format du cookie est correct, trouvé '__Secure-3PAPISID' et '__Secure-3PSID' mais ne peut récupérer aucune donnée avec ces paramètres, peut-être que vous n'avez pas copié toutes les données ?", + "ERROR_FORMAT": "Le format du cookie n'est pas correct, il manque probablement '__Secure-3PAPISID' ou '__Secure-3PSID'", + "ERROR_NONE": "Le format du cookie semble correct, mais l'objet renvoyé est Aucun", + "ERROR_FORBIDDEN": "YouTube a renvoyé une erreur 403, ce qui signifie que vos données de connexion ne sont plus valides. Veuillez mettre à jour le cookie" + } + }, + "options": { + "step": { + "init": { + "description": "Veuillez entrer le chemin et les données du cookie. Plus d'informations disponibles sur https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "name": "Nom de l'entité (sans le préfixe 'media_player')", + "cookie": "Saisissez le texte du cookie, copié depuis le navigateur", + "speakers": "Sélectionnez le périphérique de sortie par défaut", + "header_path": "Chemin d'accès au fichier d'en-tête", + "advance_config": "Afficher la configuration avancée" + } + }, + "finish": { + "description": "Ici, vous pouvez modifier les identifiants d'entité de certains champs, si vous n'utilisez pas les listes déroulantes, laissez-les tels quels", + "data": { + "brand_id": "Entrez un identifiant de marque si vous utilisez un compte de marque", + "select_speakers": "ID de l'entité input_select pour la sélection du haut-parleur", + "select_playmode":"ID de l'entité input_select pour la sélection du mode de lecture", + "select_source":"ID de l'entité input_select pour la sélection de playlist/radio", + "select_playlist":"ID de l'entité input_select pour la sélection de la liste de lecture", + "select_playcontinuous":"ID de l'entité input_boolean pour la sélection de lecture continue", + "proxy_path": "Chemin local pour le mode proxy, laissez vide si vous n'en avez pas besoin", + "proxy_url": "URL de base pour le mode proxy, laissez vide si vous n'en avez pas besoin", + "like_in_name": "Afficher le statut aime dans le nom", + "debug_as_error": "Afficher toutes les sorties de débogage en tant qu'erreur dans le journal", + "shuffle": "Activer la lecture aléatoire au démarrage", + "track_limit": "Limite de pistes chargées simultanément", + "legacy_radio": "Créer une radio en tant que piste dans une liste de lecture aléatoire", + "sort_browser": "Trier les résultats dans le navigateur multimédia", + "extra_sensor": "Créer un capteur qui fournit des informations supplémentaires" + } + } + }, + "error": { + "ERROR_GENERIC": "Quelque chose n'allait pas avec votre cookie. Le format et les champs sont corrects mais la connexion a échoué", + "ERROR_AUTH_USER": "Impossible de trouver le champ 'X-Goog-AuthUser', veuillez vérifier votre saisie", + "ERROR_COOKIE": "Impossible de trouver le champ 'Cookie', veuillez vérifier votre saisie", + "ERROR_CONTENTS": "Le format du cookie est correct, trouvé '__Secure-3PAPISID' et '__Secure-3PSID' mais ne peut récupérer aucune donnée avec ces paramètres, peut-être que vous n'avez pas copié toutes les données ?", + "ERROR_FORMAT": "Le format du cookie n'est pas correct, il manque probablement '__Secure-3PAPISID' ou '__Secure-3PSID'", + "ERROR_NONE": "Le format du cookie semble correct, mais l'objet renvoyé est Aucun", + "ERROR_FORBIDDEN": "YouTube a renvoyé une erreur 403, ce qui signifie que vos données de connexion ne sont plus valides. Veuillez mettre à jour le cookie" + } + } +} \ No newline at end of file diff --git a/custom_components/ytube_music_player/translations/pl.json b/custom_components/ytube_music_player/translations/pl.json new file mode 100644 index 00000000..887b5188 --- /dev/null +++ b/custom_components/ytube_music_player/translations/pl.json @@ -0,0 +1,89 @@ +{ + "title": "yTubeMediaPlayer", + "config": { + "step": { + "user": { + "description": "Podaj ścieżkę do danych cookie. Więcej informacji pod adresem https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "name": "Nazwa entity (bez prefix'u 'media_player')", + "cookie": "Wprowadź tekst cookie skopiowanej z przeglądarki", + "speakers": "Wybierz domyślne urządzenie wyjściowe", + "header_path": "Ścieżka do pliku nagłówkowego", + "advance_config": "Pokaż zaawansowaną konfigurację" + } + }, + "finish": { + "description": "Tutaj możesz zmienić na identyfikatory entity wybranych pól, jeśli nie korzystasz z list rozwijanych, po prostu pozostaw je bez zmian", + "data": { + "brand_id": "Wprowadź identyfikator brand, jeśli korzystasz z konta brand", + "select_speakers": "Identyfikator entity input_select do wyboru źródła dźwięku", + "select_playmode":"Identyfikator entity input_select do wyboru playmode", + "select_source":"Identyfikator entity input_select do wyboru playlist/radio", + "select_playlist":"Identyfikator entity input_select do wyboru playlist", + "select_playcontinuous":"Identyfikator entity input_boolean do wyboru play continouus", + "proxy_path": "Ścieżka lokalna dla trybu proxy, pozostaw puste jeśli tego nie używasz", + "proxy_url": "Podstawowy adres URL dla trybu proxy, pozostaw puste, jeśli go nie używasz", + "like_in_name": "Pokaż status polubienia w nazwie", + "debug_as_error": "Pokaż wszystkie dane wyjściowe debugowania jako ERROR w dzienniku", + "shuffle": "Włącz odtwarzanie losowe podczas uruchamiania", + "track_limit": "Limit jednocześnie załadowanych utworów", + "legacy_radio": "Utwórz radio jako listę obserwowanych losowych utworów z listy odtwarzania", + "sort_browser": "Sortuj wyniki w przeglądarce multimediów", + "extra_sensor": "Utwórz czujnik, który dostarcza dodatkowych informacji" + } + } + }, + "error": { + "ERROR_GENERIC": "Coś z Twoim cookie było nie tak. Format i pola są w porządku, ale logowanie nie powiodło się", + "ERROR_AUTH_USER": "Nie można znaleźć pola „X-Goog-AuthUser”. Sprawdź wprowadzone dane", + "ERROR_COOKIE": "Nie można znaleźć pola „Pliki cookie”, sprawdź wprowadzone dane", + "ERROR_CONTENTS": "Format pliku cookie jest OK, znaleziono „__Secure-3PAPISID” i „__Secure-3PSID”, ale nie można pobrać żadnych danych z tymi ustawieniami, może nie skopiowałeś wszystkich danych?", + "ERROR_FORMAT": "Format pliku cookie jest NIEPRAWIDŁOWY, prawdopodobnie brakuje „__Secure-3PAPISID” lub „__Secure-3PSID”", + "ERROR_NONE": "Format plików cookie wydaje się być OK, ale zwrócony obiekt podrzędny interfejsu API jest pusty (NULL)", + "ERROR_FORBIDDEN": "YouTube zwrócił błąd 403, co oznacza, że Twoje dane logowania nie są już ważne. Proszę zaktualizować plik cookie" + } + }, + "options": { + "step": { + "init": { + "description": "Podaj ścieżkę i dane pliku cookie. Więcej informacji pod adresem https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "name": "Nazwa entity (bez prefix'u 'media_player')", + "cookie": "Wprowadź tekst cookie skopiowanej z przeglądarki", + "speakers": "Wybierz domyślne urządzenie wyjściowe", + "header_path": "Ścieżka do pliku nagłówkowego", + "advance_config": "Pokaż zaawansowaną konfigurację" + } + }, + "finish": { + "description": "Tutaj możesz zmienić na identyfikatory entity wybranych pól, jeśli nie korzystasz z list rozwijanych, po prostu pozostaw je bez zmian", + "data": { + "brand_id": "Wprowadź identyfikator brand, jeśli korzystasz z konta brand", + "select_speakers": "Identyfikator entity input_select do wyboru źródła dźwięku", + "select_playmode":"Identyfikator entity input_select do wyboru playmode", + "select_source":"Identyfikator entity input_select do wyboru playlist/radio", + "select_playlist":"Identyfikator entity input_select do wyboru playlist", + "select_playcontinuous":"Identyfikator entity input_boolean do wyboru play continouus", + "proxy_path": "Ścieżka lokalna dla trybu proxy, pozostaw puste jeśli tego nie używasz", + "proxy_url": "Podstawowy adres URL dla trybu proxy, pozostaw puste, jeśli go nie używasz", + "like_in_name": "Pokaż status polubienia w nazwie", + "debug_as_error": "Pokaż wszystkie dane wyjściowe debugowania jako ERROR w dzienniku", + "shuffle": "Włącz odtwarzanie losowe podczas uruchamiania", + "track_limit": "Limit jednocześnie załadowanych utworów", + "legacy_radio": "Utwórz radio jako listę obserwowanych losowych utworów z listy odtwarzania", + "sort_browser": "Sortuj wyniki w przeglądarce multimediów", + "extra_sensor": "Utwórz czujnik, który dostarcza dodatkowych informacji" + } + } + }, + "error": { + "ERROR_GENERIC": "Coś z Twoim cookie było nie tak. Format i pola są w porządku, ale logowanie nie powiodło się", + "ERROR_AUTH_USER": "Nie można znaleźć pola „X-Goog-AuthUser”. Sprawdź wprowadzone dane", + "ERROR_COOKIE": "Nie można znaleźć pola „Pliki cookie”, sprawdź wprowadzone dane", + "ERROR_CONTENTS": "Format pliku cookie jest OK, znaleziono „__Secure-3PAPISID” i „__Secure-3PSID”, ale nie można pobrać żadnych danych z tymi ustawieniami, może nie skopiowałeś wszystkich danych?", + "ERROR_FORMAT": "Format pliku cookie jest NIEPRAWIDŁOWY, prawdopodobnie brakuje „__Secure-3PAPISID” lub „__Secure-3PSID”", + "ERROR_NONE": "Format plików cookie wydaje się być OK, ale zwrócony obiekt podrzędny interfejsu API jest pusty (NULL)", + "ERROR_FORBIDDEN": "YouTube zwrócił błąd 403, co oznacza, że Twoje dane logowania nie są już ważne. Proszę zaktualizować plik cookie" + } + } +} diff --git a/custom_components/ytube_music_player/translations/pt-BR.json b/custom_components/ytube_music_player/translations/pt-BR.json new file mode 100644 index 00000000..1cfdbf38 --- /dev/null +++ b/custom_components/ytube_music_player/translations/pt-BR.json @@ -0,0 +1,89 @@ +{ + "title": "yTubeMediaPlayer", + "config": { + "step": { + "user": { + "description": "Por favor, insira o caminho e os dados do cookie. Mais informações disponíveis em https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "name": "Nome da entidade (sem o prefixo 'media_player')", + "cookie": "Digite o texto do cookie copiado do navegador", + "speakers": "Selecione o speaker de saída padrão", + "header_path": "Caminho do arquivo para o arquivo do cabeçalho", + "advance_config": "Mostrar configuração avançada" + } + }, + "finish": { + "description": "Aqui você pode alterar para IDs de entidade de campos selecionados, se você não usar os menus suspensos, deixe-os como estão", + "data": { + "brand_id": "Insira um ID de marca se estiver usando uma conta de marca", + "select_speakers": "ID da entidade do input_select para seleção de alto-falante", + "select_playmode":"ID da entidade do input_select para seleção do modo de reprodução", + "select_source":"ID da entidade do input_select para seleção de playlist/rádio", + "select_playlist":"ID da entidade do input_select para seleção de lista de reprodução", + "select_playcontinuous":"ID da entidade do input_boolean para reprodução de seleção contínua", + "proxy_path": "Caminho local para o modo proxy, deixe em branco se não precisar", + "proxy_url": "URL base para o modo proxy, deixe em branco se não precisar", + "like_in_name": "Mostrar status como no nome", + "debug_as_error": "Mostrar todas as saídas de depuração como ERROR no log", + "shuffle": "Ativar reprodução aleatória na inicialização", + "track_limit": "Limite de faixas carregadas simultaneamente", + "legacy_radio": "Criar rádio como lista de observação de faixa de lista de reprodução aleatória", + "sort_browser": "Classifique os resultados no navegador de mídia", + "extra_sensor": "Crie um sensor que forneça informações extras" + } + } + }, + "error": { + "ERROR_GENERIC": "Algo com seu cookie não estava certo. O formato e os campos estão corretos, mas o login falhou", + "ERROR_AUTH_USER": "Não é possível encontrar o campo 'X-Goog-AuthUser', verifique sua entrada", + "ERROR_COOKIE": "Não é possível encontrar o campo 'Cookie', verifique sua entrada", + "ERROR_CONTENTS": "O formato do cookie está OK, encontrou '__Secure-3PAPISID' e '__Secure-3PSID', mas não pode recuperar nenhum dado com essas configurações, talvez você não tenha copiado todos os dados?", + "ERROR_FORMAT": "O formato do cookie NÃO está correto, provavelmente faltando '__Secure-3PAPISID' ou '__Secure-3PSID'", + "ERROR_NONE": "O formato do cookie está OK, mas o valor retornado da subAPI é Nenhum", + "ERROR_FORBIDDEN": "O YouTube retornou um erro 403, o que significa que seus dados de login não são mais válidos. Por favor, atualize o cookie" + } + }, + "options": { + "step": { + "init": { + "description": "Por favor, insira o caminho e os dados do cookie. Mais informações disponíveis em https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "name": "Nome da entidade (sem o prefixo 'media_player')", + "cookie": "Digite o texto do cookie copiado do navegador", + "speakers": "Selecione o speaker de saída padrão", + "header_path": "Caminho do arquivo para o arquivo do cabeçalho", + "advance_config": "Mostrar configuração avançada" + } + }, + "finish": { + "description": "Aqui você pode alterar para IDs de entidade de campos selecionados, se você não usar os menus suspensos, deixe-os como estão", + "data": { + "brand_id": "Insira um ID de marca se estiver usando uma conta de marca", + "select_speakers": "ID da entidade do input_select para seleção de alto-falante", + "select_playmode":"ID da entidade do input_select para seleção do modo de reprodução", + "select_source":"ID da entidade do input_select para seleção de playlist/rádio", + "select_playlist":"ID da entidade do input_select para seleção de lista de reprodução", + "select_playcontinuous":"ID da entidade do input_boolean para reprodução de seleção contínua", + "proxy_path": "Caminho local para o modo proxy, deixe em branco se não precisar", + "proxy_url": "URL base para o modo proxy, deixe em branco se não precisar", + "like_in_name": "Mostrar status como no nome", + "debug_as_error": "Mostrar todas as saídas de depuração como ERROR no log", + "shuffle": "Ativar reprodução aleatória na inicialização", + "track_limit": "Limite de faixas carregadas simultaneamente", + "legacy_radio": "Criar rádio como lista de observação de faixa de lista de reprodução aleatória", + "sort_browser": "Classifique os resultados no navegador de mídia", + "extra_sensor": "Crie um sensor que forneça informações extras" + } + } + }, + "error": { + "ERROR_GENERIC": "Algo com seu cookie não estava certo. O formato e os campos estão corretos, mas o login falhou", + "ERROR_AUTH_USER": "Não é possível encontrar o campo 'X-Goog-AuthUser', verifique sua entrada", + "ERROR_COOKIE": "Não é possível encontrar o campo 'Cookie', verifique sua entrada", + "ERROR_CONTENTS": "O formato do cookie está OK, encontrou '__Secure-3PAPISID' e '__Secure-3PSID', mas não pode recuperar nenhum dado com essas configurações, talvez você não tenha copiado todos os dados?", + "ERROR_FORMAT": "O formato do cookie NÃO está correto, provavelmente faltando '__Secure-3PAPISID' ou '__Secure-3PSID'", + "ERROR_NONE": "O formato do cookie está OK, mas o valor retornado da subAPI é Nenhum", + "ERROR_FORBIDDEN": "O YouTube retornou um erro 403, o que significa que seus dados de login não são mais válidos. Por favor, atualize o cookie" + } + } +} diff --git a/custom_components/ytube_music_player/translations/zh-Hans.json b/custom_components/ytube_music_player/translations/zh-Hans.json new file mode 100644 index 00000000..cbbc255d --- /dev/null +++ b/custom_components/ytube_music_player/translations/zh-Hans.json @@ -0,0 +1,232 @@ +{ + "title": "yTubeMediaPlayer", + "config": { + "step": { + "oauth": { + "description": "请在单独的浏览器窗口中打开下方链接,成功登录Google账户后返回本页面继续操作。", + "data": { + "code": "Google Device Code", + "name": "实体名称 (不含 'media_player' 前缀)" + } + }, + "finish": { + "description": "在这里进行基本设置。需要帮助请查看https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "speakers": "选择输出设备白名单,第一个是默认设备。", + "header_path": "header文件保存路径", + "api_language": "API返回结果语言", + "advance_config": "显示高级选项" + } + }, + "adv_finish": { + "description": "在这里进行高级设置,比如限制流量使用和单次加载的最大曲目数。", + "data": { + "brand_id": "如果您正在使用brand account,请输入brand id", + "proxy_path": "代理模式的本地路径,不需要请留空", + "proxy_url": "代理服务器地址,不需要请留空", + "like_in_name": "在名称中显示喜欢状态", + "debug_as_error": "在日志中将所有调试输出显示为ERROR", + "shuffle": "启动时随机播放", + "shuffle_mode": "播放模式", + "track_limit": "加载曲目数量限制", + "max_datarate": "限制最大比特率,设置为0以禁用", + "legacy_radio": "将随机播放列表曲目创建为收藏夹电台", + "sort_browser": "在媒体浏览器中对结果进行排序", + "extra_sensor": "创建提供额外信息的传感器实体", + "dropdowns": "创建你需要的下拉菜单实体", + "select_speakers": "播放设备下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)", + "select_playmode":"循环模式下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)", + "select_source":"播放列表/电台选择下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)", + "select_playlist":"播放列表下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)", + "select_playcontinuous":"持续播放模式下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)" + } + } + }, + "error": { + "ERROR_GENERIC": "没有获得访问权限,请再试一次。" + } + }, + "options": { + "step": { + "oauth": { + "description": "登录令牌已失效。请再次在单独的浏览器窗口中打开下方链接,成功登录Google账户后返回本页面继续操作。", + "data": { + "code": "Google Device Code", + "name": "实体名称 (不含 'media_player' 前缀)" + } + }, + "finish": { + "description": "在这里进行基本设置。需要帮助请查看https://github.com/KoljaWindeler/ytube_music_player", + "data": { + "speakers": "选择输出设备白名单,第一个是默认设备。", + "header_path": "header文件保存路径", + "api_language": "API返回结果语言", + "advance_config": "显示高级选项" + } + }, + "adv_finish": { + "description": "在这里进行高级设置,比如限制流量使用和单次加载的最大曲目数。", + "data": { + "brand_id": "如果您正在使用brand account,请输入brand id", + "proxy_path": "代理模式的本地路径,不需要请留空", + "proxy_url": "代理服务器地址,不需要请留空", + "like_in_name": "在名称中显示喜欢状态", + "debug_as_error": "在日志中将所有调试输出显示为ERROR", + "shuffle": "启动时随机播放", + "shuffle_mode": "播放模式", + "track_limit": "加载曲目数量限制", + "max_datarate": "限制最大比特率,设置为0以禁用", + "legacy_radio": "将随机播放列表曲目创建为收藏夹电台", + "sort_browser": "在媒体浏览器中对结果进行排序", + "extra_sensor": "创建提供额外信息的传感器实体", + "dropdowns": "创建你需要的下拉菜单实体", + "select_speakers": "播放设备下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)", + "select_playmode":"循环模式下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)", + "select_source":"播放列表/电台选择下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)", + "select_playlist":"播放列表下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)", + "select_playcontinuous":"持续播放模式下拉菜单实体ID(已过期,留下一个空格字符可以永久删除这个字段)" + } + } + }, + "error": { + "ERROR_GENERIC": "没有获得访问权限,请再试一次。" + } + }, + "services": { + "add_to_playlist": { + "name": "将歌曲添加到播放列表", + "description": "添加歌曲到播放列表", + "fields": { + "entity_id": { + "name": "实体ID", + "description": "ytube media player 的实体ID" + }, + "song_id": { + "name": "歌曲ID", + "description": "歌曲ID,可选。默认使用当前歌曲ID。" + }, + "playlist_id": { + "name": "播放列表ID", + "description": "播放列表ID,可选。默认使用当前播放列表ID。" + } + } + }, + "remove_from_playlist": { + "name": "从播放列表中移除歌曲", + "description": "从播放列表中移除一首歌曲", + "fields": { + "entity_id": { + "name": "实体ID", + "description": "ytube media player 的实体ID" + }, + "song_id": { + "name": "歌曲ID", + "description": "歌曲ID,可选。默认使用当前歌曲ID。" + }, + "playlist_id": { + "name": "播放列表ID", + "description": "播放列表ID,可选。默认使用当前播放列表ID。" + } + } + }, + "call_method": { + "name": "调用本组件方法", + "description": "运行自定义命令", + "fields": { + "entity_id": { + "name": "实体ID", + "description": "要运行自定义命令的目标实体ID。", + "example": "media_player.ytube_music_player" + }, + "command": { + "name": "命令", + "description": "要运行的自定义命令。", + "example": "rate_track" + }, + "parameters": { + "name": "参数", + "description": "参数数组,部分命令为可选参数。", + "example": "thumb_up" + } + } + }, + "search": { + "description": "在YouTube Music Player中搜索音乐/专辑等", + "name": "搜索", + "fields":{ + "entity_id": { + "name": "实体ID", + "description": "要运行自定义命令的目标实体ID。", + "example": "media_player.ytube_music_player" + }, + "query": { + "name": "搜索内容", + "description": "要搜索的内容文本", + "example": "2pm tetris" + }, + "filter": { + "name": "过滤器", + "description": "搜索结果过滤器,可以是 'albums', 'playlists','artists' 或者 'songs',留空返回所有结果。" + }, + "limit": { + "name": "限制", + "description": "结果数量限制", + "example": "20" + } + } + }, + "rate_track": { + "name": "对曲目进行评分", + "description": "对歌曲进行评分", + "fields": { + "entity_id": { + "name": "Entity ID", + "description": "要运行自定义命令的目标实体ID。", + "example": "media_player.ytube_music_player" + }, + "rating": { + "name":"评分", + "description": "歌曲的评分,可以是'thumb_up' / 'thumb_down' / 'thumb_middle' / 'thumb_toggle_up_middle'", + "example": "thumb_up" + }, + "song_id": { + "name": "歌曲ID", + "description": "歌曲ID,可选。默认使用当前歌曲ID。", + "example": "" + } + } + }, + "limit_count": { + "name": "歌曲限制数量", + "description": "限制加载的曲目数量", + "fields": { + "entity_id": { + "name": "实体ID", + "description": "要运行自定义命令的目标实体ID。", + "example": "media_player.ytube_music_player" + }, + "limit": { + "name": "限制", + "description": "每次执行加载的曲目数量", + "example": "20" + } + } + }, + "start_radio": { + "name": "电台", + "description": "基于当前曲目创建电台。", + "fields": { + "entity_id": { + "name": "实体ID", + "description": "要运行自定义命令的目标实体ID。", + "example": "media_player.ytube_music_player" + }, + "interrupt": { + "name": "中断", + "description": "是否中断当前播放", + "example": "true" + } + } + } + } +} diff --git a/www/community/Bubble-Card/bubble-card.js b/www/community/Bubble-Card/bubble-card.js index abcb9de1..920c205d 100644 --- a/www/community/Bubble-Card/bubble-card.js +++ b/www/community/Bubble-Card/bubble-card.js @@ -1,6 +1,6 @@ -(()=>{"use strict";var __webpack_modules__={946:(e,t,n)=>{function a(e,t=40){if(Array.isArray(e)&&3===e.length){for(let t=0;t<3;t++)if(e[t]<0||e[t]>255)return;return e.every((e=>Math.abs(e-255)<=t))}}let o;function i(e,t,n=1){if(e.startsWith("#"))if(4===e.length){let a=Math.min(255,parseInt(e.charAt(1).repeat(2),16)*n),i=Math.min(255,parseInt(e.charAt(2).repeat(2),16)*n),r=Math.min(255,parseInt(e.charAt(3).repeat(2),16)*n);o="rgba("+a+", "+i+", "+r+", "+t+")"}else{let a=Math.min(255,parseInt(e.slice(1,3),16)*n),i=Math.min(255,parseInt(e.slice(3,5),16)*n),r=Math.min(255,parseInt(e.slice(5,7),16)*n);o="rgba("+a+", "+i+", "+r+", "+t+")"}else if(e.startsWith("rgb")){let a=e.match(/\d+/g);o="rgba("+Math.min(255,a[0]*n)+", "+Math.min(255,a[1]*n)+", "+Math.min(255,a[2]*n)+", "+t+")"}else if(e.startsWith("var(--")){let a=e.slice(4,-1),r=window.getComputedStyle(document.documentElement).getPropertyValue(a);(r.startsWith("#")||r.startsWith("rgb"))&&(o=i(r,t,n))}return o}n.d(t,{_k:()=>i,wW:()=>a})},191:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{BX:()=>fireEvent,GP:()=>applyScrollingEffect,IL:()=>getAttribute,Jn:()=>tapFeedback,OC:()=>isEntityType,P2:()=>throttle,Vv:()=>isColorLight,X:()=>getWeatherIcon,az:()=>createElement,gJ:()=>getImage,jk:()=>forwardHaptic,jx:()=>setLayout,mk:()=>getIconColor,o0:()=>formatDateTime,oY:()=>getName,pr:()=>isStateOn,q7:()=>getIcon,y0:()=>getState});var _style_ts__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(946);function hasStateChanged(e,t,n){if(e.hasState=t.states[n],e.hasState)return e.newState=[e.hasState.state,e.hasState.attributes.rgb_color],e.oldState&&e.newState[0]===e.oldState[0]&&e.newState[1]===e.oldState[1]?e.stateChanged=!1:(e.oldState=e.newState,e.stateChanged=!0),e.stateChanged}function configChanged(e,t){return!(!t.classList.contains("editor")||e.config===e.previousConfig||(e.previousConfig=e.config,0))}const fireEvent=(e,t,n,a)=>{a=a||{},n=null==n?{}:n;const o=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return o.detail=n,e.dispatchEvent(o),o},forwardHaptic=e=>{fireEvent(window,"haptic",e)},navigate=(e,t,n=!1)=>{n?history.replaceState(null,"",t):history.pushState(null,"",t),fireEvent(window,"location-changed",{replace:n})};function toggleEntity(e,t){e.callService("homeassistant","toggle",{entity_id:t})}function tapFeedback(e){void 0!==e&&(e.style.display="",e.style.animation="tap-feedback .3s",setTimeout((()=>{e.style.animation="none",e.style.display="none"}),500))}function getIcon(e,t=e.config.entity,n=e.config.icon){const a=t?.split(".")[0],o=getAttribute(e,"device_class",t),i=getAttribute(e,"icon",t),r=n,s=getState(e,t),l={alarm_control_panel:"mdi:shield",alert:"mdi:alert",automation:"mdi:playlist-play",binary_sensor:function(){const n="off"===s;switch(getAttribute(e,"device_class",t)){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:server-network-off":"mdi:server-network";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness-5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}}(),calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",cover:function(){const n="closed"!==s;switch(getAttribute(e,"device_class",t)){case"awning":return n?"mdi:awning-outline":"mdi:awning";case"blind":return n?"mdi:blinds-open":"mdi:blinds";case"curtain":return n?"mdi:curtains-open":"mdi:curtains";case"damper":case"shutter":default:return n?"mdi:window-shutter-open":"mdi:window-shutter";case"door":return n?"mdi:door-open":"mdi:door-closed";case"garage":return n?"mdi:garage-open":"mdi:garage";case"gate":return n?"mdi:gate-open":"mdi:gate";case"shade":return n?"mdi:roller-shade":"mdi:roller-shade-closed";case"window":return n?"mdi:window-open":"mdi:window-closed"}}(),device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",lock:"mdi:lock",mailbox:"mdi:mailbox",media_player:"mdi:speaker",mower:"mdi:robot-mower",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:file-document",sensor:function(){switch(getAttribute(e,"device_class",t)){case"battery":return 100==s?"mdi:battery":s>=90?"mdi:battery-90":s>=80?"mdi:battery-80":s>=70?"mdi:battery-70":s>=60?"mdi:battery-60":s>=50?"mdi:battery-50":s>=40?"mdi:battery-40":s>=30?"mdi:battery-30":s>=20?"mdi:battery-20":s>=10?"mdi:battery-10":"mdi:battery-alert";case"humidity":return"mdi:water-percent";case"illuminance":return"mdi:brightness-5";case"temperature":return"mdi:thermometer";case"pressure":return"mdi:gauge";case"power":return"mdi:flash";case"signal_strength":return"mdi:wifi";case"energy":return"mdi:lightning-bolt";default:return"mdi:eye"}}(),simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:function(n=getState(e,t)){switch(n){case"cloudy":default:return"mdi:weather-cloudy";case"partlycloudy":return"mdi:weather-partly-cloudy";case"rainy":return"mdi:weather-rainy";case"snowy":return"mdi:weather-snowy";case"sunny":return"mdi:weather-sunny";case"clear-night":return"mdi:weather-night";case"fog":return"mdi:weather-fog";case"hail":return"mdi:weather-hail";case"lightning":return"mdi:weather-lightning";case"lightning-rainy":return"mdi:weather-lightning-rainy";case"pouring":return"mdi:weather-pouring";case"windy":return"mdi:weather-windy";case"windy-variant":return"mdi:weather-windy-variant";case"exceptional":return"mdi:alert-circle-outline"}}(),weblink:"mdi:open-in-new"};return r||i||(l[a]?l[a]:l[o]?l[o]:"")}function getWeatherIcon(e){switch(e){case"cloudy":default:return"mdi:weather-cloudy";case"partlycloudy":return"mdi:weather-partly-cloudy";case"rainy":return"mdi:weather-rainy";case"snowy":return"mdi:weather-snowy";case"sunny":return"mdi:weather-sunny";case"clear-night":return"mdi:weather-night";case"fog":return"mdi:weather-fog";case"hail":return"mdi:weather-hail";case"lightning":return"mdi:weather-lightning";case"lightning-rainy":return"mdi:weather-lightning-rainy";case"pouring":return"mdi:weather-pouring";case"windy":return"mdi:weather-windy";case"windy-variant":return"mdi:weather-windy-variant";case"exceptional":return"mdi:alert-circle-outline"}}let cachedColor=null,cachedResult=null;function resolveCssVariable(e){const t=getComputedStyle(document.body);let n=e;for(;n.startsWith("var(");){const e=n.match(/var\((--[^,]+),?\s*(.*)?\)/);if(!e)break;const a=t.getPropertyValue(e[1]).trim();if(a)n=a;else{if(!e[2])break;n=e[2].trim()}}return n}function isColorLight(e){const t=resolveCssVariable(e);if(!t)return!1;if(t===cachedColor)return cachedResult;cachedColor=t;const n=t.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);let a,o,i;if(n)a=parseInt(n[1],16),o=parseInt(n[2],16),i=parseInt(n[3],16);else{const e=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(!e)return cachedResult=!1,cachedResult;a=parseInt(e[1],10),o=parseInt(e[2],10),i=parseInt(e[3],10)}return cachedResult=(.2126*a+.7152*o+.0722*i)/255>.5,cachedResult}function getIconColor(e,t=e.config.entity,n=1){const a="var(--bubble-accent-color, var(--accent-color))",o=getAttribute(e,"rgb_color",t),i=isColorLight("var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))))");if(n=i?n-.2:n,!t)return a;if(!1===t.startsWith("light."))return a;const r=i?[200,200,195]:[225,225,222],s=i?[200,180,180]:[255,255,255],l=isStateOn(e)?r:s;if(!o)return`var(--bubble-light-color, rgba(${l.map((e=>Math.min(255,e*n))).join(", ")}))`;const c=o.map((e=>Math.min(255,e*n)));return(0,_style_ts__WEBPACK_IMPORTED_MODULE_0__.wW)(o)?`var(--bubble-light-color, rgba(${r.map((e=>Math.min(255,e*n))).join(", ")}))`:`var(--bubble-light-color, rgba(${c.join(", ")}))`}function getImage(e){if(e.config.force_icon)return"";const t=getAttribute(e,"entity_picture_local"),n=getAttribute(e,"entity_picture");return t||n||""}function getName(e){const t=e.config.name,n=getAttribute(e,"friendly_name");return t||n||""}function getState(e,t=e.config.entity){return e._hass.states[t]?.state??""}function getAttribute(context,attribute,entity=context.config.entity){return attribute?eval(`context._hass.states['${entity}']?.attributes.${attribute}`)??"":""}function isEntityType(e,t){return e.config.entity?.startsWith(t+".")??!1}function isStateOn(e,t=e.config.entity){const n=getState(e,t).toLowerCase(),a=Number(n);return!!(["on","open","opening","closing","cleaning","true","idle","home","playing","paused","locked","occupied","available","running","active","connected","online","mowing","starting","heat","cool","dry","heat_cool","fan_only","auto","alarm"].includes(n)||a>0)}function createElement(e,t=""){const n=document.createElement(e);return""!==t&&t.split(" ").forEach((e=>{n.classList.add(e)})),n}function debounce(e,t){let n;return function(...a){clearTimeout(n),n=setTimeout((()=>e.apply(this,a)),t)}}function applyScrollingEffect(e,t,n){const a=e.config.scrolling_effect??!0;if(!a)return void applyNonScrollingStyle(t,n);if(t.previousText===n)return;const o=t.className.split(" ").find((e=>e.startsWith("bubble-")));function i(){t.innerHTML=`
${n}
`,t.style="";const e=t.scrollWidth,i=t.parentNode?.offsetWidth||0;a&&e>i?(function(e,t,n){const a=' | ',o=`${t+a+t+a}`;e.innerHTML=`
${o}
`;const i=function(e){return`\n .${e} .scrolling-container {\n width: 100%;\n white-space: nowrap;\n mask-image: linear-gradient(to right, transparent, black calc(0% + 8px), black calc(100% - 8px), transparent);\n mask-image: linear-gradient(to left, transparent, black calc(0% + 8px), black calc(100% - 8px), transparent);\n }\n .${e} .scrolling-container span {\n display: inline-block;\n animation: scroll 14s linear infinite;\n }\n\n .bubble-scroll-separator {\n opacity: .3;\n margin: 0 6px 0 8px;\n }\n\n @keyframes scroll {\n from { transform: translateX(0%); }\n to { transform: translateX(-50%); }\n }\n `}(n);e.styleElement=document.createElement("style"),e.appendChild(e.styleElement),e.styleElement.innerHTML=i}(t,n,o),t.previousText=n):t.previousText=n}requestAnimationFrame(i),t.eventAdded||(window.addEventListener("resize",debounce(i,300)),t.eventAdded=!0)}function applyNonScrollingStyle(e,t){e.innerHTML=t,e.previousText=t,e.style.whiteSpace="normal",e.style.display="-webkit-box",e.style.webkitLineClamp="2",e.style.webkitBoxOrient="vertical",e.style.textOverflow="ellipsis"}function formatDateTime(e,t){if(!e)return"";const n=new Date(e),a=new Date;let o,i,r=Math.floor((a-n)/1e3);return isNaN(r)?"":(r<60?(o="second",i=r+1):r<3600?(o="minute",i=Math.floor(r/60)):r<86400?(o="hour",i=Math.floor(r/3600)):(o="day",i=Math.floor(r/86400)),new Intl.RelativeTimeFormat(t,{numeric:"auto"}).format(-i,o))}function setLayout(e){const t=e.config.card_layout,n="large"===t||"large-2-rows"===t,a="large-2-rows"===t;n!==e.content.classList.contains("large")&&e.content.classList.toggle("large",n),a!==e.content.classList.contains("rows-2")&&e.content.classList.toggle("rows-2",a)}function throttle(e,t=300){let n;return(...a)=>{void 0===n&&(e(...a),n=setTimeout((()=>{n=void 0}),t))}}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={};(()=>{let e="v2.3.0";var t=__webpack_require__(946),n=__webpack_require__(191);function a(e,t,n){setTimeout((()=>{const a=new Event("hass-action",{bubbles:!0,composed:!0}),o={...t};!o.entity_id&&this?.config?.entity&&(o.entity_id=this.config.entity),"tap"===n||"double_tap"===n||"hold"===n?a.detail={config:o,action:n}:(e.modifiedConfig={...o,tap_action:{...o[n]}},delete e.modifiedConfig[n],a.detail={config:e.modifiedConfig,action:"tap"}),e.dispatchEvent(a)}),10)}function o(e,t,n,a){e.classList.add("bubble-action"),e.dataset.entity=t?.entity||n,e.dataset.tapAction=JSON.stringify(t?.tap_action||a?.tap_action||{action:"more-info"}),e.dataset.doubleTapAction=JSON.stringify(t?.double_tap_action||a?.double_tap_action||{action:"toggle"}),e.dataset.holdAction=JSON.stringify(t?.hold_action||a?.hold_action||{action:"toggle"});const o=JSON.parse(e.dataset.tapAction),i=JSON.parse(e.dataset.doubleTapAction),r=JSON.parse(e.dataset.holdAction);e.style.cursor="none"===o.action&&"none"===i.action&&"none"===r.action?"":"pointer"}window.isScrolling=!1,document.addEventListener("scroll",(function(){window.isScrolling=!0,setTimeout((()=>{window.isScrolling=!1}),150)}),{passive:!0}),document.body.addEventListener("pointerdown",(e=>{if(window.isScrolling)return;const t=e.composedPath();let n=null;for(const e of t)if(e.classList&&e.classList.contains("bubble-action")){n=e;break}if(n){const t={tap_action:JSON.parse(n.dataset.tapAction),double_tap_action:JSON.parse(n.dataset.doubleTapAction),hold_action:JSON.parse(n.dataset.holdAction),entity:n.dataset.entity};n.actionHandler||(n.actionHandler=new i(n,t,r)),n.actionHandler.handleStart(e),n.addEventListener("pointerup",n.actionHandler.handleEnd.bind(n.actionHandler),{once:!0}),document.addEventListener("scroll",n.actionHandler.handleScroll.bind(n.actionHandler),{once:!0})}}),{passive:!0});class i{constructor(e,t,n){this.element=e,this.config=t,this.sendActionEvent=n,this.tapTimeout=null,this.holdTimeout=null,this.startX=0,this.startY=0,this.holdFired=!1,this.pointerMoveListener=this.detectScrollLikeMove.bind(this)}handleStart(e){window.isScrolling||this.isDisconnected||(this.startX=e.clientX,this.startY=e.clientY,this.holdFired=!1,document.addEventListener("pointermove",this.pointerMoveListener),this.holdTimeout=setTimeout((()=>{"none"===(this.config.hold_action||{action:"none"}).action||window.isScrolling||(this.sendActionEvent(this.element,this.config,"hold"),this.holdFired=!0)}),400))}detectScrollLikeMove(e){const t=Math.abs(e.clientX-this.startX),n=Math.abs(e.clientY-this.startY);(t>5||n>5)&&(clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener))}handleEnd(e){if(window.isScrolling||this.isDisconnected)return;if(clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener),this.holdFired)return;const t=Date.now(),n=this.config.double_tap_action||{action:"none"},a=this.config.tap_action||{action:"none"};this.lastTap&&t-this.lastTap<200&&"none"!==n.action?(clearTimeout(this.tapTimeout),this.sendActionEvent(this.element,this.config,"double_tap")):"none"!==a.action&&(this.tapTimeout=setTimeout((()=>{this.sendActionEvent(this.element,this.config,"tap")}),200)),this.lastTap=t}handleScroll(){clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener)}}function r(e,t,n){const o=t.tap_action||{action:"more-info"},i=t.double_tap_action||{action:"toggle"},r=t.hold_action||{action:"toggle"},s=t.entity||this.config?.entity,l=e=>e.service&&"entity"===e.target?.entity_id&&s?{...e,target:{...e.target,entity_id:s}}:e,c=l(o),d=l(i),u=l(r);let p;switch(n){case"tap":default:p=c;break;case"double_tap":p=d;break;case"hold":p=u}a(e,{entity:s,tap_action:c,double_tap_action:d,hold_action:u},n)}function s(e,t){e.addEventListener("click",(()=>{(0,n.jk)("selection"),(0,n.Jn)(t)}))}let l=!1;function c(){!l&&location.hash&&setTimeout((()=>{const e=window.location.href.split("#")[0];history.replaceState(null,"",e),window.dispatchEvent(new Event("location-changed"))}),50)}function d(e){const t=e.startsWith("#")?window.location.href.split("#")[0]+e:e;history.pushState(null,"",t),window.dispatchEvent(new Event("location-changed"))}function u(e,t){e.editor||(e.hideContentTimeout=setTimeout((()=>{const{sectionRow:t,sectionRowContainer:n}=e;"hui-card"===t?.tagName.toLowerCase()&&(t.hidden=!0,t.style.display="none",n?.classList.contains("card")&&(n.style.display="none"))}),t))}function p(e,t){const{showBackdrop:n,hideBackdrop:a}=L(e);t?n():a()}function b(e,t){if(e.config.background_update)return;const n=t?"appendChild":"removeChild";requestAnimationFrame((()=>{e.verticalStack[n](e.popUp)}))}function h(e,t){requestAnimationFrame((()=>{e.classList.toggle("is-popup-opened",t),e.classList.toggle("is-popup-closed",!t)}))}function m(e,t){e.boundClickOutside||(e.boundClickOutside=t=>function(e,t){(t.config.close_by_clicking_outside??1)&&(e.composedPath().find((e=>e.classList?.contains("bubble-pop-up")||["HA-DIALOG","HA-MORE-INFO-DIALOG","HA-DIALOG-DATE-PICKER"].includes(e.nodeName)))||c())}(t,e)),t?(e.listenersAdded||(e.popUp.addEventListener("touchstart",e.resetCloseTimeout,{passive:!0}),e.listenersAdded=!0),window.clickOutsideListenerAdded||(window.addEventListener("click",e.boundClickOutside,{passive:!0}),window.clickOutsideListenerAdded=!0)):e.listenersAdded&&(e.popUp.removeEventListener("touchstart",e.resetCloseTimeout),e.listenersAdded=!1,!location.hash&&window.clickOutsideListenerAdded&&(window.removeEventListener("click",e.boundClickOutside),window.clickOutsideListenerAdded=!1))}function g(e){document.body.style.overflow=e}function f(e){["hideContentTimeout","removeDomTimeout","closeTimeout"].forEach((t=>clearTimeout(e[t])))}const _="\n .bubble-backdrop {\n position: fixed;\n background-color: var(--bubble-backdrop-background-color);\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 4;\n opacity: 0;\n transition: opacity 0.3s;\n transition-delay: .1s;\n display: flex;\n backdrop-filter: var(--custom-backdrop-filter);\n -webkit-backdrop-filter: var(--custom-backdrop-filter);\n transform: translate3d(0, 0, 0);\n }\n\n .bubble-backdrop.is-visible {\n opacity: 1;\n }\n\n .bubble-backdrop.is-hidden {\n opacity: 0;\n pointer-events: none;\n }\n";let y,v,w,x,k=!1;const C=window.matchMedia("(prefers-color-scheme: dark)"),$=(0,n.az)("style");function S(){x=getComputedStyle(document.body).getPropertyValue("--ha-card-background")||getComputedStyle(document.body).getPropertyValue("--card-background-color"),document.body.style.setProperty("--bubble-backdrop-background-color",(0,t._k)(x,.8,.6))}function L(e){const t=e.config.hide_backdrop??!1;if(y)return y;$.innerHTML=_,document.head.appendChild($);const a=(0,n.az)("style");document.head.appendChild(a);const o=(0,n.az)("div","bubble-backdrop backdrop is-hidden");return t&&(o.style.display="none",o.style.pointerEvents="none"),document.body.appendChild(o),o.style.setProperty("--custom-backdrop-filter",`blur(${e.config.backdrop_blur??0}px)`),y={hideBackdrop:function(){o.classList.add("is-hidden"),o.classList.remove("is-visible")},showBackdrop:function(){requestAnimationFrame((()=>{o.classList.add("is-visible"),o.classList.remove("is-hidden")}))},backdropElement:o,backdropCustomStyle:a},y}function T(e,t,n,a){let o;switch(n){case"hvac_modes":o=document.createElement("ha-icon"),o.slot="graphic",o.icon=function(e){switch(e){case"auto":return"mdi:thermostat-auto";case"cool":return"mdi:snowflake";case"heat":return"mdi:fire";case"heat_cool":return"mdi:sun-snowflake-variant";case"dry":return"mdi:water-percent";case"fan_only":default:return"mdi:fan";case"off":return"mdi:power"}}(a);break;case"fan_modes":o=document.createElement("ha-attribute-icon"),o.slot="graphic",o.attribute="fan_mode",o.attributeValue=a,o.hass=e._hass,o.stateObj=t;break;case"swing_modes":o=document.createElement("ha-attribute-icon"),o.slot="graphic",o.attribute="swing_mode",o.attributeValue=a,o.hass=e._hass,o.stateObj=t;break;case"preset_modes":o=document.createElement("ha-attribute-icon"),o.slot="graphic",o.attribute="preset_mode",o.attributeValue=a,o.hass=e._hass,o.stateObj=t;break;default:o=!1}return o}C.addEventListener("change",S),S();const O="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n mwc-list-item {\n border-radius: var(--bubble-select-list-border-radius, var(--bubble-border-radius, 24px));\n margin: 0 8px;\n }\n mwc-list-item[selected] {\n color: var(--primary-text-color) !important;\n background-color: var(--bubble-list-item-accent-color, var(--bubble-accent-color, var(--accent-color)));\n }\n ha-select {\n --mdc-shape-medium: var(--bubble-select-list-border-radius, var(--bubble-border-radius, 32px));\n --mdc-theme-surface: var(--bubble-select-list-background-color, var(--bubble-select-main-background-color, var(--bubble-main-background-color, var(--card-background-color, var(--secondary-background-color)))));\n --mdc-shape-large: 32px;\n --mdc-shape-small: 64px;\n --mdc-menu-max-width: min-content;\n --mdc-menu-min-width: var(--bubble-select-list-width, 200px);\n --mdc-select-max-width: min-content;\n --mdc-select-outlined-hover-border-color: transparent;\n --mdc-select-outlined-idle-border-color: transparent;\n --mdc-theme-primary: transparent;\n --right-value: calc(var(--mdc-menu-min-width) - 154px);\n }\n .mdc-select {\n color: transparent !important;\n width: 150px !important;\n position: absolute !important;\n pointer-events: none;\n right: var(--right-value, 46px);\n top: -28px;\n }\n .mdc-menu, mwc-list, .mdc-list-item {\n pointer-events: auto;\n }\n .mdc-select__dropdown-icon {\n display: none !important;\n }\n .mdc-select__selected-text {\n color: transparent !important;\n }\n .mdc-select__anchor {\n width: 100%;\n pointer-events: none;\n }\n .bubble-dropdown-container {\n display: flex !important;\n width: auto;\n height: 100%;\n align-items: center;\n }\n .bubble-dropdown-arrow {\n display: flex;\n position: absolute;\n background: var(--bubble-select-arrow-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n height: 36px;\n width: 36px;\n right: 6px;\n pointer-events: none;\n border-radius: var(--bubble-select-button-border-radius, var(--bubble-border-radius, 20px));\n align-items: center;\n justify-content: center;\n transition: background 0.2s, transform 0.2s;\n pointer-events: none;\n }\n .bubble-dropdown-select {\n position: relative;\n width: 42px;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n .bubble-select-card-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-select-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n touch-action: pan-y;\n box-sizing: border-box;\n border: solid 2px transparent;\n transition: all 0.15s;\n cursor: pointer;\n }\n .bubble-select-card,\n .bubble-select-background {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n }\n .bubble-select-background {\n background-color: var(--bubble-select-background-color);\n opacity: .5;\n overflow: hidden !important;\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n }\n .is-unavailable .bubble-select-card {\n cursor: not-allowed;\n }\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n margin: 6px;\n border-radius: var(--bubble-select-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-select-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n }\n .bubble-icon-container::after {\n content: '';\n background-color: currentColor;\n position: absolute;\n display: block;\n width: 100%;\n height: 100%;\n transition: all 1s;\n left: 0;\n right: 0;\n opacity: 0;\n pointer-events: none;\n }\n\n .bubble-icon {\n display: flex;\n opacity: 0.6;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 18px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin: 0 16px 0 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-weight: 600;\n }\n\n .bubble-state {\n font-size: 12px;\n font-weight: normal;\n opacity: 0.7;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-select-card-container {\n height: 56px;\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 6px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";function z(e,t=e.elements,a){t.dropdownContainer=(0,n.az)("div","bubble-dropdown-container"),t.dropdownSelect=(0,n.az)("ha-select","bubble-dropdown-select"),t.dropdownSelect.setAttribute("outlined",""),t.dropdownArrow=(0,n.az)("ha-icon","bubble-dropdown-arrow"),t.dropdownArrow.setAttribute("icon","mdi:chevron-down"),t.dropdownContainer.appendChild(t.dropdownArrow),t.dropdownStyleElement=(0,n.az)("style"),t.dropdownCustomStyleElement=(0,n.az)("style"),t.dropdownStyleElement.textContent=O,t.dropdownSelect.updateComplete.then((()=>{!function(){if(t.dropdownSelect.shadowRoot)if(t!==e.elements){t.dropdownSelectStyleElement=(0,n.az)("style"),t.dropdownSelectStyleElement.textContent=O,t.dropdownSelect.shadowRoot.appendChild(t.dropdownSelectStyleElement),t.dropdownContainer.appendChild(t.dropdownStyleElement),a&&(t.dropdownContainer.style.width="24px"),t.dropdownArrow.style.height="20px",t.dropdownArrow.style.width="20px",t.mainContainer=t.parentElement.parentElement.parentElement;let e=t.dropdownSelect.shadowRoot.querySelector("mwc-menu");e&&(e.style.position="relative",e.style.right="138px")}else t.dropdownSelect.shadowRoot.appendChild(t.dropdownStyleElement),t.dropdownSelect.shadowRoot.appendChild(t.dropdownCustomStyleElement)}()})),t===e.elements?t.selectCard.appendChild(t.dropdownContainer):t.appendChild(t.dropdownContainer)}function E(e,t=e.elements,n=e.config.entity,a=e.config){const{dropdownArrow:o,dropdownSelect:i,selectCardContainer:r,selectBackground:s}=t,l=t===e.elements?r:t,c=t===e.elements?s:t;t!==e.elements&&(l.style.border="solid 2px rgba(0,0,0,0)");let d=!0;c.addEventListener("click",(e=>{if("mwc-list-item"===e.target.tagName.toLowerCase())return;const n=i.shadowRoot.querySelector("mwc-menu"),a=()=>{o.style.transform="rotate(180deg)",t.dropdownArrow.style.background="var(--accent-color)",l.style.border="var(--bubble-select-border, solid 2px var(--accent-color))",t.mainContainer&&(t.mainContainer.style.overflow="visible")};d?(d=!1,o.style.transition="none",n.setAttribute("open",""),requestAnimationFrame((()=>{n.removeAttribute("open"),setTimeout((()=>{o.style.transition="",a()}),140)}))):(n.hasAttribute("open")||(n.removeAttribute("mdc-menu-surface--is-open-below"),n.setAttribute("mdc-menu-surface--is-open-above",""),n.setAttribute("open","")),a())})),i.addEventListener("closed",(e=>{e.stopPropagation(),e.preventDefault(),o.style.transform="rotate(0deg)",l.style.border="solid 2px rgba(0,0,0,0)",t.dropdownArrow.style.background="",t.mainContainer&&(t.mainContainer.style.overflow="")})),t.dropdownSelect.addEventListener("click",(t=>{const o=t.target.value;!function(e,t,n,a){const o=t?.split(".")[0];switch(o){case"input_select":e._hass.callService("input_select","select_option",{entity_id:t,option:n});break;case"select":e._hass.callService("select","select_option",{entity_id:t,option:n});break;case"climate":switch(a.select_attribute){case"hvac_modes":e._hass.callService("climate","set_hvac_mode",{entity_id:t,hvac_mode:n});break;case"fan_modes":e._hass.callService("climate","set_fan_mode",{entity_id:t,fan_mode:n});break;case"swing_modes":e._hass.callService("climate","set_swing_mode",{entity_id:t,swing_mode:n});break;case"preset_modes":e._hass.callService("climate","set_preset_mode",{entity_id:t,preset_mode:n})}break;case"fan":"preset_modes"===a.select_attribute&&e._hass.callService("fan","set_preset_mode",{entity_id:t,preset_mode:n});break;case"light":"effect_list"===a.select_attribute&&e._hass.callService("light","turn_on",{entity_id:t,effect:n});break;case"media_player":switch(a.select_attribute){case"source_list":e._hass.callService("media_player","select_source",{entity_id:t,source:n});break;case"sound_mode_list":e._hass.callService("media_player","select_sound_mode",{entity_id:t,sound_mode:n})}break;default:console.warn(`Unsupported entity type: ${o}`)}}(e,n,o,a)}))}function B(e,t=e.elements,n=e.config.entity,a){if(t.currentState=e._hass.states[n]?.state,!t.currentState)return;if(t.currentList=n?.startsWith("input_select")||n?.startsWith("select")?e._hass.states[n].attributes.options:e._hass.states[n].attributes[a.select_attribute],t.previousList===t.currentList&&t.previousState===t.currentState)return;let o=t.currentList;for(t.currentState;t.dropdownSelect.firstChild;)t.dropdownSelect.removeChild(t.dropdownSelect.firstChild);o.forEach((o=>{const i=document.createElement("mwc-list-item");i.value=o;const r=T(e,e._hass.states[n],a.select_attribute,o);r&&(i.graphic="icon",i.appendChild(r));const s=function(e,t,n,a){switch(n){case"fan_modes":return e._hass.formatEntityAttributeValue(t,"fan_mode",a);case"hvac_modes":return e._hass.formatEntityState(t,a);case"swing_modes":return e._hass.formatEntityAttributeValue(t,"swing_mode",a);case"preset_modes":return e._hass.formatEntityAttributeValue(t,"preset_mode",a);default:return function(e){const t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}(a)}}(e,e._hass.states[n],a.select_attribute,o);i.appendChild(document.createTextNode(s)),o===function(e,t){switch(t){case"fan_modes":return e.attributes.fan_mode;case"swing_modes":return e.attributes.swing_mode;case"preset_modes":return e.attributes.preset_mode;case"effect_list":return e.attributes.effect;case"source_list":return e.attributes.source;case"sound_mode_list":return e.attributes.sound_mode;default:return e.state}}(e._hass.states[n],a.select_attribute)&&i.setAttribute("selected",""),t.dropdownSelect.appendChild(i),t.previousList=t.currentList,t.previousState=t.currentState})),t.dropdownContainer.appendChild(t.dropdownSelect)}function A(e){const t=e._hass.states[e.config.entity],a=(0,n.IL)(e,e.config.attribute,e.config.entity),o=t?.last_changed,i="state"===e.config.button_type,r=e.config.show_name??!0,s=e.config.show_icon??!0,l=e.config.show_state??i,c=e.config.show_attribute??i,d=e.config.show_last_changed??e.config.show_last_updated??!1,u=e.config.scrolling_effect??!0,p=e.previousConfig||{};if(e.previousState===t&&e.previousAttribute===a&&e.previousLastChanged===o&&p.showName===r&&p.showIcon===s&&p.showState===l&&p.showAttribute===c&&p.showLastChanged===d&&p.scrollingEffect===u)return;let b=t&&l?e._hass.formatEntityState(t):"",h="",m="",g="";var f;c&&a&&(h=t?e._hass.formatEntityAttributeValue(t,e.config.attribute)??a:""),d&&t&&(m=t?(f=(0,n.o0)(o,e._hass.locale.language)).charAt(0).toUpperCase()+f.slice(1):""),e.elements.stateStyles||(e.elements.stateStyles=(0,n.az)("style"),e.elements.stateStyles.innerText=I,e.content.appendChild(e.elements.stateStyles),"pop-up"===e.config.card_type&&e.elements.buttonContainer.appendChild(e.elements.stateStyles)),g=[b,h,m].filter((e=>e)).join(" • "),r?e.elements.name.classList.remove("hidden"):e.elements.name.classList.add("hidden"),s?(e.elements.iconContainer.classList.remove("hidden"),e.elements.nameContainer.classList.remove("name-without-icon")):(e.elements.iconContainer.classList.add("hidden"),e.elements.nameContainer.classList.add("name-without-icon")),(l||d||c)&&!r?e.elements.state.classList.add("state-without-name"):e.elements.state.classList.remove("state-without-name"),l||d||c?(e.elements.state.classList.add("display-state"),e.elements.state.classList.remove("hidden")):(e.elements.state.classList.remove("display-state"),e.elements.state.classList.add("hidden")),(0,n.GP)(e,e.elements.state,g),e.previousState=t,e.previousAttribute=a,e.previousConfig={showName:r,showIcon:s,showState:l,showAttribute:c,showLastChanged:d,scrollingEffect:u}}const I="\n .hidden {\n display: none !important;\n }\n\n .state-without-name {\n opacity: 1;\n font-size: 14px;\n }\n\n .name-without-icon {\n margin-left: 16px;\n }\n\n .display-state {\n display: flex;\n }\n";function V(e,t=e.content,a=t.firstChild.firstChild,i=!1){const r=e.config.sub_button;if(!r)return;e.previousValues=e.previousValues||{};let l=[...e.previousValues.subButtons||[]];e.elements=e.elements||{};const c=e.elements.subButtonContainer??(0,n.az)("div","bubble-sub-button-container");if(!e.elements.subButtonContainer&&e.config.sub_button){const t=(0,n.az)("style");t.innerText=P,c.appendChild(t),i?a.prepend(c):a.appendChild(c),e.elements.subButtonContainer=c}r.forEach(((t,a)=>{if(!t)return;const i=a+1,r=t.entity??e.config.entity,l=e._hass.states[r],d=t.name??(0,n.IL)(e,"friendly_name",r)??"",u=t.attribute??"",p=(0,n.IL)(e,u,r),b=(0,n.pr)(e,r),h=t.show_name??!1,m=t.show_state??!1,g=t.show_attribute??!1,f=(t.show_last_changed||t.show_last_updated)??!1,_=t.show_icon??!0,y=t.show_background??!0,v=t.state_background??!0,w=t.light_background??!0,x=t.show_arrow??!0,k=r?.startsWith("input_select")||r?.startsWith("select")||t.select_attribute,C=(0,n.q7)(e,t.entity,t.icon??"");let $=e.elements[i]||(0,n.az)("div","bubble-sub-button bubble-sub-button-"+i);if(!e.elements[i]||k&&!$.contains($.dropdownContainer)){let a=Array.prototype.indexOf.call(c.children,$);k&&!$.contains($.dropdownContainer)&&c.contains($)&&(c.removeChild($),$=(0,n.az)("div","bubble-sub-button bubble-sub-button-"+i)),$.nameContainer=(0,n.az)("div","bubble-sub-button-name-container"),$.feedbackContainer=(0,n.az)("div","bubble-feedback-container"),$.feedback=(0,n.az)("div","bubble-feedback-element feedback-element"),$.appendChild($.feedbackContainer),$.feedbackContainer.appendChild($.feedback),k&&(z(e,$,x),$.dropdownContainer.style.display="none",E(e,$,r,t)),$.appendChild($.nameContainer),a>=0&&ae.hasAttribute("selected")))?.value;if(_&&C){let a=$.icon;if(a||(a=(0,n.az)("ha-icon","bubble-sub-button-icon"),a.classList.add("show-icon"),$.appendChild(a),$.icon=a),S){const n=T(e,l,t.select_attribute,S);n&&!t.icon?(a.tagName!==n.tagName||a.icon!==n.icon||a.attribute!==n.attribute||a.attributeValue!==n.attributeValue)&&($.replaceChild(n,a),$.icon=n,a=n):a.icon!==C&&a.setAttribute("icon",C)}else a.icon!==C&&a.setAttribute("icon",C);$.icon.classList.remove("hidden"),$.icon.classList.add("bubble-sub-button-icon","show-icon")}else $.icon&&($.icon.classList.remove("show-icon"),$.icon.classList.add("hidden"));if(y)if(b&&v){const t=(0,n.Vv)("var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))))");w&&$.style.setProperty("--bubble-sub-button-light-background-color",(0,n.mk)(e,r,t?1:.8)),$.classList.add("background-on"),$.classList.remove("background-off")}else $.classList.add("background-off"),$.classList.remove("background-on");else $.classList.remove("background-on"),$.classList.remove("background-off");"none"===t.tap_action?.action&&"none"===t.double_tap_action?.action&&"none"===t.hold_action?.action||$.actionAdded||(o($,k?"":t,r,{tap_action:{action:k?"none":"more-info"},double_tap_action:{action:"none"},hold_action:{action:"none"}}),s($,$.feedback),k&&($.style.pointerEvents="auto",$.style.cursor="pointer"),$.actionAdded=!0);let L="";const O=l&&m?e._hass.formatEntityState(l):"",A=l&&""!==p&&g?e._hass.formatEntityAttributeValue(l,u)??p:"",I=l&&f?(0,n.o0)(l.last_changed,e._hass.locale.language):"";h&&""!==d&&(L+=d),""!==O&&(L+=(L?" · ":"")+O),""!==I&&(L+=(L?" · ":"")+I),""!==A&&(L+=(L?" · ":"")+A),L=L.charAt(0).toUpperCase()+L.slice(1),L||_||k?($.classList.remove("hidden"),$.nameContainer.innerText!==L&&($.nameContainer.innerText=L),_&&$.icon&&(L?($.icon.classList.add("icon-with-state"),$.icon.classList.remove("icon-without-state")):($.icon.classList.add("icon-without-state"),$.icon.classList.remove("icon-with-state"))),L||_||!k?k&&($.dropdownContainer.classList.remove("no-icon-select-container"),$.dropdownArrow.classList.remove("no-icon-select-arrow")):($.dropdownContainer.classList.add("no-icon-select-container"),$.dropdownArrow.classList.add("no-icon-select-arrow"))):($.classList.add("hidden"),$.dropdownContainer&&($.dropdownContainer.classList.remove("no-icon-select-container"),$.dropdownArrow.classList.remove("no-icon-select-arrow")))})),e.previousValues.subButtons=r.slice();for(let t=l.length;t>0;t--)if(t>r.length){let n=e.elements[t];n&&(c.removeChild(n),delete e.elements[t])}}const P="\n .bubble-sub-button-container {\n position: relative;\n display: flex;\n justify-content: end;\n right: 8px;\n align-content: center;\n gap: 8px;\n align-items: center;\n }\n .bubble-sub-button {\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row-reverse;\n align-items: center;\n justify-content: center;\n position: relative;\n right: 0;\n box-sizing: border-box;\n width: min-content;\n min-width: 36px;\n height: 36px;\n vertical-align: middle;\n font-size: 12px;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n padding: 0 8px;\n white-space: nowrap;\n transition: all 0.5s ease-in-out;\n color: var(--primary-text-color);\n }\n .bubble-feedback-container {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n pointer-events: none;\n }\n .bubble-sub-button-name-container {\n display: flex;\n }\n .show-icon {\n display: flex;\n --mdc-icon-size: 16px;\n }\n .background-on {\n background-color: var(--bubble-sub-button-light-background-color, var(--accent-color));\n }\n .background-off {\n background-color: var(--bubble-sub-button-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n }\n .hidden {\n display: none;\n }\n .icon-with-state {\n margin-right: 4px;\n --mdc-icon-size: 16px;\n }\n .icon-without-state {\n margin-right: 0;\n --mdc-icon-size: 20px;\n }\n .no-icon-select-arrow {\n width: 28px !important;\n height: 28px !important;\n right: 2px !important; \n }\n .no-icon-select-container {\n width: 16px !important;\n }\n .bubble-dropdown-arrow {\n background: var(--bubble-select-arrow-background-color) !important;\n }\n";function D(e){Array.isArray(e.subButtonIcon)||(e.subButtonIcon=[]),"pop-up"===e.config.card_type?e.popUp.querySelectorAll(".bubble-sub-button-icon").forEach(((t,n)=>{e.subButtonIcon[n]=t})):e.content.querySelectorAll(".bubble-sub-button-icon").forEach(((t,n)=>{e.subButtonIcon[n]=t}))}function H(e){let t=e.config.button_type;return"custom"===t&&(console.error('Buttons "custom" have been removed. Use either "switch", "slider", "state" or "name"'),t=""),e.config.entity?t||"switch":t||"name"}function M(e,t){const a=e._hass.states[e.config.entity];if((0,n.OC)(e,"light"))e._hass.callService("light","turn_on",{entity_id:e.config.entity,brightness:Math.round(255*t/100)});else if((0,n.OC)(e,"media_player"))e._hass.callService("media_player","volume_set",{entity_id:e.config.entity,volume_level:(t/100).toFixed(2)});else if((0,n.OC)(e,"cover"))e._hass.callService("cover","set_cover_position",{entity_id:e.config.entity,position:Math.round(t)});else if((0,n.OC)(e,"input_number")){const o=a.attributes.min??0,i=a.attributes.max??100,r=(0,n.IL)(e,"step")??1;let s=(i-o)*t/100+o,l=Math.round(s/r)*r;e._hass.callService("input_number","set_value",{entity_id:e.config.entity,value:l})}else if((0,n.OC)(e,"fan")){const n=a.attributes.percentage_step??1;let o=Math.round(t/n)*n;e._hass.callService("fan","set_percentage",{entity_id:e.config.entity,percentage:o})}else if((0,n.OC)(e,"climate")){const n=a.attributes.min_temp??0,o=a.attributes.max_temp??1e4,i="°C"===e._hass.config.unit_system.temperature,r=a.attributes.target_temp_step?a.attributes.target_temp_step:i?.5:1;let s=(o-n)*t/100+n,l=Math.round(s/r)*r;l=parseFloat(l.toFixed(1)),e._hass.callService("climate","set_temperature",{entity_id:e.config.entity,temperature:l})}else if((0,n.OC)(e,"number")){const n=a.attributes.min??0,o=a.attributes.max??100,i=a.attributes.step??1;let r=(o-n)*t/100+n,s=Math.round(r/i)*i;e._hass.callService("number","set_value",{entity_id:e.config.entity,value:s})}}function U(e,t){const n=e.elements.rangeSlider.getBoundingClientRect(),a=100*(t-n.left)/n.width,o=Math.min(100,Math.max(0,a));return e.elements.rangeFill.style.transform=`translateX(${o}%)`,o}const N="\n * {\n -webkit-tap-highlight-color: transparent !important;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n }\n *::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-button-card-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-button-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: scroll;\n touch-action: pan-y;\n }\n\n .bubble-button-card,\n .bubble-range-slider,\n .bubble-button-background {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n }\n .bubble-button-background {\n background-color: var(--bubble-button-background-color);\n opacity: .5;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n }\n .bubble-range-fill {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n left: -100%;\n transition: all .3s;\n z-index: 0;\n }\n .is-dragging .bubble-range-fill {\n transition: none;\n }\n .is-light .bubble-range-fill {\n opacity: 0.5;\n }\n .is-unavailable .bubble-button-card,\n .is-unavailable .bubble-range-slider {\n cursor: not-allowed;\n }\n .bubble-range-slider {\n cursor: ew-resize;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n mask-image: radial-gradient(white, black);\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n }\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n margin: 6px;\n border-radius: var(--bubble-button-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n }\n\n .bubble-icon {\n display: flex;\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 18px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin: 0 16px 0 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n font-weight: 600;\n }\n\n .bubble-state {\n font-size: 12px;\n font-weight: normal;\n opacity: 0.7;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-button-card-container {\n height: 56px;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";function j(e,t=e.content,a=t){const i=H(e);e.cardType!==`button-${i}`&&e.buttonType!==i&&(function(e,t=e.content,a=t){const o=H(e);e.dragging=!1,e.elements||(e.elements={}),e.elements.buttonCardContainer=(0,n.az)("div","bubble-button-card-container button-container"),e.elements.buttonCard=(0,n.az)("div","bubble-button-card switch-button"),e.elements.buttonBackground=(0,n.az)("div","bubble-button-background"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container icon-container"),e.elements.name=(0,n.az)("div","bubble-name name"),e.elements.state=(0,n.az)("div","bubble-state state"),e.elements.feedback=(0,n.az)("div","bubble-feedback-element feedback-element"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.feedback.style.display="none",e.elements.style.innerText=N,e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),"name"!==o&&e.elements.nameContainer.appendChild(e.elements.state),e.elements.buttonCard.appendChild(e.elements.buttonBackground),e.elements.buttonCard.appendChild(e.elements.iconContainer),e.elements.buttonCard.appendChild(e.elements.nameContainer),e.elements.buttonCard.appendChild(e.elements.feedback),e.elements.buttonCardContainer.appendChild(e.elements.buttonCard),t.innerHTML="",a===t&&t.appendChild(e.elements.buttonCardContainer),t.appendChild(e.elements.style),t.appendChild(e.elements.customStyle),a!==t?(a.innerHTML="",e.elements.buttonCardContainer.appendChild(t),a.appendChild(e.elements.buttonCardContainer),e.buttonType=o):e.cardType=`button-${o}`}(e,t,a),"switch"===i?function(e){o(e.elements.iconContainer,e.config),o(e.elements.buttonBackground,e.config.button_action,e.config.entity,{tap_action:{action:"toggle"},double_tap_action:{action:"toggle"},hold_action:{action:"more-info"}}),s(e.elements.buttonBackground,e.elements.feedback)}(e):"slider"===i?function(e){o(e.elements.iconContainer,e.config);let t=0,a=null;e.elements.rangeFill=(0,n.az)("div","bubble-range-fill range-fill"),e.elements.rangeSlider=(0,n.az)("div","bubble-range-slider range-slider"),e.elements.rangeSlider.appendChild(e.elements.rangeFill),e.elements.buttonCardContainer.appendChild(e.elements.rangeSlider),e.elements.buttonCardContainer.insertBefore(e.elements.rangeSlider,e.elements.buttonCard),e.elements.buttonCard.style.cursor="ew-resize",e.elements.buttonCardContainer.addEventListener("pointercancel",(function(){clearTimeout(a),e.dragging=!1,e.elements.buttonCardContainer.classList.remove("is-dragging"),e.elements.buttonCardContainer.removeEventListener("pointermove",r),window.removeEventListener("pointerup",s)})),e.elements.buttonCardContainer.addEventListener("pointerdown",(n=>{n.target.closest(".bubble-action")||(e.elements.buttonCardContainer.setPointerCapture(n.pointerId),e.card.classList.contains("is-unavailable")||(e.dragging=!0,t=n.pageX||(n.touches?n.touches[0].pageX:0),e.elements.buttonCardContainer.classList.add("is-dragging"),e.elements.buttonCardContainer.addEventListener("pointermove",r),window.addEventListener("pointerup",s)))}));const i=(0,n.P2)(M,200);function r(t){if(t.stopPropagation(),t.target.closest(".bubble-action"))return;const n=t.pageX||(t.touches?t.touches[0].pageX:0),a=U(e,n);e.config.slider_live_update&&i(e,a)}function s(t){t.stopPropagation(),clearTimeout(a),a=setTimeout((()=>{e.dragging=!1}),1400);const o=t.pageX||(t.touches?t.touches[0].pageX:0),i=U(e,o);e.config.slider_live_update||M(e,i),(0,n.jk)("selection"),e.elements.buttonCardContainer.classList.remove("is-dragging"),e.elements.buttonCardContainer.removeEventListener("pointermove",r),window.removeEventListener("pointerup",s)}}(e):"state"===i?function(e){o(e.elements.buttonCardContainer,e.config),o(e.elements.buttonBackground,e.config.button_action,e.config.entity,{tap_action:{action:"more-info"},double_tap_action:{action:"more-info"},hold_action:{action:"more-info"}}),s(e.elements.buttonBackground,e.elements.feedback)}(e):"name"===i&&function(e){const t={tap_action:{action:"none"},double_tap_action:{action:"none"},hold_action:{action:"none"}};o(e.elements.iconContainer,e.config,e.config.entity,t),o(e.elements.buttonBackground,e.config.button_action,e.config.entity,t),s(e.elements.buttonBackground,e.elements.feedback)}(e)),"name"!==i&&(function(e){const t=(0,n.y0)(e),a=e.config.card_type;"unavailable"===t?"button"===a?e.card.classList.add("is-unavailable"):"pop-up"===a&&e.elements.headerContainer.classList.add("is-unavailable"):"button"===a?e.card.classList.remove("is-unavailable"):"pop-up"===a&&e.elements.headerContainer.classList.remove("is-unavailable"),(0,n.OC)(e,"light")?"button"===a?e.card.classList.add("is-light"):"pop-up"===a&&e.elements.headerContainer.classList.add("is-light"):"button"===a?e.card.classList.remove("is-light"):"pop-up"===a&&e.elements.headerContainer.classList.remove("is-light"),(0,n.pr)(e)?"button"===a?e.card.classList.add("is-on"):"pop-up"===a&&e.elements.headerContainer.classList.add("is-on"):"button"===a?e.card.classList.remove("is-on"):"pop-up"===a&&e.elements.headerContainer.classList.remove("is-on")}(e),function(e){const t=e.config.card_type,a=H(e),o=(0,n.OC)(e,"light"),i=(0,n.pr)(e),r=(0,n.mk)(e),s="button"===t?e.card.style.getPropertyValue("--bubble-button-background-color"):e.popUp.style.getPropertyValue("--bubble-button-background-color"),l=e.elements.buttonBackground.style.opacity;let c="",d="";"switch"===a&&i?r&&o?(c=(0,n.mk)(e),d=".5"):(c="var(--bubble-button-accent-color, var(--bubble-accent-color, var(--accent-color)))",d="1"):(c="rgba(0, 0, 0, 0)",d=".5"),s!==c&&("button"===t?e.card.style.setProperty("--bubble-button-background-color",c):"pop-up"===t&&e.popUp.style.setProperty("--bubble-button-background-color",c)),l!==d&&(e.elements.buttonBackground.style.opacity=d)}(e),function(e){if("slider"===H(e)){if(e.elements.rangeFill.style.backgroundColor=(0,n.mk)(e),e.dragging)return;let t=0;if((0,n.OC)(e,"light"))t=100*(0,n.IL)(e,"brightness")/255;else if((0,n.OC)(e,"media_player"))t=(0,n.pr)(e)?100*(0,n.IL)(e,"volume_level"):0;else if((0,n.OC)(e,"cover"))t=(0,n.IL)(e,"current_position");else if((0,n.OC)(e,"input_number")){const a=(0,n.IL)(e,"min"),o=(0,n.IL)(e,"max");t=100*((0,n.y0)(e)-a)/(o-a)}else if((0,n.OC)(e,"fan"))t=(0,n.pr)(e)?(0,n.IL)(e,"percentage"):0;else if((0,n.OC)(e,"climate")){const a=(0,n.IL)(e,"min_temp"),o=(0,n.IL)(e,"max_temp");t=100*((0,n.IL)(e,"temperature")-a)/(o-a)}else if((0,n.OC)(e,"number")){const a=(0,n.IL)(e,"min"),o=(0,n.IL)(e,"max");t=100*((0,n.y0)(e)-a)/(o-a)}e.elements.rangeFill.style.transform=`translateX(${t}%)`}}(e)),function(e){const t=H(e),a="name"!==t&&(0,n.pr)(e),o="name"!==t?(0,n.q7)(e):e.config.icon,i="name"!==t?(0,n.gJ)(e):"",r="name"!==t&&(0,n.OC)(e,"light"),s=e.elements.iconContainer.style.color,l=e.elements.image.style.backgroundImage,c=e.elements.icon.icon,d=e.elements.icon.style.display,u=e.elements.image.style.display;if(r&&a){const t=`var(--bubble-icon-background-color, ${(0,n.mk)(e)})`;s!==t&&(e.elements.iconContainer.style.color=t)}else""!==s&&(e.elements.iconContainer.style.color="");if(""!==i){const t="url("+i+")";l!==t&&(e.elements.image.style.backgroundImage=t),"none"!==d&&(e.elements.icon.style.display="none"),""!==u&&(e.elements.image.style.display="")}else if(""!==o){c!==o&&(e.elements.icon.icon=o);const i=a&&"state"!==t?(0,n.mk)(e):"inherit";e.elements.icon.style.color!==i&&(e.elements.icon.style.color=i),""!==d&&(e.elements.icon.style.display=""),"none"!==u&&(e.elements.image.style.display="none")}else"none"!==d&&(e.elements.icon.style.display="none"),"none"!==u&&(e.elements.image.style.display="none")}(e),function(e){const t="name"!==H(e)?(0,n.oY)(e):e.config.name;t!==e.elements.previousName&&((0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e),A(e),V(e,t,e.elements.buttonCard),"pop-up"!==e.cardType&&function(e){if(D(e),(0,n.jx)(e),!e.config.styles)return;const t=(0,n.y0)(e);let a="";try{a=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating button custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=a)}(e)}async function F(e){if("pop-up"!==e.cardType){if(e.getRootNode()instanceof ShadowRoot==0)return;!function(e){try{e.cardType="pop-up",e.verticalStack=e.getRootNode(),e.sectionRow=e.verticalStack.host.parentElement,e.sectionRowContainer=e.sectionRow?.parentElement,e.popUp=e.verticalStack.querySelector("#root"),e.popUp.classList.add("bubble-pop-up","pop-up","is-popup-closed"),e.editor||e.config.background_update||e.verticalStack.removeChild(e.popUp),e.elements={},L(e),e.cardTitle&&(e.cardTitle.style.display="none"),k=k||(e.config.hide_backdrop??!0),e.popUp.style.setProperty("--custom-height-offset-desktop",e.config.margin_top_desktop??"0px"),e.popUp.style.setProperty("--custom-height-offset-mobile",e.config.margin_top_mobile??"0px"),e.popUp.style.setProperty("--custom-margin",`-${e.config.margin??"7px"}`),e.popUp.style.setProperty("--custom-popup-filter",e.config.backdrop_blur&&"0"!==e.config.backdrop_blur?"none":`blur(${e.config.bg_blur??10}px)`),e.popUp.style.setProperty("--custom-shadow-opacity",(e.config.shadow_opacity??0)/100);const t=function(e){return()=>{e.config.hash===location.hash?(l=!0,setTimeout((()=>{l=!1}),100),function(e){e.popUp.classList.contains("is-popup-opened")||(f(e),b(e,!0),requestAnimationFrame((()=>{p(e,!0),h(e.popUp,!0),function(e){const{sectionRow:t,sectionRowContainer:n,popUp:a}=e;a.style.transform="","hui-card"===t?.tagName.toLowerCase()&&(t.hidden=!1,t.style.display="",n?.classList.contains("card")&&(n.style.display=""))}(e)})),m(e,!0),e.config.auto_close>0&&(e.closeTimeout=setTimeout(c,e.config.auto_close)),g("hidden"),e.config.open_action&&a(e.popUp,e.config,"open_action"))}(e)):function(e){e.popUp.classList.contains("is-popup-opened")&&(f(e),h(e.popUp,!1),p(e,!1),e.removeDomTimeout=setTimeout((()=>{b(e,!1),u(e,0)}),300),m(e,!1),g(""),e.config.close_action&&a(e,e.config,"close_action"))}(e)}}(e);window.addEventListener("location-changed",t),window.addEventListener("popstate",t)}catch(e){console.error(e)}}(e),function(e){e.elements={closeIcon:(0,n.az)("ha-icon","bubble-close-icon"),closeButton:(0,n.az)("button","bubble-close-button close-pop-up"),buttonContainer:(0,n.az)("div","bubble-button-container"),header:(0,n.az)("div","bubble-header")},e.elements.closeIcon.icon="mdi:close",e.elements.closeButton.appendChild(e.elements.closeIcon),e.elements.closeButton.addEventListener("click",(()=>{c(),(0,n.jk)("selection")}));const t=e.popUp.querySelector(".bubble-header-container");t?Object.assign(e.elements,{headerContainer:t,closeIcon:t.querySelector(".bubble-close-icon"),closeButton:t.querySelector(".bubble-close-button"),buttonContainer:t.querySelector(".bubble-button-container"),header:t.querySelector(".bubble-header")}):(e.elements.headerContainer=(0,n.az)("div","bubble-header-container"),e.elements.headerContainer.setAttribute("id","header-container"),e.elements.headerContainer.appendChild(e.elements.header),e.elements.headerContainer.appendChild(e.elements.closeButton),e.elements.header.appendChild(e.elements.buttonContainer)),e.popUp.addEventListener("touchstart",(e=>{v=e.touches[0].clientY}),{passive:!0}),e.elements.header.addEventListener("touchmove",(t=>{const n=t.touches[0].clientY-v;n>0&&(e.popUp.style.transform=`translateY(${n}px)`)}),{passive:!0}),e.elements.header.addEventListener("touchend",(t=>{t.changedTouches[0].clientY-v>50?c():e.popUp.style.transform=""}),{passive:!0})}(e),function(e){try{e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .bubble-pop-up-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n margin-top: -50px;\n max-width: 100%;\n padding-top: 40px;\n padding-bottom: 80px;\n grid-gap: 14px;\n gap: 14px;\n column-gap: 14px;\n --grid-gap: 14px;\n --vertical-stack-card-gap: 14px;\n --horizontal-stack-card-gap: 14px;\n --stack-card-gap: 14px;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n overflow-y: auto; \n overflow-x: hidden; \n grid-auto-rows: min-content;\n mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 40px), transparent 100%);\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 40px), transparent 100%);\n padding: 18px 18px calc(140px + var(--custom-height-offset-mobile)) 18px;\n }\n .bubble-pop-up-container > * {\n flex-shrink: 0 !important;\n }\n .bubble-pop-up.card-content {\n width: 100% !important;\n padding: 0 !important;\n }\n .bubble-pop-up {\n transition: transform 0.3s ease;\n position: fixed;\n width: 100%;\n max-width: 100%;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) 0 0;\n box-sizing: border-box;\n margin-left: var(--custom-margin);\n left: 7px;\n z-index: 5 !important;\n bottom: calc(-56px - var(--custom-height-offset-mobile));\n }\n .bubble-pop-up-background {\n width: 100%;\n height: 100%;\n display: flex;\n top: 0;\n left: 0;\n position: absolute;\n background-color: var(--bubble-pop-up-main-background-color, var(--bubble-pop-up-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color)))));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) 0 0;\n backdrop-filter: var(--custom-popup-filter);\n -webkit-backdrop-filter: var(--custom-popup-filter);\n }\n .bubble-pop-up-container::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n .is-popup-opened {\n box-shadow: 0px 0px 50px rgba(0, 0, 0, var(--custom-shadow-opacity));\n }\n .is-popup-closed { \n transform: translateY(100%);\n box-shadow: none !important;\n }\n\n @media only screen and (min-width: 600px) {\n .bubble-pop-up {\n margin-left: 0 !important;\n bottom: calc(-56px - var(--custom-height-offset-desktop));\n min-width: var(--desktop-width, 540px);\n max-width: var(--desktop-width, 540px);\n left: calc(50% - (var(--desktop-width, 540px) / 2));\n }\n .bubble-pop-up-container {\n padding: 18px 18px calc(140px + var(--custom-height-offset-desktop)) 18px;\n }\n }\n @media only screen and (min-width: 768px) {\n .bubble-pop-up {\n left: calc(var(--mdc-drawer-width, 0px) / 2 + 50% - (var(--desktop-width, 540px) / 2));\n }\n }\n .bubble-pop-up.editor {\n transition: none !important;\n position: relative !important;\n top: 0;\n left: 0;\n width: 100% !important;\n backdrop-filter: none !important;\n display: flex !important;\n transform: none !important;\n height: auto !important;\n min-width: auto;\n z-index: 0 !important;\n }\n .bubble-header-container {\n display: inline-flex;\n height: 50px;\n margin: 0;\n padding: 0;\n z-index: 3;\n padding: 18px 18px 22px;\n position: sticky;\n top: 0;\n background: none !important;\n overflow: visible;\n }\n .bubble-header {\n display: inline-flex;\n flex-grow: 1;\n margin-right: 14px;\n color: var(--primary-text-color);\n }\n .bubble-name {\n font-size: 14px;\n font-weight: heavy;\n }\n .bubble-close-button {\n height: 50px;\n width: 50px;\n border: none;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px));\n z-index: 1;\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n color: var(--primary-text-color);\n flex-shrink: 0;\n cursor: pointer;\n }\n .bubble-button-card-container {\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n }\n .bubble-pop-up-container.editor-cropped {\n height: 122px !important;\n mask-image: linear-gradient(to bottom, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%) !important;\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%) !important; \n }\n .bubble-pop-up.editor > .bubble-pop-up-container {\n padding-bottom: 18px !important;\n mask-image: none;\n -webkit-mask-image: none; \n overflow: hidden; \n }\n .editor .bubble-pop-up-background {\n width: 100%;\n height: 100%;\n left: 0px;\n top: 0px;\n z-index: -1;\n display: flex;\n position: absolute;\n background-color: var(--bubble-pop-up-main-background-color, var(--bubble-pop-up-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color)))));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) !important;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n }\n\n .no-header .bubble-header-container {\n visibility: hidden !important;\n height: 0px !important;\n }\n .no-header .bubble-pop-up-container {\n padding-top: 4px !important;\n mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%) !important;\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%) !important;\n }\n\n .large .bubble-button-card-container {\n height: 56px;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 36px));\n }\n .large .bubble-pop-up-container {\n margin-top: -36px;\n }\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n .large .bubble-close-button {\n height: 56px;\n width: 56px;\n border: none;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px));\n z-index: 1;\n --mdc-icon-size: 28px !important;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";let a,o=e.popUp.querySelector("style");e.stylesAdded&&o?e.elements.customStyle=o:(e.elements.customStyle=(0,n.az)("style"),e.popUp.appendChild(e.elements.customStyle),e.popUp.appendChild(e.elements.style),e.stylesAdded=!0);const i=e.config.bg_opacity??88;function r(){a=getComputedStyle(document.body).getPropertyValue("--ha-card-background")||getComputedStyle(document.body).getPropertyValue("--card-background-color");const n=e.config.bg_color?e.config.bg_color:a,o=(0,t._k)(n,i/100,1.02);e.popUp.style.setProperty("--bubble-pop-up-background-color",o)}C.addEventListener("change",(()=>{r()}),{passive:!0}),r(),e.popUp.style.setProperty("--desktop-width",e.config.width_desktop??"540px"),e.config.close_on_click&&e.popUp.addEventListener("click",c,{passive:!0}),window.addEventListener("keydown",(t=>{"Escape"===t.key&&e.config.hash===location.hash&&c()}),{passive:!0});let s=e.config.slide_to_close_distance??400;e.popUp.addEventListener("touchmove",(e=>{e.touches[0].clientY-v>s&&e.touches[0].clientY>w&&c(),w=e.touches[0].clientY}),{passive:!0});const l=e.popUp.querySelector(".bubble-pop-up-container");if(null===l){e.elements.popUpContainer=(0,n.az)("div"),e.elements.popUpContainer.classList.add("bubble-pop-up-container");let d=e.popUp.firstChild;for(;d;)e.elements.popUpContainer.appendChild(d),d=e.popUp.firstChild}else e.elements.popUpContainer=l;e.popUpBackground=(0,n.az)("div","bubble-pop-up-background"),e.popUp.appendChild(e.popUpBackground),e.popUp.appendChild(e.elements.headerContainer),e.popUp.appendChild(e.elements.popUpContainer),e.config.hash!==location.hash&&u(e,0),window.dispatchEvent(new Event("location-changed"))}catch(p){console.error(p)}}(e)}else e.popUp&&e.elements&&(e.config.hash!==location.hash&&e.config===e.previousConfig||((e.config.entity||e.config.name)&&j(e,e.elements.buttonContainer,e.elements.header),requestAnimationFrame((()=>{!function(e){D(e);const t=e.config.card_layout,a="large"===t||"large-2-rows"===t,o="large-2-rows"===t;a!==e.popUp.classList.contains("large")&&e.popUp.classList.toggle("large",a),o!==e.popUp.classList.contains("rows-2")&&e.popUp.classList.toggle("rows-2",o);const i=e.config.show_header??!0;if(e.popUp.classList.contains("no-header")===i&&e.popUp.classList.toggle("no-header",!i),!e.config.styles)return;const r=(0,n.y0)(e),{backdropCustomStyle:s}=L(e);let l="";try{l=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,r,e.elements.icon,e.subButtonIcon,n.X,e.popUp):""}catch(e){throw new Error(`Error in generating pop-up custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=l),s.innerText=l}(e)})),e.previousConfig=e.config),e.editor||function(e){let t=e.config.trigger_entity??"";if(""===t)return;let n=e.config.trigger_state??"",a=e.config.trigger_close??!1,o=e._hass.states[t]?.state;if(!t)return;if(!n)return;if(e.oldTriggerEntityState===o)return;const i=!e.hasPageLoaded;e.hasPageLoaded=!0,e.config.hash===location.hash?a&&n!==o&&(i||c()):o===n&&d(e.config.hash),e.oldTriggerEntityState=o}(e),function(e){if(!e.verticalStack)return;const{host:t}=e.verticalStack,{popUp:n,sectionRow:a,sectionRowContainer:o,elements:i}=e,r=e._cachedDetectedEditor??=t?.closest("hui-card-preview")||t?.closest("hui-card[preview][class]")||t?.getRootNode().host?.closest("hui-section[preview][class]"),s=n?.classList.contains("is-popup-opened"),l="hui-card"===a?.tagName.toLowerCase();if(e.previousEditorState??=null,e.previousDetectedEditor??=null,!s&&l){const{editor:t,editorAccess:n}=e;t||!n||r||a?.hasAttribute("hidden")?o?.classList.contains("card")&&t&&"none"===o.style.display&&(o.style.display=""):(a.setAttribute("hidden",""),a.style.display="none")}const c=n?.classList;if(e.editor||r){c?.contains("editor")||(document.body.style.overflow="",c?.remove("is-popup-opened"),c?.add("is-popup-closed","editor")),e.editorAccess=!0;const t=null===r;i?.popUpContainer?.classList.contains("editor-cropped")!==t&&i.popUpContainer.classList.toggle("editor-cropped",t)}else c?.contains("editor")&&c.remove("editor"),i?.popUpContainer?.classList.remove("editor-cropped");e.editor===e.previousEditorState&&r===e.previousDetectedEditor||(function(e){const{hideBackdrop:t}=L(e),n=e.verticalStack.host,a=n?.closest("hui-card-preview");(e.editor||a)&&(t(),clearTimeout(e.removeDomTimeout),a||e.verticalStack.contains(e.popUp)||e.verticalStack.appendChild(e.popUp))}(e),e.previousEditorState=e.editor,e.previousDetectedEditor=r)}(e))}let q=!1;function W(e,t){const a=e.config[`${t}_name`]??"",o=e.config[`${t}_icon`]??"",i=e.config[`${t}_pir_sensor`],r=e.config[`${t}_link`],s=e.config[`${t}_entity`];q=q||location.hash===r;const l=(0,n.az)("ha-icon","bubble-icon icon");l.icon=o;const u=(0,n.az)("div","bubble-name name");u.innerText=a;const p=(0,n.az)("div","bubble-background-color background-color"),b=(0,n.az)("div","bubble-background background"),h=(0,n.az)("div",`bubble-button bubble-button-${t} button ${r.substring(1)}`);let m=localStorage.getItem(`bubbleButtonWidth-${r}`);return h.style.width=`${m}px`,h.appendChild(l),h.appendChild(u),h.appendChild(p),h.appendChild(b),h.addEventListener("click",(()=>{location.hash!==r&&(q=!1),q?c():d(r),q=!q,(0,n.jk)("light")})),h.icon=l,h.name=u,h.backgroundColor=p,h.background=b,h.pirSensor=i,h.lightEntity=s,h.link=r,h.index=t,window.addEventListener("location-changed",(function(){e.config.highlight_current_view&&(location.pathname===r||location.hash===r?h.classList.add("highlight"):h.classList.remove("highlight"))})),e.elements.buttons.push(h),h}const X=1,R=2,Y=8;function J(e,t){return function(e,t){return!(!e||void 0===e.supported_features)&&0!=(e.supported_features&t)}(e.attributes,t)}function G(e,t){(0,n.OC)(e,"media_player")&&e._hass.callService("media_player","volume_set",{entity_id:e.config.entity,volume_level:(t/100).toFixed(2)})}function K(e,t,n=!1){const a=e.elements.rangeSlider.getBoundingClientRect(),o=100*(t-a.left)/a.width,i=Math.round(Math.min(100,Math.max(0,o)));if(e.elements.rangeFill.style.transform=`translateX(${i}%)`,n){if(e.dragging)return;G(e,i)}else G(e,i)}(0,n.P2)(G);const Z="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n overflow: visible !important;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-media-player-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-media-player-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n touch-action: pan-y;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .bubble-media-player {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n background-color: rgba(0,0,0,0);\n }\n\n .bubble-button-container {\n display: inline-grid;\n grid-auto-flow: column;\n gap: 10px;\n align-self: center;\n margin-right: 8px;\n }\n\n .bubble-play-pause-button,\n .bubble-previous-button,\n .bubble-next-button,\n .bubble-volume-button,\n .bubble-power-button {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: var(--bubble-media-player-buttons-border-radius, var(--bubble-border-radius, 32px));\n padding: 6px;\n height: 24px;\n width: 24px;\n transition: background 0.3s ease;\n align-self: center;\n }\n\n .bubble-play-pause-button {\n background-color: var(--bubble-accent-color, var(--accent-color));\n }\n\n .bubble-volume-slider {\n position: absolute;\n width: calc(100% - 150px);\n height: 38px;\n left: 50px;\n overflow: hidden;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n z-index: 1;\n background-color: var(--bubble-media-player-slider-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n opacity: 1;\n transition: opacity .2s, transform .2s;\n transform: translateX(0);\n }\n\n .bubble-range-value {\n display: flex;\n justify-content: flex-end;\n height: 38px;\n align-items: center;\n padding-right: 14px;\n font-size: 12px;\n opacity: 0.8;\n }\n\n .bubble-mute-button {\n opacity: 1;\n transition: opacity .2s, transform .2s;\n transform: translateX(0);\n }\n\n .is-hidden {\n opacity: 0 !important;\n pointer-events: none;\n transform: translateX(14px);\n }\n\n .bubble-range-fill {\n z-index: -1;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n left: -100%;\n transition: all .3s;\n background-color: var(--accent-color);\n }\n\n .is-dragging .bubble-range-fill {\n transition: none;\n }\n\n .is-light .bubble-range-fill {\n opacity: 0.5;\n }\n\n .is-unavailable .bubble-button-card {\n cursor: not-allowed;\n }\n\n .bubble-range-slider {\n cursor: ew-resize;\n }\n .is-unavailable .bubble-range-slider {\n cursor: not-allowed;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n width: 38px;\n height: 38px;\n min-width: 38px;\n min-height: 38px;\n align-items: center;\n justify-content: center;\n margin: 6px;\n border-radius: var(--bubble-media-player-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-media-player-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n pointer-events: auto;\n }\n\n .bubble-icon {\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-icon,\n .bubble-mute-button {\n display: flex;\n position: absolute;\n height: 38px;\n width: 38px;\n justify-content: center;\n align-items: center;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-media-info-container {\n display: flex;\n line-height: 14px;\n font-size: 12px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-title,\n .bubble-name,\n .bubble-state,\n .bubble-artist {\n display: flex;\n margin: 2px 0;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-title {\n font-weight: 600;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n }\n\n .bubble-sub-button-container {\n right: 0 !important;\n }\n\n .bubble-background-container {\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n }\n\n .bubble-cover-background {\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n background-size: cover;\n background-position: 50%;\n filter: blur(50px);\n opacity: 0.5;\n }\n\n @media screen and (max-width: 250px) {\n .bubble-previous-button {\n display: none;\n }\n }\n\n @media screen and (max-width: 206px) {\n .bubble-next-button {\n display: none;\n }\n }\n\n @media screen and (max-width: 160px) {\n .bubble-volume-button {\n display: none;\n }\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-media-player-container {\n height: 56px;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n \n .large .bubble-play-pause-button {\n display: flex;\n height: 42px;\n width: 42px;\n padding: 0;\n align-items: center;\n justify-content: center;\n }\n\n .large .bubble-volume-slider {\n height: 42px;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n left: 60px;\n width: calc(100% - 168px);\n }\n\n .large .bubble-range-value {\n place-items: center;\n height: 42px;\n }\n\n .large .bubble-button-container {\n align-items: center;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, 1fr);\n grid-template-rows: repeat(2, minmax(auto, max-content));\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";let Q;function ee(e){"media-player"!==e.cardType&&function(e){e.dragging=!1,e.elements={},e.elements.mediaPlayerContainer=(0,n.az)("div","bubble-media-player-container"),e.elements.mediaPlayerCard=(0,n.az)("div","bubble-media-player"),e.elements.mediaInfoContainer=(0,n.az)("div","bubble-media-info-container"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.buttonContainer=(0,n.az)("div","bubble-button-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.backgroundContainer=(0,n.az)("div","bubble-background-container"),e.elements.coverBackground=(0,n.az)("div","bubble-cover-background"),e.elements.playPauseButton=(0,n.az)("ha-icon","bubble-play-pause-button"),e.elements.previousButton=(0,n.az)("ha-icon","bubble-previous-button"),e.elements.previousButton.setAttribute("icon","mdi:skip-previous"),e.elements.nextButton=(0,n.az)("ha-icon","bubble-next-button"),e.elements.nextButton.setAttribute("icon","mdi:skip-next"),e.elements.volumeButton=(0,n.az)("ha-icon","bubble-volume-button"),e.elements.volumeButton.setAttribute("icon","mdi:volume-high"),e.elements.powerButton=(0,n.az)("ha-icon","bubble-power-button"),e.elements.powerButton.setAttribute("icon","mdi:power-standby"),e.elements.muteButton=(0,n.az)("ha-icon","bubble-mute-button is-hidden"),e.elements.muteButton.setAttribute("icon","mdi:volume-off"),e.elements.title=(0,n.az)("div","bubble-title"),e.elements.artist=(0,n.az)("div","bubble-artist"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.style.innerText=Z,e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.iconContainer.appendChild(e.elements.muteButton),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.mediaInfoContainer.appendChild(e.elements.title),e.elements.mediaInfoContainer.appendChild(e.elements.artist),e.elements.buttonContainer.appendChild(e.elements.powerButton),e.elements.buttonContainer.appendChild(e.elements.previousButton),e.elements.buttonContainer.appendChild(e.elements.nextButton),e.elements.buttonContainer.appendChild(e.elements.volumeButton),e.elements.buttonContainer.appendChild(e.elements.playPauseButton),e.elements.mediaPlayerCard.appendChild(e.elements.iconContainer),e.elements.mediaPlayerCard.appendChild(e.elements.mediaInfoContainer),e.elements.mediaPlayerCard.appendChild(e.elements.nameContainer),e.elements.mediaPlayerCard.appendChild(e.elements.buttonContainer),e.elements.backgroundContainer.appendChild(e.elements.coverBackground),e.elements.mediaPlayerContainer.appendChild(e.elements.backgroundContainer),e.content.innerHTML="",e.content.appendChild(e.elements.mediaPlayerContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.elements.mediaPlayerContainer.appendChild(e.elements.mediaPlayerCard),o(e.elements.icon,e.config,e.config.entity),o(e.elements.image,e.config,e.config.entity),e.elements.volumeSliderContainer=(0,n.az)("div","bubble-volume-slider is-hidden"),function(e,t){let a=0;function o(t){t.stopPropagation();const n=t.pageX||(t.touches?t.touches[0].pageX:0);Math.abs(a-n)>10&&K(e,n,!0);const o=e.elements.rangeSlider.getBoundingClientRect(),i=100*(n-o.left)/o.width,r=Math.min(100,Math.max(0,i));e.elements.rangeValue.innerText=Math.round(r)+"%"}function i(n){n.stopPropagation(),e.dragging=!1;const a=n.pageX||(n.touches?n.touches[0].pageX:0);K(e,a),t.classList.remove("is-dragging"),t.removeEventListener("pointermove",o),t.removeEventListener("pointerup",i);const r=e.elements.rangeSlider.getBoundingClientRect(),s=100*(a-r.left)/r.width,l=Math.min(100,Math.max(0,s));e.elements.rangeValue.innerText=Math.round(l)+"%"}Q=Math.round(100*(0,n.IL)(e,"volume_level"))+"%",e.elements.rangeFill=(0,n.az)("div","bubble-range-fill range-fill"),e.elements.rangeSlider=(0,n.az)("div","bubble-range-slider range-slider"),e.elements.rangeValue=(0,n.az)("div","bubble-range-value"),e.elements.rangeSlider.appendChild(e.elements.rangeValue),e.elements.rangeSlider.appendChild(e.elements.rangeFill),t.appendChild(e.elements.rangeSlider),t.addEventListener("pointercancel",(function(){e.dragging=!1,t.classList.remove("is-dragging"),t.removeEventListener("pointermove",o),t.removeEventListener("pointerup",i)})),t.addEventListener("pointerdown",(n=>{t.setPointerCapture(n.pointerId),e.card.classList.contains("is-unavailable")||(e.dragging=!0,a=n.pageX||(n.touches?n.touches[0].pageX:0),t.classList.add("is-dragging"),t.addEventListener("pointermove",o),t.addEventListener("pointerup",i))})),e.elements.rangeValue.innerText=Q}(e,e.elements.volumeSliderContainer),e.elements.mediaPlayerCard.appendChild(e.elements.volumeSliderContainer),e.elements.volumeButton.addEventListener("click",(()=>{e.elements.volumeSliderContainer.classList.toggle("is-hidden"),e.elements.muteButton.classList.toggle("is-hidden"),e.elements.icon.classList.toggle("is-hidden"),e.elements.image.classList.toggle("is-hidden"),function(e){const t=e.elements.volumeButton.isHidden,n=t?"1":"0",a=t?"mdi:volume-high":"mdi:close";e.elements.volumeButton.setAttribute("icon",a),e.elements.mediaInfoContainer.style.opacity=n,e.elements.nameContainer.style.opacity=n,e.elements.subButtonContainer.style.opacity=n,e.elements.previousButton.style.opacity=n,e.elements.nextButton.style.opacity=n,e.elements.powerButton.style.opacity=n,e.elements.volumeButton.isHidden=!t}(e),Q=Math.round(100*(0,n.IL)(e,"volume_level"))+"%"})),e.elements.powerButton.addEventListener("click",(()=>{const t=(0,n.pr)(e);e._hass.callService("media_player",t?"turn_off":"turn_on",{entity_id:e.config.entity})})),e.elements.muteButton.addEventListener("click",(()=>{const t=!0===(0,n.IL)(e,"is_volume_muted");e._hass.callService("media_player","volume_mute",{entity_id:e.config.entity,is_volume_muted:!t}),e.elements.muteButton.clicked=!0})),e.elements.previousButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_previous_track",{entity_id:e.config.entity})})),e.elements.nextButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_next_track",{entity_id:e.config.entity})})),e.elements.playPauseButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_play_pause",{entity_id:e.config.entity}),e.elements.playPauseButton.clicked=!0})),e.elements.mediaPlayerContainer.addEventListener("click",(()=>(0,n.jk)("selection"))),e.cardType="media-player"}(e),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable"),(0,n.pr)(e)?e.card.classList.add("is-on"):e.card.classList.remove("is-on")}(e),function(e){const t=(0,n.oY)(e);t!==e.previousName&&(e.elements.name.innerText=t,e.previousName=t,(0,n.GP)(e,e.elements.name,t))}(e),function(e){const t=(0,n.IL)(e,"media_title"),a=(0,n.IL)(e,"media_artist"),o=t+a;o!==e.previousMediaState&&(e.elements.artist.style.display=""===a?"none":"flex",e.previousMediaState=o,(0,n.GP)(e,e.elements.title,t),(0,n.GP)(e,e.elements.artist,a))}(e),function(e){(0,n.IL)(e,"media_title");const t=""===(0,n.IL)(e,"media_artist");e.elements.mediaInfoContainer.style.display=t?"none":"",e.elements.nameContainer.style.display=t?"":"none"}(e),function(e){const t=(0,n.pr)(e),a=(0,n.q7)(e),o=(0,n.gJ)(e),i=e.elements.image.style.backgroundImage,r=e.elements.icon.icon,s=e.elements.icon.style.color;if(""!==o){const t="url("+o+")";i!==t&&(e.elements.image.style.backgroundImage=t),"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),""!==e.elements.image.style.display&&(e.elements.image.style.display="")}else if(""!==a){r!==a&&(e.elements.icon.icon=a);const n=t?"var(--accent-color)":"inherit";s!==n&&(e.elements.icon.style.color=n),""!==e.elements.icon.style.display&&(e.elements.icon.style.display=""),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}else"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}(e),function(e){const t=(0,n.pr)(e),a=(0,n.gJ)(e),o=e.config.cover_background,i=e.elements.coverBackground.style.backgroundImage;if(o&&t&&a){const t="url("+a+")";i!==t&&(e.elements.coverBackground.style.backgroundImage=t)}else""!==i&&(e.elements.coverBackground.style.backgroundImage="")}(e),A(e),function(e){if((0,n.OC)(e,"media_player")&&!1===e.dragging&&e.elements.rangeFill){const t=100*(0,n.IL)(e,"volume_level");e.elements.rangeFill.style.transform=`translateX(${t}%)`}}(e),function(e){const t="playing"===(0,n.y0)(e),a=e.elements.playPauseButton.clicked;t?e.elements.playPauseButton.setAttribute("icon",a?"mdi:play":"mdi:pause"):e.elements.playPauseButton.setAttribute("icon",a?"mdi:pause":"mdi:play"),e.elements.playPauseButton.clicked=!1}(e),function(e){const t=!0===(0,n.IL)(e,"is_volume_muted"),a=e.elements.muteButton.clicked;e.elements.muteButton.style.color=t?a?"":"var(--accent-color)":a?"var(--accent-color)":"",e.elements.muteButton.clicked=!1}(e),function(e){const t=(0,n.pr)(e);e.elements.powerButton.style.color=t?"var(--accent-color)":""}(e),V(e,e.content,e.elements.buttonContainer,!0),function(e){D(e),(0,n.jx)(e);const t=(0,n.y0)(e),a="off"!==t&&"unknown"!==t;if(e.config.hide?.power_button&&"none"!==e.elements.powerButton.style.display?e.elements.powerButton.style.display="none":e.config.hide?.power_button||"none"!==e.elements.powerButton.style.display||(e.elements.powerButton.style.display=""),!e.config.hide?.previous_button&&(e.editor||a)||"none"===e.elements.previousButton.style.display?e.config.hide?.previous_button||!e.editor&&!a||"none"!==e.elements.previousButton.style.display||(e.elements.previousButton.style.display=""):e.elements.previousButton.style.display="none",!e.config.hide?.next_button&&(e.editor||a)||"none"===e.elements.nextButton.style.display?e.config.hide?.next_button||!e.editor&&!a||"none"!==e.elements.nextButton.style.display||(e.elements.nextButton.style.display=""):e.elements.nextButton.style.display="none",!e.config.hide?.volume_button&&(e.editor||a)||"none"===e.elements.volumeButton.style.display?e.config.hide?.volume_button||!e.editor&&!a||"none"!==e.elements.volumeButton.style.display||(e.elements.volumeButton.style.display=""):e.elements.volumeButton.style.display="none",!e.config.hide?.play_pause_button&&(e.editor||a)||"none"===e.elements.playPauseButton.style.display?e.config.hide?.play_pause_button||!e.editor&&!a||"none"!==e.elements.playPauseButton.style.display||(e.elements.playPauseButton.style.display=""):e.elements.playPauseButton.style.display="none",!e.config.styles)return;let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating media player custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e)}function te(e){let t="";const n=e._hass.states[e.config.entity],a=(n.attributes.current_temperature,n.attributes.hvac_action),o=n.state,i="heating"===a||"heat"===o&&e.config.state_color,r="cooling"===a||"cool"===o&&e.config.state_color,s="off"!==o&&"unknown"!==o;switch(o){case"fan_only":t="var(--bubble-state-climate-fan-only-color, var(--state-climate-fan-only-color, var(--state-climate-active-color, var(--state-active-color))))";break;case"dry":t="var(--bubble-state-climate-dry-color, var(--state-climate-dry-color, var(--state-climate-active-color, var(--state-active-color))))";break;default:t=r?"var(--bubble-state-climate-cool-color, var(--state-climate-cool-color, var(--state-climate-active-color, var(--state-active-color))))":i?"var(--bubble-state-climate-heat-color, var(--state-climate-heat-color, var(--state-climate-active-color, var(--state-active-color))))":s&&e.config.state_color?"auto"===o?"var(--bubble-state-climate-auto-color, var(--state-climate-auto-color, var(--state-climate-active-color, var(--state-active-color))))":"heat_cool"===o?"var(--bubble-state-climate-heat-cool-color, var(--state-climate-heat-cool-color, var(--state-climate-active-color, var(--state-active-color))))":"var(--bubble-climate-accent-color, var(--bubble-accent-color, var(--accent-color)))":""}return t}let ne,ae,oe;class ie extends HTMLElement{editor=!1;isConnected=!1;connectedCallback(){this.isConnected=!0,this._hass&&this.updateBubbleCard()}disconnectedCallback(){this.isConnected=!1}set editMode(e){this.editor!==e&&(this.editor=e,this._hass&&this.updateBubbleCard())}set hass(e){!function(e){if(!e.content){let t=e.shadowRoot||e.attachShadow({mode:"open"}),n=document.createElement("ha-card");n.style.cssText="background: none; border: none; box-shadow: none; border-radius: 16px;";let a=document.createElement("div");a.className="card-content",a.style.padding="0",n.appendChild(a),t.appendChild(n),e.card=n,e.content=a}}(this),this._hass=e,this.editor||(this.isConnected||"pop-up"===this.config.card_type)&&this.updateBubbleCard()}updateBubbleCard(){switch(this.config.card_type){case"pop-up":F(this);break;case"button":j(this);break;case"separator":"separator"!==(e=this).cardType&&function(e){e.elements={},e.elements.separatorCard=(0,n.az)("div","bubble-separator separator-container"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.name=(0,n.az)("h4","bubble-name"),e.elements.line=(0,n.az)("div","bubble-line"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .bubble-separator {\n display: flex;\n width: 100%;\n \n align-items: center;\n z-index: 1;\n }\n .bubble-icon {\n display: inline-flex;\n height: auto;\n width: auto;\n margin: 0 22px 0 8px;\n }\n .bubble-name {\n margin: 0 30px 0 0;\n font-size: 16px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .bubble-name:empty {\n display: none;\n }\n .bubble-line {\n border-radius: 6px;\n opacity: 0.5;\n flex-grow: 1;\n height: 6px;\n background-color: var(--bubble-line-background-color, var(--background-color, var(--secondary-background-color)));\n margin-right: 14px;\n }\n .bubble-sub-button-container {\n margin: 0 8px;\n right: 0 !important;\n }\n\n .large .bubble-separator {\n height: 56px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.elements.separatorCard.appendChild(e.elements.icon),e.elements.separatorCard.appendChild(e.elements.name),e.elements.separatorCard.appendChild(e.elements.line),e.content.innerHTML="",e.content.appendChild(e.elements.separatorCard),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.cardType="separator"}(e),function(e){e.elements.icon.icon=(0,n.q7)(e),""===e.elements.icon.icon&&""===e.elements.icon.style.margin?(e.elements.icon.style.margin="0px 8px",e.elements.icon.style.width="0px"):""!==e.elements.icon.icon&&"0px 8px"===e.elements.icon.style.margin&&(e.elements.icon.style.margin="",e.elements.icon.style.width="")}(e),function(e){const t=(0,n.oY)(e);t!==e.elements.name.innerText&&(e.elements.name.innerText=t)}(e),V(e,e.content,e.elements.separatorCard),function(e){D(e),(0,n.jx)(e);const t=(0,n.y0)(e);let a="";try{a=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating separator custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=a)}(e);break;case"cover":!function(e){"cover"!==e.cardType&&function(e){e.elements={},e.elements.coverCardContainer=(0,n.az)("div","bubble-cover-card-container cover-container"),e.elements.headerContainer=(0,n.az)("div","bubble-header header-container"),e.elements.buttonsContainer=(0,n.az)("div","bubble-buttons buttons-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container icon-container"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container name-container"),e.elements.name=(0,n.az)("div","bubble-name name"),e.elements.state=(0,n.az)("div","bubble-state state"),e.elements.buttonOpen=(0,n.az)("div","bubble-button bubble-open button open"),e.elements.buttonStop=(0,n.az)("div","bubble-button bubble-stop button stop"),e.elements.buttonClose=(0,n.az)("div","bubble-button bubble-close button close"),e.elements.iconOpen=(0,n.az)("ha-icon","bubble-icon bubble-icon-open"),e.elements.iconStop=(0,n.az)("ha-icon","bubble-icon bubble-icon-stop"),e.elements.iconStop.icon="mdi:stop",e.elements.iconClose=(0,n.az)("ha-icon","bubble-icon bubble-icon-close"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n ha-card {\n margin-top: 0 !important;\n background: none !important;\n }\n\n .bubble-cover-card-container {\n display: grid;\n gap: 10px;\n overflow: hidden;\n }\n\n .bubble-header {\n display: flex;\n align-items: center;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n border-radius: var(--bubble-cover-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-cover-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n border: 6px solid var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n cursor: pointer;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n margin-right: 16px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n white-space: nowrap;\n display: flex;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n white-space: nowrap;\n display: flex;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-buttons {\n display: grid;\n align-self: center;\n grid-auto-flow: column;\n grid-gap: 18px;\n }\n\n .bubble-icon {\n display: flex; \n height: 24px; \n width: 24px; \n color: var(--primary-text-color);\n }\n\n .bubble-button.disabled {\n opacity: 0.3 !important;\n pointer-events: none !important;\n cursor: none !important;\n }\n\n .bubble-button {\n display: flex;\n background: var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n height: 42px;\n border-radius: var(--bubble-cover-border-radius, var(--bubble-border-radius, 32px));\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border: none;\n }\n\n .large .bubble-cover-card-container {\n height: 56px;\n display: flex;\n background: var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-cover-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-buttons .bubble-icon {\n color: var(--primary-text-color) !important;\n opacity: 1;\n }\n\n .large .bubble-header-container {\n height: 56px;\n }\n\n .large .bubble-header {\n width: 100%;\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n align-content: center;\n border: none;\n margin: 8px 6px 8px 8px;\n }\n\n .large .bubble-icon {\n align-items: center;\n }\n\n .large .bubble-buttons {\n display: flex;\n position: relative;\n right: 18px;\n align-self: center;\n grid-gap: 18px;\n }\n\n .large .bubble-sub-button-container {\n margin-right: 14px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.elements.iconContainer.appendChild(e.elements.icon),e.elements.headerContainer.appendChild(e.elements.iconContainer),e.elements.headerContainer.appendChild(e.elements.nameContainer),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.buttonsContainer.appendChild(e.elements.buttonOpen),e.elements.buttonsContainer.appendChild(e.elements.buttonStop),e.elements.buttonsContainer.appendChild(e.elements.buttonClose),e.elements.buttonOpen.appendChild(e.elements.iconOpen),e.elements.buttonOpen.addEventListener("click",(()=>{const t=e.config.open_service??"cover.open_cover",[n,a]=t.split(".");e._hass.callService(n,a,{entity_id:e.config.entity})})),e.elements.buttonStop.appendChild(e.elements.iconStop),e.elements.buttonStop.addEventListener("click",(()=>{const t=e.config.stop_service??"cover.stop_cover",[n,a]=t.split(".");e._hass.callService(n,a,{entity_id:e.config.entity})})),e.elements.buttonClose.appendChild(e.elements.iconClose),e.elements.buttonClose.addEventListener("click",(()=>{const t=e.config.close_service??"cover.close_cover",[n,a]=t.split(".");e._hass.callService(n,a,{entity_id:e.config.entity})})),o(e.elements.iconContainer,e.config),e.content.innerHTML="",e.content.appendChild(e.elements.coverCardContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.elements.coverCardContainer.appendChild(e.elements.headerContainer),e.elements.coverCardContainer.appendChild(e.elements.buttonsContainer),e.elements.coverCardContainer.addEventListener("click",(()=>(0,n.jk)("selection"))),e.cardType="cover"}(e),function(e){const t=e._hass.states[e.config.entity],{current_position:a,assumed_state:o}=t.attributes,i=J(t,X),r=J(t,R),s=J(t,Y),l=function(e){return void 0!==e.attributes.current_position?100===e.attributes.current_position:"open"===e.state}(t),c=function(e){return void 0!==e.attributes.current_position?0===e.attributes.current_position:"closed"===e.state}(t),d="curtain"===(0,n.IL)(e,"device_class");e.elements.icon.icon=l?(0,n.q7)(e,e.config.entity,e.config.icon_open):(0,n.q7)(e,e.config.entity,e.config.icon_close),e.elements.iconOpen.icon=e.config.icon_up||(d?"mdi:arrow-expand-horizontal":"mdi:arrow-up"),e.elements.iconClose.icon=e.config.icon_down||(d?"mdi:arrow-collapse-horizontal":"mdi:arrow-down"),void 0!==a?(l?e.elements.buttonOpen.classList.add("disabled"):i&&e.elements.buttonOpen.classList.remove("disabled"),c?e.elements.buttonClose.classList.add("disabled"):r&&e.elements.buttonClose.classList.remove("disabled")):(e.elements.buttonOpen.classList.remove("disabled"),e.elements.buttonClose.classList.remove("disabled")),e.elements.buttonStop.style.display=s?"":"none"}(e),function(e){const t=(0,n.oY)(e);t!==e.elements.previousName&&(e.elements.name.innerText=t,(0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e),A(e),V(e,e.content,e.elements.headerContainer),function(e){if(D(e),(0,n.jx)(e),!e.config.styles)return;const t=(0,n.y0)(e);let a="";try{a=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating cover custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=a)}(e)}(this);break;case"empty-column":!function(e){"empty-column"!==e.cardType&&function(e){e.elements={},e.elements.emptyColumnCard=(0,n.az)("div","bubble-empty-column empty-column"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .empty-column {\n display: flex;\n width: 100%;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.content.innerHTML="",e.content.appendChild(e.elements.emptyColumnCard),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.cardType="empty-column"}(e)}(this);break;case"horizontal-buttons-stack":!function(e){"horizontal-buttons-stack"!==e.cardType&&function(e){e.elements={},e.elements.buttons=[],e.elements.cardContainer=(0,n.az)("div","bubble-horizontal-buttons-stack-card-container horizontal-buttons-stack-container");let t=1;for(;e.config[t+"_link"];)e.elements.cardContainer.appendChild(W(e,t)),t++;e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n @keyframes from-bottom {\n 0% { transform: translate(-50%, 100px); }\n 26% { transform: translate(-50%, -8px); }\n 46% { transform: translate(-50%, 1px); }\n 62% { transform: translate(-50%, -2px); }\n 70% { transform: translate(-50%, 0); }\n 100% { transform: translate(-50%, 0); }\n }\n @keyframes pulse {\n 0% { filter: brightness(0.7); }\n 100% { filter: brightness(1.3); }\n }\n ha-card {\n border-radius: 0;\n }\n .horizontal-buttons-stack-card {\n bottom: 16px;\n height: 51px;\n margin-top: 0;\n position: fixed;\n width: calc(100% - var(--mdc-drawer-width, 0px) - 8px);\n left: calc(var(--mdc-drawer-width, 0px) + 4px);\n z-index: 6; /* Higher value hide the more-info panel */\n }\n @media only screen and (max-width: 870px) {\n .horizontal-buttons-stack-card {\n width: calc(100% - 16px);\n left: 8px;\n }\n\n .horizontal-buttons-stack-card::before {\n left: -10px;\n }\n }\n .horizontal-buttons-stack-card::before {\n content: '';\n position: absolute;\n top: -32px;\n display: none;\n background: linear-gradient(0deg, var(--background-color, var(--primary-background-color)) 50%, rgba(79, 69, 87, 0));\n width: 200%;\n height: 100px;\n pointer-events: none;\n }\n .has-gradient.horizontal-buttons-stack-card::before {\n display: block;\n }\n\n .card-content {\n width: calc(100% + 36px);\n padding: 0 !important;\n max-width: calc(var(--desktop-width) - 8px);\n box-sizing: border-box;\n overflow: scroll;\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n -ms-overflow-style: none;\n scrollbar-width: none;\n -webkit-mask-image: linear-gradient(\n 90deg,\n #000000 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n transparent 100%\n );\n }\n .is-scrollable.card-content {\n padding: 0 !important;\n width: 100%;\n }\n .is-scrolled.card-content {\n padding: 0 !important;\n width: 100%;\n -webkit-mask-image: linear-gradient(\n 90deg,\n transparent 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n transparent 100%\n );\n }\n .is-maxed-scroll.card-content {\n -webkit-mask-image: linear-gradient(\n 90deg,\n transparent 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n #000000 100%\n );\n }\n .card-content::-webkit-scrollbar {\n display: none;\n }\n\n .bubble-horizontal-buttons-stack-card-container {\n height: 51px;\n position: relative;\n margin: auto;\n }\n\n .bubble-button {\n align-items: center;\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n color: var(--primary-text-color);\n cursor: pointer;\n display: inline-flex;\n height: 50px;\n left: 0;\n padding: 0 16px;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n transition: transform 1s;\n box-sizing: border-box;\n }\n .bubble-button.highlight {\n animation: pulse 1.4s infinite alternate;\n }\n .bubble-background-color {\n border: 1px solid var(--primary-text-color);\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n box-sizing: border-box;\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n transition: background-color 1s;\n width: 100%;\n z-index: -1;\n }\n .bubble-background {\n opacity: 0.8;\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n width: 100%;\n height: 100%;\n box-sizing: border-box !important;\n position: absolute;\n left: 0;\n z-index: -2;\n background-color: var(--background-color,var(--primary-background-color));\n }\n .bubble-icon {\n height: 24px;\n width: 24px;\n }\n .bubble-icon + .bubble-name {\n margin-left: 8px;\n }\n\n\n .horizontal-buttons-stack-card.editor {\n position: relative;\n width: 100%;\n left: 0;\n bottom: 0;\n }\n .horizontal-buttons-stack-card.editor::before {\n background: none;\n }\n\n",e.elements.customStyle=(0,n.az)("style"),e.card.classList.add("horizontal-buttons-stack-card"),e.card.style.marginLeft=e.config.margin??"",e.config.hide_gradient||e.card.classList.add("has-gradient"),e.card.style.setProperty("--desktop-width",e.config.width_desktop??"500px"),e.elements.cardContainer.appendChild(e.elements.style),e.elements.cardContainer.appendChild(e.elements.customStyle),e.content.appendChild(e.elements.cardContainer),e.content.addEventListener("scroll",(()=>{e.content.scrollLeft>0?e.content.classList.add("is-scrolled"):e.content.classList.remove("is-scrolled"),e.content.scrollWidth-12{e.content.style.animation="none"}),1500));let a=e.card.parentNode.host;a&&!e.editor&&"hui-card"!==a.parentElement.tagName.toLowerCase()?a.style.padding="0 0 80px":a.parentElement&&!e.editor&&"hui-card"===a.parentElement.tagName.toLowerCase()&&(a.parentElement.style.padding="0 0 80px"),e.cardType="horizontal-buttons-stack"}(e),function(e){if(!e.config.styles)return;let t="";try{t=e.config.styles?Function("hass","card",`return \`${e.config.styles}\`;`)(e._hass,e.card):""}catch(e){throw new Error(`Error in generating horizontal buttons stack custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=t)}(e),function(e){if(!e.config.auto_order)return;const t=e._hass.states;e.elements.buttons.sort(((e,n)=>{if(!t[e.pirSensor])return 1;if(!t[e.pirSensor])return-1;const a=t[e.pirSensor]?.last_updated,o=t[n.pirSensor]?.last_updated;return"on"===t[e.pirSensor]?.state&&"on"===t[n.pirSensor]?.state?a>o?-1:a===o?0:1:"on"===t[e.pirSensor]?.state?-1:"on"===t[n.pirSensor]?.state?1:a>o?-1:a===o?0:1}))}(e),function(e){e.elements.buttons.forEach((t=>{const n=t.index,a=e.config[`${n}_name`]??"",o=e.config[`${n}_icon`]??"",i=e.config[`${n}_pir_sensor`],r=e.config[`${n}_link`],s=e.config[`${n}_entity`];t.pirSensor=i,t.lightEntity=s,t.link=r,a?(t.name.innerText=a,t.name.style.display=""):t.name.style.display="none",o?(t.icon.icon=o,t.icon.style.display=""):t.icon.style.display="none",void 0===r&&(t.remove(),e.elements.buttons=e.elements.buttons.filter((e=>e!==t)),e.elements.buttons.forEach(((e,t)=>{e.index=t+1})))}));let t=e.elements.buttons.length+1;for(;void 0!==e.config[`${t}_link`];){if(!e.elements.buttons.find((e=>e.index===t))){const n=W(e,t);e.elements.buttons.push(n)}t++}}(e),function(e){const t=e.shadowRoot.host.closest("hui-card-preview, hui-card-options");e.editor||null!==t?(e.elements.cardContainer.classList.add("editor"),e.card.classList.add("editor")):(e.elements.cardContainer.classList.remove("editor"),e.card.classList.remove("editor"))}(e),function(e){let t=0;for(let n=0;n0&&(a=o,localStorage.setItem(`bubbleButtonWidth-${e.elements.buttons[n].link}`,`${o}`)),null!==a&&(e.elements.buttons[n].style.transform=`translateX(${t}px)`,e.elements.buttons[n].style.width="",t+=+a+12)}e.elements.cardContainer.style.width=`${t}px`}(e),function(e){e.elements.buttons.forEach((n=>{const a=e._hass.states[n.lightEntity],o=a?.attributes.rgb_color,i=a?.state;if(o){const e=(0,t.wW)(o)?"rgba(255, 220, 200, 0.5)":`rgba(${o}, 0.5)`;n.backgroundColor.style.backgroundColor=e,n.backgroundColor.style.borderColor="rgba(0, 0, 0, 0)"}else"on"==i?(n.backgroundColor.style.backgroundColor="rgba(255, 255, 255, 0.5)",n.backgroundColor.style.borderColor="rgba(0, 0, 0, 0)"):(n.backgroundColor.style.backgroundColor="rgba(0, 0, 0, 0)",n.backgroundColor.style.borderColor="var(--primary-text-color)")}))}(e),function(e){e.content.scrollWidth>=e.content.offsetWidth?e.content.classList.add("is-scrollable"):e.content.classList.remove("is-scrollable")}(e)}(this);break;case"media-player":ee(this);break;case"select":!function(e){e.cardType,"select"!==e.cardType&&(function(e){e.elements||(e.elements={});let t=e.content;e.elements.selectCardContainer=(0,n.az)("div","bubble-select-card-container"),e.elements.selectCard=(0,n.az)("div","bubble-select-card"),e.elements.selectBackground=(0,n.az)("div","bubble-select-background"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.feedback=(0,n.az)("div","bubble-feedback-element"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.feedback.style.display="none",e.elements.style.innerText=O,s(e.elements.selectBackground,e.elements.feedback),o(e.elements.iconContainer,e.config,e.config.entity),e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.selectCard.appendChild(e.elements.selectBackground),e.elements.selectCard.appendChild(e.elements.iconContainer),e.elements.selectCard.appendChild(e.elements.nameContainer),e.elements.selectCardContainer.appendChild(e.elements.selectCard),e.elements.selectBackground.appendChild(e.elements.feedback),t.innerHTML="",t.appendChild(e.elements.selectCardContainer),t.appendChild(e.elements.style),t.appendChild(e.elements.customStyle),e.cardType="select"}(e),z(e),E(e)),B(e,e.elements,e.config.entity,e.config),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable")}(e),function(e){const t=(0,n.q7)(e),a=(0,n.gJ)(e);""!==a?(e.elements.image.style.backgroundImage="url("+a+")",e.elements.icon.style.display="none",e.elements.image.style.display=""):""!==t?(e.elements.icon.icon=t,e.elements.icon.style.color="inherit",e.elements.icon.style.display="",e.elements.image.style.display="none"):(e.elements.icon.style.display="none",e.elements.image.style.display="none")}(e),function(e){const t=(0,n.oY)(e);t!==e.elements.previousName&&((0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e),A(e),V(e,e.content,e.elements.dropdownContainer,!0),function(e){D(e),(0,n.jx)(e);const t=(0,n.y0)(e);let a="";try{a=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating select custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=a,e.elements.dropdownCustomStyleElement.innerText=a)}(e)}(this);break;case"climate":!function(e){"climate"!==e.cardType&&function(e){e.dragging=!1,e.elements={};const t=e.config.entity,a=e._hass.states[t],i="°C"===e._hass.config.unit_system.temperature,r=a.attributes.target_temp_step?a.attributes.target_temp_step:i?.5:1;function l(t,a,o){const i=(0,n.az)("div","bubble-climate-minus-button"),r=(0,n.az)("div","bubble-climate-plus-button"),l=(0,n.az)("ha-icon","bubble-climate-minus-button-icon");l.setAttribute("icon","mdi:minus"),i.appendChild(l),s(i);const c=(0,n.az)("ha-icon","bubble-climate-plus-button-icon");let d,u;c.setAttribute("icon","mdi:plus"),r.appendChild(c),s(r),"temperature"===a?(e.elements.tempDisplay=(0,n.az)("div","bubble-temperature-display"),d=e.elements.tempDisplay):"target_temp_low"===a?(e.elements.lowTempDisplay=(0,n.az)("div","bubble-low-temperature-display"),d=e.elements.lowTempDisplay):"target_temp_high"===a&&(e.elements.highTempDisplay=(0,n.az)("div","bubble-high-temperature-display"),d=e.elements.highTempDisplay),t.appendChild(i),t.appendChild(d),t.appendChild(r);let p=parseFloat((0,n.IL)(e,a))||0,b=p;function h(t){"temperature"===a?e.elements.tempDisplay.innerText=t.toFixed(1):"target_temp_low"===a?e.elements.lowTempDisplay.innerText=t.toFixed(1):"target_temp_high"===a&&(e.elements.highTempDisplay.innerText=t.toFixed(1))}function m(){const t=parseFloat((0,n.IL)(e,a))||0;t!==b&&(p=t,b=t)}function g(){m();const t={entity_id:e.config.entity};"target_temp_low"===a?(t.target_temp_low=p,t.target_temp_high=(0,n.IL)(e,"target_temp_high")):"target_temp_high"===a?(t.target_temp_high=p,t.target_temp_low=(0,n.IL)(e,"target_temp_low")):t[a]=p,e._hass.callService("climate","set_temperature",t)}i.addEventListener("click",(()=>{m(),p=parseFloat((p-o).toFixed(1)),h(p),clearTimeout(u),u=setTimeout(g,700)})),r.addEventListener("click",(()=>{m(),p=parseFloat((p+o).toFixed(1)),h(p),clearTimeout(u),u=setTimeout(g,700)}))}e.elements.climateContainer=(0,n.az)("div","bubble-climate-container"),e.elements.climateCard=(0,n.az)("div","bubble-climate"),e.elements.buttonContainer=(0,n.az)("div","bubble-button-container"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture entity-picture"),e.elements.colorBackground=(0,n.az)("div","bubble-color-background"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.style.innerText="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-climate-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-climate-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n overflow: visible;\n touch-action: pan-y;\n }\n\n .bubble-climate {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n background-color: rgba(0,0,0,0);\n }\n\n .bubble-button-container {\n display: inline-grid;\n grid-auto-flow: column;\n gap: 10px;\n align-self: center;\n align-items: center;\n margin-right: 8px;\n }\n\n .bubble-temperature-container, .bubble-low-temp-container, .bubble-high-temp-container {\n display: inline-flex;\n position: relative;\n font-size: 12px;\n white-space: nowrap;\n justify-content: center;\n align-items: center;\n width: auto;\n height: 100%;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n background-color: var(--bubble-climate-button-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background))));\n }\n\n .bubble-low-temp-container {\n color: var(--state-climate-heat-color, var(--state-climate-active-color, var(--state-active-color)));\n }\n\n .bubble-high-temp-container {\n color: var(--state-climate-cool-color, var(--state-climate-active-color, var(--state-active-color)));\n }\n\n .bubble-target-temperature-container {\n display: flex;\n gap: 10px;\n }\n\n .bubble-climate-minus-button,\n .bubble-climate-plus-button {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 36px;\n height: 36px;\n vertical-align: middle;\n font-size: 18px;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n .bubble-climate-minus-button-icon,\n .bubble-climate-plus-button-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n --mdc-icon-size: 16px;\n }\n\n .bubble-feedback-container {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n pointer-events: none;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n .bubble-color-background {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n opacity: 0.7;\n transition: background-color 2s ease;\n }\n\n .is-unavailable .bubble-climate {\n cursor: not-allowed;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n width: 38px;\n height: 38px;\n min-width: 38px;\n min-height: 38px;\n align-items: center;\n justify-content: center;\n margin: 6px;\n border-radius: var(--bubble-climate-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-climate-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n pointer-events: auto;\n }\n\n .bubble-icon {\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-icon {\n display: flex;\n position: absolute;\n height: 38px;\n width: 38px;\n justify-content: center;\n align-items: center;\n transition: all 2s;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n margin: 2px 0;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n }\n\n .bubble-sub-button-container {\n right: 0 !important;\n }\n\n .hidden {\n display: none !important;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-climate-container {\n height: 56px;\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state);const c=void 0!==a?.attributes?.target_temp_low,d=void 0!==a?.attributes?.target_temp_high;void 0!==a?.attributes?.temperature&&(e.elements.temperatureContainer=(0,n.az)("div","bubble-temperature-container"),l(e.elements.temperatureContainer,"temperature",r),e.elements.buttonContainer.appendChild(e.elements.temperatureContainer)),(c||d)&&(e.elements.targetTemperatureContainer=(0,n.az)("div","bubble-target-temperature-container"),c&&(e.elements.lowTempContainer=(0,n.az)("div","bubble-low-temp-container"),l(e.elements.lowTempContainer,"target_temp_low",r),e.elements.targetTemperatureContainer.appendChild(e.elements.lowTempContainer)),d&&(e.elements.highTempContainer=(0,n.az)("div","bubble-high-temp-container"),l(e.elements.highTempContainer,"target_temp_high",r),e.elements.targetTemperatureContainer.appendChild(e.elements.highTempContainer)),e.elements.buttonContainer.appendChild(e.elements.targetTemperatureContainer)),e.elements.climateCard.appendChild(e.elements.iconContainer),e.elements.climateCard.appendChild(e.elements.nameContainer),e.elements.climateCard.appendChild(e.elements.buttonContainer),e.elements.climateContainer.appendChild(e.elements.colorBackground),e.elements.climateContainer.appendChild(e.elements.climateCard),e.content.innerHTML="",e.content.appendChild(e.elements.climateContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),o(e.elements.iconContainer,e.config),e.cardType="climate"}(e),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable"),(0,n.pr)(e)?e.card.classList.add("is-on"):e.card.classList.remove("is-on")}(e),function(e){const t=(0,n.oY)(e);t!==e.previousName&&e.elements.name&&(e.elements.name.innerText=t,e.previousName=t,(0,n.GP)(e,e.elements.name,t))}(e),function(e){const t=(0,n.pr)(e),a=(0,n.q7)(e),o=(0,n.gJ)(e),i=e.elements.image.style.backgroundImage,r=e.elements.icon.icon,s=e.elements.icon.style.color;if(""!==o){const t="url("+o+")";i!==t&&(e.elements.image.style.backgroundImage=t),"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),""!==e.elements.image.style.display&&(e.elements.image.style.display="")}else if(""!==a){r!==a&&(e.elements.icon.icon=a);const n=t?`var(--bubble-icon-background-color, ${te(e)})`:"inherit";s!==n&&(e.elements.icon.style.color=n),""!==e.elements.icon.style.display&&(e.elements.icon.style.display=""),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}else"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}(e),A(e),function(e){const t=(0,n.IL)(e,"temperature");""===t?e.elements.temperatureContainer?.classList.add("hidden"):e.elements.temperatureContainer?.classList.remove("hidden"),t!==e.previousTemp&&(e.previousTemp=t,e.elements.tempDisplay&&(e.elements.tempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),function(e){const t=(0,n.IL)(e,"target_temp_low"),a=e.config.hide_target_temp_low;""===t?e.elements.targetTemperatureContainer?.classList.add("hidden"):e.elements.targetTemperatureContainer?.classList.remove("hidden"),a?e.elements.lowTempContainer?.classList.add("hidden"):e.elements.lowTempContainer?.classList.remove("hidden"),t!==e.previousTargetTempLow&&(e.previousTargetTempLow=t,e.elements.lowTempDisplay&&(e.elements.lowTempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),function(e){const t=(0,n.IL)(e,"target_temp_high");e.config.hide_target_temp_high?e.elements.highTempContainer?.classList.add("hidden"):e.elements.highTempContainer?.classList.remove("hidden"),t!==e.previousTargetTempHigh&&(e.previousTargetTempHigh=t,e.elements.highTempDisplay&&(e.elements.highTempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),V(e,e.content,e.elements.buttonContainer,!0),function(e){D(e),(0,n.jx)(e);const t=(0,n.y0)(e);if(e.previousState!==t&&(e.previousState=t,e.elements.colorBackground.style.backgroundColor=`var(--bubble-climate-background-color, ${te(e)})`),e.config.card_layout,e.elements.hvacModeDropdown,!e.config.styles)return;let a="";try{a=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating climate custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=a)}(e)}(this)}var e}setConfig(e){if(e.error)throw new Error(e.error);if("pop-up"===e.card_type){if(!e.hash)throw new Error("You need to define an hash. Please note that this card must be placed inside a vertical_stack to work as a pop-up.")}else if("horizontal-buttons-stack"===e.card_type){var t={};for(var n in e)if(n.match(/^\d+_icon$/)){var a=n.replace("_icon","_link");if(void 0===e[a])throw new Error("You need to define "+a);if(t[e[a]])throw new Error("You can't use "+e[a]+" twice");t[e[a]]=!0}}else if(["button","cover","climate","select","media-player"].includes(e.card_type)&&!e.entity&&"name"!==e.button_type)throw new Error("You need to define an entity");if("select"===e.card_type&&e.entity&&!e.select_attribute&&!e.entity?.startsWith("input_select")&&!e.entity?.startsWith("select"))throw new Error('"Select menu (from attributes)" missing');if(window.entityError)throw new Error("You need to define a valid entity");if("button"===e.card_type){const t={...e},n=t.button_type||"switch";t.tap_action=t.tap_action??{action:"more-info"},t.double_tap_action=t.double_tap_action??{action:"state"===n?"more-info":"toggle"},t.hold_action=t.hold_action??{action:"state"===n?"more-info":"toggle"},this.config=t}else this.config=e;this._hass&&this.updateBubbleCard()}getCardSize(){switch(this.config.card_type){case"pop-up":return-1e5;case"button":case"separator":case"empty-column":case"media-player":case"select":case"climate":return 1;case"cover":return 2;case"horizontal-buttons-stack":return 0}}static getConfigElement(){return function(){if(!ne)try{ne=Object.getPrototypeOf(customElements.get("ha-panel-lovelace")),ae=ne.prototype?.html,oe=ne.prototype?.css}catch(e){return void console.error(e.message)}customElements.get("bubble-card-editor")||customElements.define("bubble-card-editor",class extends ne{setConfig(e){this._config={...e}}static get properties(){return{hass:{},_config:{}}}get _card_type(){return this._config?.card_type||""}get _button_type(){return this._config?.button_type||("pop-up"===this._config?.card_type?"":"switch")}get _entity(){return this._config?.entity||""}get _name(){return this._config?.name||""}get _icon(){return this._config?.icon||""}get _state(){return this._config?.state||""}get _text(){return this._config?.text||""}get _hash(){return this._config?.hash||"#pop-up-name"}get _trigger_entity(){return this._config?.trigger_entity||""}get _trigger_state(){return this._config?.trigger_state||""}get _trigger_close(){return this._config?.trigger_close||!1}get _margin(){return this._config?.margin||"7px"}get _margin_top_mobile(){return this._config?.margin_top_mobile||"0px"}get _margin_top_desktop(){return this._config?.margin_top_desktop||"0px"}get _width_desktop(){return this._config?.width_desktop||"540px"}get _bg_color(){return this._config?.bg_color||""}get _bg_opacity(){return void 0!==this._config?.bg_opacity?this._config?.bg_opacity:"88"}get _bg_blur(){return void 0!==this._config?.bg_blur?this._config?.bg_blur:"10"}get _backdrop_blur(){return void 0!==this._config?.backdrop_blur?this._config?.backdrop_blur:"0"}get _shadow_opacity(){return void 0!==this._config?.shadow_opacity?this._config?.shadow_opacity:"0"}get _rise_animation(){return void 0===this._config?.rise_animation||this._config?.rise_animation}get _auto_close(){return this._config?.auto_close||""}get _close_on_click(){return this._config?.close_on_click||!1}get _close_by_clicking_outside(){return this._config?.close_by_clicking_outside??!0}get _background_update(){return this._config?.background_update||!1}get _icon_open(){return this._config?.icon_open||""}get _icon_close(){return this._config?.icon_close||""}get _icon_down(){return this._config?.icon_down||""}get _icon_up(){return this._config?.icon_up||""}get _open_service(){return this._config?.open_service||"cover.open_cover"}get _close_service(){return this._config?.close_service||"cover.close_cover"}get _stop_service(){return this._config?.stop_service||"cover.stop_cover"}get _auto_order(){return this._config?.auto_order||!1}get _highlight_current_view(){return this._config?.highlight_current_view||!1}get _show_state(){const e="state"===this._config?.card_type;return this._config?.show_state||e}get _show_attribute(){const e="state"===this._config.card_type;return this._config.show_attribute||e}get _show_last_changed(){const e="state"===this._config.card_type;return this._config.show_last_changed||this._config.show_last_updated||e}get _attribute(){return this._config.attribute||!1}get _hide_backdrop(){return this._config.hide_backdrop??!1}get _hide_gradient(){return this._config.hide_gradient||!1}get _hide_play_pause_button(){return this._config.hide?.play_pause_button||!1}get _hide_next_button(){return this._config.hide?.next_button||!1}get _hide_previous_button(){return this._config.hide?.previous_button||!1}get _hide_volume_button(){return this._config.hide?.volume_button||!1}get _hide_power_button(){return this._config.hide?.power_button||!1}get _sub_button(){return this._config.sub_button||""}get _button_action(){return this._config.button_action||""}get _open_action(){return this._config.open_action||""}get _close_action(){return this._config.close_action||""}get _show_header(){return this._config.show_header??!0}get _slide_to_close_distance(){return this._config.slide_to_close_distance??400}get _slider_live_update(){return this._config.slider_live_update??!1}get _cover_background(){return this._config.cover_background??!1}get _tap_action(){return{action:this._config.tap_action?.action||"more-info",navigation_path:this._config.tap_action?.navigation_path||"",url_path:this._config.tap_action?.url_path||"",service:this._config.tap_action?.service||"",target_entity:this._config.tap_action?.target?.entity_id||"",data:this._config.tap_action?.data||""}}get _double_tap_action(){return{action:this._config.double_tap_action?.action||"toggle",navigation_path:this._config.double_tap_action?.navigation_path||"",url_path:this._config.double_tap_action?.url_path||"",service:this._config.double_tap_action?.service||"",target_entity:this._config.double_tap_action?.target?.entity_id||"",data:this._config.double_tap_action?.data||""}}get _hold_action(){return{action:this._config.hold_action?.action||"toggle",navigation_path:this._config.hold_action?.navigation_path||"",url_path:this._config.hold_action?.url_path||"",service:this._config.hold_action?.service||"",target_entity:this._config.hold_action?.target?.entity_id||"",data:this._config.hold_action?.data||""}}get _selectable_attributes(){return["source_list","sound_mode_list","hvac_modes","fan_modes","swing_modes","preset_modes","effect_list"]}render(){if(!this.hass)return ae``;const t=document.querySelector("body > home-assistant").shadowRoot.querySelector("hui-dialog-edit-card").shadowRoot.querySelector("ha-dialog > div.content > div.element-preview");if("sticky"!==t.style.position&&(t.style.position="sticky",t.style.top="0"),!this.listsUpdated){const s=e=>({label:e,value:e});this.allEntitiesList=Object.keys(this.hass.states).map(s),this.lightList=Object.keys(this.hass.states).filter((e=>"light"===e.substr(0,e.indexOf(".")))).map(s),this.sensorList=Object.keys(this.hass.states).filter((e=>"sensor"===e.substr(0,e.indexOf(".")))).map(s),this.binarySensorList=Object.keys(this.hass.states).filter((e=>"binary_sensor"===e.substr(0,e.indexOf(".")))).map(s),this.coverList=Object.keys(this.hass.states).filter((e=>"cover"===e.substr(0,e.indexOf(".")))).map(s),this.mediaPlayerList=Object.keys(this.hass.states).filter((e=>"media_player"===e.substr(0,e.indexOf(".")))).map(s),this.climateList=Object.keys(this.hass.states).filter((e=>"climate"===e.substr(0,e.indexOf(".")))).map(s),this.inputSelectList=Object.keys(this.hass.states).filter((e=>{const t=this.hass.states[e],n=e.substr(0,e.indexOf(".")),a="input_select"===n||"select"===n,o=this._selectable_attributes.some((e=>t.attributes?.[e]));return a||o})).map(s),this.attributeList=Object.keys(this.hass.states[this._entity]?.attributes||{}).map((e=>{let t=this.hass.states[this._entity];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})),this.cardTypeList=[{label:"Button (Switch, slider, ...)",value:"button"},{label:"Cover",value:"cover"},{label:"Climate",value:"climate"},{label:"Empty column",value:"empty-column"},{label:"Horizontal buttons stack",value:"horizontal-buttons-stack"},{label:"Media player",value:"media-player"},{label:"Pop-up",value:"pop-up"},{label:"Select",value:"select"},{label:"Separator",value:"separator"}],this.buttonTypeList=[{label:"Switch",value:"switch"},{label:"Slider",value:"slider"},{label:"State",value:"state"},{label:"Name / Text",value:"name"}],this.tapActionTypeList=[{label:"More info",value:"more-info"},{label:"Toggle",value:"toggle"},{label:"Navigate",value:"navigate"},{label:"URL",value:"url"},{label:"Call service",value:"call-service"},{label:"Assist",value:"assist"},{label:"No action",value:"none"}],this.listsUpdated=!0}const n=this.allEntitiesList,a=(this.lightList,this.sensorList,this.coverList),o=this.cardTypeList,i=this.buttonTypeList,r="name"===this._config?.button_type;if("pop-up"===this._config?.card_type)return ae` +(()=>{"use strict";var __webpack_modules__={946:(e,t,n)=>{function o(e,t=40){if(Array.isArray(e)&&3===e.length){for(let t=0;t<3;t++)if(e[t]<0||e[t]>255)return;return e.every((e=>Math.abs(e-255)<=t))}}let a;function i(e,t,n=1){if(e.startsWith("#"))if(4===e.length){let o=Math.min(255,parseInt(e.charAt(1).repeat(2),16)*n),i=Math.min(255,parseInt(e.charAt(2).repeat(2),16)*n),r=Math.min(255,parseInt(e.charAt(3).repeat(2),16)*n);a="rgba("+o+", "+i+", "+r+", "+t+")"}else{let o=Math.min(255,parseInt(e.slice(1,3),16)*n),i=Math.min(255,parseInt(e.slice(3,5),16)*n),r=Math.min(255,parseInt(e.slice(5,7),16)*n);a="rgba("+o+", "+i+", "+r+", "+t+")"}else if(e.startsWith("rgb")){let o=e.match(/\d+/g);a="rgba("+Math.min(255,o[0]*n)+", "+Math.min(255,o[1]*n)+", "+Math.min(255,o[2]*n)+", "+t+")"}else if(e.startsWith("var(--")){let o=e.slice(4,-1),r=window.getComputedStyle(document.documentElement).getPropertyValue(o);(r.startsWith("#")||r.startsWith("rgb"))&&(a=i(r,t,n))}return a}n.d(t,{_k:()=>i,wW:()=>o})},191:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{BX:()=>fireEvent,GP:()=>applyScrollingEffect,IL:()=>getAttribute,Jn:()=>tapFeedback,OC:()=>isEntityType,P2:()=>throttle,Vv:()=>isColorLight,X:()=>getWeatherIcon,az:()=>createElement,gJ:()=>getImage,jk:()=>forwardHaptic,jx:()=>setLayout,mk:()=>getIconColor,o0:()=>formatDateTime,oY:()=>getName,pr:()=>isStateOn,q7:()=>getIcon,y0:()=>getState});var _style_ts__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(946);function hasStateChanged(e,t,n){if(e.hasState=t.states[n],e.hasState)return e.newState=[e.hasState.state,e.hasState.attributes.rgb_color],e.oldState&&e.newState[0]===e.oldState[0]&&e.newState[1]===e.oldState[1]?e.stateChanged=!1:(e.oldState=e.newState,e.stateChanged=!0),e.stateChanged}function configChanged(e,t){return!(!t.classList.contains("editor")||e.config===e.previousConfig||(e.previousConfig=e.config,0))}const fireEvent=(e,t,n,o)=>{o=o||{},n=null==n?{}:n;const a=new Event(t,{bubbles:void 0===o.bubbles||o.bubbles,cancelable:Boolean(o.cancelable),composed:void 0===o.composed||o.composed});return a.detail=n,e.dispatchEvent(a),a},forwardHaptic=e=>{fireEvent(window,"haptic",e)},navigate=(e,t,n=!1)=>{n?history.replaceState(null,"",t):history.pushState(null,"",t),fireEvent(window,"location-changed",{replace:n})};function toggleEntity(e,t){e.callService("homeassistant","toggle",{entity_id:t})}function tapFeedback(e){void 0!==e&&(e.style.display="",e.style.animation="tap-feedback .3s",setTimeout((()=>{e.style.animation="none",e.style.display="none"}),500))}function getIcon(e,t=e.config.entity,n=e.config.icon){const o=t?.split(".")[0],a=getAttribute(e,"device_class",t),i=getAttribute(e,"icon",t),r=n,s=getState(e,t),l={alarm_control_panel:"mdi:shield",alert:"mdi:alert",automation:"mdi:playlist-play",binary_sensor:function(){const n="off"===s;switch(getAttribute(e,"device_class",t)){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:server-network-off":"mdi:server-network";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness-5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"plug":case"power":return n?"mdi:power-plug-off":"mdi:power-plug";case"running":return n?"mdi:stop":"mdi:play";case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}}(),calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",cover:function(){const n="closed"!==s;switch(getAttribute(e,"device_class",t)){case"awning":return n?"mdi:awning-outline":"mdi:awning";case"blind":return n?"mdi:blinds-open":"mdi:blinds";case"curtain":return n?"mdi:curtains-open":"mdi:curtains";case"damper":case"shutter":default:return n?"mdi:window-shutter-open":"mdi:window-shutter";case"door":return n?"mdi:door-open":"mdi:door-closed";case"garage":return n?"mdi:garage-open":"mdi:garage";case"gate":return n?"mdi:gate-open":"mdi:gate";case"shade":return n?"mdi:roller-shade":"mdi:roller-shade-closed";case"window":return n?"mdi:window-open":"mdi:window-closed"}}(),device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",lock:"mdi:lock",mailbox:"mdi:mailbox",media_player:"mdi:speaker",mower:"mdi:robot-mower",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:file-document",sensor:function(){switch(getAttribute(e,"device_class",t)){case"battery":return 100==s?"mdi:battery":s>=90?"mdi:battery-90":s>=80?"mdi:battery-80":s>=70?"mdi:battery-70":s>=60?"mdi:battery-60":s>=50?"mdi:battery-50":s>=40?"mdi:battery-40":s>=30?"mdi:battery-30":s>=20?"mdi:battery-20":s>=10?"mdi:battery-10":"mdi:battery-alert";case"humidity":return"mdi:water-percent";case"illuminance":return"mdi:brightness-5";case"temperature":return"mdi:thermometer";case"pressure":return"mdi:gauge";case"power":return"mdi:flash";case"signal_strength":return"mdi:wifi";case"energy":return"mdi:lightning-bolt";default:return"mdi:eye"}}(),simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:function(n=getState(e,t)){switch(n){case"cloudy":default:return"mdi:weather-cloudy";case"partlycloudy":return"mdi:weather-partly-cloudy";case"rainy":return"mdi:weather-rainy";case"snowy":return"mdi:weather-snowy";case"sunny":return"mdi:weather-sunny";case"clear-night":return"mdi:weather-night";case"fog":return"mdi:weather-fog";case"hail":return"mdi:weather-hail";case"lightning":return"mdi:weather-lightning";case"lightning-rainy":return"mdi:weather-lightning-rainy";case"pouring":return"mdi:weather-pouring";case"windy":return"mdi:weather-windy";case"windy-variant":return"mdi:weather-windy-variant";case"exceptional":return"mdi:alert-circle-outline"}}(),weblink:"mdi:open-in-new"};return r||i||(l[o]?l[o]:l[a]?l[a]:"")}function getWeatherIcon(e){switch(e){case"cloudy":default:return"mdi:weather-cloudy";case"partlycloudy":return"mdi:weather-partly-cloudy";case"rainy":return"mdi:weather-rainy";case"snowy":return"mdi:weather-snowy";case"sunny":return"mdi:weather-sunny";case"clear-night":return"mdi:weather-night";case"fog":return"mdi:weather-fog";case"hail":return"mdi:weather-hail";case"lightning":return"mdi:weather-lightning";case"lightning-rainy":return"mdi:weather-lightning-rainy";case"pouring":return"mdi:weather-pouring";case"windy":return"mdi:weather-windy";case"windy-variant":return"mdi:weather-windy-variant";case"exceptional":return"mdi:alert-circle-outline"}}let cachedColor=null,cachedResult=null;function resolveCssVariable(e){const t=getComputedStyle(document.body);let n=e;for(;n.startsWith("var(");){const e=n.match(/var\((--[^,]+),?\s*(.*)?\)/);if(!e)break;const o=t.getPropertyValue(e[1]).trim();if(o)n=o;else{if(!e[2])break;n=e[2].trim()}}return n}function isColorLight(e){const t=resolveCssVariable(e);if(!t)return!1;if(t===cachedColor)return cachedResult;cachedColor=t;const n=t.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);let o,a,i;if(n)o=parseInt(n[1],16),a=parseInt(n[2],16),i=parseInt(n[3],16);else{const e=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(!e)return cachedResult=!1,cachedResult;o=parseInt(e[1],10),a=parseInt(e[2],10),i=parseInt(e[3],10)}return cachedResult=(.2126*o+.7152*a+.0722*i)/255>.5,cachedResult}function getIconColor(e,t=e.config.entity,n=1){const o=e.config.card_type,a=e.config.use_accent_color,i="var(--bubble-accent-color, var(--accent-color))",r=getAttribute(e,"rgb_color",t),s=isColorLight("var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))))");if(n=s?n-.2:n,!t)return i;if(isEntityType(e,"light")&&!a?"button"===o?e.card.classList.add("is-light"):"pop-up"===o&&e.elements.headerContainer.classList.add("is-light"):"button"===o?e.card.classList.remove("is-light"):"pop-up"===o&&e.elements.headerContainer.classList.remove("is-light"),!1===t.startsWith("light.")||a)return i;const l=[225,225,210];if(!r)return`var(--bubble-light-color, rgba(${l.map((e=>Math.min(255,e*n))).join(", ")}))`;const c=r.map((e=>Math.min(255,e*n)));return(0,_style_ts__WEBPACK_IMPORTED_MODULE_0__.wW)(r)?`var(--bubble-light-color, rgba(${l.map((e=>Math.min(255,e*n))).join(", ")}))`:`var(--bubble-light-color, rgba(${c.join(", ")}))`}function getImage(e,t=e.config.entity){if(e.config.force_icon)return"";const n=e._hass.states[t],o=n.attributes.entity_picture_local||n.attributes.entity_picture;return o?e._hass.hassUrl(o):""}function getName(e){const t=e.config.name,n=getAttribute(e,"friendly_name");return e.name||t||n||""}function getState(e,t=e.config.entity){return e._hass.states[t]?.state??""}function getAttribute(context,attribute,entity=context.config.entity){return attribute?eval(`context._hass.states['${entity}']?.attributes.${attribute}`)??"":""}function isEntityType(e,t){return e.config.entity?.startsWith(t+".")??!1}function isStateOn(e,t=e.config.entity){const n=getState(e,t).toLowerCase(),o=Number(n);return!!(["on","open","opening","closing","cleaning","true","idle","home","playing","paused","locked","occupied","available","running","active","connected","online","mowing","starting","heat","cool","dry","heat_cool","fan_only","auto","alarm"].includes(n)||o>0)}function createElement(e,t=""){const n=document.createElement(e);return""!==t&&t.split(" ").forEach((e=>{n.classList.add(e)})),n}function debounce(e,t){let n;return function(...o){clearTimeout(n),n=setTimeout((()=>e.apply(this,o)),t)}}function applyScrollingEffect(e,t,n){const o=e.config.scrolling_effect??!0;if(!o)return void applyNonScrollingStyle(t,n);if(t.previousText===n)return;const a=t.className.split(" ").find((e=>e.startsWith("bubble-")));function i(){t.innerHTML=`
${n}
`,t.style="";const e=t.scrollWidth,i=t.parentNode?.offsetWidth||0;o&&e>i?(function(e,t,n){const o=' | ',a=`${t+o+t+o}`;e.innerHTML=`
${a}
`;const i=function(e){return`\n .${e} .scrolling-container {\n width: 100%;\n white-space: nowrap;\n mask-image: linear-gradient(to right, transparent, black calc(0% + 8px), black calc(100% - 8px), transparent);\n mask-image: linear-gradient(to left, transparent, black calc(0% + 8px), black calc(100% - 8px), transparent);\n }\n .${e} .scrolling-container span {\n display: inline-block;\n animation: scroll 14s linear infinite;\n }\n\n .bubble-scroll-separator {\n opacity: .3;\n margin: 0 6px 0 8px;\n }\n\n @keyframes scroll {\n from { transform: translateX(0%); }\n to { transform: translateX(-50%); }\n }\n `}(n);e.styleElement=document.createElement("style"),e.appendChild(e.styleElement),e.styleElement.innerHTML=i}(t,n,a),t.previousText=n):t.previousText=n}requestAnimationFrame(i),t.eventAdded||(window.addEventListener("resize",debounce(i,300)),t.eventAdded=!0)}function applyNonScrollingStyle(e,t){e.innerHTML=t,e.previousText=t,e.style.whiteSpace="normal",e.style.display="-webkit-box",e.style.webkitLineClamp="2",e.style.webkitBoxOrient="vertical",e.style.textOverflow="ellipsis"}function formatDateTime(e,t){if(!e)return"";const n=new Date(e),o=new Date;let a,i,r=Math.floor((o-n)/1e3);return isNaN(r)?"":(r<60?(a="second",i=r+1):r<3600?(a="minute",i=Math.floor(r/60)):r<86400?(a="hour",i=Math.floor(r/3600)):(a="day",i=Math.floor(r/86400)),new Intl.RelativeTimeFormat(t,{numeric:"auto"}).format(-i,a))}function setLayout(e){const t=e.config.card_layout,n="large"===t||"large-2-rows"===t,o="large-2-rows"===t;n!==e.content.classList.contains("large")&&e.content.classList.toggle("large",n),o!==e.content.classList.contains("rows-2")&&e.content.classList.toggle("rows-2",o)}function throttle(e,t=300){let n;return(...o)=>{void 0===n&&(e(...o),n=setTimeout((()=>{n=void 0}),t))}}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={};(()=>{let e="v2.3.3";var t=__webpack_require__(946),n=__webpack_require__(191);function o(e,t,n){setTimeout((()=>{const o=new Event("hass-action",{bubbles:!0,composed:!0}),a={...t};!a.entity_id&&this?.config?.entity&&(a.entity_id=this.config.entity),"tap"===n||"double_tap"===n||"hold"===n?o.detail={config:a,action:n}:(e.modifiedConfig={...a,tap_action:{...a[n]}},delete e.modifiedConfig[n],o.detail={config:e.modifiedConfig,action:"tap"}),e.dispatchEvent(o)}),10)}function a(e,t,n,o){e.classList.add("bubble-action"),e.dataset.entity=t?.entity||n,e.dataset.tapAction=JSON.stringify(t?.tap_action||o?.tap_action||{action:"more-info"}),e.dataset.doubleTapAction=JSON.stringify(t?.double_tap_action||o?.double_tap_action||{action:"toggle"}),e.dataset.holdAction=JSON.stringify(t?.hold_action||o?.hold_action||{action:"toggle"});const a=JSON.parse(e.dataset.tapAction),i=JSON.parse(e.dataset.doubleTapAction),r=JSON.parse(e.dataset.holdAction);e.style.cursor="none"===a.action&&"none"===i.action&&"none"===r.action?"":"pointer"}window.isScrolling=!1,document.addEventListener("scroll",(function(){window.isScrolling=!0,setTimeout((()=>{window.isScrolling=!1}),150)}),{passive:!0}),document.body.addEventListener("pointerdown",(e=>{if(window.isScrolling)return;const t=e.composedPath();let n=null;for(const e of t)if(e.classList&&e.classList.contains("bubble-action")){n=e;break}if(n){const t={tap_action:JSON.parse(n.dataset.tapAction),double_tap_action:JSON.parse(n.dataset.doubleTapAction),hold_action:JSON.parse(n.dataset.holdAction),entity:n.dataset.entity};n.actionHandler||(n.actionHandler=new i(n,t,r)),n.actionHandler.handleStart(e),n.addEventListener("pointerup",n.actionHandler.handleEnd.bind(n.actionHandler),{once:!0}),document.addEventListener("scroll",n.actionHandler.handleScroll.bind(n.actionHandler),{once:!0})}}),{passive:!0});class i{constructor(e,t,n){this.element=e,this.config=t,this.sendActionEvent=n,this.tapTimeout=null,this.holdTimeout=null,this.startX=0,this.startY=0,this.holdFired=!1,this.pointerMoveListener=this.detectScrollLikeMove.bind(this)}handleStart(e){window.isScrolling||this.isDisconnected||(this.startX=e.clientX,this.startY=e.clientY,this.holdFired=!1,document.addEventListener("pointermove",this.pointerMoveListener),this.holdTimeout=setTimeout((()=>{"none"===(this.config.hold_action||{action:"none"}).action||window.isScrolling||(this.sendActionEvent(this.element,this.config,"hold"),this.holdFired=!0)}),400))}detectScrollLikeMove(e){const t=Math.abs(e.clientX-this.startX),n=Math.abs(e.clientY-this.startY);(t>5||n>5)&&(clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener))}handleEnd(e){if(window.isScrolling||this.isDisconnected)return;if(clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener),this.holdFired)return;const t=Date.now(),n=this.config.double_tap_action||{action:"none"},o=this.config.tap_action||{action:"none"};this.lastTap&&t-this.lastTap<200&&"none"!==n.action?(clearTimeout(this.tapTimeout),this.sendActionEvent(this.element,this.config,"double_tap")):"none"!==o.action&&(this.tapTimeout=setTimeout((()=>{this.sendActionEvent(this.element,this.config,"tap")}),200)),this.lastTap=t}handleScroll(){clearTimeout(this.holdTimeout),this.holdTimeout=null,document.removeEventListener("pointermove",this.pointerMoveListener)}}function r(e,t,n){const a=t.tap_action||{action:"more-info"},i=t.double_tap_action||{action:"toggle"},r=t.hold_action||{action:"toggle"},s=t.entity||this.config?.entity,l=e=>e.service&&"entity"===e.target?.entity_id&&s?{...e,target:{...e.target,entity_id:s}}:e,c=l(a),d=l(i),u=l(r);let b;switch(n){case"tap":default:b=c;break;case"double_tap":b=d;break;case"hold":b=u}o(e,{entity:s,tap_action:c,double_tap_action:d,hold_action:u},n)}function s(e,t){e.addEventListener("click",(()=>{(0,n.jk)("selection"),(0,n.Jn)(t)}))}let l=!1;function c(){!l&&location.hash&&setTimeout((()=>{const e=window.location.href.split("#")[0];history.replaceState(null,"",e),window.dispatchEvent(new Event("location-changed"))}),50)}function d(e){const t=e.startsWith("#")?window.location.href.split("#")[0]+e:e;history.pushState(null,"",t),window.dispatchEvent(new Event("location-changed"))}function u(e,t){e.editor||(e.hideContentTimeout=setTimeout((()=>{const{sectionRow:t,sectionRowContainer:n}=e;"hui-card"===t?.tagName.toLowerCase()&&(t.hidden=!0,t.style.display="none",n?.classList.contains("card")&&(n.style.display="none"))}),t))}function b(e,t){const{showBackdrop:n,hideBackdrop:o}=L(e);t?n():o()}function p(e,t){if(e.config.background_update)return;const n=t?"appendChild":"removeChild";requestAnimationFrame((()=>{e.verticalStack[n](e.popUp)}))}function h(e,t){requestAnimationFrame((()=>{e.classList.toggle("is-popup-opened",t),e.classList.toggle("is-popup-closed",!t)}))}function m(e,t){e.boundClickOutside||(e.boundClickOutside=t=>function(e,t){(t.config.close_by_clicking_outside??1)&&(e.composedPath().find((e=>e.classList?.contains("bubble-pop-up")||["HA-DIALOG","HA-MORE-INFO-DIALOG","HA-DIALOG-DATE-PICKER"].includes(e.nodeName)))||c())}(t,e)),t?(e.listenersAdded||(e.popUp.addEventListener("touchstart",e.resetCloseTimeout,{passive:!0}),e.listenersAdded=!0),window.clickOutsideListenerAdded||(window.addEventListener("click",e.boundClickOutside,{passive:!0}),window.clickOutsideListenerAdded=!0)):e.listenersAdded&&(e.popUp.removeEventListener("touchstart",e.resetCloseTimeout),e.listenersAdded=!1,!location.hash&&window.clickOutsideListenerAdded&&(window.removeEventListener("click",e.boundClickOutside),window.clickOutsideListenerAdded=!1))}function g(e){document.body.style.overflow=e}function f(e){["hideContentTimeout","removeDomTimeout","closeTimeout"].forEach((t=>clearTimeout(e[t])))}const _="\n .bubble-backdrop {\n position: fixed;\n background-color: var(--bubble-backdrop-background-color);\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 4;\n opacity: 0;\n transition: opacity 0.3s;\n transition-delay: .1s;\n display: flex;\n backdrop-filter: var(--custom-backdrop-filter);\n -webkit-backdrop-filter: var(--custom-backdrop-filter);\n transform: translate3d(0, 0, 0);\n }\n\n .bubble-backdrop.is-visible {\n opacity: 1;\n }\n\n .bubble-backdrop.is-hidden {\n opacity: 0;\n pointer-events: none;\n }\n";let y,v,w,x,k=!1;const C=window.matchMedia("(prefers-color-scheme: dark)"),$=(0,n.az)("style");function S(){x=getComputedStyle(document.body).getPropertyValue("--ha-card-background")||getComputedStyle(document.body).getPropertyValue("--card-background-color"),document.body.style.setProperty("--bubble-backdrop-background-color",(0,t._k)(x,.8,.6))}function L(e){const t=e.config.hide_backdrop??!1;if(y)return y;$.innerHTML=_,document.head.appendChild($);const o=(0,n.az)("style");document.head.appendChild(o);const a=(0,n.az)("div","bubble-backdrop backdrop is-hidden");return t&&(a.style.display="none",a.style.pointerEvents="none"),document.body.appendChild(a),a.style.setProperty("--custom-backdrop-filter",`blur(${e.config.backdrop_blur??0}px)`),y={hideBackdrop:function(){a.classList.add("is-hidden"),a.classList.remove("is-visible")},showBackdrop:function(){requestAnimationFrame((()=>{a.classList.add("is-visible"),a.classList.remove("is-hidden")}))},backdropElement:a,backdropCustomStyle:o},y}function T(e,t,n,o){let a;switch(n){case"hvac_modes":a=document.createElement("ha-icon"),a.slot="graphic",a.icon=function(e){switch(e){case"auto":return"mdi:thermostat-auto";case"cool":return"mdi:snowflake";case"heat":return"mdi:fire";case"heat_cool":return"mdi:sun-snowflake-variant";case"dry":return"mdi:water-percent";case"fan_only":default:return"mdi:fan";case"off":return"mdi:power"}}(o);break;case"fan_modes":if(!t.attributes.fan_modes)return null;a=document.createElement("ha-attribute-icon"),a.slot="graphic",a.attribute="fan_mode",a.attributeValue=o,a.hass=e._hass,a.stateObj=t;break;case"swing_modes":a=document.createElement("ha-attribute-icon"),a.slot="graphic",a.attribute="swing_mode",a.attributeValue=o,a.hass=e._hass,a.stateObj=t;break;case"preset_modes":a=document.createElement("ha-attribute-icon"),a.slot="graphic",a.attribute="preset_mode",a.attributeValue=o,a.hass=e._hass,a.stateObj=t;break;default:a=!1}return a}C.addEventListener("change",S),S();const O="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n mwc-list-item {\n border-radius: var(--bubble-select-list-border-radius, var(--bubble-border-radius, 24px));\n margin: 0 8px;\n }\n mwc-list-item[selected] {\n color: var(--primary-text-color) !important;\n background-color: var(--bubble-list-item-accent-color, var(--bubble-accent-color, var(--accent-color)));\n }\n ha-select {\n --mdc-shape-medium: var(--bubble-select-list-border-radius, var(--bubble-border-radius, 32px));\n --mdc-theme-surface: var(--bubble-select-list-background-color, var(--bubble-select-main-background-color, var(--bubble-main-background-color, var(--card-background-color, var(--secondary-background-color)))));\n --mdc-shape-large: 32px;\n --mdc-shape-small: 64px;\n --mdc-menu-max-width: min-content;\n --mdc-menu-min-width: var(--bubble-select-list-width, 200px);\n --mdc-select-max-width: min-content;\n --mdc-select-outlined-hover-border-color: transparent;\n --mdc-select-outlined-idle-border-color: transparent;\n --mdc-theme-primary: transparent;\n --right-value: calc(var(--mdc-menu-min-width) - 154px);\n }\n .mdc-select {\n color: transparent !important;\n width: 150px !important;\n position: absolute !important;\n pointer-events: none;\n right: var(--right-value, 46px);\n top: -28px;\n }\n .mdc-menu, mwc-list, .mdc-list-item {\n pointer-events: auto;\n }\n .mdc-select__dropdown-icon {\n display: none !important;\n }\n .mdc-select__selected-text {\n color: transparent !important;\n }\n .mdc-select__anchor {\n width: 100%;\n pointer-events: none;\n }\n .bubble-dropdown-container {\n display: flex !important;\n width: auto;\n height: 100%;\n align-items: center;\n }\n .bubble-dropdown-arrow {\n display: flex;\n position: absolute;\n background: var(--bubble-select-arrow-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n height: 36px;\n width: 36px;\n right: 6px;\n pointer-events: none;\n border-radius: var(--bubble-select-button-border-radius, var(--bubble-border-radius, 20px));\n align-items: center;\n justify-content: center;\n transition: background 0.2s, transform 0.2s;\n pointer-events: none;\n }\n .bubble-dropdown-select {\n position: relative;\n width: 42px;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n .bubble-select-card-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-select-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-select-box-shadow, var(--bubble-box-shadow, none));\n touch-action: pan-y;\n box-sizing: border-box;\n border: solid 2px transparent;\n transition: all 0.15s;\n cursor: pointer;\n }\n .bubble-select-card,\n .bubble-select-background {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n }\n .bubble-select-background {\n background-color: var(--bubble-select-background-color);\n opacity: .5;\n overflow: hidden !important;\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n }\n .is-unavailable .bubble-select-card {\n cursor: not-allowed;\n }\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n margin: 6px;\n border-radius: var(--bubble-select-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-select-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n }\n .bubble-icon-container::after {\n content: '';\n background-color: currentColor;\n position: absolute;\n display: block;\n width: 100%;\n height: 100%;\n transition: all 1s;\n left: 0;\n right: 0;\n opacity: 0;\n pointer-events: none;\n }\n\n .bubble-icon {\n display: flex;\n opacity: 0.6;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 18px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin: 0 16px 0 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-weight: 600;\n }\n\n .bubble-state {\n font-size: 12px;\n font-weight: normal;\n opacity: 0.7;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-select-card-container {\n height: 56px;\n border-radius: var(--bubble-select-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 6px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";function z(e,t=e.elements,o){t.dropdownContainer=(0,n.az)("div","bubble-dropdown-container"),t.dropdownSelect=(0,n.az)("ha-select","bubble-dropdown-select"),t.dropdownSelect.setAttribute("outlined",""),t.dropdownArrow=(0,n.az)("ha-icon","bubble-dropdown-arrow"),t.dropdownArrow.setAttribute("icon","mdi:chevron-down"),t.dropdownContainer.appendChild(t.dropdownArrow),t.dropdownStyleElement=(0,n.az)("style"),t.dropdownCustomStyleElement=(0,n.az)("style"),t.dropdownStyleElement.textContent=O,t.dropdownSelect.updateComplete.then((()=>{!function(){if(t.dropdownSelect.shadowRoot)if(t!==e.elements){t.dropdownSelectStyleElement=(0,n.az)("style"),t.dropdownSelectStyleElement.textContent=O,t.dropdownSelect.shadowRoot.appendChild(t.dropdownSelectStyleElement),t.dropdownContainer.appendChild(t.dropdownStyleElement),o&&(t.dropdownContainer.style.width="24px"),t.dropdownArrow.style.height="20px",t.dropdownArrow.style.width="20px",t.mainContainer=t.parentElement.parentElement.parentElement;let e=t.dropdownSelect.shadowRoot.querySelector("mwc-menu");e&&(e.style.position="relative",e.style.right="138px")}else t.dropdownSelect.shadowRoot.appendChild(t.dropdownStyleElement),t.dropdownSelect.shadowRoot.appendChild(t.dropdownCustomStyleElement)}()})),t===e.elements?t.selectCard.appendChild(t.dropdownContainer):t.appendChild(t.dropdownContainer)}function E(e,t=e.elements,n=e.config.entity,o=e.config){const{dropdownArrow:a,dropdownSelect:i,selectCardContainer:r,selectBackground:s}=t,l=t===e.elements?r:t,c=t===e.elements?s:t;t!==e.elements&&(l.style.border="solid 2px rgba(0,0,0,0)");let d=!0;c.addEventListener("click",(e=>{if("mwc-list-item"===e.target.tagName.toLowerCase())return;const n=i.shadowRoot.querySelector("mwc-menu"),o=()=>{a.style.transform="rotate(180deg)",t.dropdownArrow.style.background="var(--accent-color)",l.style.border="var(--bubble-select-border, solid 2px var(--accent-color))",t.mainContainer&&(t.mainContainer.style.overflow="visible")};d?(d=!1,a.style.transition="none",n.setAttribute("open",""),requestAnimationFrame((()=>{n.removeAttribute("open"),setTimeout((()=>{a.style.transition="",o()}),140)}))):(n.hasAttribute("open")||(n.removeAttribute("mdc-menu-surface--is-open-below"),n.setAttribute("mdc-menu-surface--is-open-above",""),n.setAttribute("open","")),o())})),i.addEventListener("closed",(e=>{e.stopPropagation(),e.preventDefault(),a.style.transform="rotate(0deg)",l.style.border="solid 2px rgba(0,0,0,0)",t.dropdownArrow.style.background="",t.mainContainer&&(t.mainContainer.style.overflow="")})),t.dropdownSelect.addEventListener("click",(t=>{const a=t.target.value;!function(e,t,n,o){const a=t?.split(".")[0];switch(a){case"input_select":e._hass.callService("input_select","select_option",{entity_id:t,option:n});break;case"select":e._hass.callService("select","select_option",{entity_id:t,option:n});break;case"climate":switch(o.select_attribute){case"hvac_modes":e._hass.callService("climate","set_hvac_mode",{entity_id:t,hvac_mode:n});break;case"fan_modes":e._hass.callService("climate","set_fan_mode",{entity_id:t,fan_mode:n});break;case"swing_modes":e._hass.callService("climate","set_swing_mode",{entity_id:t,swing_mode:n});break;case"preset_modes":e._hass.callService("climate","set_preset_mode",{entity_id:t,preset_mode:n})}break;case"fan":"preset_modes"===o.select_attribute&&e._hass.callService("fan","set_preset_mode",{entity_id:t,preset_mode:n});break;case"light":"effect_list"===o.select_attribute&&e._hass.callService("light","turn_on",{entity_id:t,effect:n});break;case"media_player":switch(o.select_attribute){case"source_list":e._hass.callService("media_player","select_source",{entity_id:t,source:n});break;case"sound_mode_list":e._hass.callService("media_player","select_sound_mode",{entity_id:t,sound_mode:n})}break;default:console.warn(`Unsupported entity type: ${a}`)}}(e,n,a,o)}))}function B(e,t=e.elements,n=e.config.entity,o){if(t.currentState=e._hass.states[n]?.state,!t.currentState)return;if(t.currentList=n?.startsWith("input_select")||n?.startsWith("select")?e._hass.states[n].attributes.options:e._hass.states[n].attributes[o.select_attribute],t.previousList===t.currentList&&t.previousState===t.currentState)return;let a=t.currentList;for(t.currentState;t.dropdownSelect.firstChild;)t.dropdownSelect.removeChild(t.dropdownSelect.firstChild);a.forEach((a=>{const i=document.createElement("mwc-list-item");i.value=a;const r=T(e,e._hass.states[n],o.select_attribute,a);r&&(i.graphic="icon",i.appendChild(r));const s=function(e,t,n,o){switch(n){case"fan_modes":return e._hass.formatEntityAttributeValue(t,"fan_mode",o);case"hvac_modes":return e._hass.formatEntityState(t,o);case"swing_modes":return e._hass.formatEntityAttributeValue(t,"swing_mode",o);case"preset_modes":return e._hass.formatEntityAttributeValue(t,"preset_mode",o);default:return function(e){const t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}(o)}}(e,e._hass.states[n],o.select_attribute,a);i.appendChild(document.createTextNode(s)),a===function(e,t){switch(t){case"fan_modes":return e.attributes.fan_mode||null;case"swing_modes":return e.attributes.swing_mode||null;case"preset_modes":return e.attributes.preset_mode||null;case"effect_list":return e.attributes.effect||null;case"source_list":return e.attributes.source||null;case"sound_mode_list":return e.attributes.sound_mode||null;default:return e.state}}(e._hass.states[n],o.select_attribute)&&i.setAttribute("selected",""),t.dropdownSelect.appendChild(i),t.previousList=t.currentList,t.previousState=t.currentState})),t.dropdownContainer.appendChild(t.dropdownSelect)}function A(e,t){try{if(e.states[t])return e.states[t]?.state}catch{}}function I(e,t){const n=e.entity&&t.states[e.entity]?t.states[e.entity].state:"unavailable";let o=e.state??e.state_not;if(Array.isArray(o)){const e=o.map((e=>A(t,e))).filter((e=>void 0!==e));o=[...o,...e]}else if("string"==typeof o){const e=A(t,o);o=[o],e&&o.push(e)}return null!=e.state?V(o).includes(n):!V(o).includes(n)}function V(e){return void 0===e||Array.isArray(e)?e:[e]}function P(e,t){return e.every((e=>{if("condition"in e)switch(e.condition){case"screen":return!!(n=e).media_query&&matchMedia(n.media_query).matches;case"user":return function(e,t){return!(!e.users||!t.user?.id)&&e.users.includes(t.user.id)}(e,t);case"numeric_state":return function(e,t){const n=(e.entity?t.states[e.entity]:void 0)?.state;let o=e.above,a=e.below;"string"==typeof o&&(o=A(t,o)??o),"string"==typeof a&&(a=A(t,a)??a);const i=Number(n),r=Number(o),s=Number(a);return!isNaN(i)&&(null==e.above||isNaN(r)||ri)}(e,t);case"and":return function(e,t){return!e.conditions||P(e.conditions,t)}(e,t);case"or":return function(e,t){return!e.conditions||e.conditions.some((e=>P([e],t)))}(e,t);default:return I(e,t)}var n;return I(e,t)}))}function D(e){return null!=e.entity&&(null!=e.state||null!=e.state_not)}function U(e){return e.every((e=>{if("condition"in e)switch(e.condition){case"screen":return null!=e.media_query;case"user":return null!=e.users;case"numeric_state":return function(e){return null!=e.entity&&(null!=e.above||null!=e.below)}(e);case"and":case"or":return function(e){return null!=e.conditions}(e);default:return D(e)}return D(e)}))}function H(e){const t=e._hass.states[e.config.entity],o=(0,n.IL)(e,e.config.attribute,e.config.entity),a=t?.last_changed,i="state"===e.config.button_type,r=e.config.show_name??!0,s=e.config.show_icon??!0,l=e.config.show_state??i,c=e.config.show_attribute??i,d=e.config.show_last_changed??e.config.show_last_updated??!1,u=e.config.scrolling_effect??!0,b=e.previousConfig||{};if(e.previousState===t&&e.previousAttribute===o&&e.previousLastChanged===a&&b.showName===r&&b.showIcon===s&&b.showState===l&&b.showAttribute===c&&b.showLastChanged===d&&b.scrollingEffect===u)return;let p=t&&l?e._hass.formatEntityState(t):"",h="",m="",g="";var f;c&&o&&(h=t?e._hass.formatEntityAttributeValue(t,e.config.attribute)??o:""),d&&t&&(m=t?(f=(0,n.o0)(a,e._hass.locale.language)).charAt(0).toUpperCase()+f.slice(1):""),e.elements.stateStyles||(e.elements.stateStyles=(0,n.az)("style"),e.elements.stateStyles.innerText=M,e.content.appendChild(e.elements.stateStyles),"pop-up"===e.config.card_type&&e.elements.buttonContainer.appendChild(e.elements.stateStyles)),g=[p,h,m].filter((e=>e)).join(" • "),r?e.elements.name.classList.remove("hidden"):e.elements.name.classList.add("hidden"),s?(e.elements.iconContainer.classList.remove("hidden"),e.elements.nameContainer.classList.remove("name-without-icon")):(e.elements.iconContainer.classList.add("hidden"),e.elements.nameContainer.classList.add("name-without-icon")),(l||d||c)&&!r?e.elements.state.classList.add("state-without-name"):e.elements.state.classList.remove("state-without-name"),l||d||c?(e.elements.state.classList.add("display-state"),e.elements.state.classList.remove("hidden")):(e.elements.state.classList.remove("display-state"),e.elements.state.classList.add("hidden")),(0,n.GP)(e,e.elements.state,g),e.previousState=t,e.previousAttribute=o,e.previousConfig={showName:r,showIcon:s,showState:l,showAttribute:c,showLastChanged:d,scrollingEffect:u}}const M="\n .hidden {\n display: none !important;\n }\n\n .state-without-name {\n opacity: 1;\n font-size: 14px;\n }\n\n .name-without-icon {\n margin-left: 16px;\n }\n\n .display-state {\n display: flex;\n }\n";function N(e,t=e.content,o=t.firstChild.firstChild,i=!1){const r=e.config.sub_button;if(!r)return;e.previousValues=e.previousValues||{};let l=[...e.previousValues.subButtons||[]];e.elements=e.elements||{};const c=e.elements.subButtonContainer??(0,n.az)("div","bubble-sub-button-container");if(!e.elements.subButtonContainer&&e.config.sub_button){const t=(0,n.az)("style");t.innerText=j,c.appendChild(t),i?o.prepend(c):o.appendChild(c),e.elements.subButtonContainer=c}r.forEach(((t,o)=>{if(!t)return;const i=o+1,r=t.entity??e.config.entity,l=e._hass.states[r],d=t.name??(0,n.IL)(e,"friendly_name",r)??"",u=t.attribute??"",b=(0,n.IL)(e,u,r),p=(0,n.pr)(e,r);if("fan_modes"===u&&null==b)return void(e.elements[i]||(0,n.az)("div","bubble-sub-button bubble-sub-button-"+i)).classList.add("hidden");const h=t.show_name??!1,m=t.show_state??!1,g=t.show_attribute??!1,f=(t.show_last_changed||t.show_last_updated)??!1,_=t.show_icon??!0,y=t.show_background??!0,v=t.state_background??!0,w=t.light_background??!0,x=t.show_arrow??!0,k=r?.startsWith("input_select")||r?.startsWith("select")||t.select_attribute,C=(0,n.q7)(e,t.entity,t.icon??"");let $=e.elements[i]||(0,n.az)("div","bubble-sub-button bubble-sub-button-"+i);if(!e.elements[i]||k&&!$.contains($.dropdownContainer)){let o=Array.prototype.indexOf.call(c.children,$);k&&!$.contains($.dropdownContainer)&&c.contains($)&&(c.removeChild($),$=(0,n.az)("div","bubble-sub-button bubble-sub-button-"+i)),$.nameContainer=(0,n.az)("div","bubble-sub-button-name-container"),$.feedbackContainer=(0,n.az)("div","bubble-feedback-container"),$.feedback=(0,n.az)("div","bubble-feedback-element feedback-element"),$.appendChild($.feedbackContainer),$.feedbackContainer.appendChild($.feedback),k&&(z(e,$,x),$.dropdownContainer.style.display="none",E(e,$,r,t)),$.appendChild($.nameContainer),o>=0&&oe.hasAttribute("selected")))?.value;if(_&&C){let o=$.icon;if(o||(o=(0,n.az)("ha-icon","bubble-sub-button-icon"),o.classList.add("show-icon"),$.appendChild(o),$.icon=o),S){const n=T(e,l,t.select_attribute,S);n&&!t.icon?(o.tagName!==n.tagName||o.icon!==n.icon||o.attribute!==n.attribute||o.attributeValue!==n.attributeValue)&&($.replaceChild(n,o),$.icon=n,o=n):o.icon!==C&&o.setAttribute("icon",C)}else o.icon!==C&&o.setAttribute("icon",C);$.icon.classList.remove("hidden"),$.icon.classList.add("bubble-sub-button-icon","show-icon")}else $.icon&&($.icon.classList.remove("show-icon"),$.icon.classList.add("hidden"));if(y)if(p&&v){const t=(0,n.Vv)("var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))))");w&&$.style.setProperty("--bubble-sub-button-light-background-color",(0,n.mk)(e,r,t?1:.8)),$.classList.add("background-on"),$.classList.remove("background-off")}else $.classList.add("background-off"),$.classList.remove("background-on");else $.classList.remove("background-on"),$.classList.remove("background-off");"none"===t.tap_action?.action&&"none"===t.double_tap_action?.action&&"none"===t.hold_action?.action||$.actionAdded||(a($,k?"":t,r,{tap_action:{action:k?"none":"more-info"},double_tap_action:{action:"none"},hold_action:{action:"none"}}),s($,$.feedback),k&&($.style.pointerEvents="auto",$.style.cursor="pointer"),$.actionAdded=!0);let L="";const O=l&&m?e._hass.formatEntityState(l):"",A=l&&""!==b&&g?e._hass.formatEntityAttributeValue(l,u)??b:"",I=l&&f?(0,n.o0)(l.last_changed,e._hass.locale.language):"";h&&""!==d&&(L+=d),""!==O&&(L+=(L?" · ":"")+O),""!==I&&(L+=(L?" · ":"")+I),""!==A&&(L+=(L?" · ":"")+A),L=L.charAt(0).toUpperCase()+L.slice(1),L||_||k?($.classList.remove("hidden"),$.nameContainer.innerText!==L&&($.nameContainer.innerText=L),_&&$.icon&&(L?($.icon.classList.add("icon-with-state"),$.icon.classList.remove("icon-without-state")):($.icon.classList.add("icon-without-state"),$.icon.classList.remove("icon-with-state"))),L||_||!k?k&&($.dropdownContainer.classList.remove("no-icon-select-container"),$.dropdownArrow.classList.remove("no-icon-select-arrow")):($.dropdownContainer.classList.add("no-icon-select-container"),$.dropdownArrow.classList.add("no-icon-select-arrow"))):($.classList.add("hidden"),$.dropdownContainer&&($.dropdownContainer.classList.remove("no-icon-select-container"),$.dropdownArrow.classList.remove("no-icon-select-arrow")));const D=t.visibility;if(null!=D){const t=V(D);U(t)&&(P(t,e._hass)?$.classList.remove("hidden"):$.classList.add("hidden"))}})),e.previousValues.subButtons=r.slice();for(let t=l.length;t>0;t--)if(t>r.length){let n=e.elements[t];n&&(c.removeChild(n),delete e.elements[t])}}const j="\n .bubble-sub-button-container {\n position: relative;\n display: flex;\n justify-content: end;\n right: 8px;\n align-content: center;\n gap: 8px;\n align-items: center;\n }\n .bubble-sub-button {\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row-reverse;\n align-items: center;\n justify-content: center;\n position: relative;\n right: 0;\n box-sizing: border-box;\n width: min-content;\n min-width: 36px;\n height: 36px;\n vertical-align: middle;\n font-size: 12px;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n padding: 0 8px;\n white-space: nowrap;\n transition: all 0.5s ease-in-out;\n color: var(--primary-text-color);\n }\n .bubble-feedback-container {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n pointer-events: none;\n }\n .bubble-sub-button-name-container {\n display: flex;\n }\n .show-icon {\n display: flex;\n --mdc-icon-size: 16px;\n }\n .background-on {\n background-color: var(--bubble-sub-button-light-background-color, var(--accent-color));\n }\n .background-off {\n background-color: var(--bubble-sub-button-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n }\n .hidden {\n display: none;\n }\n .icon-with-state {\n margin-right: 4px;\n --mdc-icon-size: 16px;\n }\n .icon-without-state {\n margin-right: 0;\n --mdc-icon-size: 20px;\n }\n .no-icon-select-arrow {\n width: 28px !important;\n height: 28px !important;\n right: 2px !important; \n }\n .no-icon-select-container {\n width: 16px !important;\n }\n .bubble-dropdown-arrow {\n background: var(--bubble-select-arrow-background-color) !important;\n }\n";function q(e){Array.isArray(e.subButtonIcon)||(e.subButtonIcon=[]),"pop-up"===e.config.card_type?e.popUp.querySelectorAll(".bubble-sub-button-icon").forEach(((t,n)=>{e.subButtonIcon[n]=t})):e.content.querySelectorAll(".bubble-sub-button-icon").forEach(((t,n)=>{e.subButtonIcon[n]=t}))}function F(e){let t=e.config.button_type;return"custom"===t&&(console.error('Buttons "custom" have been removed. Use either "switch", "slider", "state" or "name"'),t=""),e.config.entity?t||"switch":t||"name"}function X(e,t){const o=e._hass.states[e.config.entity];if((0,n.OC)(e,"light"))e._hass.callService("light","turn_on",{entity_id:e.config.entity,brightness:Math.round(255*t/100)});else if((0,n.OC)(e,"media_player"))e._hass.callService("media_player","volume_set",{entity_id:e.config.entity,volume_level:(t/100).toFixed(2)});else if((0,n.OC)(e,"cover"))e._hass.callService("cover","set_cover_position",{entity_id:e.config.entity,position:Math.round(t)});else if((0,n.OC)(e,"input_number")){const a=o.attributes.min??0,i=o.attributes.max??100,r=(0,n.IL)(e,"step")??1;let s=(i-a)*t/100+a,l=Math.round(s/r)*r;e._hass.callService("input_number","set_value",{entity_id:e.config.entity,value:l})}else if((0,n.OC)(e,"fan")){const n=o.attributes.percentage_step??1;let a=Math.round(t/n)*n;e._hass.callService("fan","set_percentage",{entity_id:e.config.entity,percentage:a})}else if((0,n.OC)(e,"climate")){const n=o.attributes.min_temp??0,a=o.attributes.max_temp??1e4,i="°C"===e._hass.config.unit_system.temperature,r=o.attributes.target_temp_step?o.attributes.target_temp_step:i?.5:1;let s=(a-n)*t/100+n,l=Math.round(s/r)*r;l=parseFloat(l.toFixed(1)),e._hass.callService("climate","set_temperature",{entity_id:e.config.entity,temperature:l})}else if((0,n.OC)(e,"number")){const n=o.attributes.min??0,a=o.attributes.max??100,i=o.attributes.step??1;let r=(a-n)*t/100+n,s=Math.round(r/i)*i;e._hass.callService("number","set_value",{entity_id:e.config.entity,value:s})}}function W(e,t){const n=e.elements.rangeSlider.getBoundingClientRect(),o=100*(t-n.left)/n.width,a=Math.min(100,Math.max(0,o));return e.elements.rangeFill.style.transform=`translateX(${a}%)`,a}const R="\n * {\n -webkit-tap-highlight-color: transparent !important;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n }\n *::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-button-card-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-button-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-button-box-shadow, var(--bubble-box-shadow, none));\n overflow: scroll;\n touch-action: pan-y;\n }\n\n .bubble-button-card,\n .bubble-range-slider,\n .bubble-button-background {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n }\n .bubble-button-background {\n background-color: var(--bubble-button-background-color);\n opacity: .5;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n }\n .bubble-range-fill {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n left: -100%;\n transition: all .3s;\n z-index: 0;\n }\n .is-dragging .bubble-range-fill {\n transition: none;\n }\n .is-light .bubble-range-fill {\n opacity: 0.5;\n }\n .is-unavailable .bubble-button-card,\n .is-unavailable .bubble-range-slider {\n cursor: not-allowed;\n }\n .bubble-range-slider {\n cursor: ew-resize;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n mask-image: radial-gradient(white, black);\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n }\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n margin: 6px;\n border-radius: var(--bubble-button-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-button-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n }\n\n .bubble-icon {\n display: flex;\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 18px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin: 0 16px 0 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n font-weight: 600;\n }\n\n .bubble-state {\n font-size: 12px;\n font-weight: normal;\n opacity: 0.7;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-button-card-container {\n height: 56px;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";function Y(e,t=e.content,o=t){const i=F(e);e.cardType!==`button-${i}`&&e.buttonType!==i&&(function(e,t=e.content,o=t){const a=F(e);e.dragging=!1,e.elements||(e.elements={}),e.elements.buttonCardContainer=(0,n.az)("div","bubble-button-card-container button-container"),e.elements.buttonCard=(0,n.az)("div","bubble-button-card switch-button"),e.elements.buttonBackground=(0,n.az)("div","bubble-button-background"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container icon-container"),e.elements.name=(0,n.az)("div","bubble-name name"),e.elements.state=(0,n.az)("div","bubble-state state"),e.elements.feedback=(0,n.az)("div","bubble-feedback-element feedback-element"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.feedback.style.display="none",e.elements.style.innerText=R,e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),"name"!==a&&e.elements.nameContainer.appendChild(e.elements.state),e.elements.buttonCard.appendChild(e.elements.buttonBackground),e.elements.buttonCard.appendChild(e.elements.iconContainer),e.elements.buttonCard.appendChild(e.elements.nameContainer),e.elements.buttonCard.appendChild(e.elements.feedback),e.elements.buttonCardContainer.appendChild(e.elements.buttonCard),t.innerHTML="",o===t&&t.appendChild(e.elements.buttonCardContainer),t.appendChild(e.elements.style),t.appendChild(e.elements.customStyle),o!==t?(o.innerHTML="",e.elements.buttonCardContainer.appendChild(t),o.appendChild(e.elements.buttonCardContainer),e.buttonType=a):e.cardType=`button-${a}`}(e,t,o),"switch"===i?function(e){a(e.elements.iconContainer,e.config),a(e.elements.buttonBackground,e.config.button_action,e.config.entity,{tap_action:{action:"toggle"},double_tap_action:{action:"toggle"},hold_action:{action:"more-info"}}),s(e.elements.buttonBackground,e.elements.feedback)}(e):"slider"===i?function(e){a(e.elements.iconContainer,e.config);let t=0,o=null;e.elements.rangeFill=(0,n.az)("div","bubble-range-fill range-fill"),e.elements.rangeSlider=(0,n.az)("div","bubble-range-slider range-slider"),e.elements.rangeSlider.appendChild(e.elements.rangeFill),e.elements.buttonCardContainer.appendChild(e.elements.rangeSlider),e.elements.buttonCardContainer.insertBefore(e.elements.rangeSlider,e.elements.buttonCard),e.elements.buttonCard.style.cursor="ew-resize",e.elements.buttonCardContainer.addEventListener("pointercancel",(function(){clearTimeout(o),e.dragging=!1,e.elements.buttonCardContainer.classList.remove("is-dragging"),e.elements.buttonCardContainer.removeEventListener("pointermove",r),window.removeEventListener("pointerup",s)})),e.elements.buttonCardContainer.addEventListener("pointerdown",(n=>{n.target.closest(".bubble-action")||(e.elements.buttonCardContainer.setPointerCapture(n.pointerId),e.card.classList.contains("is-unavailable")||(e.dragging=!0,t=n.pageX||(n.touches?n.touches[0].pageX:0),e.elements.buttonCardContainer.classList.add("is-dragging"),e.elements.buttonCardContainer.addEventListener("pointermove",r),window.addEventListener("pointerup",s)))}));const i=(0,n.P2)(X,200);function r(t){if(t.stopPropagation(),t.target.closest(".bubble-action"))return;const n=t.pageX||(t.touches?t.touches[0].pageX:0),o=W(e,n);e.config.slider_live_update&&i(e,o)}function s(t){t.stopPropagation(),clearTimeout(o),o=setTimeout((()=>{e.dragging=!1}),1400);const a=t.pageX||(t.touches?t.touches[0].pageX:0),i=W(e,a);e.config.slider_live_update||X(e,i),(0,n.jk)("selection"),e.elements.buttonCardContainer.classList.remove("is-dragging"),e.elements.buttonCardContainer.removeEventListener("pointermove",r),window.removeEventListener("pointerup",s)}}(e):"state"===i?function(e){a(e.elements.buttonCardContainer,e.config),a(e.elements.buttonBackground,e.config.button_action,e.config.entity,{tap_action:{action:"more-info"},double_tap_action:{action:"more-info"},hold_action:{action:"more-info"}}),s(e.elements.buttonBackground,e.elements.feedback)}(e):"name"===i&&function(e){const t={tap_action:{action:"none"},double_tap_action:{action:"none"},hold_action:{action:"none"}};a(e.elements.iconContainer,e.config,e.config.entity,t),a(e.elements.buttonBackground,e.config.button_action,e.config.entity,t),s(e.elements.buttonBackground,e.elements.feedback)}(e)),"name"!==i&&(function(e){const t=(0,n.y0)(e),o=e.config.card_type;"unavailable"===t?"button"===o?e.card.classList.add("is-unavailable"):"pop-up"===o&&e.elements.headerContainer.classList.add("is-unavailable"):"button"===o?e.card.classList.remove("is-unavailable"):"pop-up"===o&&e.elements.headerContainer.classList.remove("is-unavailable"),(0,n.pr)(e)?"button"===o?e.card.classList.add("is-on"):"pop-up"===o&&e.elements.headerContainer.classList.add("is-on"):"button"===o?e.card.classList.remove("is-on"):"pop-up"===o&&e.elements.headerContainer.classList.remove("is-on")}(e),function(e){const t=e.config.card_type,o=F(e),a=(0,n.OC)(e,"light"),i=(0,n.pr)(e),r=(0,n.mk)(e),s="button"===t?e.card.style.getPropertyValue("--bubble-button-background-color"):e.popUp.style.getPropertyValue("--bubble-button-background-color"),l=e.elements.buttonBackground.style.opacity;let c="",d="";"switch"===o&&i?r&&a?(c=(0,n.mk)(e),d=".5"):(c="var(--bubble-button-accent-color, var(--bubble-accent-color, var(--accent-color)))",d="1"):(c="rgba(0, 0, 0, 0)",d=".5"),s!==c&&("button"===t?e.card.style.setProperty("--bubble-button-background-color",c):"pop-up"===t&&e.popUp.style.setProperty("--bubble-button-background-color",c)),l!==d&&(e.elements.buttonBackground.style.opacity=d)}(e),function(e){if("slider"===F(e)){if(e.elements.rangeFill.style.backgroundColor=(0,n.mk)(e),e.dragging)return;let t=0;if((0,n.OC)(e,"light"))t=100*(0,n.IL)(e,"brightness")/255;else if((0,n.OC)(e,"media_player"))t=(0,n.pr)(e)?100*(0,n.IL)(e,"volume_level"):0;else if((0,n.OC)(e,"cover"))t=(0,n.IL)(e,"current_position");else if((0,n.OC)(e,"input_number")){const o=(0,n.IL)(e,"min"),a=(0,n.IL)(e,"max");t=100*((0,n.y0)(e)-o)/(a-o)}else if((0,n.OC)(e,"fan"))t=(0,n.pr)(e)?(0,n.IL)(e,"percentage"):0;else if((0,n.OC)(e,"climate")){const o=(0,n.IL)(e,"min_temp"),a=(0,n.IL)(e,"max_temp");t=100*((0,n.IL)(e,"temperature")-o)/(a-o)}else if((0,n.OC)(e,"number")){const o=(0,n.IL)(e,"min"),a=(0,n.IL)(e,"max");t=100*((0,n.y0)(e)-o)/(a-o)}e.elements.rangeFill.style.transform=`translateX(${t}%)`}}(e)),function(e){const t=F(e),o="name"!==t&&(0,n.pr)(e),a="name"!==t?(0,n.q7)(e):e.config.icon,i="name"!==t?(0,n.gJ)(e):"",r="name"!==t&&(0,n.OC)(e,"light"),s=e.elements.iconContainer.style.color,l=e.elements.image.style.backgroundImage,c=e.elements.icon.icon,d=e.elements.icon.style.display,u=e.elements.image.style.display;if(r&&o){const t=`var(--bubble-icon-background-color, ${(0,n.mk)(e)})`;s!==t&&(e.elements.iconContainer.style.color=t)}else""!==s&&(e.elements.iconContainer.style.color="");if(""!==i){const t="url("+i+")";l!==t&&(e.elements.image.style.backgroundImage=t),"none"!==d&&(e.elements.icon.style.display="none"),""!==u&&(e.elements.image.style.display="")}else if(""!==a){c!==a&&(e.elements.icon.icon=a);const i=o&&"state"!==t?(0,n.mk)(e):"inherit";e.elements.icon.style.color!==i&&(e.elements.icon.style.color=i),""!==d&&(e.elements.icon.style.display=""),"none"!==u&&(e.elements.image.style.display="none")}else"none"!==d&&(e.elements.icon.style.display="none"),"none"!==u&&(e.elements.image.style.display="none")}(e),H(e),N(e,t,e.elements.buttonCard),"pop-up"!==e.cardType&&function(e){if(q(e),(0,n.jx)(e),!e.config.styles)return;const t=(0,n.y0)(e);let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card","name",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card,e.card.name):""}catch(e){throw new Error(`Error in generating button custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t="name"!==F(e)?(0,n.oY)(e):e.config.name;t!==e.elements.previousName&&((0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e)}async function J(e){if("pop-up"!==e.cardType){if(e.getRootNode()instanceof ShadowRoot==0)return;!function(e){try{e.cardType="pop-up",e.verticalStack=e.getRootNode(),e.sectionRow=e.verticalStack.host.parentElement,e.sectionRowContainer=e.sectionRow?.parentElement,e.popUp=e.verticalStack.querySelector("#root"),e.popUp.classList.add("bubble-pop-up","pop-up","is-popup-closed"),e.editor||e.config.background_update||e.verticalStack.removeChild(e.popUp),e.elements={},L(e),e.cardTitle&&(e.cardTitle.style.display="none"),k=k||(e.config.hide_backdrop??!0),e.popUp.style.setProperty("--custom-height-offset-desktop",e.config.margin_top_desktop??"0px"),e.popUp.style.setProperty("--custom-height-offset-mobile",e.config.margin_top_mobile??"0px"),e.popUp.style.setProperty("--custom-margin",`-${e.config.margin??"7px"}`),e.popUp.style.setProperty("--custom-popup-filter",e.config.backdrop_blur&&"0"!==e.config.backdrop_blur?"none":`blur(${e.config.bg_blur??10}px)`),e.popUp.style.setProperty("--custom-shadow-opacity",(e.config.shadow_opacity??0)/100);const t=function(e){return()=>{e.config.hash===location.hash?(l=!0,setTimeout((()=>{l=!1}),100),function(e){e.popUp.classList.contains("is-popup-opened")||(f(e),p(e,!0),requestAnimationFrame((()=>{b(e,!0),h(e.popUp,!0),function(e){const{sectionRow:t,sectionRowContainer:n,popUp:o}=e;o.style.transform="","hui-card"===t?.tagName.toLowerCase()&&(t.hidden=!1,t.style.display="",n?.classList.contains("card")&&(n.style.display=""))}(e)})),m(e,!0),e.config.auto_close>0&&(e.closeTimeout=setTimeout(c,e.config.auto_close)),g("hidden"),e.config.open_action&&o(e.popUp,e.config,"open_action"))}(e)):function(e){e.popUp.classList.contains("is-popup-opened")&&(f(e),h(e.popUp,!1),b(e,!1),e.removeDomTimeout=setTimeout((()=>{p(e,!1),u(e,0)}),300),m(e,!1),g(""),e.config.close_action&&o(e,e.config,"close_action"))}(e)}}(e);window.addEventListener("location-changed",t),window.addEventListener("popstate",t)}catch(e){console.error(e)}}(e),function(e){e.elements={closeIcon:(0,n.az)("ha-icon","bubble-close-icon"),closeButton:(0,n.az)("button","bubble-close-button close-pop-up"),buttonContainer:(0,n.az)("div","bubble-button-container"),header:(0,n.az)("div","bubble-header")},e.elements.closeIcon.icon="mdi:close",e.elements.closeButton.appendChild(e.elements.closeIcon),e.elements.closeButton.addEventListener("click",(()=>{c(),(0,n.jk)("selection")}));const t=e.popUp.querySelector(".bubble-header-container");t?Object.assign(e.elements,{headerContainer:t,closeIcon:t.querySelector(".bubble-close-icon"),closeButton:t.querySelector(".bubble-close-button"),buttonContainer:t.querySelector(".bubble-button-container"),header:t.querySelector(".bubble-header")}):(e.elements.headerContainer=(0,n.az)("div","bubble-header-container"),e.elements.headerContainer.setAttribute("id","header-container"),e.elements.headerContainer.appendChild(e.elements.header),e.elements.headerContainer.appendChild(e.elements.closeButton),e.elements.header.appendChild(e.elements.buttonContainer)),e.popUp.addEventListener("touchstart",(e=>{v=e.touches[0].clientY}),{passive:!0}),e.elements.header.addEventListener("touchmove",(t=>{const n=t.touches[0].clientY-v;n>0&&(e.popUp.style.transform=`translateY(${n}px)`)}),{passive:!0}),e.elements.header.addEventListener("touchend",(t=>{t.changedTouches[0].clientY-v>50?c():e.popUp.style.transform=""}),{passive:!0})}(e),function(e){try{e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .bubble-pop-up-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n margin-top: -50px;\n max-width: 100%;\n padding-top: 40px;\n padding-bottom: 80px;\n grid-gap: 14px;\n gap: 14px;\n column-gap: 14px;\n --grid-gap: 14px;\n --vertical-stack-card-gap: 14px;\n --horizontal-stack-card-gap: 14px;\n --stack-card-gap: 14px;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n overflow-y: auto; \n overflow-x: hidden; \n grid-auto-rows: min-content;\n mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 40px), transparent 100%);\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 40px), transparent 100%);\n padding: 18px 18px calc(140px + var(--custom-height-offset-mobile)) 18px;\n }\n .bubble-pop-up-container > * {\n flex-shrink: 0 !important;\n }\n .bubble-pop-up.card-content {\n width: 100% !important;\n padding: 0 !important;\n }\n .bubble-pop-up {\n transition: transform 0.3s ease;\n position: fixed;\n width: 100%;\n max-width: 100%;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) 0 0;\n box-sizing: border-box;\n margin-left: var(--custom-margin);\n left: 7px;\n z-index: 5 !important;\n bottom: calc(-56px - var(--custom-height-offset-mobile));\n }\n .bubble-pop-up-background {\n width: 100%;\n height: 100%;\n display: flex;\n top: 0;\n left: 0;\n position: absolute;\n background-color: var(--bubble-pop-up-main-background-color, var(--bubble-pop-up-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color)))));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) 0 0;\n backdrop-filter: var(--custom-popup-filter);\n -webkit-backdrop-filter: var(--custom-popup-filter);\n }\n .bubble-pop-up-container::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n .is-popup-opened {\n box-shadow: 0px 0px 50px rgba(0, 0, 0, var(--custom-shadow-opacity));\n }\n .is-popup-closed { \n transform: translateY(100%);\n box-shadow: none !important;\n }\n\n @media only screen and (min-width: 600px) {\n .bubble-pop-up {\n margin-left: 0 !important;\n bottom: calc(-56px - var(--custom-height-offset-desktop));\n min-width: var(--desktop-width, 540px);\n max-width: var(--desktop-width, 540px);\n left: calc(50% - (var(--desktop-width, 540px) / 2));\n }\n .bubble-pop-up-container {\n padding: 18px 18px calc(140px + var(--custom-height-offset-desktop)) 18px;\n }\n }\n @media only screen and (min-width: 768px) {\n .bubble-pop-up {\n left: calc(var(--mdc-drawer-width, 0px) / 2 + 50% - (var(--desktop-width, 540px) / 2));\n }\n }\n .bubble-pop-up.editor {\n transition: none !important;\n position: relative !important;\n top: 0;\n left: 0;\n width: 100% !important;\n backdrop-filter: none !important;\n display: flex !important;\n transform: none !important;\n height: auto !important;\n min-width: auto;\n z-index: 0 !important;\n }\n .bubble-header-container {\n display: inline-flex;\n height: 50px;\n margin: 0;\n padding: 0;\n z-index: 3;\n padding: 18px 18px 22px;\n position: sticky;\n top: 0;\n background: none !important;\n overflow: visible;\n }\n .bubble-header {\n display: inline-flex;\n flex-grow: 1;\n margin-right: 14px;\n color: var(--primary-text-color);\n }\n .bubble-name {\n font-size: 14px;\n font-weight: heavy;\n }\n .bubble-close-button {\n height: 50px;\n width: 50px;\n border: none;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px));\n z-index: 1;\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n color: var(--primary-text-color);\n flex-shrink: 0;\n cursor: pointer;\n }\n .bubble-button-card-container {\n background: var(--bubble-pop-up-main-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color))));\n }\n .bubble-pop-up-container.editor-cropped {\n height: 122px !important;\n mask-image: linear-gradient(to bottom, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%) !important;\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%) !important; \n }\n .bubble-pop-up.editor > .bubble-pop-up-container {\n padding-bottom: 18px !important;\n mask-image: none;\n -webkit-mask-image: none; \n overflow: hidden; \n }\n .editor .bubble-pop-up-background {\n width: 100%;\n height: 100%;\n left: 0px;\n top: 0px;\n z-index: -1;\n display: flex;\n position: absolute;\n background-color: var(--bubble-pop-up-main-background-color, var(--bubble-pop-up-background-color, var(--bubble-secondary-background-color, var(--background-color, var(--secondary-background-color)))));\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px)) !important;\n backdrop-filter: none;\n -webkit-backdrop-filter: none;\n }\n\n .no-header .bubble-header-container {\n visibility: hidden !important;\n height: 0px !important;\n }\n .no-header .bubble-pop-up-container {\n padding-top: 4px !important;\n mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%) !important;\n -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%) !important;\n }\n\n .large .bubble-button-card-container {\n height: 56px;\n border-radius: var(--bubble-button-border-radius, var(--bubble-border-radius, 36px));\n }\n .large .bubble-pop-up-container {\n margin-top: -36px;\n }\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n .large .bubble-close-button {\n height: 56px;\n width: 56px;\n border: none;\n border-radius: var(--bubble-pop-up-border-radius, var(--bubble-border-radius, 42px));\n z-index: 1;\n --mdc-icon-size: 28px !important;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";let o,a=e.popUp.querySelector("style");e.stylesAdded&&a?e.elements.customStyle=a:(e.elements.customStyle=(0,n.az)("style"),e.popUp.appendChild(e.elements.customStyle),e.popUp.appendChild(e.elements.style),e.stylesAdded=!0);const i=e.config.bg_opacity??88;function r(){o=getComputedStyle(document.body).getPropertyValue("--ha-card-background")||getComputedStyle(document.body).getPropertyValue("--card-background-color");const n=e.config.bg_color?e.config.bg_color:o,a=(0,t._k)(n,i/100,1.02);e.popUp.style.setProperty("--bubble-pop-up-background-color",a)}C.addEventListener("change",(()=>{r()}),{passive:!0}),r(),e.popUp.style.setProperty("--desktop-width",e.config.width_desktop??"540px"),e.config.close_on_click&&e.popUp.addEventListener("click",c,{passive:!0}),window.addEventListener("keydown",(t=>{"Escape"===t.key&&e.config.hash===location.hash&&c()}),{passive:!0});let s=e.config.slide_to_close_distance??400;e.popUp.addEventListener("touchmove",(e=>{e.touches[0].clientY-v>s&&e.touches[0].clientY>w&&c(),w=e.touches[0].clientY}),{passive:!0});const l=e.popUp.querySelector(".bubble-pop-up-container");if(null===l){e.elements.popUpContainer=(0,n.az)("div"),e.elements.popUpContainer.classList.add("bubble-pop-up-container");let d=e.popUp.firstChild;for(;d;)e.elements.popUpContainer.appendChild(d),d=e.popUp.firstChild}else e.elements.popUpContainer=l;e.popUpBackground=(0,n.az)("div","bubble-pop-up-background"),e.popUp.appendChild(e.popUpBackground),e.popUp.appendChild(e.elements.headerContainer),e.popUp.appendChild(e.elements.popUpContainer),e.config.hash!==location.hash&&u(e,0),window.dispatchEvent(new Event("location-changed"))}catch(b){console.error(b)}}(e)}else e.popUp&&e.elements&&(e.config.hash!==location.hash&&e.config===e.previousConfig||((e.config.entity||e.config.name)&&Y(e,e.elements.buttonContainer,e.elements.header),requestAnimationFrame((()=>{!function(e){q(e);const t=e.config.card_layout,o="large"===t||"large-2-rows"===t,a="large-2-rows"===t;o!==e.popUp.classList.contains("large")&&e.popUp.classList.toggle("large",o),a!==e.popUp.classList.contains("rows-2")&&e.popUp.classList.toggle("rows-2",a);const i=e.config.show_header??!0;if(e.popUp.classList.contains("no-header")===i&&e.popUp.classList.toggle("no-header",!i),!e.config.styles)return;const r=(0,n.y0)(e),{backdropCustomStyle:s}=L(e);let l="";try{l=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,r,e.elements.icon,e.subButtonIcon,n.X,e.popUp):""}catch(e){throw new Error(`Error in generating pop-up custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=l),s.innerText=l}(e)})),e.previousConfig=e.config),e.editor||function(e){const t=e.config.trigger;if(t){const n=!e.hasPageLoaded;e.hasPageLoaded=!0;const o=V(t);if(U(o)){const t=P(o,e._hass);if(t===e.previousTrigger)return;e.config.hash===location.hash?t||n||c():t&&d(e.config.hash),e.previousTrigger=t}}else{let t=e.config.trigger_entity??"";if(""===t)return;let n=e.config.trigger_state??"",o=e.config.trigger_close??!1,a=e._hass.states[t]?.state;if(!t)return;if(!n)return;if(e.oldTriggerEntityState===a)return;const i=!e.hasPageLoaded;e.hasPageLoaded=!0,e.config.hash===location.hash?o&&n!==a&&(i||c()):a===n&&d(e.config.hash),e.oldTriggerEntityState=a}}(e),function(e){if(!e.verticalStack)return;const{host:t}=e.verticalStack,{popUp:n,sectionRow:o,sectionRowContainer:a,elements:i}=e,r=e._cachedDetectedEditor??=t?.closest("hui-card-preview")||t?.closest("hui-card[preview][class]")||t?.getRootNode().host?.closest("hui-section[preview][class]"),s=n?.classList.contains("is-popup-opened"),l="hui-card"===o?.tagName.toLowerCase();if(e.previousEditorState??=null,e.previousDetectedEditor??=null,!s&&l){const{editor:t,editorAccess:n}=e;t||!n||r||o?.hasAttribute("hidden")?a?.classList.contains("card")&&t&&"none"===a.style.display&&(a.style.display=""):(o.setAttribute("hidden",""),o.style.display="none")}const c=n?.classList;if(e.editor||r){c?.contains("editor")||(document.body.style.overflow="",c?.remove("is-popup-opened"),c?.add("is-popup-closed","editor")),e.editorAccess=!0;const t=null===r;i?.popUpContainer?.classList.contains("editor-cropped")!==t&&i.popUpContainer.classList.toggle("editor-cropped",t)}else c?.contains("editor")&&c.remove("editor"),i?.popUpContainer?.classList.remove("editor-cropped");e.editor===e.previousEditorState&&r===e.previousDetectedEditor||(function(e){const{hideBackdrop:t}=L(e),n=e.verticalStack.host,o=n?.closest("hui-card-preview");(e.editor||o)&&(t(),clearTimeout(e.removeDomTimeout),o||e.verticalStack.contains(e.popUp)||e.verticalStack.appendChild(e.popUp))}(e),e.previousEditorState=e.editor,e.previousDetectedEditor=r)}(e))}let G=!1;function K(e,t){const o=e.config[`${t}_name`]??"",a=e.config[`${t}_icon`]??"",i=e.config[`${t}_pir_sensor`],r=e.config[`${t}_link`],s=e.config[`${t}_entity`];G=G||location.hash===r;const l=(0,n.az)("ha-icon","bubble-icon icon");l.icon=a;const u=(0,n.az)("div","bubble-name name");u.innerText=o;const b=(0,n.az)("div","bubble-background-color background-color"),p=(0,n.az)("div","bubble-background background"),h=(0,n.az)("div",`bubble-button bubble-button-${t} button ${r.substring(1)}`);let m=localStorage.getItem(`bubbleButtonWidth-${r}`);return h.style.width=`${m}px`,h.appendChild(l),h.appendChild(u),h.appendChild(b),h.appendChild(p),h.addEventListener("click",(()=>{location.hash!==r&&(G=!1),G?c():d(r),G=!G,(0,n.jk)("light")})),h.icon=l,h.name=u,h.backgroundColor=b,h.background=p,h.pirSensor=i,h.lightEntity=s,h.link=r,h.index=t,window.addEventListener("location-changed",(function(){e.config.highlight_current_view&&(location.pathname===r||location.hash===r?h.classList.add("highlight"):h.classList.remove("highlight"))})),e.elements.buttons.push(h),h}const Z=1,Q=2,ee=8;function te(e,t){return function(e,t){return!(!e||void 0===e.supported_features)&&0!=(e.supported_features&t)}(e.attributes,t)}function ne(e,t){(0,n.OC)(e,"media_player")&&e._hass.callService("media_player","volume_set",{entity_id:e.config.entity,volume_level:(t/100).toFixed(2)})}function oe(e,t,n=!1){const o=e.elements.rangeSlider.getBoundingClientRect(),a=100*(t-o.left)/o.width,i=Math.round(Math.min(100,Math.max(0,a)));if(e.elements.rangeFill.style.transform=`translateX(${i}%)`,n){if(e.dragging)return;ne(e,i)}else ne(e,i)}(0,n.P2)(ne);const ae="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n overflow: visible !important;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-media-player-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-media-player-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n touch-action: pan-y;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-media-player-box-shadow, var(--bubble-box-shadow, none));\n }\n\n .bubble-media-player {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n background-color: rgba(0,0,0,0);\n }\n\n .bubble-button-container {\n display: inline-grid;\n grid-auto-flow: column;\n gap: 10px;\n align-self: center;\n margin-right: 8px;\n }\n\n .bubble-play-pause-button,\n .bubble-previous-button,\n .bubble-next-button,\n .bubble-volume-button,\n .bubble-power-button {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: var(--bubble-media-player-buttons-border-radius, var(--bubble-border-radius, 32px));\n padding: 6px;\n height: 24px;\n width: 24px;\n transition: background 0.3s ease;\n align-self: center;\n }\n\n .bubble-play-pause-button {\n background-color: var(--bubble-accent-color, var(--accent-color));\n }\n\n .bubble-volume-slider {\n position: absolute;\n width: calc(100% - 150px);\n height: 38px;\n left: 50px;\n overflow: hidden;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n z-index: 1;\n background-color: var(--bubble-media-player-slider-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n opacity: 1;\n transition: opacity .2s, transform .2s;\n transform: translateX(0);\n }\n\n .bubble-range-value {\n display: flex;\n justify-content: flex-end;\n height: 38px;\n align-items: center;\n padding-right: 14px;\n font-size: 12px;\n opacity: 0.8;\n }\n\n .bubble-mute-button {\n opacity: 1;\n transition: opacity .2s, transform .2s;\n transform: translateX(0);\n }\n\n .is-hidden {\n opacity: 0 !important;\n pointer-events: none;\n transform: translateX(14px);\n }\n\n .bubble-range-fill {\n z-index: -1;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n left: -100%;\n transition: all .3s;\n background-color: var(--accent-color);\n }\n\n .is-dragging .bubble-range-fill {\n transition: none;\n }\n\n .is-light .bubble-range-fill {\n opacity: 0.5;\n }\n\n .is-unavailable .bubble-button-card {\n cursor: not-allowed;\n }\n\n .bubble-range-slider {\n cursor: ew-resize;\n }\n .is-unavailable .bubble-range-slider {\n cursor: not-allowed;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n width: 38px;\n height: 38px;\n min-width: 38px;\n min-height: 38px;\n align-items: center;\n justify-content: center;\n margin: 6px;\n border-radius: var(--bubble-media-player-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-media-player-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n pointer-events: auto;\n }\n\n .bubble-icon {\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-icon,\n .bubble-mute-button {\n display: flex;\n position: absolute;\n height: 38px;\n width: 38px;\n justify-content: center;\n align-items: center;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-media-info-container {\n display: flex;\n line-height: 14px;\n font-size: 12px;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-title,\n .bubble-name,\n .bubble-state,\n .bubble-artist {\n display: flex;\n margin: 2px 0;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-title {\n font-weight: 600;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n }\n\n .bubble-sub-button-container {\n right: 0 !important;\n }\n\n .bubble-background-container {\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n border-radius: inherit;\n overflow: hidden;\n }\n\n .bubble-cover-background {\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n background-size: cover;\n background-position: 50%;\n filter: blur(50px);\n opacity: 0.5;\n }\n\n @media screen and (max-width: 250px) {\n .bubble-previous-button {\n display: none;\n }\n }\n\n @media screen and (max-width: 206px) {\n .bubble-next-button {\n display: none;\n }\n }\n\n @media screen and (max-width: 160px) {\n .bubble-volume-button {\n display: none;\n }\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-media-player-container {\n height: 56px;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n \n .large .bubble-play-pause-button {\n display: flex;\n height: 42px;\n width: 42px;\n padding: 0;\n align-items: center;\n justify-content: center;\n }\n\n .large .bubble-volume-slider {\n height: 42px;\n border-radius: var(--bubble-media-player-border-radius, var(--bubble-border-radius, 32px));\n left: 60px;\n width: calc(100% - 168px);\n }\n\n .large .bubble-range-value {\n place-items: center;\n height: 42px;\n }\n\n .large .bubble-button-container {\n align-items: center;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, 1fr);\n grid-template-rows: repeat(2, minmax(auto, max-content));\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n";let ie;function re(e){"media-player"!==e.cardType&&function(e){e.dragging=!1,e.elements={},e.elements.mediaPlayerContainer=(0,n.az)("div","bubble-media-player-container"),e.elements.mediaPlayerCard=(0,n.az)("div","bubble-media-player"),e.elements.mediaInfoContainer=(0,n.az)("div","bubble-media-info-container"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.buttonContainer=(0,n.az)("div","bubble-button-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.backgroundContainer=(0,n.az)("div","bubble-background-container"),e.elements.coverBackground=(0,n.az)("div","bubble-cover-background"),e.elements.playPauseButton=(0,n.az)("ha-icon","bubble-play-pause-button"),e.elements.previousButton=(0,n.az)("ha-icon","bubble-previous-button"),e.elements.previousButton.setAttribute("icon","mdi:skip-previous"),e.elements.nextButton=(0,n.az)("ha-icon","bubble-next-button"),e.elements.nextButton.setAttribute("icon","mdi:skip-next"),e.elements.volumeButton=(0,n.az)("ha-icon","bubble-volume-button"),e.elements.volumeButton.setAttribute("icon","mdi:volume-high"),e.elements.powerButton=(0,n.az)("ha-icon","bubble-power-button"),e.elements.powerButton.setAttribute("icon","mdi:power-standby"),e.elements.muteButton=(0,n.az)("ha-icon","bubble-mute-button is-hidden"),e.elements.muteButton.setAttribute("icon","mdi:volume-off"),e.elements.title=(0,n.az)("div","bubble-title"),e.elements.artist=(0,n.az)("div","bubble-artist"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.style.innerText=ae,e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.iconContainer.appendChild(e.elements.muteButton),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.mediaInfoContainer.appendChild(e.elements.title),e.elements.mediaInfoContainer.appendChild(e.elements.artist),e.elements.buttonContainer.appendChild(e.elements.powerButton),e.elements.buttonContainer.appendChild(e.elements.previousButton),e.elements.buttonContainer.appendChild(e.elements.nextButton),e.elements.buttonContainer.appendChild(e.elements.volumeButton),e.elements.buttonContainer.appendChild(e.elements.playPauseButton),e.elements.mediaPlayerCard.appendChild(e.elements.iconContainer),e.elements.mediaPlayerCard.appendChild(e.elements.mediaInfoContainer),e.elements.mediaPlayerCard.appendChild(e.elements.nameContainer),e.elements.mediaPlayerCard.appendChild(e.elements.buttonContainer),e.elements.backgroundContainer.appendChild(e.elements.coverBackground),e.elements.mediaPlayerContainer.appendChild(e.elements.backgroundContainer),e.content.innerHTML="",e.content.appendChild(e.elements.mediaPlayerContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.elements.mediaPlayerContainer.appendChild(e.elements.mediaPlayerCard),a(e.elements.icon,e.config,e.config.entity),a(e.elements.image,e.config,e.config.entity),e.elements.volumeSliderContainer=(0,n.az)("div","bubble-volume-slider is-hidden"),function(e,t){let o=0;function a(t){t.stopPropagation();const n=t.pageX||(t.touches?t.touches[0].pageX:0);Math.abs(o-n)>10&&oe(e,n,!0);const a=e.elements.rangeSlider.getBoundingClientRect(),i=100*(n-a.left)/a.width,r=Math.min(100,Math.max(0,i));e.elements.rangeValue.innerText=Math.round(r)+"%"}function i(n){n.stopPropagation(),e.dragging=!1;const o=n.pageX||(n.touches?n.touches[0].pageX:0);oe(e,o),t.classList.remove("is-dragging"),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",i);const r=e.elements.rangeSlider.getBoundingClientRect(),s=100*(o-r.left)/r.width,l=Math.min(100,Math.max(0,s));e.elements.rangeValue.innerText=Math.round(l)+"%"}ie=Math.round(100*(0,n.IL)(e,"volume_level"))+"%",e.elements.rangeFill=(0,n.az)("div","bubble-range-fill range-fill"),e.elements.rangeSlider=(0,n.az)("div","bubble-range-slider range-slider"),e.elements.rangeValue=(0,n.az)("div","bubble-range-value"),e.elements.rangeSlider.appendChild(e.elements.rangeValue),e.elements.rangeSlider.appendChild(e.elements.rangeFill),t.appendChild(e.elements.rangeSlider),t.addEventListener("pointercancel",(function(){e.dragging=!1,t.classList.remove("is-dragging"),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",i)})),t.addEventListener("pointerdown",(n=>{t.setPointerCapture(n.pointerId),e.card.classList.contains("is-unavailable")||(e.dragging=!0,o=n.pageX||(n.touches?n.touches[0].pageX:0),t.classList.add("is-dragging"),t.addEventListener("pointermove",a),t.addEventListener("pointerup",i))})),e.elements.rangeValue.innerText=ie}(e,e.elements.volumeSliderContainer),e.elements.mediaPlayerCard.appendChild(e.elements.volumeSliderContainer),e.elements.volumeButton.addEventListener("click",(()=>{e.elements.volumeSliderContainer.classList.toggle("is-hidden"),e.elements.muteButton.classList.toggle("is-hidden"),e.elements.icon.classList.toggle("is-hidden"),e.elements.image.classList.toggle("is-hidden"),function(e){const t=e.elements.volumeButton.isHidden,n=t?"1":"0",o=t?"mdi:volume-high":"mdi:close";e.elements.volumeButton.setAttribute("icon",o),e.elements.mediaInfoContainer.style.opacity=n,e.elements.nameContainer.style.opacity=n,e.elements.subButtonContainer&&(e.elements.subButtonContainer.style.opacity=n),e.elements.previousButton.style.opacity=n,e.elements.nextButton.style.opacity=n,e.elements.powerButton.style.opacity=n,e.elements.volumeButton.isHidden=!t}(e),ie=Math.round(100*(0,n.IL)(e,"volume_level"))+"%"})),e.elements.powerButton.addEventListener("click",(()=>{const t=(0,n.pr)(e);e._hass.callService("media_player",t?"turn_off":"turn_on",{entity_id:e.config.entity})})),e.elements.muteButton.addEventListener("click",(()=>{const t=!0===(0,n.IL)(e,"is_volume_muted");e._hass.callService("media_player","volume_mute",{entity_id:e.config.entity,is_volume_muted:!t}),e.elements.muteButton.clicked=!0})),e.elements.previousButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_previous_track",{entity_id:e.config.entity})})),e.elements.nextButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_next_track",{entity_id:e.config.entity})})),e.elements.playPauseButton.addEventListener("click",(()=>{e._hass.callService("media_player","media_play_pause",{entity_id:e.config.entity}),e.elements.playPauseButton.clicked=!0})),e.elements.mediaPlayerContainer.addEventListener("click",(()=>(0,n.jk)("selection"))),e.cardType="media-player"}(e),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable"),(0,n.pr)(e)?e.card.classList.add("is-on"):e.card.classList.remove("is-on")}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.previousName&&(e.elements.name.innerText=t,e.previousName=t,(0,n.GP)(e,e.elements.name,t))}(e),function(e){const t=(0,n.IL)(e,"media_title"),o=(0,n.IL)(e,"media_artist"),a=t+o;a!==e.previousMediaState&&(e.elements.artist.style.display=""===o?"none":"flex",e.previousMediaState=a,(0,n.GP)(e,e.elements.title,t),(0,n.GP)(e,e.elements.artist,o))}(e),function(e){(0,n.IL)(e,"media_title");const t=""===(0,n.IL)(e,"media_artist");e.elements.mediaInfoContainer.style.display=t?"none":"",e.elements.nameContainer.style.display=t?"":"none"}(e),function(e){const t=(0,n.pr)(e),o=(0,n.q7)(e),a=(0,n.gJ)(e),i=e.elements.image.style.backgroundImage,r=e.elements.icon.icon,s=e.elements.icon.style.color;if(""!==a){const t="url("+a+")";i!==t&&(e.elements.image.style.backgroundImage=t),"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),""!==e.elements.image.style.display&&(e.elements.image.style.display="")}else if(""!==o){r!==o&&(e.elements.icon.icon=o);const n=t?"var(--accent-color)":"inherit";s!==n&&(e.elements.icon.style.color=n),""!==e.elements.icon.style.display&&(e.elements.icon.style.display=""),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}else"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}(e),function(e){const t=(0,n.pr)(e),o=(0,n.gJ)(e),a=e.config.cover_background,i=e.elements.coverBackground.style.backgroundImage;if(a&&t&&o){const t="url("+o+")";i!==t&&(e.elements.coverBackground.style.backgroundImage=t)}else""!==i&&(e.elements.coverBackground.style.backgroundImage="")}(e),H(e),function(e){if((0,n.OC)(e,"media_player")&&!1===e.dragging&&e.elements.rangeFill){const t=100*(0,n.IL)(e,"volume_level");e.elements.rangeFill.style.transform=`translateX(${t}%)`}}(e),function(e){const t="playing"===(0,n.y0)(e),o=e.elements.playPauseButton.clicked;t?e.elements.playPauseButton.setAttribute("icon",o?"mdi:play":"mdi:pause"):e.elements.playPauseButton.setAttribute("icon",o?"mdi:pause":"mdi:play"),e.elements.playPauseButton.clicked=!1}(e),function(e){const t=!0===(0,n.IL)(e,"is_volume_muted"),o=e.elements.muteButton.clicked;e.elements.muteButton.style.color=t?o?"":"var(--accent-color)":o?"var(--accent-color)":"",e.elements.muteButton.clicked=!1}(e),function(e){const t=(0,n.pr)(e);e.elements.powerButton.style.color=t?"var(--accent-color)":""}(e),N(e,e.content,e.elements.buttonContainer,!0),function(e){q(e),(0,n.jx)(e);const t=(0,n.y0)(e),o="off"!==t&&"unknown"!==t;if(e.config.hide?.power_button&&"none"!==e.elements.powerButton.style.display?e.elements.powerButton.style.display="none":e.config.hide?.power_button||"none"!==e.elements.powerButton.style.display||(e.elements.powerButton.style.display=""),!e.config.hide?.previous_button&&(e.editor||o)||"none"===e.elements.previousButton.style.display?e.config.hide?.previous_button||!e.editor&&!o||"none"!==e.elements.previousButton.style.display||(e.elements.previousButton.style.display=""):e.elements.previousButton.style.display="none",!e.config.hide?.next_button&&(e.editor||o)||"none"===e.elements.nextButton.style.display?e.config.hide?.next_button||!e.editor&&!o||"none"!==e.elements.nextButton.style.display||(e.elements.nextButton.style.display=""):e.elements.nextButton.style.display="none",!e.config.hide?.volume_button&&(e.editor||o)||"none"===e.elements.volumeButton.style.display?e.config.hide?.volume_button||!e.editor&&!o||"none"!==e.elements.volumeButton.style.display||(e.elements.volumeButton.style.display=""):e.elements.volumeButton.style.display="none",!e.config.hide?.play_pause_button&&(e.editor||o)||"none"===e.elements.playPauseButton.style.display?e.config.hide?.play_pause_button||!e.editor&&!o||"none"!==e.elements.playPauseButton.style.display||(e.elements.playPauseButton.style.display=""):e.elements.playPauseButton.style.display="none",!e.config.styles)return;let a="";try{a=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating media player custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=a)}(e)}function se(e){let t="";const n=e._hass.states[e.config.entity],o=(n.attributes.current_temperature,n.attributes.hvac_action),a=n.state,i="heating"===o||"heat"===a&&e.config.state_color,r="cooling"===o||"cool"===a&&e.config.state_color,s="off"!==a&&"unknown"!==a;switch(a){case"fan_only":t="var(--bubble-state-climate-fan-only-color, var(--state-climate-fan-only-color, var(--state-climate-active-color, var(--state-active-color))))";break;case"dry":t="var(--bubble-state-climate-dry-color, var(--state-climate-dry-color, var(--state-climate-active-color, var(--state-active-color))))";break;default:t=r?"var(--bubble-state-climate-cool-color, var(--state-climate-cool-color, var(--state-climate-active-color, var(--state-active-color))))":i?"var(--bubble-state-climate-heat-color, var(--state-climate-heat-color, var(--state-climate-active-color, var(--state-active-color))))":s&&e.config.state_color?"auto"===a?"var(--bubble-state-climate-auto-color, var(--state-climate-auto-color, var(--state-climate-active-color, var(--state-active-color))))":"heat_cool"===a?"var(--bubble-state-climate-heat-cool-color, var(--state-climate-heat-cool-color, var(--state-climate-active-color, var(--state-active-color))))":"var(--bubble-climate-accent-color, var(--bubble-accent-color, var(--accent-color)))":""}return t}let le,ce,de;class ue extends HTMLElement{editor=!1;isConnected=!1;connectedCallback(){this.isConnected=!0,this._hass&&this.updateBubbleCard()}disconnectedCallback(){this.isConnected=!1}set editMode(e){this.editor!==e&&(this.editor=e,this._hass&&this.updateBubbleCard())}set hass(e){!function(e){if(!e.content){let t=e.shadowRoot||e.attachShadow({mode:"open"}),n=document.createElement("ha-card");n.style.cssText="background: none; border: none; box-shadow: none; border-radius: 16px;";let o=document.createElement("div");o.className="card-content",o.style.padding="0",n.appendChild(o),t.appendChild(n),e.card=n,e.content=o}}(this),this._hass=e,this.editor||(this.isConnected||"pop-up"===this.config.card_type)&&this.updateBubbleCard()}updateBubbleCard(){switch(this.config.card_type){case"pop-up":J(this);break;case"button":Y(this);break;case"separator":"separator"!==(e=this).cardType&&function(e){e.elements={},e.elements.separatorCard=(0,n.az)("div","bubble-separator separator-container"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.name=(0,n.az)("h4","bubble-name"),e.elements.line=(0,n.az)("div","bubble-line"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .bubble-separator {\n display: flex;\n width: 100%;\n \n align-items: center;\n z-index: 1;\n }\n .bubble-icon {\n display: inline-flex;\n height: auto;\n width: auto;\n margin: 0 22px 0 8px;\n }\n .bubble-name {\n margin: 0 30px 0 0;\n font-size: 16px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .bubble-name:empty {\n display: none;\n }\n .bubble-line {\n border-radius: 6px;\n opacity: 0.5;\n flex-grow: 1;\n height: 6px;\n background-color: var(--bubble-line-background-color, var(--background-color, var(--secondary-background-color)));\n margin-right: 14px;\n }\n .bubble-sub-button-container {\n margin: 0 8px;\n right: 0 !important;\n }\n\n .large .bubble-separator {\n height: 56px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.elements.separatorCard.appendChild(e.elements.icon),e.elements.separatorCard.appendChild(e.elements.name),e.elements.separatorCard.appendChild(e.elements.line),e.content.innerHTML="",e.content.appendChild(e.elements.separatorCard),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.cardType="separator"}(e),function(e){e.elements.icon.icon=(0,n.q7)(e),""===e.elements.icon.icon&&""===e.elements.icon.style.margin?(e.elements.icon.style.margin="0px 8px",e.elements.icon.style.width="0px"):""!==e.elements.icon.icon&&"0px 8px"===e.elements.icon.style.margin&&(e.elements.icon.style.margin="",e.elements.icon.style.width="")}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.elements.name.innerText&&(e.elements.name.innerText=t)}(e),N(e,e.content,e.elements.separatorCard),function(e){q(e),(0,n.jx)(e);const t=(0,n.y0)(e);let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating separator custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e);break;case"cover":!function(e){"cover"!==e.cardType&&function(e){e.elements={},e.elements.coverCardContainer=(0,n.az)("div","bubble-cover-card-container cover-container"),e.elements.headerContainer=(0,n.az)("div","bubble-header header-container"),e.elements.buttonsContainer=(0,n.az)("div","bubble-buttons buttons-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container icon-container"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container name-container"),e.elements.name=(0,n.az)("div","bubble-name name"),e.elements.state=(0,n.az)("div","bubble-state state"),e.elements.buttonOpen=(0,n.az)("div","bubble-button bubble-open button open"),e.elements.buttonStop=(0,n.az)("div","bubble-button bubble-stop button stop"),e.elements.buttonClose=(0,n.az)("div","bubble-button bubble-close button close"),e.elements.iconOpen=(0,n.az)("ha-icon","bubble-icon bubble-icon-open"),e.elements.iconStop=(0,n.az)("ha-icon","bubble-icon bubble-icon-stop"),e.elements.iconStop.icon="mdi:stop",e.elements.iconClose=(0,n.az)("ha-icon","bubble-icon bubble-icon-close"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n ha-card {\n margin-top: 0 !important;\n background: none !important;\n }\n\n .bubble-cover-card-container {\n display: grid;\n gap: 10px;\n overflow: hidden;\n }\n\n .bubble-header {\n display: flex;\n align-items: center;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-content: center;\n min-width: 38px;\n min-height: 38px;\n border-radius: var(--bubble-cover-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-cover-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n border: 6px solid var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n cursor: pointer;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n margin-right: 16px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n white-space: nowrap;\n display: flex;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n white-space: nowrap;\n display: flex;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-buttons {\n display: grid;\n align-self: center;\n grid-auto-flow: column;\n grid-gap: 18px;\n }\n\n .bubble-icon {\n display: flex; \n height: 24px; \n width: 24px; \n color: var(--primary-text-color);\n }\n\n .bubble-button.disabled {\n opacity: 0.3 !important;\n pointer-events: none !important;\n cursor: none !important;\n }\n\n .bubble-button {\n display: flex;\n background: var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n height: 42px;\n border-radius: var(--bubble-cover-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-cover-box-shadow, var(--bubble-button-box-shadow, var(--bubble-box-shadow, none)));\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border: none;\n }\n\n .large .bubble-cover-card-container {\n height: 56px;\n display: flex;\n background: var(--bubble-cover-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-cover-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-cover-box-shadow, var(--bubble-button-box-shadow, var(--bubble-box-shadow, none)));\n }\n\n .large .bubble-buttons .bubble-icon {\n color: var(--primary-text-color) !important;\n opacity: 1;\n }\n\n .large .bubble-header-container {\n height: 56px;\n }\n\n .large .bubble-header {\n width: 100%;\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n align-content: center;\n border: none;\n margin: 8px 6px 8px 8px;\n }\n\n .large .bubble-icon {\n align-items: center;\n }\n\n .large .bubble-buttons {\n display: flex;\n position: relative;\n right: 18px;\n align-self: center;\n grid-gap: 18px;\n }\n\n .large .bubble-button,\n .large .bubble-sub-button {\n box-shadow: none;\n }\n\n .large .bubble-sub-button-container {\n margin-right: 14px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n padding-right: 14px;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.elements.iconContainer.appendChild(e.elements.icon),e.elements.headerContainer.appendChild(e.elements.iconContainer),e.elements.headerContainer.appendChild(e.elements.nameContainer),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.buttonsContainer.appendChild(e.elements.buttonOpen),e.elements.buttonsContainer.appendChild(e.elements.buttonStop),e.elements.buttonsContainer.appendChild(e.elements.buttonClose),e.elements.buttonOpen.appendChild(e.elements.iconOpen),e.elements.buttonOpen.addEventListener("click",(()=>{const t=e.config.open_service??"cover.open_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})})),e.elements.buttonStop.appendChild(e.elements.iconStop),e.elements.buttonStop.addEventListener("click",(()=>{const t=e.config.stop_service??"cover.stop_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})})),e.elements.buttonClose.appendChild(e.elements.iconClose),e.elements.buttonClose.addEventListener("click",(()=>{const t=e.config.close_service??"cover.close_cover",[n,o]=t.split(".");e._hass.callService(n,o,{entity_id:e.config.entity})})),a(e.elements.iconContainer,e.config),e.content.innerHTML="",e.content.appendChild(e.elements.coverCardContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.elements.coverCardContainer.appendChild(e.elements.headerContainer),e.elements.coverCardContainer.appendChild(e.elements.buttonsContainer),e.elements.coverCardContainer.addEventListener("click",(()=>(0,n.jk)("selection"))),e.cardType="cover"}(e),function(e){const t=e._hass.states[e.config.entity],{current_position:o,assumed_state:a}=t.attributes,i=te(t,Z),r=te(t,Q),s=te(t,ee),l=function(e){return void 0!==e.attributes.current_position?100===e.attributes.current_position:"open"===e.state}(t),c=function(e){return void 0!==e.attributes.current_position?0===e.attributes.current_position:"closed"===e.state}(t),d="curtain"===(0,n.IL)(e,"device_class");e.elements.icon.icon=l?(0,n.q7)(e,e.config.entity,e.config.icon_open):(0,n.q7)(e,e.config.entity,e.config.icon_close),e.elements.iconOpen.icon=e.config.icon_up||(d?"mdi:arrow-expand-horizontal":"mdi:arrow-up"),e.elements.iconClose.icon=e.config.icon_down||(d?"mdi:arrow-collapse-horizontal":"mdi:arrow-down"),void 0!==o?(l?e.elements.buttonOpen.classList.add("disabled"):i&&e.elements.buttonOpen.classList.remove("disabled"),c?e.elements.buttonClose.classList.add("disabled"):r&&e.elements.buttonClose.classList.remove("disabled")):(e.elements.buttonOpen.classList.remove("disabled"),e.elements.buttonClose.classList.remove("disabled")),e.elements.buttonStop.style.display=s?"":"none"}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.elements.previousName&&(e.elements.name.innerText=t,(0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e),H(e),N(e,e.content,e.elements.headerContainer),function(e){if(q(e),(0,n.jx)(e),!e.config.styles)return;const t=(0,n.y0)(e);let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating cover custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e)}(this);break;case"empty-column":!function(e){"empty-column"!==e.cardType&&function(e){e.elements={},e.elements.emptyColumnCard=(0,n.az)("div","bubble-empty-column empty-column"),e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n .empty-column {\n display: flex;\n width: 100%;\n }\n",e.elements.customStyle=(0,n.az)("style"),e.content.innerHTML="",e.content.appendChild(e.elements.emptyColumnCard),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),e.cardType="empty-column"}(e)}(this);break;case"horizontal-buttons-stack":!function(e){"horizontal-buttons-stack"!==e.cardType&&function(e){e.elements={},e.elements.buttons=[],e.elements.cardContainer=(0,n.az)("div","bubble-horizontal-buttons-stack-card-container horizontal-buttons-stack-container");let t=1;for(;e.config[t+"_link"];)e.elements.cardContainer.appendChild(K(e,t)),t++;e.elements.style=(0,n.az)("style"),e.elements.style.innerText="\n @keyframes from-bottom {\n 0% { transform: translate(-50%, 100px); }\n 26% { transform: translate(-50%, -8px); }\n 46% { transform: translate(-50%, 1px); }\n 62% { transform: translate(-50%, -2px); }\n 70% { transform: translate(-50%, 0); }\n 100% { transform: translate(-50%, 0); }\n }\n @keyframes pulse {\n 0% { filter: brightness(0.7); }\n 100% { filter: brightness(1.3); }\n }\n ha-card {\n border-radius: 0;\n }\n .horizontal-buttons-stack-card {\n bottom: 16px;\n height: 51px;\n margin-top: 0;\n position: fixed;\n width: calc(100% - var(--mdc-drawer-width, 0px) - 8px);\n left: calc(var(--mdc-drawer-width, 0px) + 4px);\n z-index: 6; /* Higher value hide the more-info panel */\n }\n @media only screen and (max-width: 870px) {\n .horizontal-buttons-stack-card {\n width: calc(100% - 16px);\n left: 8px;\n }\n\n .horizontal-buttons-stack-card::before {\n left: -10px;\n }\n }\n .horizontal-buttons-stack-card::before {\n content: '';\n position: absolute;\n top: -32px;\n display: none;\n background: linear-gradient(0deg, var(--background-color, var(--primary-background-color)) 50%, rgba(79, 69, 87, 0));\n width: 200%;\n height: 100px;\n pointer-events: none;\n }\n .has-gradient.horizontal-buttons-stack-card::before {\n display: block;\n }\n\n .card-content {\n width: calc(100% + 36px);\n padding: 0 !important;\n max-width: calc(var(--desktop-width) - 8px);\n box-sizing: border-box;\n overflow: scroll;\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n -ms-overflow-style: none;\n scrollbar-width: none;\n -webkit-mask-image: linear-gradient(\n 90deg,\n #000000 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n transparent 100%\n );\n }\n .is-scrollable.card-content {\n padding: 0 !important;\n width: 100%;\n }\n .is-scrolled.card-content {\n padding: 0 !important;\n width: 100%;\n -webkit-mask-image: linear-gradient(\n 90deg,\n transparent 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n transparent 100%\n );\n }\n .is-maxed-scroll.card-content {\n -webkit-mask-image: linear-gradient(\n 90deg,\n transparent 0%,\n #000000 calc(0% + 28px),\n #000000 calc(100% - 28px),\n #000000 100%\n );\n }\n .card-content::-webkit-scrollbar {\n display: none;\n }\n\n .bubble-horizontal-buttons-stack-card-container {\n height: 51px;\n position: relative;\n margin: auto;\n }\n\n .bubble-button {\n align-items: center;\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n color: var(--primary-text-color);\n cursor: pointer;\n display: inline-flex;\n height: 50px;\n left: 0;\n padding: 0 16px;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n transition: transform 1s;\n box-sizing: border-box;\n }\n .bubble-button.highlight {\n animation: pulse 1.4s infinite alternate;\n }\n .bubble-background-color {\n border: 1px solid var(--primary-text-color);\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n box-sizing: border-box;\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n transition: background-color 1s;\n width: 100%;\n z-index: -1;\n }\n .bubble-background {\n opacity: 0.8;\n border-radius: var(--bubble-horizontal-buttons-stack-border-radius, var(--bubble-border-radius, 32px));\n width: 100%;\n height: 100%;\n box-sizing: border-box !important;\n position: absolute;\n left: 0;\n z-index: -2;\n background-color: var(--background-color,var(--primary-background-color));\n }\n .bubble-icon {\n height: 24px;\n width: 24px;\n }\n .bubble-icon + .bubble-name {\n margin-left: 8px;\n }\n\n\n .horizontal-buttons-stack-card.editor {\n position: relative;\n width: 100%;\n left: 0;\n bottom: 0;\n }\n .horizontal-buttons-stack-card.editor::before {\n background: none;\n }\n\n",e.elements.customStyle=(0,n.az)("style"),e.card.classList.add("horizontal-buttons-stack-card"),e.card.style.marginLeft=e.config.margin??"",e.config.hide_gradient||e.card.classList.add("has-gradient"),e.card.style.setProperty("--desktop-width",e.config.width_desktop??"500px"),e.elements.cardContainer.appendChild(e.elements.style),e.elements.cardContainer.appendChild(e.elements.customStyle),e.content.appendChild(e.elements.cardContainer),e.content.addEventListener("scroll",(()=>{e.content.scrollLeft>0?e.content.classList.add("is-scrolled"):e.content.classList.remove("is-scrolled"),e.content.scrollWidth-12{e.content.style.animation="none"}),1500));let o=e.card.parentNode.host;o&&!e.editor&&"hui-card"!==o.parentElement.tagName.toLowerCase()?o.style.padding="0 0 80px":o.parentElement&&!e.editor&&"hui-card"===o.parentElement.tagName.toLowerCase()&&(o.parentElement.style.padding="0 0 80px"),e.cardType="horizontal-buttons-stack"}(e),function(e){if(!e.config.styles)return;let t="";try{t=e.config.styles?Function("hass","card",`return \`${e.config.styles}\`;`)(e._hass,e.card):""}catch(e){throw new Error(`Error in generating horizontal buttons stack custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=t)}(e),function(e){if(!e.config.auto_order)return;const t=e._hass.states;e.elements.buttons.sort(((e,n)=>{if(!t[e.pirSensor])return 1;if(!t[e.pirSensor])return-1;const o=t[e.pirSensor]?.last_updated,a=t[n.pirSensor]?.last_updated;return"on"===t[e.pirSensor]?.state&&"on"===t[n.pirSensor]?.state?o>a?-1:o===a?0:1:"on"===t[e.pirSensor]?.state?-1:"on"===t[n.pirSensor]?.state?1:o>a?-1:o===a?0:1}))}(e),function(e){e.elements.buttons.forEach((t=>{const n=t.index,o=e.config[`${n}_name`]??"",a=e.config[`${n}_icon`]??"",i=e.config[`${n}_pir_sensor`],r=e.config[`${n}_link`],s=e.config[`${n}_entity`];t.pirSensor=i,t.lightEntity=s,t.link=r,o?(t.name.innerText=o,t.name.style.display=""):t.name.style.display="none",a?(t.icon.icon=a,t.icon.style.display=""):t.icon.style.display="none",void 0===r&&(t.remove(),e.elements.buttons=e.elements.buttons.filter((e=>e!==t)),e.elements.buttons.forEach(((e,t)=>{e.index=t+1})))}));let t=e.elements.buttons.length+1;for(;void 0!==e.config[`${t}_link`];){if(!e.elements.buttons.find((e=>e.index===t))){const n=K(e,t);e.elements.buttons.push(n)}t++}}(e),function(e){const t=e.shadowRoot.host.closest("hui-card-preview, hui-card-options");e.editor||null!==t?(e.elements.cardContainer.classList.add("editor"),e.card.classList.add("editor")):(e.elements.cardContainer.classList.remove("editor"),e.card.classList.remove("editor"))}(e),function(e){let t=0;for(let n=0;n0&&(o=a,localStorage.setItem(`bubbleButtonWidth-${e.elements.buttons[n].link}`,`${a}`)),null!==o&&(e.elements.buttons[n].style.transform=`translateX(${t}px)`,e.elements.buttons[n].style.width="",t+=+o+12)}e.elements.cardContainer.style.width=`${t}px`}(e),function(e){e.elements.buttons.forEach((n=>{const o=e._hass.states[n.lightEntity],a=o?.attributes.rgb_color,i=o?.state;if(a){const e=(0,t.wW)(a)?"rgba(255, 220, 200, 0.5)":`rgba(${a}, 0.5)`;n.backgroundColor.style.backgroundColor=e,n.backgroundColor.style.borderColor="rgba(0, 0, 0, 0)"}else"on"==i?(n.backgroundColor.style.backgroundColor="rgba(255, 255, 255, 0.5)",n.backgroundColor.style.borderColor="rgba(0, 0, 0, 0)"):(n.backgroundColor.style.backgroundColor="rgba(0, 0, 0, 0)",n.backgroundColor.style.borderColor="var(--primary-text-color)")}))}(e),function(e){e.content.scrollWidth>=e.content.offsetWidth?e.content.classList.add("is-scrollable"):e.content.classList.remove("is-scrollable")}(e)}(this);break;case"media-player":re(this);break;case"select":!function(e){e.cardType,"select"!==e.cardType&&(function(e){e.elements||(e.elements={});let t=e.content;e.elements.selectCardContainer=(0,n.az)("div","bubble-select-card-container"),e.elements.selectCard=(0,n.az)("div","bubble-select-card"),e.elements.selectBackground=(0,n.az)("div","bubble-select-background"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.feedback=(0,n.az)("div","bubble-feedback-element"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.feedback.style.display="none",e.elements.style.innerText=O,s(e.elements.selectBackground,e.elements.feedback),a(e.elements.iconContainer,e.config,e.config.entity),e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state),e.elements.selectCard.appendChild(e.elements.selectBackground),e.elements.selectCard.appendChild(e.elements.iconContainer),e.elements.selectCard.appendChild(e.elements.nameContainer),e.elements.selectCardContainer.appendChild(e.elements.selectCard),e.elements.selectBackground.appendChild(e.elements.feedback),t.innerHTML="",t.appendChild(e.elements.selectCardContainer),t.appendChild(e.elements.style),t.appendChild(e.elements.customStyle),e.cardType="select"}(e),z(e),E(e)),B(e,e.elements,e.config.entity,e.config),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable")}(e),function(e){const t=(0,n.q7)(e),o=(0,n.gJ)(e);""!==o?(e.elements.image.style.backgroundImage="url("+o+")",e.elements.icon.style.display="none",e.elements.image.style.display=""):""!==t?(e.elements.icon.icon=t,e.elements.icon.style.color="inherit",e.elements.icon.style.display="",e.elements.image.style.display="none"):(e.elements.icon.style.display="none",e.elements.image.style.display="none")}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.elements.previousName&&((0,n.GP)(e,e.elements.name,t),e.elements.previousName=t)}(e),H(e),N(e,e.content,e.elements.dropdownContainer,!0),function(e){q(e),(0,n.jx)(e);const t=(0,n.y0)(e);let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating select custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o,e.elements.dropdownCustomStyleElement.innerText=o)}(e)}(this);break;case"climate":!function(e){"climate"!==e.cardType&&function(e){e.dragging=!1,e.elements={};const t=e.config.entity,o=e._hass.states[t],i="°C"===e._hass.config.unit_system.temperature,r=o.attributes.target_temp_step?o.attributes.target_temp_step:i?.5:1;function l(t,o,a){const i=(0,n.az)("div","bubble-climate-minus-button"),r=(0,n.az)("div","bubble-climate-plus-button"),l=(0,n.az)("ha-icon","bubble-climate-minus-button-icon");l.setAttribute("icon","mdi:minus"),i.appendChild(l),s(i);const c=(0,n.az)("ha-icon","bubble-climate-plus-button-icon");let d,u;c.setAttribute("icon","mdi:plus"),r.appendChild(c),s(r),"temperature"===o?(e.elements.tempDisplay=(0,n.az)("div","bubble-temperature-display"),d=e.elements.tempDisplay):"target_temp_low"===o?(e.elements.lowTempDisplay=(0,n.az)("div","bubble-low-temperature-display"),d=e.elements.lowTempDisplay):"target_temp_high"===o&&(e.elements.highTempDisplay=(0,n.az)("div","bubble-high-temperature-display"),d=e.elements.highTempDisplay),t.appendChild(i),t.appendChild(d),t.appendChild(r);let b=parseFloat((0,n.IL)(e,o))||0,p=b;function h(t){"temperature"===o?e.elements.tempDisplay.innerText=t.toFixed(1):"target_temp_low"===o?e.elements.lowTempDisplay.innerText=t.toFixed(1):"target_temp_high"===o&&(e.elements.highTempDisplay.innerText=t.toFixed(1))}function m(){const t=parseFloat((0,n.IL)(e,o))||0;t!==p&&(b=t,p=t)}function g(){m();const t={entity_id:e.config.entity};"target_temp_low"===o?(t.target_temp_low=b,t.target_temp_high=(0,n.IL)(e,"target_temp_high")):"target_temp_high"===o?(t.target_temp_high=b,t.target_temp_low=(0,n.IL)(e,"target_temp_low")):t[o]=b,e._hass.callService("climate","set_temperature",t)}i.addEventListener("click",(()=>{m(),b=parseFloat((b-a).toFixed(1)),h(b),clearTimeout(u),u=setTimeout(g,700)})),r.addEventListener("click",(()=>{m(),b=parseFloat((b+a).toFixed(1)),h(b),clearTimeout(u),u=setTimeout(g,700)}))}e.elements.climateContainer=(0,n.az)("div","bubble-climate-container"),e.elements.climateCard=(0,n.az)("div","bubble-climate"),e.elements.buttonContainer=(0,n.az)("div","bubble-button-container"),e.elements.nameContainer=(0,n.az)("div","bubble-name-container"),e.elements.iconContainer=(0,n.az)("div","bubble-icon-container"),e.elements.name=(0,n.az)("div","bubble-name"),e.elements.state=(0,n.az)("div","bubble-state"),e.elements.icon=(0,n.az)("ha-icon","bubble-icon"),e.elements.image=(0,n.az)("div","bubble-entity-picture entity-picture"),e.elements.colorBackground=(0,n.az)("div","bubble-color-background"),e.elements.style=(0,n.az)("style"),e.elements.customStyle=(0,n.az)("style"),e.elements.style.innerText="\n * {\n -webkit-tap-highlight-color: transparent !important;\n }\n\n ha-card {\n margin-top: 0;\n background: none;\n opacity: 1;\n }\n .is-unavailable {\n opacity: 0.5;\n }\n\n .bubble-climate-container {\n position: relative;\n width: 100%;\n height: 50px;\n background-color: var(--bubble-climate-main-background-color, var(--bubble-main-background-color, var(--background-color-2, var(--secondary-background-color))));\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n box-shadow: var(--bubble-climate-box-shadow, var(--bubble-box-shadow, none));\n overflow: visible;\n touch-action: pan-y;\n }\n\n .bubble-climate {\n display: flex;\n position: absolute;\n justify-content: space-between;\n align-items: center;\n height: 100%;\n width: 100%;\n transition: background-color 1.5s;\n background-color: rgba(0,0,0,0);\n }\n\n .bubble-button-container {\n display: inline-grid;\n grid-auto-flow: column;\n gap: 10px;\n align-self: center;\n align-items: center;\n margin-right: 8px;\n }\n\n .bubble-temperature-container, .bubble-low-temp-container, .bubble-high-temp-container {\n display: inline-flex;\n position: relative;\n font-size: 12px;\n white-space: nowrap;\n justify-content: center;\n align-items: center;\n width: auto;\n height: 100%;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n background-color: var(--bubble-climate-button-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background))));\n }\n\n .bubble-low-temp-container {\n color: var(--state-climate-heat-color, var(--state-climate-active-color, var(--state-active-color)));\n }\n\n .bubble-high-temp-container {\n color: var(--state-climate-cool-color, var(--state-climate-active-color, var(--state-active-color)));\n }\n\n .bubble-target-temperature-container {\n display: flex;\n gap: 10px;\n }\n\n .bubble-climate-minus-button,\n .bubble-climate-plus-button {\n display: flex;\n position: relative;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 36px;\n height: 36px;\n vertical-align: middle;\n font-size: 18px;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n .bubble-climate-minus-button-icon,\n .bubble-climate-plus-button-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n --mdc-icon-size: 16px;\n }\n\n .bubble-feedback-container {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-sub-button-border-radius, var(--bubble-border-radius, 32px));\n overflow: hidden;\n pointer-events: none;\n }\n\n .bubble-feedback-element {\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(0,0,0);\n pointer-events: none;\n }\n\n .bubble-color-background {\n display: flex;\n width: 100%;\n height: 100%;\n position: absolute;\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n opacity: 0.7;\n transition: background-color 2s ease;\n }\n\n .is-unavailable .bubble-climate {\n cursor: not-allowed;\n }\n\n .bubble-icon-container {\n display: flex;\n flex-wrap: wrap;\n width: 38px;\n height: 38px;\n min-width: 38px;\n min-height: 38px;\n align-items: center;\n justify-content: center;\n margin: 6px;\n border-radius: var(--bubble-climate-icon-border-radius, var(--bubble-icon-border-radius, var(--bubble-border-radius, 50%)));\n background-color: var(--bubble-climate-icon-background-color, var(--bubble-icon-background-color, var(--bubble-secondary-background-color, var(--card-background-color, var(--ha-card-background)))));\n overflow: hidden;\n position: relative;\n cursor: pointer;\n pointer-events: auto;\n }\n\n .bubble-icon {\n opacity: 0.6;\n }\n\n .is-on .bubble-icon {\n filter: brightness(1.1);\n opacity: 1;\n }\n\n .bubble-icon {\n display: flex;\n position: absolute;\n height: 38px;\n width: 38px;\n justify-content: center;\n align-items: center;\n transition: all 2s;\n }\n\n .bubble-entity-picture {\n background-size: cover;\n background-position: center;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n\n .bubble-name,\n .bubble-state {\n display: flex;\n margin: 2px 0;\n position: relative;\n white-space: nowrap;\n }\n\n .bubble-name-container {\n display: flex;\n line-height: 1em;\n flex-direction: column;\n justify-content: center;\n flex-grow: 1;\n font-weight: 600;\n margin-left: 4px;\n pointer-events: none;\n position: relative;\n overflow: hidden;\n }\n\n .bubble-name {\n font-size: 13px;\n margin: 2px 0;\n }\n\n .bubble-state {\n font-size: 12px;\n opacity: 0.7;\n margin: 2px 0;\n font-weight: normal;\n }\n\n .bubble-sub-button-container {\n right: 0 !important;\n }\n\n .hidden {\n display: none !important;\n }\n\n @keyframes tap-feedback {\n 0% {transform: translateX(-100%); opacity: 0;}\n 64% {transform: translateX(0); opacity: 0.1;}\n 100% {transform: translateX(100%); opacity: 0;}\n }\n\n .large .bubble-climate-container {\n height: 56px;\n border-radius: var(--bubble-climate-border-radius, var(--bubble-border-radius, 32px));\n }\n\n .large .bubble-icon-container {\n --mdc-icon-size: 24px;\n min-width: 42px !important;\n min-height: 42px !important;\n margin-left: 8px;\n }\n\n .rows-2 .bubble-sub-button-container {\n flex-direction: column;\n gap: 4px !important;\n display: grid !important;\n grid-template-columns: repeat(2, min-content);\n grid-template-rows: repeat(2, 1fr);\n grid-auto-flow: column;\n width: auto;\n }\n\n .rows-2 .bubble-sub-button {\n height: 20px !important;\n }\n",e.elements.iconContainer.appendChild(e.elements.icon),e.elements.iconContainer.appendChild(e.elements.image),e.elements.nameContainer.appendChild(e.elements.name),e.elements.nameContainer.appendChild(e.elements.state);const c=void 0!==o?.attributes?.target_temp_low,d=void 0!==o?.attributes?.target_temp_high;void 0!==o?.attributes?.temperature&&(e.elements.temperatureContainer=(0,n.az)("div","bubble-temperature-container"),l(e.elements.temperatureContainer,"temperature",r),e.elements.buttonContainer.appendChild(e.elements.temperatureContainer)),(c||d)&&(e.elements.targetTemperatureContainer=(0,n.az)("div","bubble-target-temperature-container"),c&&(e.elements.lowTempContainer=(0,n.az)("div","bubble-low-temp-container"),l(e.elements.lowTempContainer,"target_temp_low",r),e.elements.targetTemperatureContainer.appendChild(e.elements.lowTempContainer)),d&&(e.elements.highTempContainer=(0,n.az)("div","bubble-high-temp-container"),l(e.elements.highTempContainer,"target_temp_high",r),e.elements.targetTemperatureContainer.appendChild(e.elements.highTempContainer)),e.elements.buttonContainer.appendChild(e.elements.targetTemperatureContainer)),e.elements.climateCard.appendChild(e.elements.iconContainer),e.elements.climateCard.appendChild(e.elements.nameContainer),e.elements.climateCard.appendChild(e.elements.buttonContainer),e.elements.climateContainer.appendChild(e.elements.colorBackground),e.elements.climateContainer.appendChild(e.elements.climateCard),e.content.innerHTML="",e.content.appendChild(e.elements.climateContainer),e.content.appendChild(e.elements.style),e.content.appendChild(e.elements.customStyle),a(e.elements.iconContainer,e.config),e.cardType="climate"}(e),function(e){"unavailable"===(0,n.y0)(e)?e.card.classList.add("is-unavailable"):e.card.classList.remove("is-unavailable"),(0,n.pr)(e)?e.card.classList.add("is-on"):e.card.classList.remove("is-on")}(e),function(e){if(e.config.styles?.includes("card.querySelector('.bubble-name').innerText"))return;const t=(0,n.oY)(e);t!==e.previousName&&e.elements.name&&(e.elements.name.innerText=t,e.previousName=t,(0,n.GP)(e,e.elements.name,t))}(e),function(e){const t=(0,n.pr)(e),o=(0,n.q7)(e),a=(0,n.gJ)(e),i=e.elements.image.style.backgroundImage,r=e.elements.icon.icon,s=e.elements.icon.style.color;if(""!==a){const t="url("+a+")";i!==t&&(e.elements.image.style.backgroundImage=t),"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),""!==e.elements.image.style.display&&(e.elements.image.style.display="")}else if(""!==o){r!==o&&(e.elements.icon.icon=o);const n=t?`var(--bubble-icon-background-color, ${se(e)})`:"inherit";s!==n&&(e.elements.icon.style.color=n),""!==e.elements.icon.style.display&&(e.elements.icon.style.display=""),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}else"none"!==e.elements.icon.style.display&&(e.elements.icon.style.display="none"),"none"!==e.elements.image.style.display&&(e.elements.image.style.display="none")}(e),H(e),function(e){const t=(0,n.IL)(e,"temperature");""===t?e.elements.temperatureContainer?.classList.add("hidden"):e.elements.temperatureContainer?.classList.remove("hidden"),t!==e.previousTemp&&(e.previousTemp=t,e.elements.tempDisplay&&(e.elements.tempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),function(e){const t=(0,n.IL)(e,"target_temp_low"),o=e.config.hide_target_temp_low;""===t?e.elements.targetTemperatureContainer?.classList.add("hidden"):e.elements.targetTemperatureContainer?.classList.remove("hidden"),o?e.elements.lowTempContainer?.classList.add("hidden"):e.elements.lowTempContainer?.classList.remove("hidden"),t!==e.previousTargetTempLow&&(e.previousTargetTempLow=t,e.elements.lowTempDisplay&&(e.elements.lowTempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),function(e){const t=(0,n.IL)(e,"target_temp_high");e.config.hide_target_temp_high?e.elements.highTempContainer?.classList.add("hidden"):e.elements.highTempContainer?.classList.remove("hidden"),t!==e.previousTargetTempHigh&&(e.previousTargetTempHigh=t,e.elements.highTempDisplay&&(e.elements.highTempDisplay.innerText=parseFloat(t).toFixed(1)))}(e),N(e,e.content,e.elements.buttonContainer,!0),function(e){q(e),(0,n.jx)(e);const t=(0,n.y0)(e);if(e.previousState!==t&&(e.previousState=t,e.elements.colorBackground.style.backgroundColor=`var(--bubble-climate-background-color, ${se(e)})`),e.config.card_layout,e.elements.hvacModeDropdown,!e.config.styles)return;let o="";try{o=e.config.styles?Function("hass","entity","state","icon","subButtonIcon","getWeatherIcon","card",`return \`${e.config.styles}\`;`)(e._hass,e.config.entity,t,e.elements.icon,e.subButtonIcon,n.X,e.card):""}catch(e){throw new Error(`Error in generating climate custom templates: ${e.message}`)}e.elements.customStyle&&(e.elements.customStyle.innerText=o)}(e)}(this)}var e}setConfig(e){if(e.error)throw new Error(e.error);if("pop-up"===e.card_type){if(!e.hash)throw new Error("You need to define an hash. Please note that this card must be placed inside a vertical_stack to work as a pop-up.")}else if("horizontal-buttons-stack"===e.card_type){var t={};for(var n in e)if(n.match(/^\d+_icon$/)){var o=n.replace("_icon","_link");if(void 0===e[o])throw new Error("You need to define "+o);if(t[e[o]])throw new Error("You can't use "+e[o]+" twice");t[e[o]]=!0}}else if(["button","cover","climate","select","media-player"].includes(e.card_type)&&!e.entity&&"name"!==e.button_type)throw new Error("You need to define an entity");if("select"===e.card_type&&e.entity&&!e.select_attribute&&!e.entity?.startsWith("input_select")&&!e.entity?.startsWith("select"))throw new Error('"Select menu (from attributes)" missing');if(window.entityError)throw new Error("You need to define a valid entity");if("button"===e.card_type){const t={...e},n=t.button_type||"switch";t.tap_action=t.tap_action??{action:"more-info"},t.double_tap_action=t.double_tap_action??{action:"state"===n?"more-info":"toggle"},t.hold_action=t.hold_action??{action:"state"===n?"more-info":"toggle"},this.config=t}else this.config=e;this._hass&&this.updateBubbleCard()}getCardSize(){switch(this.config.card_type){case"pop-up":return-1e5;case"button":case"separator":case"empty-column":case"media-player":case"select":case"climate":return 1;case"cover":return 2;case"horizontal-buttons-stack":return 0}}static getConfigElement(){return function(){if(!le)try{le=Object.getPrototypeOf(customElements.get("ha-panel-lovelace")),ce=le.prototype?.html,de=le.prototype?.css}catch(e){return void console.error(e.message)}customElements.get("bubble-card-editor")||customElements.define("bubble-card-editor",class extends le{setConfig(e){this._config={...e}}static get properties(){return{hass:{},_config:{}}}get _card_type(){return this._config?.card_type||""}get _button_type(){return this._config?.button_type||("pop-up"===this._config?.card_type?"":"switch")}get _entity(){return this._config?.entity||""}get _name(){return this._config?.name||""}get _icon(){return this._config?.icon||""}get _state(){return this._config?.state||""}get _text(){return this._config?.text||""}get _hash(){return this._config?.hash||"#pop-up-name"}get _trigger_entity(){return this._config?.trigger_entity||""}get _trigger_state(){return this._config?.trigger_state||""}get _trigger_close(){return this._config?.trigger_close||!1}get _margin(){return this._config?.margin||"7px"}get _margin_top_mobile(){return this._config?.margin_top_mobile||"0px"}get _margin_top_desktop(){return this._config?.margin_top_desktop||"0px"}get _width_desktop(){return this._config?.width_desktop||"540px"}get _bg_color(){return this._config?.bg_color||""}get _bg_opacity(){return void 0!==this._config?.bg_opacity?this._config?.bg_opacity:"88"}get _bg_blur(){return void 0!==this._config?.bg_blur?this._config?.bg_blur:"10"}get _backdrop_blur(){return void 0!==this._config?.backdrop_blur?this._config?.backdrop_blur:"0"}get _shadow_opacity(){return void 0!==this._config?.shadow_opacity?this._config?.shadow_opacity:"0"}get _rise_animation(){return void 0===this._config?.rise_animation||this._config?.rise_animation}get _auto_close(){return this._config?.auto_close||""}get _close_on_click(){return this._config?.close_on_click||!1}get _close_by_clicking_outside(){return this._config?.close_by_clicking_outside??!0}get _background_update(){return this._config?.background_update||!1}get _icon_open(){return this._config?.icon_open||""}get _icon_close(){return this._config?.icon_close||""}get _icon_down(){return this._config?.icon_down||""}get _icon_up(){return this._config?.icon_up||""}get _open_service(){return this._config?.open_service||"cover.open_cover"}get _close_service(){return this._config?.close_service||"cover.close_cover"}get _stop_service(){return this._config?.stop_service||"cover.stop_cover"}get _auto_order(){return this._config?.auto_order||!1}get _highlight_current_view(){return this._config?.highlight_current_view||!1}get _show_state(){const e="state"===this._config?.card_type;return this._config?.show_state||e}get _show_attribute(){const e="state"===this._config.card_type;return this._config.show_attribute||e}get _show_last_changed(){const e="state"===this._config.card_type;return this._config.show_last_changed||this._config.show_last_updated||e}get _attribute(){return this._config.attribute||!1}get _hide_backdrop(){return this._config.hide_backdrop??!1}get _hide_gradient(){return this._config.hide_gradient||!1}get _hide_play_pause_button(){return this._config.hide?.play_pause_button||!1}get _hide_next_button(){return this._config.hide?.next_button||!1}get _hide_previous_button(){return this._config.hide?.previous_button||!1}get _hide_volume_button(){return this._config.hide?.volume_button||!1}get _hide_power_button(){return this._config.hide?.power_button||!1}get _sub_button(){return this._config.sub_button||""}get _button_action(){return this._config.button_action||""}get _open_action(){return this._config.open_action||""}get _close_action(){return this._config.close_action||""}get _show_header(){return this._config.show_header??!0}get _slide_to_close_distance(){return this._config.slide_to_close_distance??400}get _slider_live_update(){return this._config.slider_live_update??!1}get _cover_background(){return this._config.cover_background??!1}get _tap_action(){return{action:this._config.tap_action?.action||"more-info",navigation_path:this._config.tap_action?.navigation_path||"",url_path:this._config.tap_action?.url_path||"",service:this._config.tap_action?.service||"",target_entity:this._config.tap_action?.target?.entity_id||"",data:this._config.tap_action?.data||""}}get _double_tap_action(){return{action:this._config.double_tap_action?.action||"toggle",navigation_path:this._config.double_tap_action?.navigation_path||"",url_path:this._config.double_tap_action?.url_path||"",service:this._config.double_tap_action?.service||"",target_entity:this._config.double_tap_action?.target?.entity_id||"",data:this._config.double_tap_action?.data||""}}get _hold_action(){return{action:this._config.hold_action?.action||"toggle",navigation_path:this._config.hold_action?.navigation_path||"",url_path:this._config.hold_action?.url_path||"",service:this._config.hold_action?.service||"",target_entity:this._config.hold_action?.target?.entity_id||"",data:this._config.hold_action?.data||""}}get _selectable_attributes(){return["source_list","sound_mode_list","hvac_modes","fan_modes","swing_modes","preset_modes","effect_list"]}render(){if(!this.hass)return ce``;const t=document.querySelector("body > home-assistant").shadowRoot.querySelector("hui-dialog-edit-card").shadowRoot.querySelector("ha-dialog > div.content > div.element-preview");if("sticky"!==t.style.position&&(t.style.position="sticky",t.style.top="0"),!this.listsUpdated){const s=e=>({label:e,value:e});this.allEntitiesList=Object.keys(this.hass.states).map(s),this.lightList=Object.keys(this.hass.states).filter((e=>"light"===e.substr(0,e.indexOf(".")))).map(s),this.sensorList=Object.keys(this.hass.states).filter((e=>"sensor"===e.substr(0,e.indexOf(".")))).map(s),this.binarySensorList=Object.keys(this.hass.states).filter((e=>"binary_sensor"===e.substr(0,e.indexOf(".")))).map(s),this.coverList=Object.keys(this.hass.states).filter((e=>"cover"===e.substr(0,e.indexOf(".")))).map(s),this.mediaPlayerList=Object.keys(this.hass.states).filter((e=>"media_player"===e.substr(0,e.indexOf(".")))).map(s),this.climateList=Object.keys(this.hass.states).filter((e=>"climate"===e.substr(0,e.indexOf(".")))).map(s),this.inputSelectList=Object.keys(this.hass.states).filter((e=>{const t=this.hass.states[e],n=e.substr(0,e.indexOf(".")),o="input_select"===n||"select"===n,a=this._selectable_attributes.some((e=>t.attributes?.[e]));return o||a})).map(s),this.attributeList=Object.keys(this.hass.states[this._entity]?.attributes||{}).map((e=>{let t=this.hass.states[this._entity];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})),this.cardTypeList=[{label:"Button (Switch, slider, ...)",value:"button"},{label:"Cover",value:"cover"},{label:"Climate",value:"climate"},{label:"Empty column",value:"empty-column"},{label:"Horizontal buttons stack",value:"horizontal-buttons-stack"},{label:"Media player",value:"media-player"},{label:"Pop-up",value:"pop-up"},{label:"Select",value:"select"},{label:"Separator",value:"separator"}],this.buttonTypeList=[{label:"Switch",value:"switch"},{label:"Slider",value:"slider"},{label:"State",value:"state"},{label:"Name / Text",value:"name"}],this.tapActionTypeList=[{label:"More info",value:"more-info"},{label:"Toggle",value:"toggle"},{label:"Navigate",value:"navigate"},{label:"URL",value:"url"},{label:"Call service",value:"call-service"},{label:"Assist",value:"assist"},{label:"No action",value:"none"}],this.listsUpdated=!0}const n=this.allEntitiesList,o=(this.lightList,this.sensorList,this.coverList),a=this.cardTypeList,i=this.buttonTypeList,r="name"===this._config?.button_type;if("pop-up"===this._config?.card_type){const l=this._config?.trigger??[];return ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)}
- ${this.makeDropdown("Optional - Entity to open the pop-up based on its state","trigger_entity",n)} - - - -
- -
-
- This allows you to open this pop-up based on the state of any entity, for example you can open a "Security" pop-up with a camera when a person is in front of your house. You can also create a toggle helper (input_boolean) and trigger its opening/closing in an automation. + this._conditionChanged(e)} + > + + + The pop-up will be opened when ALL conditions are fulfilled. For example you can open a "Security" pop-up with a camera when a person is in front of your house. You can also create a toggle helper (input_boolean) and trigger its opening/closing in an automation. +
@@ -272,9 +262,9 @@ Since v1.7.0, the optimized mode has been removed to ensure stability and to simplify updates for everyone. However, if your pop-up content still appears on the screen during page loading, you can install this similar fix. ${this.makeVersion()}
- `;if("button"===this._config?.card_type)return ae` + `}if("button"===this._config?.card_type)return ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)} ${this.makeDropdown("Button type","button_type",i)} ${this.makeDropdown("slider"!==this._button_type?"Entity (toggle)":"Entity (light, media_player, cover or input_number)","entity",n,r)} @@ -341,9 +331,9 @@ This card allows you to control your entities. ${"slider"===this._config.button_type?"Supported entities: Light (brightness), media player (volume), cover (position), fan (percentage), climate (temperature), input number and number (value). To access color / control of an entity, simply tap on the icon.":""} ${this.makeVersion()}
- `;if("separator"===this._config?.card_type)return ae` + `;if("separator"===this._config?.card_type)return ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)} This card is a simple separator for dividing your pop-up into categories / sections. e.g. Lights, Devices, Covers, Settings, Automations... ${this.makeVersion()}
- `;if("horizontal-buttons-stack"===this._config?.card_type){if(!this.buttonAdded)for(this.buttonAdded=!0,this.buttonIndex=0;this._config[this.buttonIndex+1+"_link"];)this.buttonIndex++;function l(){this.buttonIndex++,this.requestUpdate()}return ae` + `;if("horizontal-buttons-stack"===this._config?.card_type){if(!this.buttonAdded)for(this.buttonAdded=!0,this.buttonIndex=0;this._config[this.buttonIndex+1+"_link"];)this.buttonIndex++;function c(){this.buttonIndex++,this.requestUpdate()}return ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)}
${this.makeButton()}
- @@ -451,10 +441,10 @@ This card is the companion to the pop-up card, allowing you to open the corresponding pop-ups. It also allows you to open any page of your dashboard. In addition, you can add your motion sensors so that the order of the buttons adapts according to the room you just entered. This card is scrollable, remains visible and acts as a footer. ${this.makeVersion()}
- `}if("cover"===this._config?.card_type)return ae` + `}if("cover"===this._config?.card_type)return ce`
- ${this.makeDropdown("Card type","card_type",o)} - ${this.makeDropdown("Entity","entity",a)} + ${this.makeDropdown("Card type","card_type",a)} + ${this.makeDropdown("Entity","entity",o)}

@@ -533,9 +523,9 @@ This card allows you to control your covers. ${this.makeVersion()}

- `;if("media-player"===this._config?.card_type)return ae` + `;if("media-player"===this._config?.card_type)return ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)} ${this.makeDropdown("Entity","entity",this.mediaPlayerList)}

@@ -660,9 +650,9 @@ This card allows you to control a media player. You can tap on the icon to get more control. ${this.makeVersion()}

- `;if("empty-column"===this._config?.card_type)return ae` + `;if("empty-column"===this._config?.card_type)return ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)}

@@ -675,11 +665,11 @@ Just an empty card to fill any empty column. ${this.makeVersion()}

- `;if("select"===this._config?.card_type){const c=this._config.entity,d=(c?.startsWith("input_select")||c?.startsWith("select")||this._config.select_attribute,this.hass.states[c]?.attributes),u=this._selectable_attributes.some((e=>d?.[e])),p=Object.keys(this.hass.states[c]?.attributes||{}).map((e=>{let t=this.hass.states[c];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})).filter((e=>this._selectable_attributes.includes(e.value)));return ae` + `;if("select"===this._config?.card_type){const d=this._config.entity,u=(d?.startsWith("input_select")||d?.startsWith("select")||this._config.select_attribute,this.hass.states[d]?.attributes),b=this._selectable_attributes.some((e=>u?.[e])),p=Object.keys(this.hass.states[d]?.attributes||{}).map((e=>{let t=this.hass.states[d];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})).filter((e=>this._selectable_attributes.includes(e.value)));return ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)} ${this.makeDropdown("Entity","entity",this.inputSelectList)} - ${u?ae` + ${b?ce`
${this.makeVersion()}
- `}if("climate"===this._config?.card_type){if("climate"===this._config.card_type&&!this.climateSubButtonsAdded&&this._config.entity){const b=this.hass.states[this._config.entity]?.attributes?.hvac_modes;this._config.sub_button&&0!==this._config.sub_button.length?this._config.sub_button=this._config.sub_button.filter((e=>!("temperature"===e.attribute&&"mdi:thermometer"===e.icon))):this._config.sub_button=[b?{name:"HVAC modes menu",select_attribute:"hvac_modes",state_background:!1,show_arrow:!1}:null].filter(Boolean),this.climateSubButtonsAdded=!0}return ae` + `}if("climate"===this._config?.card_type){if("climate"===this._config.card_type&&!this.climateSubButtonsAdded&&this._config.entity){const h=this.hass.states[this._config.entity]?.attributes?.hvac_modes;this._config.sub_button&&0!==this._config.sub_button.length||(this._config.sub_button=[h?{name:"HVAC modes menu",select_attribute:"hvac_modes",state_background:!1,show_arrow:!1}:null].filter(Boolean)),this.climateSubButtonsAdded=!0}return ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)} ${this.makeDropdown("Entity","entity",this.climateList)}

@@ -757,7 +747,7 @@ > ${this.makeDropdown("Optional - Icon","icon")} ${this.makeShowState()} - ${this.hass.states[this._config.entity]?.attributes?.target_temp_low?ae` + ${this.hass.states[this._config.entity]?.attributes?.target_temp_low?ce` `:""} - ${this.hass.states[this._config.entity]?.attributes?.target_temp_high?ae` + ${this.hass.states[this._config.entity]?.attributes?.target_temp_high?ce` This card allows you to control your climate entities. You can also add a sub-button that display a select menu for your climate modes (check if you have "Select menu" available when you create a new sub-button). ${this.makeVersion()}

- `}return this._config?.card_type?void 0:ae` + `}return this._config?.card_type?void 0:ce`
- ${this.makeDropdown("Card type","card_type",o)} + ${this.makeDropdown("Card type","card_type",a)} You need to add a card type first. Please note that in some cases, a page refresh might be needed after exiting the editor.

The Bubble Card ${e} changelog is available here.

@@ -846,7 +836,7 @@

Thank you! 🍻

${this.makeVersion()}
- `}makeLayoutOptions(){return ae` + `}makeLayoutOptions(){return ce`
- `}makeShowState(e=this._config,t="",n=!1,a){const o=e?.entity??this._config.entity??"",i="name"===this._config.button_type,r=o?.startsWith("input_select")||o?.startsWith("select")||e.select_attribute,s=Object.keys(this.hass.states[o]?.attributes||{}).map((e=>{let t=this.hass.states[o];return{label:this.hass.formatEntityAttributeName(t,e),value:e}}));return ae` - ${"sub_button"!==n?ae` + `}makeShowState(e=this._config,t="",n=!1,o){const a=e?.entity??this._config.entity??"",i="name"===this._config.button_type,r=a?.startsWith("input_select")||a?.startsWith("select")||e.select_attribute,s=Object.keys(this.hass.states[a]?.attributes||{}).map((e=>{let t=this.hass.states[a];return{label:this.hass.formatEntityAttributeName(t,e),value:e}}));return ce` + ${"sub_button"!==n?ce`
`:""} - ${"sub_button"===n?ae` + ${"sub_button"===n?ce`
`:""} - ${"sub_button"===n&&(e?.show_background??1)?ae` + ${"sub_button"===n&&(e?.show_background??1)?ce`
`:""} - ${"sub_button"===n&&(e?.show_background??1)&&(e?.entity?e?.entity?.startsWith("light"):this._config?.entity?.startsWith("light"))?ae` + ${"sub_button"===n&&(e?.state_background??1)&&a.startsWith("light")?ce`
`:""} + ${"sub_button"!==n&&a.startsWith("light")?ce` + + +
+ +
+
+ `:""}
- ${"sub_button"!==n?ae` + ${"sub_button"!==n?ce`
@@ -956,7 +959,7 @@ aria-label="Optional - Show name" .checked=${!!(e?.show_name??"sub_button"!==n)} .configValue="${t+"show_name"}" - @change="${n?e=>this._arrayValueChange(a,{show_name:e.target.checked},n):this._valueChanged}" + @change="${n?e=>this._arrayValueChange(o,{show_name:e.target.checked},n):this._valueChanged}" >
@@ -968,7 +971,7 @@ .checked="${e?.show_state??"state"===e.button_type}" .configValue="${t+"show_state"}" .disabled="${i&&"sub_button"!==n}" - @change="${n?e=>this._arrayValueChange(a,{show_state:e.target.checked},n):this._valueChanged}" + @change="${n?e=>this._arrayValueChange(o,{show_state:e.target.checked},n):this._valueChanged}" >
@@ -980,7 +983,7 @@ .checked=${e?.show_last_changed} .configValue="${t+"show_last_changed"}" .disabled="${i&&"sub_button"!==n}" - @change="${n?e=>this._arrayValueChange(a,{show_last_changed:e.target.checked},n):this._valueChanged}" + @change="${n?e=>this._arrayValueChange(o,{show_last_changed:e.target.checked},n):this._valueChanged}" >
@@ -992,13 +995,13 @@ .checked=${e?.show_attribute} .configValue="${t+"show_attribute"}" .disabled="${i&&"sub_button"!==n}" - @change="${n?e=>this._arrayValueChange(a,{show_attribute:e.target.checked},n):this._valueChanged}" + @change="${n?e=>this._arrayValueChange(o,{show_attribute:e.target.checked},n):this._valueChanged}" >
- ${e?.show_attribute?ae` + ${e?.show_attribute?ce`
`:""} - ${"sub_button"===n&&r?ae` + ${"sub_button"===n&&r?ce`
`:""} - `}makeDropdown(e,t,n,a){return e.includes("icon")||e.includes("Icon")?ae` + `}makeDropdown(e,t,n,o){return e.includes("icon")||e.includes("Icon")?ce`
- `:ae` + `:ce`
- `}makeTapActionPanel(e,t=this._config,n,a,o=this._config){this.hass;const i="Tap action"===e?"mdi:gesture-tap":"Double tap action"===e?"mdi:gesture-double-tap":"Hold action"===e?"mdi:gesture-tap-hold":"mdi:gesture-tap",r="Tap action"===e?t.tap_action:"Double tap action"===e?t.double_tap_action:"Hold action"===e?t.hold_action:"Open action"===e?t.open_action:t.close_action,s="Tap action"===e?"tap_action":"Double tap action"===e?"double_tap_action":"Hold action"===e?"hold_action":"Open action"===e?"open_action":"close_action",l=t===this._config;return n||(n=l&&"Tap action"===e?"name"!==this._config.button_type?"more-info":"none":l?"name"!==this._config.button_type?"toggle":"none":""),ae` + `}makeTapActionPanel(e,t=this._config,n,o,a=this._config){this.hass;const i="Tap action"===e?"mdi:gesture-tap":"Double tap action"===e?"mdi:gesture-double-tap":"Hold action"===e?"mdi:gesture-tap-hold":"mdi:gesture-tap",r="Tap action"===e?t.tap_action:"Double tap action"===e?t.double_tap_action:"Hold action"===e?t.hold_action:"Open action"===e?t.open_action:t.close_action,s="Tap action"===e?"tap_action":"Double tap action"===e?"double_tap_action":"Hold action"===e?"hold_action":"Open action"===e?"open_action":"close_action",l=t===this._config;return n||(n=l&&"Tap action"===e?"name"!==this._config.button_type?"more-info":"none":l?"name"!==this._config.button_type?"toggle":"none":""),ce`

@@ -1057,33 +1060,33 @@ label="${e}" .value="${r?.action??n}" .items="${this.tapActionTypeList}" - @value-changed="${e=>this._tapActionValueChange(o,{[s]:{action:e.detail.value}},a)}" + @value-changed="${e=>this._tapActionValueChange(a,{[s]:{action:e.detail.value}},o)}" >

- ${"navigate"===r?.action?ae` + ${"navigate"===r?.action?ce`
`:""} - ${"url"===r?.action?ae` + ${"url"===r?.action?ce`
`:""} - ${"call-service"===r?.action?ae` + ${"call-service"===r?.action?ce`
@@ -1091,37 +1094,37 @@ label="Optional - Entity" .value="${r?.target?.entity_id}" .items="${this.allEntitiesList}" - @value-changed="${"entity"!==r?.target?.entity_id?e=>{this._tapActionValueChange(o,{[s]:{target:{entity_id:e.detail.value}}},a)}:""}" + @value-changed="${"entity"!==r?.target?.entity_id?e=>{this._tapActionValueChange(a,{[s]:{target:{entity_id:e.detail.value}}},o)}:""}" >
`:""} - ${"call-service"===r?.action&&r?.service?ae` + ${"call-service"===r?.action&&r?.service?ce` For now, you still need to switch to the YAML editor if you want to add data: to your service. `:""}
- `}makeSubButtonPanel(){const e=this._config?.sub_button?.map(((e,t)=>{if(!e)return;const n="sub_button."+t+".",a=e.entity??this._config.entity,o=a?.startsWith("input_select")||a?.startsWith("select")||e.select_attribute,i=this.hass.states[a]?.attributes,r=this._selectable_attributes.some((e=>i?.[e])),s=Object.keys(this.hass.states[a]?.attributes||{}).map((e=>{let t=this.hass.states[a];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})).filter((e=>this._selectable_attributes.includes(e.value)));return ae` + `}makeSubButtonPanel(){const e=this._config?.sub_button?.map(((e,t)=>{if(!e)return;const n="sub_button."+t+".",o=e.entity??this._config.entity,a=o?.startsWith("input_select")||o?.startsWith("select")||e.select_attribute,i=this.hass.states[o]?.attributes,r=this._selectable_attributes.some((e=>i?.[e])),s=Object.keys(this.hass.states[o]?.attributes||{}).map((e=>{let t=this.hass.states[o];return{label:this.hass.formatEntityAttributeName(t,e),value:e}})).filter((e=>this._selectable_attributes.includes(e.value))),l=e.visibility??[];return ce`

${this._config.sub_button[t]?"Button "+(t+1)+(e.name?" - "+e.name:""):"New button"} - - ${t>0?ae``:""} - ${t + ${t `:""}

@@ -1135,12 +1138,12 @@
- ${r?ae` + ${r?ce`
- +

Tap action on button @@ -1180,9 +1183,26 @@ ${this.makeTapActionPanel("Hold action",e,"none","sub_button",t)}

+ +

+ + Visibility +

+
+ this._conditionChanged(e,t,"sub_button")} + > + + + The sub-button will be shown when ALL conditions are fulfilled. If no conditions are set, the sub-button will always be shown. + +
+
- `}));return ae` + `}));return ce`

@@ -1206,7 +1226,7 @@

- `}makeButton(){let e=[];for(let t=1;t<=this.buttonIndex;t++)e.push(ae` + `}makeButton(){let e=[];for(let t=1;t<=this.buttonIndex;t++)e.push(ce`

@@ -1256,7 +1276,7 @@

- `);return e}makeVersion(){return ae` + `);return e}makeVersion(){return ce`

@@ -1302,7 +1322,7 @@ - `}_valueChanged(e){const t=e.target,a=e.detail;let o;if("HA-SWITCH"===t.tagName?o=t.checked:void 0!==t.value&&(o="string"==typeof t.value?t.value.replace(",","."):t.value),"string"==typeof o&&(o.endsWith(".")||"-"===o))return;const{configValue:i,checked:r}=t;if(i){const n=i.split(".");let r=this._config;for(let e=0;ethis._arrayValueChange(e,t,a)),10);this._config[a]=this._config[a]||[];let o=[...this._config[a]];o[e]=o[e]||{},o[e]={...o[e],...t},this._config[a]=o,(0,n.BX)(this,"config-changed",{config:this._config}),this.requestUpdate()}_tapActionValueChange(e,t,a){if(void 0===a)for(let e in t)this._config[e]={...this._config[e],...t[e]};else{this._config[a]=this._config[a]||(a?{}:[]);let n=Array.isArray(this._config[a])?[...this._config[a]]:{...this._config[a]};if(Array.isArray(n)){n[e]=n[e]||{};let a={...n[e]};for(let e in t)a[e]=e in a?{...a[e],...t[e]}:t[e];n[e]=a}else for(let e in t)n.hasOwnProperty(e)?n[e]={...n[e],...t[e]}:n[e]=t[e];this._config[a]=n}(0,n.BX)(this,"config-changed",{config:this._config}),this.requestUpdate()}static get styles(){return oe` + `}_valueChanged(e){const t=e.target,o=e.detail;let a;if("HA-SWITCH"===t.tagName?a=t.checked:void 0!==t.value&&(a="string"==typeof t.value?t.value.replace(",","."):t.value),"string"==typeof a&&(a.endsWith(".")||"-"===a))return;const{configValue:i,checked:r}=t;if(i){const n=i.split(".");let r=this._config;for(let e=0;ethis._arrayValueChange(e,t,o)),10);this._config[o]=this._config[o]||[];let a=[...this._config[o]];a[e]=a[e]||{},a[e]={...a[e],...t},this._config[o]=a,(0,n.BX)(this,"config-changed",{config:this._config}),this.requestUpdate()}_tapActionValueChange(e,t,o){if(void 0===o)for(let e in t)this._config[e]={...this._config[e],...t[e]};else{this._config[o]=this._config[o]||(o?{}:[]);let n=Array.isArray(this._config[o])?[...this._config[o]]:{...this._config[o]};if(Array.isArray(n)){n[e]=n[e]||{};let o={...n[e]};for(let e in t)o[e]=e in o?{...o[e],...t[e]}:t[e];n[e]=o}else for(let e in t)n.hasOwnProperty(e)?n[e]={...n[e],...t[e]}:n[e]=t[e];this._config[o]=n}(0,n.BX)(this,"config-changed",{config:this._config}),this.requestUpdate()}_conditionChanged(e,t,o){if(e.stopPropagation(),o){this._config[o]=this._config[o]||[];let n=[...this._config[o]];n[t]=n[t]||{};const a=e.detail.value;n[t]={...n[t],visibility:a},this._config[o]=n}else if("pop-up"===this._config.card_type){const t=e.detail.value;this._config={...this._config,trigger:t}}(0,n.BX)(this,"config-changed",{config:this._config}),this.requestUpdate()}static get styles(){return de` div { display: grid; grid-gap: 12px; @@ -1414,4 +1434,8 @@ padding: 0; margin: 0 8px; } - `}})}(),document.createElement("bubble-card-editor")}getLayoutOptions(){let e=1;"pop-up"===this.config.card_type?e=0:"horizontal-buttons-stack"===this.config.card_type?e=1:["cover"].includes(this.config.card_type)&&(e=2);let t=4;return"pop-up"===this.config.card_type?t=0:"horizontal-buttons-stack"===this.config.card_type&&(t=4),{grid_columns:this.config.columns??t,grid_rows:this.config.rows??e}}}customElements.define("bubble-card",ie),window.customCards=window.customCards||[],window.customCards.push({type:"bubble-card",name:"Bubble Card",preview:!1,description:"A minimalist card collection with a nice pop-up touch.",documentationURL:"https://github.com/Clooos/Bubble-Card/"}),console.info(`%c Bubble Card %c ${e} `,"background-color: #555;color: #fff;padding: 3px 2px 3px 3px;border-radius: 14px 0 0 14px;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)","background-color: #506eac;color: #fff;padding: 3px 3px 3px 2px;border-radius: 0 14px 14px 0;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)")})()})(); \ No newline at end of file + + ha-card-conditions-editor { + margin-top: -12px; + } + `}})}(),document.createElement("bubble-card-editor")}getLayoutOptions(){let e=1;"pop-up"===this.config.card_type?e=0:"horizontal-buttons-stack"===this.config.card_type?e=1:["cover"].includes(this.config.card_type)&&(e=2);let t=4;return"pop-up"===this.config.card_type?t=0:"horizontal-buttons-stack"===this.config.card_type&&(t=4),{grid_columns:this.config.columns??t,grid_rows:this.config.rows??e}}}customElements.define("bubble-card",ue),window.customCards=window.customCards||[],window.customCards.push({type:"bubble-card",name:"Bubble Card",preview:!1,description:"A minimalist card collection with a nice pop-up touch.",documentationURL:"https://github.com/Clooos/Bubble-Card/"}),console.info(`%c Bubble Card %c ${e} `,"background-color: #555;color: #fff;padding: 3px 2px 3px 3px;border-radius: 14px 0 0 14px;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)","background-color: #506eac;color: #fff;padding: 3px 3px 3px 2px;border-radius: 0 14px 14px 0;font-family: DejaVu Sans,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)")})()})(); \ No newline at end of file diff --git a/www/community/Bubble-Card/bubble-card.js.gz b/www/community/Bubble-Card/bubble-card.js.gz index 668602e9..4d04a6e4 100644 Binary files a/www/community/Bubble-Card/bubble-card.js.gz and b/www/community/Bubble-Card/bubble-card.js.gz differ diff --git a/www/community/Bubble-Card/bubble-pop-up-fix.js.gz b/www/community/Bubble-Card/bubble-pop-up-fix.js.gz index b969b232..b7fe951f 100644 Binary files a/www/community/Bubble-Card/bubble-pop-up-fix.js.gz and b/www/community/Bubble-Card/bubble-pop-up-fix.js.gz differ diff --git a/www/community/android-tv-card/universal-remote-card.min.js b/www/community/android-tv-card/universal-remote-card.min.js index 94156c54..6c662ad9 100644 --- a/www/community/android-tv-card/universal-remote-card.min.js +++ b/www/community/android-tv-card/universal-remote-card.min.js @@ -1,8 +1,26 @@ /*! For license information please see universal-remote-card.min.js.LICENSE.txt */ -(()=>{var __webpack_modules__={894:function(t){var e;"undefined"!=typeof self&&self,e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e,n){"use strict";var i=Array.prototype,o=Object.prototype,a={"&":"&",'"':""","'":"'","<":"<",">":">","\\":"\"},r=/[&"'<>\\]/g;function s(t,e){return o.hasOwnProperty.call(t,e)}function c(t){return a[t]}function l(t,e,n){var i,o,a;if(t instanceof Error&&(t=(o=t).name+": "+o.message),Object.setPrototypeOf?(i=new Error(t),Object.setPrototypeOf(i,l.prototype)):(i=this,Object.defineProperty(i,"message",{enumerable:!1,writable:!0,value:t})),Object.defineProperty(i,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(i,this.constructor),o){var r=Object.getOwnPropertyDescriptor(o,"stack");(a=r&&(r.get||function(){return r.value}))||(a=function(){return o.stack})}else{var s=new Error(t).stack;a=function(){return s}}return Object.defineProperty(i,"stack",{get:function(){return a.call(i)}}),Object.defineProperty(i,"cause",{value:o}),i.lineno=e,i.colno=n,i.firstUpdate=!0,i.Update=function(t){var e="("+(t||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?e+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(e+=" [Line "+this.lineno+"]")),e+="\n ",this.firstUpdate&&(e+=" "),this.message=e+(this.message||""),this.firstUpdate=!1,this},i}function u(t){return"[object Function]"===o.toString.call(t)}function p(t){return"[object Array]"===o.toString.call(t)}function h(t){return"[object String]"===o.toString.call(t)}function d(t){return"[object Object]"===o.toString.call(t)}function m(t){var e,n=(e=t)?"string"==typeof e?e.split("."):[e]:[];return function(t){for(var e=t,i=0;it.length)r=o.slice(0,t.length),o.slice(r.length,l).forEach((function(t,n){n2?o-2:0),r=2;r0||!n)&&process.stdout.write(" ".repeat(e));var a=o===i.length-1?"":"\n";process.stdout.write(""+t+a)}))}t.exports={Node:c,Root:p,NodeList:u,Value:l,Literal:h,Symbol:d,Group:m,Array:f,Pair:y,Dict:_,Output:U,Capture:K,TemplateData:V,If:v,IfAsync:g,InlineIf:k,For:w,AsyncEach:E,AsyncAll:C,Macro:x,Caller:L,Import:T,FromImport:A,FunCall:S,Filter:O,FilterAsync:M,KeywordArgs:$,Block:I,Super:N,Extends:D,Include:P,Set:R,Switch:F,Case:j,LookupVal:b,BinOp:H,In:Y,Is:Z,Or:z,And:q,Not:W,Add:G,Concat:X,Sub:J,Mul:Q,Div:tt,FloorDiv:et,Mod:nt,Pow:it,Neg:ot,Pos:at,Compare:rt,CompareOperand:st,CallExtension:ct,CallExtensionAsync:lt,printNodes:function t(e,n){if(n=n||0,ut(e.typename+": ",n),e instanceof u)ut("\n"),e.children.forEach((function(e){t(e,n+2)}));else if(e instanceof ct)ut(e.extName+"."+e.prop+"\n"),e.args&&t(e.args,n+2),e.contentArgs&&e.contentArgs.forEach((function(e){t(e,n+2)}));else{var i=[],o=null;e.iterFields((function(t,e){t instanceof c?i.push([e,t]):(o=o||{})[e]=t})),o?ut(JSON.stringify(o,null,2)+"\n",null,!0):ut("\n"),i.forEach((function(e){var i=e[0],o=e[1];ut("["+i+"] =>",n+2),t(o,n+4)}))}}}},function(t,e){},function(t,e,n){"use strict";function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var o=n(8),a=n(17),r=n(3),s=n(0).TemplateError,c=n(2).Frame,l=n(1).Obj,u={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},p=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,i(e,n);var a=o.prototype;return a.init=function(t,e){this.templateName=t,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=e},a.fail=function(t,e,n){throw void 0!==e&&(e+=1),void 0!==n&&(n+=1),new s(t,e,n)},a._pushBuffer=function(){var t=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=t,this._emit("var "+this.buffer+' = "";'),t},a._popBuffer=function(){this.buffer=this.bufferStack.pop()},a._emit=function(t){this.codebuf.push(t)},a._emitLine=function(t){this._emit(t+"\n")},a._emitLines=function(){for(var t=this,e=arguments.length,n=new Array(e),i=0;i0&&o._emit(","),o.compile(t,e)})),i&&this._emit(i)},a._compileExpression=function(t,e){this.assertType(t,r.Literal,r.Symbol,r.Group,r.Array,r.Dict,r.FunCall,r.Caller,r.Filter,r.LookupVal,r.Compare,r.InlineIf,r.In,r.Is,r.And,r.Or,r.Not,r.Add,r.Concat,r.Sub,r.Mul,r.Div,r.FloorDiv,r.Mod,r.Pow,r.Neg,r.Pos,r.Compare,r.NodeList),this.compile(t,e)},a.assertType=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i0&&i._emit(","),t){i._emitLine("function(cb) {"),i._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var o=i._pushBuffer();i._withScopedSyntax((function(){i.compile(t,e),i._emitLine("cb(null, "+o+");")})),i._popBuffer(),i._emitLine("return "+o+";"),i._emitLine("}")}else i._emit("null")})),n){var c=this._tmpid();this._emitLine(", "+this._makeCallback(c)),this._emitLine(this.buffer+" += runtime.suppressValue("+c+", "+s+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+s+" && env.opts.autoescape);\n")},a.compileCallExtensionAsync=function(t,e){this.compileCallExtension(t,e,!0)},a.compileNodeList=function(t,e){this._compileChildren(t,e)},a.compileLiteral=function(t){if("string"==typeof t.value){var e=t.value.replace(/\\/g,"\\\\");e=(e=(e=(e=(e=e.replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u2028/g,"\\u2028"),this._emit('"'+e+'"')}else null===t.value?this._emit("null"):this._emit(t.value.toString())},a.compileSymbol=function(t,e){var n=t.value,i=e.lookup(n);i?this._emit(i):this._emit('runtime.contextOrFrameLookup(context, frame, "'+n+'")')},a.compileGroup=function(t,e){this._compileAggregate(t,e,"(",")")},a.compileArray=function(t,e){this._compileAggregate(t,e,"[","]")},a.compileDict=function(t,e){this._compileAggregate(t,e,"{","}")},a.compilePair=function(t,e){var n=t.key,i=t.value;n instanceof r.Symbol?n=new r.Literal(n.lineno,n.colno,n.value):n instanceof r.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,e),this._emit(": "),this._compileExpression(i,e)},a.compileInlineIf=function(t,e){this._emit("("),this.compile(t.cond,e),this._emit("?"),this.compile(t.body,e),this._emit(":"),null!==t.else_?this.compile(t.else_,e):this._emit('""'),this._emit(")")},a.compileIn=function(t,e){this._emit("runtime.inOperator("),this.compile(t.left,e),this._emit(","),this.compile(t.right,e),this._emit(")")},a.compileIs=function(t,e){var n=t.right.name?t.right.name.value:t.right.value;this._emit('env.getTest("'+n+'").call(context, '),this.compile(t.left,e),t.right.args&&(this._emit(","),this.compile(t.right.args,e)),this._emit(") === true")},a._binOpEmitter=function(t,e,n){this.compile(t.left,e),this._emit(n),this.compile(t.right,e)},a.compileOr=function(t,e){return this._binOpEmitter(t,e," || ")},a.compileAnd=function(t,e){return this._binOpEmitter(t,e," && ")},a.compileAdd=function(t,e){return this._binOpEmitter(t,e," + ")},a.compileConcat=function(t,e){return this._binOpEmitter(t,e,' + "" + ')},a.compileSub=function(t,e){return this._binOpEmitter(t,e," - ")},a.compileMul=function(t,e){return this._binOpEmitter(t,e," * ")},a.compileDiv=function(t,e){return this._binOpEmitter(t,e," / ")},a.compileMod=function(t,e){return this._binOpEmitter(t,e," % ")},a.compileNot=function(t,e){this._emit("!"),this.compile(t.target,e)},a.compileFloorDiv=function(t,e){this._emit("Math.floor("),this.compile(t.left,e),this._emit(" / "),this.compile(t.right,e),this._emit(")")},a.compilePow=function(t,e){this._emit("Math.pow("),this.compile(t.left,e),this._emit(", "),this.compile(t.right,e),this._emit(")")},a.compileNeg=function(t,e){this._emit("-"),this.compile(t.target,e)},a.compilePos=function(t,e){this._emit("+"),this.compile(t.target,e)},a.compileCompare=function(t,e){var n=this;this.compile(t.expr,e),t.ops.forEach((function(t){n._emit(" "+u[t.type]+" "),n.compile(t.expr,e)}))},a.compileLookupVal=function(t,e){this._emit("runtime.memberLookup(("),this._compileExpression(t.target,e),this._emit("),"),this._compileExpression(t.val,e),this._emit(")")},a._getNodeName=function(t){switch(t.typename){case"Symbol":return t.value;case"FunCall":return"the return value of ("+this._getNodeName(t.name)+")";case"LookupVal":return this._getNodeName(t.target)+'["'+this._getNodeName(t.val)+'"]';case"Literal":return t.value.toString();default:return"--expression--"}},a.compileFunCall=function(t,e){this._emit("(lineno = "+t.lineno+", colno = "+t.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(t.name,e),this._emit(', "'+this._getNodeName(t.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(t.args,e,"[","])"),this._emit(")")},a.compileFilter=function(t,e){var n=t.name;this.assertType(n,r.Symbol),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(t.args,e),this._emit(")")},a.compileFilterAsync=function(t,e){var n=t.name,i=t.symbol.value;this.assertType(n,r.Symbol),e.set(i,i),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(t.args,e),this._emitLine(", "+this._makeCallback(i)),this._addScopeLevel()},a.compileKeywordArgs=function(t,e){this._emit("runtime.makeKeywordArgs("),this.compileDict(t,e),this._emit(")")},a.compileSet=function(t,e){var n=this,i=[];t.targets.forEach((function(t){var o=t.value,a=e.lookup(o);null==a&&(a=n._tmpid(),n._emitLine("var "+a+";")),i.push(a)})),t.value?(this._emit(i.join(" = ")+" = "),this._compileExpression(t.value,e),this._emitLine(";")):(this._emit(i.join(" = ")+" = "),this.compile(t.body,e),this._emitLine(";")),t.targets.forEach((function(t,e){var o=i[e],a=t.value;n._emitLine('frame.set("'+a+'", '+o+", true);"),n._emitLine("if(frame.topLevel) {"),n._emitLine('context.setVariable("'+a+'", '+o+");"),n._emitLine("}"),"_"!==a.charAt(0)&&(n._emitLine("if(frame.topLevel) {"),n._emitLine('context.addExport("'+a+'", '+o+");"),n._emitLine("}"))}))},a.compileSwitch=function(t,e){var n=this;this._emit("switch ("),this.compile(t.expr,e),this._emit(") {"),t.cases.forEach((function(t,i){n._emit("case "),n.compile(t.cond,e),n._emit(": "),n.compile(t.body,e),t.body.children.length&&n._emitLine("break;")})),t.default&&(this._emit("default:"),this.compile(t.default,e)),this._emit("}")},a.compileIf=function(t,e,n){var i=this;this._emit("if("),this._compileExpression(t.cond,e),this._emitLine(") {"),this._withScopedSyntax((function(){i.compile(t.body,e),n&&i._emit("cb()")})),t.else_?(this._emitLine("}\nelse {"),this._withScopedSyntax((function(){i.compile(t.else_,e),n&&i._emit("cb()")}))):n&&(this._emitLine("}\nelse {"),this._emit("cb()")),this._emitLine("}")},a.compileIfAsync=function(t,e){this._emit("(function(cb) {"),this.compileIf(t,e,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},a._emitLoopBindings=function(t,e,n,i){var o=this;[{name:"index",val:n+" + 1"},{name:"index0",val:n},{name:"revindex",val:i+" - "+n},{name:"revindex0",val:i+" - "+n+" - 1"},{name:"first",val:n+" === 0"},{name:"last",val:n+" === "+i+" - 1"},{name:"length",val:i}].forEach((function(t){o._emitLine('frame.set("loop.'+t.name+'", '+t.val+");")}))},a.compileFor=function(t,e){var n=this,i=this._tmpid(),o=this._tmpid(),a=this._tmpid();if(e=e.push(),this._emitLine("frame = frame.push();"),this._emit("var "+a+" = "),this._compileExpression(t.arr,e),this._emitLine(";"),this._emit("if("+a+") {"),this._emitLine(a+" = runtime.fromIterator("+a+");"),t.name instanceof r.Array){this._emitLine("var "+i+";"),this._emitLine("if(runtime.isArray("+a+")) {"),this._emitLine("var "+o+" = "+a+".length;"),this._emitLine("for("+i+"=0; "+i+" < "+a+".length; "+i+"++) {"),t.name.children.forEach((function(o,r){var s=n._tmpid();n._emitLine("var "+s+" = "+a+"["+i+"]["+r+"];"),n._emitLine('frame.set("'+o+'", '+a+"["+i+"]["+r+"]);"),e.set(t.name.children[r].value,s)})),this._emitLoopBindings(t,a,i,o),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}"),this._emitLine("} else {");var s=t.name.children,c=s[0],l=s[1],u=this._tmpid(),p=this._tmpid();e.set(c.value,u),e.set(l.value,p),this._emitLine(i+" = -1;"),this._emitLine("var "+o+" = runtime.keys("+a+").length;"),this._emitLine("for(var "+u+" in "+a+") {"),this._emitLine(i+"++;"),this._emitLine("var "+p+" = "+a+"["+u+"];"),this._emitLine('frame.set("'+c.value+'", '+u+");"),this._emitLine('frame.set("'+l.value+'", '+p+");"),this._emitLoopBindings(t,a,i,o),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}"),this._emitLine("}")}else{var h=this._tmpid();e.set(t.name.value,h),this._emitLine("var "+o+" = "+a+".length;"),this._emitLine("for(var "+i+"=0; "+i+" < "+a+".length; "+i+"++) {"),this._emitLine("var "+h+" = "+a+"["+i+"];"),this._emitLine('frame.set("'+t.name.value+'", '+h+");"),this._emitLoopBindings(t,a,i,o),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}")}this._emitLine("}"),t.else_&&(this._emitLine("if (!"+o+") {"),this.compile(t.else_,e),this._emitLine("}")),this._emitLine("frame = frame.pop();")},a._compileAsyncLoop=function(t,e,n){var i=this,o=this._tmpid(),a=this._tmpid(),s=this._tmpid(),c=n?"asyncAll":"asyncEach";if(e=e.push(),this._emitLine("frame = frame.push();"),this._emit("var "+s+" = runtime.fromIterator("),this._compileExpression(t.arr,e),this._emitLine(");"),t.name instanceof r.Array){var l=t.name.children.length;this._emit("runtime."+c+"("+s+", "+l+", function("),t.name.children.forEach((function(t){i._emit(t.value+",")})),this._emit(o+","+a+",next) {"),t.name.children.forEach((function(t){var n=t.value;e.set(n,n),i._emitLine('frame.set("'+n+'", '+n+");")}))}else{var u=t.name.value;this._emitLine("runtime."+c+"("+s+", 1, function("+u+", "+o+", "+a+",next) {"),this._emitLine('frame.set("'+u+'", '+u+");"),e.set(u,u)}this._emitLoopBindings(t,s,o,a),this._withScopedSyntax((function(){var a;n&&(a=i._pushBuffer()),i.compile(t.body,e),i._emitLine("next("+o+(a?","+a:"")+");"),n&&i._popBuffer()}));var p=this._tmpid();this._emitLine("}, "+this._makeCallback(p)),this._addScopeLevel(),n&&this._emitLine(this.buffer+" += "+p+";"),t.else_&&(this._emitLine("if (!"+s+".length) {"),this.compile(t.else_,e),this._emitLine("}")),this._emitLine("frame = frame.pop();")},a.compileAsyncEach=function(t,e){this._compileAsyncLoop(t,e)},a.compileAsyncAll=function(t,e){this._compileAsyncLoop(t,e,!0)},a._compileMacro=function(t,e){var n=this,i=[],o=null,a="macro_"+this._tmpid(),s=void 0!==e;t.args.children.forEach((function(e,a){a===t.args.children.length-1&&e instanceof r.Dict?o=e:(n.assertType(e,r.Symbol),i.push(e))}));var l,u=[].concat(i.map((function(t){return"l_"+t.value})),["kwargs"]),p=i.map((function(t){return'"'+t.value+'"'})),h=(o&&o.children||[]).map((function(t){return'"'+t.key.value+'"'}));l=s?e.push(!0):new c,this._emitLines("var "+a+" = runtime.makeMacro(","["+p.join(", ")+"], ","["+h.join(", ")+"], ","function ("+u.join(", ")+") {","var callerFrame = frame;","frame = "+(s?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),i.forEach((function(t){n._emitLine('frame.set("'+t.value+'", l_'+t.value+");"),l.set(t.value,"l_"+t.value)})),o&&o.children.forEach((function(t){var e=t.key.value;n._emit('frame.set("'+e+'", '),n._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+e+'")'),n._emit(' ? kwargs["'+e+'"] : '),n._compileExpression(t.value,l),n._emit(");")}));var d=this._pushBuffer();return this._withScopedSyntax((function(){n.compile(t.body,l)})),this._emitLine("frame = "+(s?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+d+");"),this._emitLine("});"),this._popBuffer(),a},a.compileMacro=function(t,e){var n=this._compileMacro(t),i=t.name.value;e.set(i,n),e.parent?this._emitLine('frame.set("'+i+'", '+n+");"):("_"!==t.name.value.charAt(0)&&this._emitLine('context.addExport("'+i+'");'),this._emitLine('context.setVariable("'+i+'", '+n+");"))},a.compileCaller=function(t,e){this._emit("(function (){");var n=this._compileMacro(t,e);this._emit("return "+n+";})()")},a._compileGetTemplate=function(t,e,n,i){var o=this._tmpid(),a=this._templateName(),r=this._makeCallback(o),s=n?"true":"false",c=i?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(t.template,e),this._emitLine(", "+s+", "+a+", "+c+", "+r),o},a.compileImport=function(t,e){var n=t.target.value,i=this._compileGetTemplate(t,e,!1,!1);this._addScopeLevel(),this._emitLine(i+".getExported("+(t.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(i)),this._addScopeLevel(),e.set(n,i),e.parent?this._emitLine('frame.set("'+n+'", '+i+");"):this._emitLine('context.setVariable("'+n+'", '+i+");")},a.compileFromImport=function(t,e){var n=this,i=this._compileGetTemplate(t,e,!1,!1);this._addScopeLevel(),this._emitLine(i+".getExported("+(t.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(i)),this._addScopeLevel(),t.names.children.forEach((function(t){var o,a,s=n._tmpid();t instanceof r.Pair?(o=t.key.value,a=t.value.value):a=o=t.value,n._emitLine("if(Object.prototype.hasOwnProperty.call("+i+', "'+o+'")) {'),n._emitLine("var "+s+" = "+i+"."+o+";"),n._emitLine("} else {"),n._emitLine("cb(new Error(\"cannot import '"+o+"'\")); return;"),n._emitLine("}"),e.set(a,s),e.parent?n._emitLine('frame.set("'+a+'", '+s+");"):n._emitLine('context.setVariable("'+a+'", '+s+");")}))},a.compileBlock=function(t){var e=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+t.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(e)),this._emitLine(this.buffer+" += "+e+";"),this._addScopeLevel()},a.compileSuper=function(t,e){var n=t.blockName.value,i=t.symbol.value,o=this._makeCallback(i);this._emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+o),this._emitLine(i+" = runtime.markSafe("+i+");"),this._addScopeLevel(),e.set(i,i)},a.compileExtends=function(t,e){var n=this._tmpid(),i=this._compileGetTemplate(t,e,!0,!1);this._emitLine("parentTemplate = "+i),this._emitLine("for(var "+n+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this._emitLine("}"),this._addScopeLevel()},a.compileInclude=function(t,e){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var n=this._compileGetTemplate(t,e,!1,t.ignoreMissing);this._emitLine("callback(null,"+n+");});"),this._emitLine("});");var i=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(i)),this._emitLine("callback(null,"+i+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},a.compileTemplateData=function(t,e){this.compileLiteral(t,e)},a.compileCapture=function(t,e){var n=this,i=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=i},a.compileOutput=function(t,e){var n=this;t.children.forEach((function(i){i instanceof r.TemplateData?i.value&&(n._emit(n.buffer+" += "),n.compileLiteral(i,e),n._emitLine(";")):(n._emit(n.buffer+" += runtime.suppressValue("),n.throwOnUndefined&&n._emit("runtime.ensureDefined("),n.compile(i,e),n.throwOnUndefined&&n._emit(","+t.lineno+","+t.colno+")"),n._emit(", env.opts.autoescape);\n"))}))},a.compileRoot=function(t,e){var n=this;e&&this.fail("compileRoot: root node can't have frame"),e=new c,this._emitFuncBegin(t,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(t,e),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var i=[],o=t.findAll(r.Block);o.forEach((function(t,e){var o=t.name.value;if(-1!==i.indexOf(o))throw new Error('Block "'+o+'" defined more than once.');i.push(o),n._emitFuncBegin(t,"b_"+o);var a=new c;n._emitLine("var frame = frame.push(true);"),n.compile(t.body,a),n._emitFuncEnd()})),this._emitLine("return {"),o.forEach((function(t,e){var i="b_"+t.name.value;n._emitLine(i+": "+i+",")})),this._emitLine("root: root\n};")},a.compile=function(t,e){var n=this["compile"+t.typename];n?n.call(this,t,e):this.fail("compile: Cannot compile node: "+t.typename,t.lineno,t.colno)},a.getCode=function(){return this.codebuf.join("")},o}(l);t.exports={compile:function(t,e,n,i,r){void 0===r&&(r={});var s=new p(i,r.throwOnUndefined),c=(n||[]).map((function(t){return t.preprocess})).filter((function(t){return!!t})).reduce((function(t,e){return e(t)}),t);return s.compile(a.transform(o.parse(c,n,r),e,i)),s.getCode()},Compiler:p}},function(t,e,n){"use strict";function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var o=n(4),a=n(1).EmitterObj;t.exports=function(t){var e,n;function a(){return t.apply(this,arguments)||this}n=t,(e=a).prototype=Object.create(n.prototype),e.prototype.constructor=e,i(e,n);var r=a.prototype;return r.resolve=function(t,e){return o.resolve(o.dirname(t),e)},r.isRelative=function(t){return 0===t.indexOf("./")||0===t.indexOf("../")},a}(a)},function(t,e,n){"use strict";function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}var a=n(12),r=n(15),s=n(0),c=n(5),l=n(18),u=n(10),p=u.FileSystemLoader,h=u.WebLoader,d=u.PrecompiledLoader,m=n(20),f=n(21),y=n(1),_=y.Obj,b=y.EmitterObj,v=n(2),g=v.handleError,k=v.Frame,w=n(22);function E(t,e,n){a((function(){t(e,n)}))}var C={type:"code",obj:{root:function(t,e,n,i,o){try{o(null,"")}catch(t){o(g(t,null,null))}}}},x=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.init=function(t,e){var n=this;e=this.opts=e||{},this.opts.dev=!!e.dev,this.opts.autoescape=null==e.autoescape||e.autoescape,this.opts.throwOnUndefined=!!e.throwOnUndefined,this.opts.trimBlocks=!!e.trimBlocks,this.opts.lstripBlocks=!!e.lstripBlocks,this.loaders=[],t?this.loaders=s.isArray(t)?t:[t]:p?this.loaders=[new p("views")]:h&&(this.loaders=[new h("/views")]),"undefined"!=typeof window&&window.nunjucksPrecompiled&&this.loaders.unshift(new d(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=f(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],s._entries(l).forEach((function(t){var e=t[0],i=t[1];return n.addFilter(e,i)})),s._entries(m).forEach((function(t){var e=t[0],i=t[1];return n.addTest(e,i)}))},n._initLoaders=function(){var t=this;this.loaders.forEach((function(e){e.cache={},"function"==typeof e.on&&(e.on("update",(function(n,i){e.cache[n]=null,t.emit("update",n,i,e)})),e.on("load",(function(n,i){t.emit("load",n,i,e)})))}))},n.invalidateCache=function(){this.loaders.forEach((function(t){t.cache={}}))},n.addExtension=function(t,e){return e.__name=t,this.extensions[t]=e,this.extensionsList.push(e),this},n.removeExtension=function(t){var e=this.getExtension(t);e&&(this.extensionsList=s.without(this.extensionsList,e),delete this.extensions[t])},n.getExtension=function(t){return this.extensions[t]},n.hasExtension=function(t){return!!this.extensions[t]},n.addGlobal=function(t,e){return this.globals[t]=e,this},n.getGlobal=function(t){if(void 0===this.globals[t])throw new Error("global not found: "+t);return this.globals[t]},n.addFilter=function(t,e,n){var i=e;return n&&this.asyncFilters.push(t),this.filters[t]=i,this},n.getFilter=function(t){if(!this.filters[t])throw new Error("filter not found: "+t);return this.filters[t]},n.addTest=function(t,e){return this.tests[t]=e,this},n.getTest=function(t){if(!this.tests[t])throw new Error("test not found: "+t);return this.tests[t]},n.resolveTemplate=function(t,e,n){return t.isRelative&&e&&t.isRelative(n)&&t.resolve?t.resolve(e,n):n},n.getTemplate=function(t,e,n,i,o){var a,r=this,c=this,l=null;if(t&&t.raw&&(t=t.raw),s.isFunction(n)&&(o=n,n=null,e=e||!1),s.isFunction(e)&&(o=e,e=!1),t instanceof T)l=t;else{if("string"!=typeof t)throw new Error("template names must be a string: "+t);for(var u=0;u0&&!this.skip(o.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",t.lineno,t.colno);var s=this.parsePrimary();if("_"===s.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",s.lineno,s.colno),this.skipSymbol("as")){var c=this.parsePrimary();i.addChild(new a.Pair(s.lineno,s.colno,s,c))}else i.addChild(s);n=this.parseWithContext()}return new a.FromImport(t.lineno,t.colno,e,i,n)},c.parseBlock=function(){var t=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",t.lineno,t.colno);var e=new a.Block(t.lineno,t.colno);e.name=this.parsePrimary(),e.name instanceof a.Symbol||this.fail("parseBlock: variable name expected",t.lineno,t.colno),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(e.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),e},c.parseExtends=function(){var t="extends",e=this.peekToken();this.skipSymbol(t)||this.fail("parseTemplateRef: expected "+t);var n=new a.Extends(e.lineno,e.colno);return n.template=this.parseExpression(),this.advanceAfterBlockEnd(e.value),n},c.parseInclude=function(){var t="include",e=this.peekToken();this.skipSymbol(t)||this.fail("parseInclude: expected "+t);var n=new a.Include(e.lineno,e.colno);return n.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(n.ignoreMissing=!0),this.advanceAfterBlockEnd(e.value),n},c.parseIf=function(){var t,e=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?t=new a.If(e.lineno,e.colno):this.skipSymbol("ifAsync")?t=new a.IfAsync(e.lineno,e.colno):this.fail("parseIf: expected if, elif, or elseif",e.lineno,e.colno),t.cond=this.parseExpression(),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("elif","elseif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elseif":case"elif":t.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),t.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":t.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return t},c.parseSet=function(){var t=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",t.lineno,t.colno);for(var e,n=new a.Set(t.lineno,t.colno,[]);(e=this.parsePrimary())&&(n.targets.push(e),this.skip(o.TOKEN_COMMA)););return this.skipValue(o.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(t.value)):this.skip(o.TOKEN_BLOCK_END)?(n.body=new a.Capture(t.lineno,t.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",t.lineno,t.colno),n},c.parseSwitch=function(){var t="switch",e="endswitch",n="case",i="default",o=this.peekToken();this.skipSymbol(t)||this.skipSymbol(n)||this.skipSymbol(i)||this.fail('parseSwitch: expected "switch," "case" or "default"',o.lineno,o.colno);var r=this.parseExpression();this.advanceAfterBlockEnd(t),this.parseUntilBlocks(n,i,e);var s,c=this.peekToken(),l=[];do{this.skipSymbol(n);var u=this.parseExpression();this.advanceAfterBlockEnd(t);var p=this.parseUntilBlocks(n,i,e);l.push(new a.Case(c.line,c.col,u,p)),c=this.peekToken()}while(c&&c.value===n);switch(c.value){case i:this.advanceAfterBlockEnd(),s=this.parseUntilBlocks(e),this.advanceAfterBlockEnd();break;case e:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new a.Switch(o.lineno,o.colno,r,l,s)},c.parseStatement=function(){var t=this.peekToken();if(t.type!==o.TOKEN_SYMBOL&&this.fail("tag name expected",t.lineno,t.colno),this.breakOnBlocks&&-1!==s.indexOf(this.breakOnBlocks,t.value))return null;switch(t.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var e=0;e0;){var c=r[0],l=r[1],u=r[2];u===t?i+=1:u===e&&(i-=1),0===i?(o+=l,this.tokens.backN(c.length-l.length)):o+=c}return new a.Output(s.lineno,s.colno,[new a.TemplateData(s.lineno,s.colno,o)])},c.parsePostfix=function(t){for(var e,n=this.peekToken();n;){if(n.type===o.TOKEN_LEFT_PAREN)t=new a.FunCall(n.lineno,n.colno,t,this.parseSignature());else if(n.type===o.TOKEN_LEFT_BRACKET)(e=this.parseAggregate()).children.length>1&&this.fail("invalid index"),t=new a.LookupVal(n.lineno,n.colno,t,e.children[0]);else{if(n.type!==o.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var i=this.nextToken();i.type!==o.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+i.value,i.lineno,i.colno),e=new a.Literal(i.lineno,i.colno,i.value),t=new a.LookupVal(n.lineno,n.colno,t,e)}n=this.peekToken()}return t},c.parseExpression=function(){return this.parseInlineIf()},c.parseInlineIf=function(){var t=this.parseOr();if(this.skipSymbol("if")){var e=this.parseOr(),n=t;(t=new a.InlineIf(t.lineno,t.colno)).body=n,t.cond=e,this.skipSymbol("else")?t.else_=this.parseOr():t.else_=null}return t},c.parseOr=function(){for(var t=this.parseAnd();this.skipSymbol("or");){var e=this.parseAnd();t=new a.Or(t.lineno,t.colno,t,e)}return t},c.parseAnd=function(){for(var t=this.parseNot();this.skipSymbol("and");){var e=this.parseNot();t=new a.And(t.lineno,t.colno,t,e)}return t},c.parseNot=function(){var t=this.peekToken();return this.skipSymbol("not")?new a.Not(t.lineno,t.colno,this.parseNot()):this.parseIn()},c.parseIn=function(){for(var t=this.parseIs();;){var e=this.nextToken();if(!e)break;var n=e.type===o.TOKEN_SYMBOL&&"not"===e.value;if(n||this.pushToken(e),!this.skipSymbol("in")){n&&this.pushToken(e);break}var i=this.parseIs();t=new a.In(t.lineno,t.colno,t,i),n&&(t=new a.Not(t.lineno,t.colno,t))}return t},c.parseIs=function(){var t=this.parseCompare();if(this.skipSymbol("is")){var e=this.skipSymbol("not"),n=this.parseCompare();t=new a.Is(t.lineno,t.colno,t,n),e&&(t=new a.Not(t.lineno,t.colno,t))}return t},c.parseCompare=function(){for(var t=["==","===","!=","!==","<",">","<=",">="],e=this.parseConcat(),n=[];;){var i=this.nextToken();if(!i)break;if(-1===t.indexOf(i.value)){this.pushToken(i);break}n.push(new a.CompareOperand(i.lineno,i.colno,this.parseConcat(),i.value))}return n.length?new a.Compare(n[0].lineno,n[0].colno,e,n):e},c.parseConcat=function(){for(var t=this.parseAdd();this.skipValue(o.TOKEN_TILDE,"~");){var e=this.parseAdd();t=new a.Concat(t.lineno,t.colno,t,e)}return t},c.parseAdd=function(){for(var t=this.parseSub();this.skipValue(o.TOKEN_OPERATOR,"+");){var e=this.parseSub();t=new a.Add(t.lineno,t.colno,t,e)}return t},c.parseSub=function(){for(var t=this.parseMul();this.skipValue(o.TOKEN_OPERATOR,"-");){var e=this.parseMul();t=new a.Sub(t.lineno,t.colno,t,e)}return t},c.parseMul=function(){for(var t=this.parseDiv();this.skipValue(o.TOKEN_OPERATOR,"*");){var e=this.parseDiv();t=new a.Mul(t.lineno,t.colno,t,e)}return t},c.parseDiv=function(){for(var t=this.parseFloorDiv();this.skipValue(o.TOKEN_OPERATOR,"/");){var e=this.parseFloorDiv();t=new a.Div(t.lineno,t.colno,t,e)}return t},c.parseFloorDiv=function(){for(var t=this.parseMod();this.skipValue(o.TOKEN_OPERATOR,"//");){var e=this.parseMod();t=new a.FloorDiv(t.lineno,t.colno,t,e)}return t},c.parseMod=function(){for(var t=this.parsePow();this.skipValue(o.TOKEN_OPERATOR,"%");){var e=this.parsePow();t=new a.Mod(t.lineno,t.colno,t,e)}return t},c.parsePow=function(){for(var t=this.parseUnary();this.skipValue(o.TOKEN_OPERATOR,"**");){var e=this.parseUnary();t=new a.Pow(t.lineno,t.colno,t,e)}return t},c.parseUnary=function(t){var e,n=this.peekToken();return e=this.skipValue(o.TOKEN_OPERATOR,"-")?new a.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(o.TOKEN_OPERATOR,"+")?new a.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),t||(e=this.parseFilter(e)),e},c.parsePrimary=function(t){var e,n=this.nextToken(),i=null;if(n?n.type===o.TOKEN_STRING?e=n.value:n.type===o.TOKEN_INT?e=parseInt(n.value,10):n.type===o.TOKEN_FLOAT?e=parseFloat(n.value):n.type===o.TOKEN_BOOLEAN?"true"===n.value?e=!0:"false"===n.value?e=!1:this.fail("invalid boolean: "+n.value,n.lineno,n.colno):n.type===o.TOKEN_NONE?e=null:n.type===o.TOKEN_REGEX&&(e=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==e?i=new a.Literal(n.lineno,n.colno,e):n.type===o.TOKEN_SYMBOL?i=new a.Symbol(n.lineno,n.colno,n.value):(this.pushToken(n),i=this.parseAggregate()),t||(i=this.parsePostfix(i)),i)return i;throw this.error("unexpected token: "+n.value,n.lineno,n.colno)},c.parseFilterName=function(){for(var t=this.expect(o.TOKEN_SYMBOL),e=t.value;this.skipValue(o.TOKEN_OPERATOR,".");)e+="."+this.expect(o.TOKEN_SYMBOL).value;return new a.Symbol(t.lineno,t.colno,e)},c.parseFilterArgs=function(t){return this.peekToken().type===o.TOKEN_LEFT_PAREN?this.parsePostfix(t).args.children:[]},c.parseFilter=function(t){for(;this.skip(o.TOKEN_PIPE);){var e=this.parseFilterName();t=new a.Filter(e.lineno,e.colno,e,new a.NodeList(e.lineno,e.colno,[t].concat(this.parseFilterArgs(t))))}return t},c.parseFilterStatement=function(){var t=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var e=this.parseFilterName(),n=this.parseFilterArgs(e);this.advanceAfterBlockEnd(t.value);var i=new a.Capture(e.lineno,e.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var o=new a.Filter(e.lineno,e.colno,e,new a.NodeList(e.lineno,e.colno,[i].concat(n)));return new a.Output(e.lineno,e.colno,[o])},c.parseAggregate=function(){var t,e=this.nextToken();switch(e.type){case o.TOKEN_LEFT_PAREN:t=new a.Group(e.lineno,e.colno);break;case o.TOKEN_LEFT_BRACKET:t=new a.Array(e.lineno,e.colno);break;case o.TOKEN_LEFT_CURLY:t=new a.Dict(e.lineno,e.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===o.TOKEN_RIGHT_PAREN||n===o.TOKEN_RIGHT_BRACKET||n===o.TOKEN_RIGHT_CURLY){this.nextToken();break}if(t.children.length>0&&(this.skip(o.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",e.lineno,e.colno)),t instanceof a.Dict){var i=this.parsePrimary();this.skip(o.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",e.lineno,e.colno);var r=this.parseExpression();t.addChild(new a.Pair(i.lineno,i.colno,i,r))}else{var s=this.parseExpression();t.addChild(s)}}return t},c.parseSignature=function(t,e){var n=this.peekToken();if(!e&&n.type!==o.TOKEN_LEFT_PAREN){if(t)return null;this.fail("expected arguments",n.lineno,n.colno)}n.type===o.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var i=new a.NodeList(n.lineno,n.colno),r=new a.KeywordArgs(n.lineno,n.colno),s=!1;;){if(n=this.peekToken(),!e&&n.type===o.TOKEN_RIGHT_PAREN){this.nextToken();break}if(e&&n.type===o.TOKEN_BLOCK_END)break;if(s&&!this.skip(o.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else{var c=this.parseExpression();this.skipValue(o.TOKEN_OPERATOR,"=")?r.addChild(new a.Pair(c.lineno,c.colno,c,this.parseExpression())):i.addChild(c)}s=!0}return r.children.length&&i.addChild(r),i},c.parseUntilBlocks=function(){for(var t=this.breakOnBlocks,e=arguments.length,n=new Array(e),i=0;i=","//","**"],R=M+this.current();switch(-1!==i.indexOf(P,R)&&(this.forward(),M=R,-1!==i.indexOf(P,R+this.current())&&(M=R+this.current(),this.forward())),M){case"(":D=m;break;case")":D=f;break;case"[":D=y;break;case"]":D=_;break;case"{":D=b;break;case"}":D=v;break;case",":D=k;break;case":":D=w;break;case"~":D=E;break;case"|":D=C;break;default:D=g}return O(D,M,e,n)}if((t=this._extractUntil(o+a)).match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var F=this._extract("0123456789");return O(x,t+"."+F,e,n)}return O("int",t,e,n)}if(t.match(/^(true|false)$/))return O(L,t,e,n);if("none"===t)return O(T,t,e,n);if("null"===t)return O(T,t,e,n);if(t)return O(A,t,e,n);throw new Error("Unexpected value while parsing: "+t)}var j,U=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((t=this._extractString(this.tags.BLOCK_START+"-"))||(t=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,O(l,t,e,n);if((t=this._extractString(this.tags.VARIABLE_START+"-"))||(t=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,O(p,t,e,n);t="";var K=!1;for(this._matches(this.tags.COMMENT_START)&&(K=!0,t=this._extractString(this.tags.COMMENT_START));null!==(j=this._extractUntil(U));){if(t+=j,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!K){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=t.length){var V=t.slice(-this.colno);if(/^\s+$/.test(V)&&!(t=t.slice(0,-this.colno)).length)return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!K)throw new Error("unexpected end of comment");t+=this._extractString(this.tags.COMMENT_END);break}t+=this.current(),this.forward()}if(null===j&&K)throw new Error("expected end of comment, got end of file");return O(K?d:c,t,e,n)},e._parseString=function(t){this.forward();for(var e="";!this.isFinished()&&this.current()!==t;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":e+="\n";break;case"t":e+="\t";break;case"r":e+="\r";break;default:e+=this.current()}this.forward()}else e+=n,this.forward()}return this.forward(),e},e._matches=function(t){return this.index+t.length>this.len?null:this.str.slice(this.index,this.index+t.length)===t},e._extractString=function(t){return this._matches(t)?(this.forwardN(t.length),t):null},e._extractUntil=function(t){return this._extractMatching(!0,t||"")},e._extract=function(t){return this._extractMatching(!1,t)},e._extractMatching=function(t,e){if(this.isFinished())return null;var n=e.indexOf(this.current());if(t&&-1===n||!t&&-1!==n){var i=this.current();this.forward();for(var o=e.indexOf(this.current());(t&&-1===o||!t&&-1!==o)&&!this.isFinished();)i+=this.current(),this.forward(),o=e.indexOf(this.current());return i}return""},e._extractRegex=function(t){var e=this.currentStr().match(t);return e?(this.forwardN(e[0].length),e):null},e.isFinished=function(){return this.index>=this.len},e.forwardN=function(t){for(var e=0;e1024){for(var e=0,n=o.length-a;e0&&r.length>o&&!r.warned){r.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=r.length,s=c,console&&console.warn&&console.warn(s)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=h.bind(i);return o.listener=n,i.wrapFn=o,o}function m(t,e,n){var i=t._events;if(void 0===i)return[];var o=i[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(r=e[0]),r instanceof Error)throw r;var s=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw s.context=r,s}var c=o[t];if(void 0===c)return!1;if("function"==typeof c)a(c,this,e);else{var l=c.length,u=y(c,l);for(n=0;n=0;a--)if(n[a]===e||n[a].listener===e){r=n[a].listener,o=a;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return m(this,t,!0)},s.prototype.rawListeners=function(t){return m(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,n){"use strict";var i=n(3),o=n(0),a=0;function r(){return"hole_"+a++}function s(t,e){for(var n=null,i=0;i=e)return t;var n=e-t.length,r=i.repeat(" ",n/2-n%2),s=i.repeat(" ",n/2);return o.copySafeness(t,r+t+s)},e.default=function(t,e,n){return n?t||e:void 0!==t?t:e},e.dictsort=function(t,e,n){if(!i.isObject(t))throw new i.TemplateError("dictsort filter: val must be an object");var o,a=[];for(var r in t)a.push([r,t[r]]);if(void 0===n||"key"===n)o=0;else{if("value"!==n)throw new i.TemplateError("dictsort filter: You can only sort by either key or value");o=1}return a.sort((function(t,n){var a=t[o],r=n[o];return e||(i.isString(a)&&(a=a.toUpperCase()),i.isString(r)&&(r=r.toUpperCase())),a>r?1:a===r?0:-1})),a},e.dump=function(t,e){return JSON.stringify(t,null,e)},e.escape=function(t){return t instanceof o.SafeString?t:(t=null==t?"":t,o.markSafe(i.escape(t.toString())))},e.safe=function(t){return t instanceof o.SafeString?t:(t=null==t?"":t,o.markSafe(t.toString()))},e.first=function(t){return t[0]},e.forceescape=function(t){return t=null==t?"":t,o.markSafe(i.escape(t.toString()))},e.groupby=function(t,e){return i.groupBy(t,e,this.env.opts.throwOnUndefined)},e.indent=function(t,e,n){if(""===(t=a(t,"")))return"";e=e||4;var r=t.split("\n"),s=i.repeat(" ",e),c=r.map((function(t,e){return 0!==e||n?""+s+t:t})).join("\n");return o.copySafeness(t,c)},e.join=function(t,e,n){return e=e||"",n&&(t=i.map(t,(function(t){return t[n]}))),t.join(e)},e.last=function(t){return t[t.length-1]},e.length=function(t){var e=a(t,"");return void 0!==e?"function"==typeof Map&&e instanceof Map||"function"==typeof Set&&e instanceof Set?e.size:!i.isObject(e)||e instanceof o.SafeString?e.length:i.keys(e).length:0},e.list=c,e.lower=function(t){return(t=a(t,"")).toLowerCase()},e.nl2br=function(t){return null==t?"":o.copySafeness(t,t.replace(/\r\n|\n/g,"
\n"))},e.random=function(t){return t[Math.floor(Math.random()*t.length)]},e.reject=l(!1),e.rejectattr=function(t,e){return t.filter((function(t){return!t[e]}))},e.select=l(!0),e.selectattr=function(t,e){return t.filter((function(t){return!!t[e]}))},e.replace=function(t,e,n,i){var a=t;if(e instanceof RegExp)return t.replace(e,n);void 0===i&&(i=-1);var r="";if("number"==typeof e)e=""+e;else if("string"!=typeof e)return t;if("number"==typeof t&&(t=""+t),"string"!=typeof t&&!(t instanceof o.SafeString))return t;if(""===e)return r=n+t.split("").join(n)+n,o.copySafeness(t,r);var s=t.indexOf(e);if(0===i||-1===s)return t;for(var c=0,l=0;s>-1&&(-1===i||l=o&&u.push(n),a.push(u)}return a},e.sum=function(t,e,n){return void 0===n&&(n=0),e&&(t=i.map(t,(function(t){return t[e]}))),n+t.reduce((function(t,e){return t+e}),0)},e.sort=o.makeMacro(["value","reverse","case_sensitive","attribute"],[],(function(t,e,n,o){var a=this,r=i.map(t,(function(t){return t})),s=i.getAttrGetter(o);return r.sort((function(t,r){var c=o?s(t):t,l=o?s(r):r;if(a.env.opts.throwOnUndefined&&o&&(void 0===c||void 0===l))throw new TypeError('sort: attribute "'+o+'" resolved to undefined');return!n&&i.isString(c)&&i.isString(l)&&(c=c.toLowerCase(),l=l.toLowerCase()),cl?e?-1:1:0})),r})),e.string=function(t){return o.copySafeness(t,t)},e.striptags=function(t,e){var n,i=u((t=a(t,"")).replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,""));return n=e?i.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):i.replace(/\s+/gi," "),o.copySafeness(t,n)},e.title=function(t){var e=(t=a(t,"")).split(" ").map((function(t){return s(t)}));return o.copySafeness(t,e.join(" "))},e.trim=u,e.truncate=function(t,e,n,i){var r=t;if(e=e||255,(t=a(t,"")).length<=e)return t;if(n)t=t.substring(0,e);else{var s=t.lastIndexOf(" ",e);-1===s&&(s=e),t=t.substring(0,s)}return t+=null!=i?i:"...",o.copySafeness(r,t)},e.upper=function(t){return(t=a(t,"")).toUpperCase()},e.urlencode=function(t){var e=encodeURIComponent;return i.isString(t)?e(t):(i.isArray(t)?t:i._entries(t)).map((function(t){var n=t[0],i=t[1];return e(n)+"="+e(i)})).join("&")};var p=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,h=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,d=/^https?:\/\/.*$/,m=/^www\./,f=/\.(?:org|net|com)(?:\:|\/|$)/;e.urlize=function(t,e,n){r(e)&&(e=1/0);var i=!0===n?' rel="nofollow"':"";return t.split(/(\s+)/).filter((function(t){return t&&t.length})).map((function(t){var n=t.match(p),o=n?n[1]:t,a=o.substr(0,e);return d.test(o)?'"+a+"":m.test(o)?'"+a+"":h.test(o)?''+o+"":f.test(o)?'"+a+"":t})).join("")},e.wordcount=function(t){var e=(t=a(t,""))?t.match(/\w+/g):null;return e?e.length:null},e.float=function(t,e){var n=parseFloat(t);return r(n)?e:n};var y=o.makeMacro(["value","default","base"],[],(function(t,e,n){void 0===n&&(n=10);var i=parseInt(t,n);return r(i)?e:i}));e.int=y,e.d=e.default,e.e=e.escape},function(t,e,n){"use strict";function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var o=function(t){var e,n;function o(e){var n;return(n=t.call(this)||this).precompiled=e||{},n}return n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,i(e,n),o.prototype.getSource=function(t){return this.precompiled[t]?{src:{type:"code",obj:this.precompiled[t]},path:t}:null},o}(n(6));t.exports={PrecompiledLoader:o}},function(t,e,n){"use strict";var i=n(2).SafeString;e.callable=function(t){return"function"==typeof t},e.defined=function(t){return void 0!==t},e.divisibleby=function(t,e){return t%e==0},e.escaped=function(t){return t instanceof i},e.equalto=function(t,e){return t===e},e.eq=e.equalto,e.sameas=e.equalto,e.even=function(t){return t%2==0},e.falsy=function(t){return!t},e.ge=function(t,e){return t>=e},e.greaterthan=function(t,e){return t>e},e.gt=e.greaterthan,e.le=function(t,e){return t<=e},e.lessthan=function(t,e){return t0)for(var o=t;oe;a+=n)i.push(a);return i},cycler:function(){return t=Array.prototype.slice.call(arguments),e=-1,{current:null,reset:function(){e=-1,this.current=null},next:function(){return++e>=t.length&&(e=0),this.current=t[e],this.current}};var t,e},joiner:function(t){return function(t){t=t||",";var e=!0;return function(){var n=e?"":t;return e=!1,n}}(t)}}}},function(t,e,n){var i=n(4);t.exports=function(t,e){function n(t,e){if(this.name=t,this.path=t,this.defaultEngine=e.defaultEngine,this.ext=i.extname(t),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}return n.prototype.render=function(e,n){t.render(this.name,e,n)},e.set("view",n),e.set("nunjucksEnv",t),t}},function(t,e,n){"use strict";var i=n(4),o=n(4),a=n(0)._prettifyError,r=n(5),s=n(7).Environment,c=n(24);function l(t,e){return!!Array.isArray(e)&&e.some((function(e){return t.match(e)}))}function u(t,e){(e=e||{}).isString=!0;var n=e.env||new s([]),i=e.wrapper||c;if(!e.name)throw new Error('the "name" option is required when compiling a string');return i([p(t,e.name,n)],e)}function p(t,e,n){var i,o=(n=n||new s([])).asyncFilters,c=n.extensionsList;e=e.replace(/\\/g,"/");try{i=r.compile(t,o,c,e,n.opts)}catch(t){throw a(e,!1,t)}return{name:e,template:i}}t.exports={precompile:function(t,e){var n=(e=e||{}).env||new s([]),a=e.wrapper||c;if(e.isString)return u(t,e);var r=i.existsSync(t)&&i.statSync(t),h=[],d=[];if(r.isFile())h.push(p(i.readFileSync(t,"utf-8"),e.name||t,n));else if(r.isDirectory()){!function n(a){i.readdirSync(a).forEach((function(r){var s=o.join(a,r),c=s.substr(o.join(t,"/").length),u=i.statSync(s);u&&u.isDirectory()?l(c+="/",e.exclude)||n(s):l(c,e.include)&&d.push(s)}))}(t);for(var m=0;mt.length||o>0&&r>=i||o<0&&r<=i);r+=o)a.push(n.memberLookup(t,r));return a}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var m={pop:function(t){if(void 0===t)return this.pop();if(t>=this.length||t<0)throw new Error("KeyError");return this.splice(t,1)},append:function(t){return this.push(t)},remove:function(t){for(var e=0;e{"use strict";__webpack_require__.d(__webpack_exports__,{W:()=>BaseRemoteElement});var lit__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(670),lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(385),ha_nunjucks__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(703),_models_constants__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(290),_models_maps__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(792),_utils__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(626),__decorate=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};class BaseRemoteElement extends lit__WEBPACK_IMPORTED_MODULE_0__.WF{constructor(){super(...arguments),this.icons=[],this.renderRipple=!0,this.value=0,this.getValueFromHass=!0,this.unitOfMeasurement="",this.fireMouseEvent=!0,this.swiping=!1}fireHapticEvent(t){if(this.renderTemplate(this.config.haptics)??1){const e=new Event("haptic",{bubbles:!0,composed:!0});e.detail=t,window.dispatchEvent(e)}}endAction(){this.momentaryStart=void 0,this.momentaryEnd=void 0,this.swiping=!1,this.initialX=void 0,this.initialY=void 0}sendAction(t,e=this.config){let n;switch(t){case"momentary_start_action":n=e.momentary_start_action;break;case"momentary_end_action":n=e.momentary_end_action;break;case"multi_hold_action":n=e.multi_hold_action??e.hold_action??e.multi_tap_action??e.tap_action;break;case"multi_double_tap_action":n=e.multi_double_tap_action??e.double_tap_action??e.multi_tap_action??e.tap_action;break;case"multi_tap_action":n=e.multi_tap_action??e.tap_action;break;case"hold_action":n=e.hold_action??e.tap_action;break;case"double_tap_action":n=e.double_tap_action??e.tap_action;break;default:n=e.tap_action}if(!n)return clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!0,void this.requestUpdate();if(n=this.deepRenderTemplate(n),n&&this.handleConfirmation(n))try{switch(n.action){case"navigate":this.navigate(n);break;case"url":this.url(n);break;case"assist":this.assist(n);break;case"more-info":this.moreInfo(n);break;case"toggle":this.toggle(n);break;case"call-service":case"perform-action":this.callService(n);break;case"source":this.source(n);break;case"key":this.key(n,t);break;case"fire-dom-event":this.fireDomEvent(n);break;case"eval":this.eval(n);break;case"textbox":case"search":case"keyboard":this.keyboard(n)}}catch(t){throw this.endAction(),t}else this.dispatchEvent(new CustomEvent("confirmation-failed"))}key(t,e){switch(t.platform){case"Kodi":this.hass.callService("kodi","call_method",{entity_id:t.media_player_id,method:t.key});break;case"LG webOS":this.hass.callService("webostv","button",{entity_id:t.media_player_id,button:t.key});break;default:{const n={entity_id:t.remote_id??"",command:t.key??""};"hold_action"!=e||this.config.hold_action&&"none"!=this.config.hold_action.action||(n.hold_secs=.5),this.hass.callService("remote","send_command",n);break}}}source(t){switch(t.platform){case"Fire TV":case"Roku":case"Kodi":case"Apple TV":case"Samsung TV":case"LG webOS":this.hass.callService("media_player","select_source",{entity_id:t.media_player_id,source:t.source});break;case"Sony BRAVIA":this.hass.callService("media_player","play_media",{entity_id:t.media_player_id,media_content_id:t.source,media_content_type:"app"});break;default:this.hass.callService("remote","turn_on",{entity_id:t.remote_id,activity:t.source})}}callService(t){const[e,n]=(t.perform_action??t.service).split(".");this.hass.callService(e,n,t.data,t.target)}navigate(t){const e=t.navigation_path??"",n=t.navigation_replace??!1;if(e.includes("//"))return void console.error('Protocol detected in navigation path. To navigate to another website use the action "url" with the key "url_path" instead.');1==n?window.history.replaceState(window.history.state?.root?{root:!0}:null,"",e):window.history.pushState(null,"",e);const i=new Event("location-changed",{bubbles:!1,cancelable:!0,composed:!1});i.detail={replace:1==n},window.dispatchEvent(i)}url(t){let e=t.url_path??"";e.includes("//")||(e=`https://${e}`),window.open(e)}assist(t){this.hass?.auth?.external?.config?.hasAssist?this.hass?.auth?.external?.fireMessage({type:"assist/show",payload:{pipeline_id:t.pipeline_id,start_listening:t.start_listening}}):window.open(`${window.location.href}?conversation=1`,"_self")}moreInfo(t){const e=new Event("hass-more-info",{bubbles:!0,cancelable:!0,composed:!0});e.detail={entityId:t.target?.entity_id??this.config.entity_id},this.dispatchEvent(e)}toggle(t){const e={...t.data,...t.target};if(Array.isArray(e.entity_id))for(const t of e.entity_id)this.toggleSingle(t);else e.entity_id?this.toggleSingle(e.entity_id):this.hass.callService("homeassistant","toggle",e)}toggleSingle(t){const e=["closed","locked","off"].includes(this.hass.states[t].state);let n,i=t.split(".")[0];switch(i){case"lock":n=e?"unlock":"lock";break;case"cover":n=e?"open_cover":"close_cover";break;case"button":case"input_button":n="press";break;case"scene":n="turn_on";break;case"valve":n=e?"open_valve":"close_valve";break;default:i="homeassistant",n=e?"turn_on":"turn_off"}this.hass.callService(i,n,{entity_id:t})}keyboard(t){const e=new Event("keyboard-dialog-open",{composed:!0,bubbles:!0});e.detail=t,this.getRootNode().querySelector("keyboard-dialog").shadowRoot?.querySelector("dialog")?.dispatchEvent(e)}fireDomEvent(t){const e=new Event(t.event_type??"ll-custom",{composed:!0,bubbles:!0});e.detail=t,this.dispatchEvent(e)}eval(action){eval(action.eval??"")}handleConfirmation(t){if(t.confirmation){let e=`Are you sure you want to run action '${t.action}'?`;return 1==t.confirmation?(this.fireHapticEvent("warning"),confirm(e)):(t.confirmation?.text&&(e=t.confirmation.text),!!t.confirmation?.exemptions?.map((t=>t.user)).includes(this.hass.user?.id)||(this.fireHapticEvent("warning"),confirm(e)))}return!0}firstUpdated(){this.addEventListener("confirmation-failed",this.confirmationFailed)}confirmationFailed(){clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!0,this.requestUpdate()}setValue(){if(this.entityId=this.renderTemplate(this.config.entity_id),this.unitOfMeasurement=this.renderTemplate(this.config.unit_of_measurement)??"",this.getValueFromHass&&this.entityId)if(clearInterval(this.valueUpdateInterval),this.valueUpdateInterval=void 0,this.valueAttribute=this.renderTemplate(this.config.value_attribute??"state").toLowerCase(),this.hass.states[this.entityId])if("state"==this.valueAttribute)this.value=this.hass.states[this.entityId].state;else{let t;const e=this.valueAttribute.match(/\[\d+\]$/);if(e){const n=parseInt(e[0].replace(/\[|\]/g,""));this.valueAttribute=this.valueAttribute.replace(e[0],""),t=this.hass.states[this.entityId]?.attributes?.[this.valueAttribute],t=t&&Array.isArray(t)&&t.length?t[n]:void 0}else t=this.hass.states[this.entityId]?.attributes?.[this.valueAttribute];if(null!=t||"elapsed"==this.valueAttribute)switch(this.valueAttribute){case"brightness":this.value=Math.round(100*parseInt(t??0)/255);break;case"media_position":try{const e=()=>{"playing"==this.hass.states[this.entityId].state?this.value=Math.min(Math.floor(Math.floor(t)+(Date.now()-Date.parse(this.hass.states[this.entityId].attributes?.media_position_updated_at))/1e3),Math.floor(this.hass.states[this.entityId].attributes?.media_duration)):this.value=t};e(),this.valueUpdateInterval=setInterval(e,500)}catch(e){console.error(e),this.value=t}break;case"elapsed":if(this.entityId.startsWith("timer.")){if("idle"==this.hass.states[this.entityId].state)this.value=0;else{const t=this.hass.states[this.entityId].attributes?.duration.split(":"),e=3600*parseInt(t[0])+60*parseInt(t[1])+parseInt(t[2]),n=Date.parse(this.hass.states[this.entityId].attributes?.finishes_at);try{const t=()=>{if("active"==this.hass.states[this.entityId].state){const t=(n-Date.now())/1e3,i=Math.floor(e-t);this.value=Math.min(i,e)}else{const t=this.hass.states[this.entityId].attributes?.remaining.split(":"),n=3600*parseInt(t[0])+60*parseInt(t[1])+parseInt(t[2]);this.value=Math.floor(e-n)}};t(),this.valueUpdateInterval=setInterval(t,500)}catch(t){console.error(t),this.value=0}}break}default:this.value=t}else this.value=t}else this.value=void 0}renderTemplate(t,e){let n=0;this.momentaryStart&&this.momentaryEnd&&(n=(this.momentaryEnd-this.momentaryStart)/1e3),e={VALUE:this.value,HOLD_SECS:n??0,UNIT:this.unitOfMeasurement,value:this.value,hold_secs:n??0,unit:this.unitOfMeasurement,config:{...this.config,entity:this.entityId,attribute:this.valueAttribute},...e};let i=(e={render:t=>this.renderTemplate(t,e),...e}).value;null!=i&&"number"==typeof i&&null!=this.precision&&(i=Number(i).toFixed(this.precision),e={...e,VALUE:i,value:i});const o=(0,ha_nunjucks__WEBPACK_IMPORTED_MODULE_2__.X)(this.hass,t,e);if(o!=t)return o;if("string"==typeof t)for(const n of["VALUE","HOLD_SECS","UNIT"]){if(t==n)return e[n];t.includes(n)&&(t=t.replace(new RegExp(n,"g"),e[n]??""))}return t}deepRenderTemplate(t,e){const n=structuredClone(t),i=(0,_utils__WEBPACK_IMPORTED_MODULE_4__.b$)(n);for(const t of i)(0,_utils__WEBPACK_IMPORTED_MODULE_4__.HD)(n,t,this.renderTemplate((0,_utils__WEBPACK_IMPORTED_MODULE_4__.vz)(n,t),e));return n}resetGetValueFromHass(){const t=this.renderTemplate(this.config.value_from_hass_delay??_models_constants__WEBPACK_IMPORTED_MODULE_5__.s$);this.getValueFromHassTimer=setTimeout((()=>{this.getValueFromHass=!0,this.requestUpdate()}),t)}buildIcon(t,e){t=this.renderTemplate(t??"",e);let n=lit__WEBPACK_IMPORTED_MODULE_0__.qy``;if(t)if(t.includes(":"))n=lit__WEBPACK_IMPORTED_MODULE_0__.qy``;else{const e=(this.icons??[]).filter((e=>e.name==t))[0]??_models_maps__WEBPACK_IMPORTED_MODULE_3__.o$.filter((e=>e.name==t))[0];n=lit__WEBPACK_IMPORTED_MODULE_0__.qy``}return lit__WEBPACK_IMPORTED_MODULE_0__.qy`
${n}
`}buildLabel(t,e){if(t){const n=this.renderTemplate(t,e);if(n)return lit__WEBPACK_IMPORTED_MODULE_0__.qy`
${n}
`}return""}buildRipple(){return this.renderRipple?lit__WEBPACK_IMPORTED_MODULE_0__.qy``:""}buildStyles(t,e){return t?lit__WEBPACK_IMPORTED_MODULE_0__.qy``:""}onStart(t){}onEnd(t){}onMove(t){}onMouseDown(t){this.fireMouseEvent&&this.onStart(t)}onMouseUp(t){this.fireMouseEvent&&this.onEnd(t),this.fireMouseEvent=!0}onMouseMove(t){this.fireMouseEvent&&this.onMove(t)}onTouchStart(t){this.fireMouseEvent=!1,this.onStart(t)}onTouchEnd(t){this.fireMouseEvent=!1,this.onEnd(t)}onTouchMove(t){this.fireMouseEvent=!1,this.onMove(t)}onContextMenu(t){if(!this.fireMouseEvent)return t.preventDefault(),t.stopPropagation(),!1}toggleRipple(){this.cancelRippleToggle(),this.renderRippleTransition=setTimeout((()=>this.rippleTransition=!1),400),this.renderRippleOff=setTimeout((()=>this.renderRipple=!1),800),this.renderRippleOn=setTimeout((()=>this.cancelRippleToggle()),850)}cancelRippleToggle(){clearTimeout(this.renderRippleOff),clearTimeout(this.renderRippleOn),clearTimeout(this.renderRippleTransition),this.renderRippleOff=void 0,this.renderRippleOn=void 0,this.renderRippleTransition=void 0,this.rippleTransition=!0,this.renderRipple=!0}static get styles(){return lit__WEBPACK_IMPORTED_MODULE_0__.AH`:host{display:flex;flex-flow:column;place-content:center space-evenly;align-items:center;position:relative;border:none;border-radius:10px;padding:0;box-sizing:border-box;outline:0;overflow:visible;font-size:inherit;color:inherit;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}md-ripple.transition-on{opacity:1 transition: opacity 375ms linear}md-ripple.transition-off{opacity:0;transition:opacity 375ms linear}.icon{pointer-events:none;position:relative;flex-flow:column;place-content:center;display:var(--icon-display,inline-flex);transform:var(--icon-transform);color:var(--icon-color,var(--primary-text-color));filter:var(--icon-filter, none);height:var(--size,48px);width:var(--size,48px);--mdc-icon-size:var(--size, 48px)}ha-icon,svg{display:inline-flex;flex-direction:column;justify-content:center;text-align:center;align-items:center;vertical-align:middle;height:var(--size,48px);width:var(--size,48px);pointer-events:none}.label{position:relative;pointer-events:none;justify-content:center;align-items:center;height:15px;line-height:15px;width:inherit;margin:0;font-family:inherit;font-size:12px;font-weight:700;display:var(--label-display,inline-flex);transform:var(--label-transform);color:var(--label-color,inherit);filter:var(--label-filter, none)}`}}__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.MZ)()],BaseRemoteElement.prototype,"hass",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.MZ)()],BaseRemoteElement.prototype,"config",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.MZ)()],BaseRemoteElement.prototype,"icons",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"renderRipple",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"renderRippleOff",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"renderRippleOn",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"renderRippleTransition",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"rippleTransition",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"value",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.Ls)({passive:!0})],BaseRemoteElement.prototype,"onMouseDown",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.Ls)({passive:!0})],BaseRemoteElement.prototype,"onMouseMove",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.Ls)({passive:!0})],BaseRemoteElement.prototype,"onTouchStart",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.Ls)({passive:!0})],BaseRemoteElement.prototype,"onTouchMove",null)},290:(t,e,n)=>{"use strict";n.d(e,{$6:()=>r,At:()=>o,HB:()=>h,RZ:()=>p,Xy:()=>s,a3:()=>a,bQ:()=>d,hI:()=>l,jc:()=>i,s$:()=>c,zM:()=>u});const i=200,o=500,a=100,r=!0,s=!0,c=1e3,l=1,u=100,p=.01,h=0,d=1},792:(t,e,n)=>{"use strict";n.d(e,{$i:()=>i,tz:()=>o,qz:()=>a,_6:()=>r,J7:()=>s,hd:()=>c,o$:()=>l,iu:()=>u,ci:()=>p,np:()=>h,rl:()=>d,j0:()=>m,$S:()=>f,ks:()=>y,Qz:()=>_,CI:()=>b,Mo:()=>v});const i=[{type:"button",name:"power",tap_action:{action:"key",key:"POWER"},icon:"mdi:power"},{type:"button",name:"home",tap_action:{action:"key",key:"HOME"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"BACK"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"MENU"},icon:"mdi:menu"},{type:"button",name:"settings",tap_action:{action:"key",key:"SETTINGS"},icon:"mdi:cog"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VOLUME_UP"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VOLUME_DOWN"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"MUTE"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"DPAD_UP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"DPAD_DOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"DPAD_LEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"DPAD_RIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"DPAD_CENTER"},icon:"mdi:checkbox-blank-circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"DPAD_CENTER"},up:{tap_action:{action:"key",key:"DPAD_UP"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"DPAD_DOWN"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"DPAD_LEFT"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"DPAD_RIGHT"},hold_action:{action:"repeat"}}},{type:"button",name:"play",tap_action:{action:"key",key:"MEDIA_PLAY"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"MEDIA_PAUSE"},icon:"mdi:pause"},{type:"button",name:"play_pause",tap_action:{action:"key",key:"MEDIA_PLAY_PAUSE"},icon:"mdi:play-pause"},{type:"button",name:"rewind",tap_action:{action:"key",key:"MEDIA_REWIND"},icon:"mdi:rewind"},{type:"button",name:"fast_forward",tap_action:{action:"key",key:"MEDIA_FAST_FORWARD"},icon:"mdi:fast-forward"},{type:"button",name:"previous",tap_action:{action:"key",key:"MEDIA_PREVIOUS"},icon:"mdi:skip-previous"},{type:"button",name:"next",tap_action:{action:"key",key:"MEDIA_NEXT"},icon:"mdi:skip-next"},{type:"button",name:"stop",tap_action:{action:"key",key:"MEDIA_STOP"},icon:"mdi:stop"},{type:"button",name:"record",tap_action:{action:"key",key:"MEDIA_RECORD"},icon:"mdi:record"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:google-assistant"},{type:"button",name:"delete",tap_action:{action:"key",key:"DEL"},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"forward_delete",tap_action:{action:"key",key:"FOWARD_DEL"},hold_action:{action:"repeat"},icon:"mdi:backspace-reverse"},{type:"button",name:"enter",tap_action:{action:"key",key:"ENTER"},icon:"mdi:magnify"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"CHANNEL_UP"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"CHANNEL_DOWN"},icon:"mdi:arrow-down-circle"},{type:"button",name:"red",tap_action:{action:"key",key:"PROG_RED"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"PROG_GREEN"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"PROG_YELLOW"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"PROG_BLUE"},icon:"mdi:alpha-b-box"},{type:"button",name:"a",tap_action:{action:"key",key:"BUTTON_A"},icon:"mdi:alpha-a-circle"},{type:"button",name:"b",tap_action:{action:"key",key:"BUTTON_B"},icon:"mdi:alpha-b-circle"},{type:"button",name:"x",tap_action:{action:"key",key:"BUTTON_X"},icon:"mdi:alpha-x-circle"},{type:"button",name:"y",tap_action:{action:"key",key:"BUTTON_Y"},icon:"mdi:alpha-y-circle"},{type:"button",name:"xpad",icon:"mdi:gamepad-circle"},{type:"button",name:"npad",icon:"mdi:gamepad-circle"},{type:"button",name:"n0",tap_action:{action:"key",key:"0"},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"key",key:"1"},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"key",key:"2"},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"key",key:"3"},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"key",key:"4"},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"key",key:"5"},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"key",key:"6"},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"key",key:"7"},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"key",key:"8"},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"key",key:"9"},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"f1",tap_action:{action:"key",key:"F1"},icon:"mdi:keyboard-f1"},{type:"button",name:"f2",tap_action:{action:"key",key:"F2"},icon:"mdi:keyboard-f2"},{type:"button",name:"f3",tap_action:{action:"key",key:"F3"},icon:"mdi:keyboard-f3"},{type:"button",name:"f4",tap_action:{action:"key",key:"F4"},icon:"mdi:keyboard-f4"},{type:"button",name:"f5",tap_action:{action:"key",key:"F5"},icon:"mdi:keyboard-f5"},{type:"button",name:"f6",tap_action:{action:"key",key:"F6"},icon:"mdi:keyboard-f6"},{type:"button",name:"f7",tap_action:{action:"key",key:"F7"},icon:"mdi:keyboard-f7"},{type:"button",name:"f8",tap_action:{action:"key",key:"F8"},icon:"mdi:keyboard-f8"},{type:"button",name:"f9",tap_action:{action:"key",key:"F9"},icon:"mdi:keyboard-f9"},{type:"button",name:"f10",tap_action:{action:"key",key:"F10"},icon:"mdi:keyboard-f10"},{type:"button",name:"f11",tap_action:{action:"key",key:"F11"},icon:"mdi:keyboard-f11"},{type:"button",name:"f12",tap_action:{action:"key",key:"F12"},icon:"mdi:keyboard-f12"},{type:"button",name:"info",tap_action:{action:"key",key:"INFO"},icon:"mdi:information"},{type:"button",name:"guide",tap_action:{action:"key",key:"GUIDE"},icon:"mdi:television-guide"},{type:"button",name:"captions",tap_action:{action:"key",key:"CAPTIONS"},icon:"mdi:closed-caption"},{type:"button",name:"button_mode",tap_action:{action:"key",key:"BUTTON_MODE"},icon:"mdi:gesture-tap-button"},{type:"button",name:"explorer",tap_action:{action:"key",key:"EXPLORER"},icon:"mdi:folder-multiple"},{type:"button",name:"teletext",tap_action:{action:"key",key:"TV_TELETEXT"},icon:"mdi:card-text"},{type:"button",name:"tv",tap_action:{action:"key",key:"TV"},icon:"mdi:television-box"},{type:"button",name:"dvr",tap_action:{action:"key",key:"DVR"},icon:"mdi:audio-video"},{type:"button",name:"audio_track",tap_action:{action:"key",key:"MEDIA_AUDIO_TRACK"},icon:"mdi:waveform"}],o=[{type:"button",name:"appletv",tap_action:{action:"source",source:"https://tv.apple.com"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"crunchyroll://"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"https://open.dazn.com/"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"discoveryplus://"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"https://www.disneyplus.com"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"embyatv://tv.emby.embyatv/startapp"},icon:"mdi:emby"},{type:"button",name:"f1tv",tap_action:{action:"source",source:"com.formulaone.production"},icon:"f1tv"},{type:"button",name:"filmplus",tap_action:{action:"source",source:"com.guideplus.co"},icon:"filmplus"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"foxsports://live"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"hulu://"},icon:"mdi:hulu"},{type:"button",name:"jellyfin",tap_action:{action:"source",source:"org.jellyfin.androidtv"},icon:"jellyfin"},{type:"button",name:"kijk",tap_action:{action:"source",source:"com.talpa.kijk"},icon:"kijk"},{type:"button",name:"kodi",tap_action:{action:"source",source:"org.xbmc.kodi"},icon:"mdi:kodi"},{type:"button",name:"max",tap_action:{action:"source",source:"https://play.max.com"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"mlbatbat://"},icon:"mlbtv"},{type:"button",name:"nba",tap_action:{action:"source",source:"gametime://"},icon:"nba"},{type:"button",name:"netflix",tap_action:{action:"source",source:"netflix://"},icon:"mdi:netflix"},{type:"button",name:"npostart",tap_action:{action:"source",source:"nl.uitzendinggemist"},icon:"npo"},{type:"button",name:"nrktv",tap_action:{action:"source",source:"nrktv://"},icon:"nrktv"},{type:"button",name:"pandora",tap_action:{action:"source",source:"com.pandora.android.atv"},icon:"mdi:pandora"},{type:"button",name:"paramount",tap_action:{action:"source",source:"com.cbs.ott"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"com.peacocktv.peacockandroid"},icon:"peacock"},{type:"button",name:"pia",tap_action:{action:"source",source:"piavpn://"},icon:"pia"},{type:"button",name:"plex",tap_action:{action:"source",source:"plex://"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"https://app.primevideo.com"},icon:"primevideo"},{type:"button",name:"rakutentv",tap_action:{action:"source",source:"https://rakutentv.page.link"},icon:"rakutentv"},{type:"button",name:"rakutenviki",tap_action:{action:"source",source:"viki://home"},icon:"rakutenviki"},{type:"button",name:"skyshowtime",tap_action:{action:"source",source:"https://www.skyshowtime.com/deeplink"},icon:"showtime"},{type:"button",name:"spotify",tap_action:{action:"source",source:"spotify://"},icon:"mdi:spotify"},{type:"button",name:"starplus",tap_action:{action:"source",source:"https://www.starplus.com"},icon:"starplus"},{type:"button",name:"steam",tap_action:{action:"source",source:"com.valvesoftware.steamlink"},icon:"mdi:steam"},{type:"button",name:"stremio",tap_action:{action:"source",source:"stremio://"},icon:"stremio"},{type:"button",name:"surfshark",tap_action:{action:"source",source:"https://surfshark.com/locations-ul"},icon:"surfshark"},{type:"button",name:"tv2play",tap_action:{action:"source",source:"dk.tv2.tv2playtv://*.tv2.dk/android/dk.tv2.tv2playtv/callback"},icon:"tv2play"},{type:"button",name:"viaplay",tap_action:{action:"source",source:"viaplay://deeplink/film"},icon:"viaplay"},{type:"button",name:"videoland",tap_action:{action:"source",source:"videoland-v2://"},icon:"videoland"},{type:"button",name:"vlc",tap_action:{action:"source",source:"org.videolan.vlc"},icon:"mdi:vlc"},{type:"button",name:"vudu",tap_action:{action:"source",source:"vuduapp://"},icon:"vudu"},{type:"button",name:"waiputv",tap_action:{action:"source",source:"de.exaring.waipu"},icon:"waiputv"},{type:"button",name:"wow",tap_action:{action:"source",source:"de.sky.online"},icon:"wow"},{type:"button",name:"youtube",tap_action:{action:"source",source:"vnd.youtube://"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"https://tv.youtube.com"},icon:"mdi:youtube-tv"}],a=[{type:"button",name:"wakeup",tap_action:{action:"key",key:"wakeup"},icon:"mdi:power-on"},{type:"button",name:"suspend",tap_action:{action:"key",key:"suspend"},icon:"mdi:power-off"},{type:"button",name:"home",tap_action:{action:"key",key:"home"},icon:"mdi:home"},{type:"button",name:"menu",tap_action:{action:"key",key:"menu"},icon:"mdi:menu"},{type:"button",name:"top_menu",tap_action:{action:"key",key:"top_menu"},icon:"mdi:apple"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"volume_up"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"volume_down"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"up"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"down"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"left"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"right"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"select"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"select"},up:{tap_action:{action:"key",key:"up"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"down"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"left"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"right"},hold_action:{action:"repeat"}}},{type:"button",name:"play",tap_action:{action:"key",key:"play"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"pause"},icon:"mdi:pause"},{type:"button",name:"skip_backward",tap_action:{action:"key",key:"skip_backward"},icon:"mdi:skip-backward"},{type:"button",name:"skip_forward",tap_action:{action:"key",key:"skip_forward"},icon:"mdi:skip-forward"},{type:"button",name:"previous",tap_action:{action:"key",key:"previous"},icon:"mdi:skip-previous"},{type:"button",name:"next",tap_action:{action:"key",key:"next"},icon:"mdi:skip-next"}],r=[{type:"button",name:"allente",tap_action:{action:"source",source:"Allente"},icon:"allente"},{type:"button",name:"appletv",tap_action:{action:"source",source:"TV"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"Crunchyroll"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"DAZN"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"discovery+"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"Disney+"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"Emby"},icon:"mdi:emby"},{type:"button",name:"f1tv",tap_action:{action:"source",source:"F1 TV"},icon:"f1tv"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"FOX Sports"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"Hulu"},icon:"mdi:hulu"},{type:"button",name:"max",tap_action:{action:"source",source:"Max"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"MLB"},icon:"mlbtv"},{type:"button",name:"nba",tap_action:{action:"source",source:"NBA"},icon:"nba"},{type:"button",name:"netflix",tap_action:{action:"source",source:"Netflix"},icon:"mdi:netflix"},{type:"button",name:"npostart",tap_action:{action:"source",source:"NPO"},icon:"npo"},{type:"button",name:"nrktv",tap_action:{action:"source",source:"NRK TV"},icon:"nrktv"},{type:"button",name:"pandora",tap_action:{action:"source",source:"Pandora"},icon:"mdi:pandora"},{type:"button",name:"paramount",tap_action:{action:"source",source:"Paramount+"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"Peacock"},icon:"peacock"},{type:"button",name:"pia",tap_action:{action:"source",source:"PIA VPN"},icon:"pia"},{type:"button",name:"plex",tap_action:{action:"source",source:"Plex"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"Prime Video"},icon:"primevideo"},{type:"button",name:"skyshowtime",tap_action:{action:"source",source:"SkyShowtime"},icon:"showtime"},{type:"button",name:"spotify",tap_action:{action:"source",source:"Spotify"},icon:"mdi:spotify"},{type:"button",name:"steam",tap_action:{action:"source",source:"Steam Link"},icon:"mdi:steam"},{type:"button",name:"tv2play",tap_action:{action:"source",source:"TV 2 Play"},icon:"tv2play"},{type:"button",name:"viaplay",tap_action:{action:"source",source:"Viaplay"},icon:"viaplay"},{type:"button",name:"videoland",tap_action:{action:"source",source:"Videoland"},icon:"videoland"},{type:"button",name:"vlc",tap_action:{action:"source",source:"VLC"},icon:"mdi:vlc"},{type:"button",name:"vudu",tap_action:{action:"source",source:"Fandango at Home"},icon:"vudu"},{type:"button",name:"waiputv",tap_action:{action:"source",source:"waipu.tv"},icon:"waiputv"},{type:"button",name:"wow",tap_action:{action:"source",source:"WOW"},icon:"wow"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"YouTube TV"},icon:"mdi:youtube-tv"}],s=[{type:"button",name:"power",tap_action:{action:"key",key:"TvPower"},icon:"mdi:power"},{type:"button",name:"home",tap_action:{action:"key",key:"Home"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"Return"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"ActionMenu"},icon:"mdi:menu"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VolumeUp"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VolumeDown"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"Mute"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"Up"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"Down"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"Left"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"Right"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"Confirm"},icon:"mdi:checkbox-blank-circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"Confirm"},up:{tap_action:{action:"key",key:"Up"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"Down"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"Left"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"Right"},hold_action:{action:"repeat"}}},{type:"button",name:"play",tap_action:{action:"key",key:"Play"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"Pause"},icon:"mdi:pause"},{type:"button",name:"rewind",tap_action:{action:"key",key:"Rewind"},icon:"mdi:rewind"},{type:"button",name:"fast_forward",tap_action:{action:"key",key:"Forward"},icon:"mdi:fast-forward"},{type:"button",name:"previous",tap_action:{action:"key",key:"Prev"},icon:"mdi:skip-previous"},{type:"button",name:"next",tap_action:{action:"key",key:"Next"},icon:"mdi:skip-next"},{type:"button",name:"stop",tap_action:{action:"key",key:"Stop"},icon:"mdi:stop"},{type:"button",name:"record",tap_action:{action:"key",key:"Rec"},icon:"mdi:record"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:google-assistant"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"ChannelUp"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"ChannelDown"},icon:"mdi:arrow-down-circle"},{type:"button",name:"red",tap_action:{action:"key",key:"Red"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"Green"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"Yellow"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"Blue"},icon:"mdi:alpha-b-box"},{type:"button",name:"n0",tap_action:{action:"key",key:"Num0"},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"key",key:"Num1"},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"key",key:"Num2"},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"key",key:"Num3"},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"key",key:"Num4"},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"key",key:"Num5"},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"key",key:"Num6"},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"key",key:"Num7"},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"key",key:"Num8"},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"key",key:"Num9"},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"captions",tap_action:{action:"key",key:"SubTitle"},icon:"mdi:closed-caption"},{type:"button",name:"explorer",tap_action:{action:"key",key:"ApplicationLauncher"},icon:"mdi:folder-multiple"},{type:"button",name:"teletext",tap_action:{action:"key",key:"Teletext"},icon:"mdi:card-text"},{type:"button",name:"tv",tap_action:{action:"key",key:"Tv"},icon:"mdi:television-box"},{type:"button",name:"audio_track",tap_action:{action:"key",key:"MediaAudioTrack"},icon:"mdi:waveform"}],c=[{type:"button",name:"appletv",tap_action:{action:"source",source:"Apple TV"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"Crunchyroll"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"DAZN"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"discovery+"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"Disney+"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"Emby"},icon:"mdi:emby"},{type:"button",name:"filmplus",tap_action:{action:"source",source:"Filmplus"},icon:"filmplus"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"FOX Sports"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"Hulu"},icon:"mdi:hulu"},{type:"button",name:"jellyfin",tap_action:{action:"source",source:"Jellyfin"},icon:"jellyfin"},{type:"button",name:"kijk",tap_action:{action:"source",source:"KIJK"},icon:"kijk"},{type:"button",name:"max",tap_action:{action:"source",source:"Max"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"MLB"},icon:"mlbtv"},{type:"button",name:"nba",tap_action:{action:"source",source:"NBA"},icon:"nba"},{type:"button",name:"netflix",tap_action:{action:"key",key:"Netflix"},icon:"mdi:netflix"},{type:"button",name:"npo_start",tap_action:{action:"source",source:"NPO Start"},icon:"npo"},{type:"button",name:"nrktv",tap_action:{action:"source",source:"NRK TV"},icon:"nrktv"},{type:"button",name:"paramount",tap_action:{action:"source",source:"Paramount+"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"Peacock"},icon:"peacock"},{type:"button",name:"pia",tap_action:{action:"source",source:"Private Internet Access VPN"},icon:"pia"},{type:"button",name:"plex",tap_action:{action:"source",source:"Plex"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"Amazon Prime Video"},icon:"primevideo"},{type:"button",name:"rakutentv",tap_action:{action:"source",source:"Rakuten"},icon:"rakutentv"},{type:"button",name:"rakutenviki",tap_action:{action:"source",source:"Viki"},icon:"rakutenviki"},{type:"button",name:"skyshowtime",tap_action:{action:"source",source:"SkyShowtime"},icon:"showtime"},{type:"button",name:"spotify",tap_action:{action:"source",source:"Spotify"},icon:"mdi:spotify"},{type:"button",name:"starplus",tap_action:{action:"source",source:"Star+"},icon:"starplus"},{type:"button",name:"stremio",tap_action:{action:"source",source:"Stremio"},icon:"stremio"},{type:"button",name:"surfshark",tap_action:{action:"source",source:"Surfshark"},icon:"surfshark"},{type:"button",name:"tv2play",tap_action:{action:"source",source:"TV2 Play"},icon:"tv2play"},{type:"button",name:"viaplay",tap_action:{action:"source",source:"Viaplay"},icon:"viaplay"},{type:"button",name:"videoland",tap_action:{action:"source",source:"Videoplay"},icon:"videoland"},{type:"button",name:"vudu",tap_action:{action:"source",source:"Vudu"},icon:"vudu"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"YouTube TV"},icon:"mdi:youtube-tv"}],l=[{name:"allente",path:"M12.8246 16.9889V9.1355H8.9057C8.9057 9.1355 8.8874 10.2821 8.8874 10.3738 8.1728 9.4052 6.9869 8.9602 5.2068 8.9522 3.3664 8.9706 1.8037 9.7768.9791 10.947.3325 11.8161 0 12.9234 0 14.2716 0 15.6774.3325 16.7663.9791 17.6171 1.8481 18.8187 3.2697 19.447 5.0629 19.447 7.0759 19.447 7.8717 19.0779 8.6282 18.4497 8.6282 18.8737 8.7382 19.3187 8.8141 19.3187H13.0444C12.8612 19.0779 12.8246 17.9313 12.8246 16.9889ZM8.2408 15.8239C7.8901 16.248 7.3351 16.5072 6.4293 16.5072 5.4686 16.5072 4.8769 16.1564 4.5628 15.693 4.3219 15.3423 4.1937 14.769 4.1937 14.2323 4.1937 13.6773 4.3403 13.0674 4.6361 12.6984 4.9869 12.2742 5.5785 11.9785 6.5026 11.9785 7.3351 11.9785 7.8874 12.2559 8.2199 12.6251 8.5523 12.9758 8.7382 13.6041 8.7382 14.2323 8.7408 14.8266 8.5549 15.4365 8.2408 15.8239ZM14.2801 19.3658C14.2068 19.3291 14.1361 19.0804 14.2068 18.3134 14.2068 16.7611 14.2068 8.4731 14.2068 6.1825 14.2068 5.4234 14.0733 4.8998 14.0366 4.7322H18.2487C18.2932 4.8605 18.4188 5.3422 18.4188 6.0149 18.4188 8.0647 18.3246 15.2544 18.4188 18.4416 18.4188 18.9783 18.4188 19.2741 18.5288 19.3657ZM19.7512 19.3175C19.678 19.2808 19.678 19.1709 19.678 18.2651 19.678 16.7128 19.678 8.4248 19.678 6.1342 19.678 5.3751 19.5445 4.8515 19.5078 4.6839H23.7199C23.7644 4.8123 23.89 5.2939 23.89 5.9667 23.89 8.0164 23.89 15.4012 23.89 18.3933 23.89 18.93 23.89 19.2258 24 19.3174Z"},{name:"appletv",path:"M 6.820312 8.246094 C 7.179688 7.824219 7.398438 7.273438 7.398438 6.675781 C 7.398438 6.613281 7.398438 6.550781 7.394531 6.492188 L 7.394531 6.5 C 6.746094 6.566406 6.183594 6.871094 5.785156 7.324219 L 5.78125 7.328125 C 5.417969 7.726562 5.195312 8.261719 5.195312 8.851562 C 5.195312 8.910156 5.199219 8.96875 5.203125 9.023438 L 5.203125 9.015625 C 5.207031 9.015625 5.214844 9.015625 5.222656 9.015625 C 5.867188 9.015625 6.445312 8.71875 6.820312 8.25 Z M 8.195312 12.304688 C 8.203125 13.292969 8.796875 14.140625 9.648438 14.511719 L 9.664062 14.519531 C 9.46875 15.109375 9.214844 15.625 8.894531 16.09375 L 8.90625 16.070312 C 8.449219 16.734375 7.980469 17.398438 7.230469 17.414062 C 6.5 17.429688 6.269531 16.980469 5.425781 16.980469 C 4.589844 16.980469 4.328125 17.398438 3.632812 17.429688 C 2.925781 17.453125 2.375 16.703125 1.914062 16.039062 C 1.226562 15.109375 0.8125 13.941406 0.8125 12.671875 C 0.8125 11.902344 0.964844 11.167969 1.242188 10.5 L 1.226562 10.535156 C 1.679688 9.734375 2.519531 9.195312 3.484375 9.171875 L 3.488281 9.171875 C 4.191406 9.15625 4.863281 9.648438 5.296875 9.648438 C 5.726562 9.648438 6.535156 9.0625 7.386719 9.148438 C 8.210938 9.179688 8.933594 9.59375 9.378906 10.21875 L 9.386719 10.226562 C 8.675781 10.664062 8.210938 11.429688 8.195312 12.304688 Z M 15.019531 17.304688 C 14.589844 17.429688 14.097656 17.5 13.585938 17.5 C 13.582031 17.5 13.574219 17.5 13.566406 17.5 C 12.417969 17.5 11.847656 16.851562 11.847656 15.546875 L 11.847656 9.796875 L 10.851562 9.796875 L 10.851562 8.753906 L 11.898438 8.753906 L 11.898438 7.398438 L 13.28125 6.832031 L 13.28125 8.761719 L 14.878906 8.761719 L 14.878906 9.804688 L 13.289062 9.804688 L 13.289062 15.238281 C 13.285156 15.277344 13.285156 15.320312 13.285156 15.367188 C 13.285156 15.640625 13.359375 15.898438 13.492188 16.117188 L 13.492188 16.109375 C 13.644531 16.265625 13.855469 16.363281 14.089844 16.363281 C 14.128906 16.363281 14.160156 16.359375 14.195312 16.355469 L 14.191406 16.355469 C 14.492188 16.34375 14.777344 16.304688 15.050781 16.242188 L 15.019531 16.25 Z M 20.019531 17.367188 L 18.324219 17.367188 L 15.195312 8.753906 L 16.726562 8.753906 L 18.617188 14.355469 C 18.6875 14.574219 18.871094 15.199219 19.164062 16.242188 L 19.441406 15.308594 L 19.75 14.367188 L 21.710938 8.746094 L 23.230469 8.746094 Z M 20.019531 17.367188 Z"},{name:"crunchyroll",path:"M 2.933594 13.46875 C 2.707031 10.601562 3.65625 7.769531 5.566406 5.621094 C 7.476562 3.476562 10.179688 2.199219 13.050781 2.089844 C 15.921875 1.984375 18.710938 3.050781 20.777344 5.046875 C 22.847656 7.042969 24.007812 9.792969 24 12.667969 L 24 12 C 24 5.371094 18.628906 0 12 0 C 5.371094 0 0 5.371094 0 12 C 0 18.628906 5.371094 24 12 24 L 12.800781 24 C 7.261719 23.609375 2.964844 19.015625 2.933594 13.46875 Z M 19.199219 14 C 14.886719 14.015625 13.8125 8.011719 17.867188 6.53125 C 16.679688 5.898438 15.347656 5.574219 14 5.601562 C 10.601562 5.601562 7.539062 7.648438 6.238281 10.785156 C 4.9375 13.925781 5.65625 17.539062 8.058594 19.941406 C 10.460938 22.34375 14.074219 23.0625 17.214844 21.761719 C 20.351562 20.460938 22.398438 17.398438 22.398438 14 C 22.421875 13.464844 22.378906 12.925781 22.265625 12.398438 C 21.609375 13.449219 20.4375 14.0625 19.199219 14 Z M 19.199219 14 Z"},{name:"dazn",path:"m14.774 8.291.772-2.596.79 2.596zm3.848 2.268-2.025-6.128c-.045-.135-.097-.224-.154-.266a.497.497 0 0 0-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045 6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0 .139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0 .077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327 1.051c.026.09.051.16.077.213a.395.395 0 0 0 .087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0 .27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0 0-.036-.108l.003.006zm-.994 2.467h-.646c-.168 0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167 0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0 .148.025.246.077.294.052.048.16.072.328.072h.656c.167 0 .278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91 3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0 .278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581 1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504 9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24 0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67 18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0 .019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149 0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0 .172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0 0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0 .245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408 8.233c0 .264-.017.484-.052.661a1.08 1.08 0 0 1-.174.43.648.648 0 0 1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0 .63.11.79.324.16.215.241.571.241 1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167 0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0 .148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447 2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0 .054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z"},{name:"discovery",path:"M 20.89,2.51 C 20.89,2.51 21.19,2.51 21.19,2.51 21.19,2.51 21.19,4.12 21.19,4.12 21.19,4.12 22.90,4.12 22.90,4.12 22.90,4.12 22.90,4.52 22.90,4.52 22.90,4.52 21.19,4.52 21.19,4.52 21.19,5.07 21.32,5.87 20.99,6.33 21.37,6.65 21.51,6.90 21.77,7.33 22.76,8.97 23.02,10.57 23.00,12.45 22.95,16.30 20.25,19.55 16.67,20.72 15.89,20.97 14.98,21.18 14.16,21.19 14.16,21.19 11.95,21.19 11.95,21.19 11.52,21.19 11.05,21.25 10.64,21.09 11.68,20.46 12.51,19.78 13.21,18.78 15.48,15.57 14.70,11.39 11.65,8.99 10.33,7.95 8.87,7.56 7.23,7.43 7.23,7.43 7.23,2.71 7.23,2.71 7.23,2.71 11.75,2.71 11.75,2.71 11.75,2.71 13.76,2.71 13.76,2.71 15.63,2.71 17.70,3.38 19.18,4.52 19.18,4.52 19.18,4.12 19.18,4.12 19.18,4.12 20.89,4.12 20.89,4.12 20.89,4.12 20.89,2.51 20.89,2.51 Z M 20.89,4.52 C 20.89,4.52 19.28,4.52 19.28,4.52 19.28,4.52 20.89,6.03 20.89,6.03 20.89,6.03 20.89,4.52 20.89,4.52 Z M 6.23,8.28 C 8.69,7.96 10.94,8.76 12.50,10.74 13.67,12.24 13.78,13.56 13.76,15.36 13.73,17.32 12.38,19.32 10.74,20.30 9.24,21.21 8.31,21.21 6.63,21.19 3.58,21.15 0.82,18.17 0.80,15.16 0.80,14.11 0.75,13.69 1.08,12.65 1.85,10.26 3.80,8.73 6.23,8.28 Z"},{name:"disney",path:"M2.056 6.834C1.572 6.834 1 6.77 1 6.483c0-2.023 3.562-2.11 5.08-2.11c1.978 0 4.506.614 6.66 1.384c3.277 1.188 9.917 5.145 9.917 9.674c0 4.001-4.31 5.914-8.311 5.914a22 22 0 0 1-3.21-.33c-.066.243-.11.418-.264.924a4.3 4.3 0 0 1-.77.087l-.505-.043c-.33-.396-.44-1.033-.572-1.715c-2-1.165-3.298-2.155-3.891-2.836c-.506-.528-1.078-1.232-1.078-1.913c0-.351.22-.66.726-1.01c1.034-.77 2.352-1.188 4.507-1.563l.044-.9c.022-.22.242-2.573.748-3.013c.813.66.901 1.341.967 2.353c.022.44.044.901.11 1.385h.308c1.539 0 6.244.395 6.244 2.616c0 .528-.77 1.517-1.518 1.517a1.9 1.9 0 0 1-.966-.285c.329-.375.813-.704.945-.99c-.44-.528-2.814-1.143-4.551-1.143a4 4 0 0 0-.572.022l.022 4.815c.703.44 1.561.483 2.11.483c2.42 0 7.431-.417 7.431-4.331c0-3.87-4.946-6.86-8.64-8.266a21.4 21.4 0 0 0-7.937-1.496a7.2 7.2 0 0 0-1.803.198c-.373.088-.505.176-.505.264c0 .153.747.242.836.286a.22.22 0 0 1 .11.175a.26.26 0 0 1-.088.176c-.089 0-.286.022-.528.022M9.2 14.551c-2.176.177-4.595.397-4.595 1.166c0 .594 1.012 1.32 1.627 1.781a7.05 7.05 0 0 0 2.77 1.319zm11.155-9.85c-.02.428-.042.942-.042 1.723c0 .3 0 .642.01 1.027c-.042.193-.32.214-.46.278a1.2 1.2 0 0 1-.256-.192V4.83c0-.29.01-.588.01-1.038c0-.225 0-.482-.01-.792c0-.192.032-.374.15-.802a.34.34 0 0 1 .3-.224c.245.064.491.17.577.374c-.257.76-.235 1.594-.279 2.353m-.384-.085c.428.021.941.042 1.722.042c.3 0 .643 0 1.027-.01c.193.041.215.32.279.459q-.078.141-.193.257H20.1c-.289 0-.589-.01-1.037-.01c-.225 0-.482 0-.792.01c-.193.002-.375-.03-.803-.149a.35.35 0 0 1-.225-.299c.064-.246.172-.492.374-.578c.76.257 1.595.235 2.355.278z"},{name:"f1tv",path:"M20.2174 15 20.3424 15 20.3424 14.4214 20.3445 14.4214 20.5524 15 20.6605 15 20.8684 14.4214 20.8705 14.4214 20.8705 15 20.9955 15 20.9955 14.2503 20.8127 14.2503 20.6111 14.8373 20.609 14.8373 20.4022 14.2503 20.2174 14.2503 20.2174 15ZM19.5255 14.3636 19.7627 14.3636 19.7627 15 19.894 15 19.894 14.3636 20.1324 14.3636 20.1324 14.2503 19.5255 14.2503 19.5255 14.3636ZM18 15 24 9 20.3887 9 14.3889 15 18 15ZM17.1397 11.613 9.8764 11.613C7.6627 11.613 7.2754 11.7304 6.3272 12.6785 5.4405 13.5653 4.0001 15 4.0001 15L7.1465 15 7.8971 14.2494C8.3906 13.7559 8.6451 13.7047 9.6814 13.7047L15.0481 13.7047 17.1397 11.613ZM6.2304 12.2506C5.5755 12.8685 4.1506 14.2526 3.3826 15L0 15C0 15 2.7105 12.2974 4.217 10.8145 5.7691 9.337 6.5429 9 9.3897 9L19.7529 9 17.509 11.2437 9.6002 11.2437C7.5999 11.2437 7.1504 11.3824 6.2304 12.2506Z"},{name:"filmplus",path:"M19.5906 0C19.2204.1246 18.8469.259 18.4817.3964 18.1169.5341 17.7562.6762 17.3905.8103 17.025.9447 16.6652 1.0866 16.3033 1.2284 15.9418 1.3706 15.5767 1.5033 15.2165 1.6468 14.8561 1.7901 14.4937 1.9267 14.1333 2.0689 13.7729 2.2113 13.4083 2.3479 13.0465 2.4872 12.6847 2.6266 12.336 2.7852 11.9722 2.9182 11.6087 3.0514 11.258 3.21 10.8957 3.3469 10.5336 3.484 10.1695 3.6231 9.8086 3.765 9.4476 3.9072 9.0824 4.0401 8.7215 4.1831 8.3605 4.3264 7.9875 4.4577 7.6238 4.5907 7.2603 4.7239 6.8848 4.863 6.5236 4.9957 6.1626 5.1286 5.8024 5.2859 5.4495 5.4269 5.0967 5.5679 4.7658 5.7433 4.4291 5.9116 4.0921 6.0797 3.7952 6.2539 3.5 6.4878 3.2048 6.722 2.9843 6.9433 2.7474 7.2404 2.5105 7.5376 2.3245 7.8004 2.1626 8.1608 2.0006 8.5213 1.8671 8.8716 1.7782 9.2817 1.689 9.6917 1.5898 10.1143 1.5557 10.5645 1.5217 11.0146 1.4955 11.5342 1.5 12.0139 1.5045 12.4937 1.4958 13.03 1.5 13.5192 1.5042 14.0084 1.4933 14.5338 1.5 15.0244 1.5067 15.515 1.5368 16.0098 1.5279 16.5017 1.519 16.9937 1.5429 17.5047 1.5 17.9791 1.4571 18.4538 1.5229 18.9854 1.5557 19.4286 1.5886 19.8718 1.6684 20.3111 1.779 20.7105 1.8897 21.11 2.019 21.4422 2.1991 21.7957 2.3789 22.1494 2.5433 22.4078 2.7892 22.7108 3.0348 23.0141 3.26 23.2075 3.5836 23.4216 3.9072 23.6354 4.2342 23.7815 4.6214 23.8891 5.0083 23.9969 5.5471 24.0466 5.9599 24 6.3728 23.9534 6.8037 23.859 7.1675 23.7023 7.5312 23.5459 7.8415 23.4116 8.1411 23.1707 8.441 22.9302 8.6677 22.7392 8.9216 22.446 9.1755 22.1525 9.3328 21.884 9.5209 21.5401 9.7088 21.1958 9.8245 20.8535 9.9466 20.4605 10.0689 20.0677 10.1319 19.617 10.1709 19.1797 10.2102 18.7426 10.2339 18.2102 10.2526 17.7561 10.2713 17.302 10.3078 16.7615 10.3103 16.3086 10.3128 15.8559 10.8603 15.859 11.1702 15.6633 11.4805 15.4679 11.8376 15.3123 12.1695 15.1574 12.5015 15.0024 12.8299 14.7724 13.1733 14.6559 13.5164 14.5391 13.8735 14.3334 13.9898 13.9671 14.106 13.6011 14.2351 13.2284 14.4082 12.8803 14.581 12.5318 14.6604 12.1477 14.8305 11.7974 15.0005 11.447 15.1488 11.0807 15.2422 10.7038 14.7689 10.8594 14.3223 11.1044 13.8677 11.3084 13.4133 11.5128 12.962 11.7196 12.5127 11.9325 12.0631 12.1452 11.5978 12.3334 11.151 12.55 10.7042 12.7666 10.2403 12.9561 9.798 13.1763 9.3559 13.3962 8.8472 13.5395 8.4193 13.7764 7.9914 14.0134 7.3004 14.0733 7.3537 14.6899 7.4069 15.3065 7.3779 16.0259 7.3815 16.6411 7.3852 17.2563 7.386 18.0429 7.3813 18.6199 7.3765 19.1972 7.2826 19.7809 6.9891 20.2068 6.6958 20.633 6.3326 21.0007 5.8392 20.9709 5.3459 20.941 4.9266 20.6071 4.7036 20.1274 4.4803 19.6477 4.4218 19.018 4.4268 18.4251 4.4318 17.8322 4.4238 17.067 4.4268 16.446 4.4299 15.8249 4.424 15.0905 4.4268 14.4669 4.4296 13.8433 4.4226 13.0896 4.4268 12.4878 4.431 11.886 4.4817 11.241 4.6409 10.7228 4.7998 10.2046 5.0139 9.8537 5.3955 9.4983 5.7774 9.1431 6.1417 8.9296 6.5946 8.7183 7.0476 8.507 7.5217 8.3306 7.9755 8.1201 8.4291 7.9094 8.8817 7.7293 9.3414 7.5348 9.8008 7.3399 10.2509 7.1281 10.7075 6.9218 11.1644 6.7158 11.6433 6.5422 12.101 6.3362 12.5584 6.1299 13.018 5.9337 13.4797 5.7357 13.9415 5.5378 14.3942 5.3282 14.8606 5.1376 15.3266 4.9466 15.7626 4.7089 16.2392 4.5371 16.7162 4.3654 17.1151 4.0764 17.6109 3.9298 18.1066 3.7829 18.3569 3.3218 18.5054 2.8452 18.6543 2.3688 18.8898 1.8879 19.0521 1.4127 19.214.9374 19.4498.4808 19.5906 0ZM17.1376 6.0767C13.8936 7.4135 10.6707 8.8111 7.4373 10.1742 7.4373 11.0197 7.4373 11.8654 7.4373 12.7108 8.1832 12.3663 8.9787 12.0555 9.7169 11.7012 10.455 11.3469 11.2394 11.0534 11.9616 10.6846 12.6836 10.3155 13.5413 10.085 14.2323 9.6939 14.9233 9.3029 15.8537 9.1788 16.2373 8.4374 16.6206 7.6962 16.8519 6.8538 17.1376 6.0767ZM19.3118 17.5331C19.2422 16.7922 19.413 16.0875 19.2932 15.3497 19.1733 14.6118 18.2033 14.8496 17.6394 14.8014 17.0755 14.7532 16.1511 14.7866 16.1899 15.554 16.2286 16.3214 16.2401 16.9385 16.2456 17.7003 15.7024 17.7274 14.9517 17.6574 14.4338 17.6725 13.9159 17.6875 13.2419 17.5412 13.066 18.1165 12.8898 18.6918 13.0473 19.2808 13.0582 19.8553 13.0691 20.4295 13.7091 20.4755 14.2387 20.4321 14.7683 20.3886 15.5022 20.4647 16.0505 20.4321 16.1314 19.59 15.8272 18.4524 16.5737 17.8612 17.3202 17.27 18.4151 17.6443 19.3118 17.5331ZM17.5 17.6446C17.1808 17.6309 16.853 17.7695 16.615 17.9861 16.3769 18.2024 16.2713 18.4758 16.2456 18.8153 16.2203 19.1548 16.2587 19.6507 16.2456 20.0139 16.2325 20.3771 16.2551 20.8496 16.2456 21.2125 16.2362 21.5755 16.2576 22.0728 16.2456 22.4111 16.2337 22.7495 16.2699 23.1323 16.6167 23.2387 16.9631 23.3452 17.4153 23.2728 17.7787 23.2753 18.1422 23.2778 18.5985 23.3427 18.93 23.2282 19.2617 23.1136 19.3138 22.7401 19.3118 22.4111 19.3099 22.0822 19.3157 21.5855 19.3397 21.2404 19.3637 20.8953 19.2121 20.2662 19.6742 20.3484 20.1364 20.4307 20.4293 20.3738 20.8449 20.3763 21.2606 20.3788 21.6703 20.4123 22.043 20.3757 22.4154 20.339 22.518 19.9925 22.5453 19.6794 22.5726 19.3664 22.4399 18.8917 22.5174 18.5645 22.5949 18.2372 22.4709 17.8707 22.1464 17.7369 21.8222 17.6028 21.4169 17.6485 21.0401 17.6446 20.6632 17.6407 20.2284 17.646 19.8415 17.6446 19.4546 17.6432 19.0596 17.6663 18.6707 17.6725 18.2819 17.6786 17.8685 17.6602 17.5 17.6446Z"},{name:"foxsports",path:"M 0.2305 15.125 L 0.2305 5 L 6.2148 5 L 6.3984 7.7695 L 3.0469 7.7695 L 3.0469 9.0898 L 5.7773 9.0898 L 5.7773 11.8516 L 3.0273 11.8516 L 3.0273 15.125 L 0.2305 15.125 M 23.2813 15.0938 L 20.2852 9.8398 L 23.0078 5 L 20.0117 5 L 18.7695 7.1797 L 17.5469 5 L 14.4453 5 L 17.2188 9.875 L 14.2813 15.1016 L 17.293 15.0977 L 18.7305 12.5391 L 20.1836 15.0938 L 23.2813 15.0938 M 11.9102 12.0977 L 11.9102 8.0508 C 11.9102 7.5898 11.5156 7.1758 11.0703 7.1758 C 10.6289 7.1758 10.2695 7.5898 10.2695 8.0508 L 10.2695 12.082 C 10.2695 12.5469 10.6289 12.918 11.0703 12.918 C 11.5156 12.918 11.9102 12.5586 11.9102 12.0977 Z M 6.3242 10.0742 C 6.3242 7.3594 8.4414 5.1523 11.0586 5.1523 C 13.6758 5.1523 15.7969 7.3594 15.7969 10.0742 C 15.7969 12.793 13.6758 14.9961 11.0586 14.9961 C 8.4414 14.9961 6.3242 12.793 6.3242 10.0742 Z M 0 19.5195 L 0 18.9961 L 0.2617 18.7344 L 2.3867 18.7344 L 2.4648 18.6563 L 2.4648 18.1016 L 2.4102 18.0391 L 0.4375 18.0391 L 0 17.5938 L 0 16.3203 L 0.5039 15.8086 L 3.3633 15.8086 L 3.3633 16.3711 L 3.1563 16.5859 L 1.082 16.5859 L 1.0039 16.668 L 1.0039 17.207 L 1.0625 17.2656 L 3.0273 17.2656 L 3.4648 17.7148 L 3.4648 19.0039 L 2.9609 19.5195 L 0 19.5195 M 6.4609 17.6055 L 6.6094 17.4531 L 6.6094 16.7422 L 6.4609 16.5938 L 5.0938 16.5938 L 5.0938 17.6055 Z M 4.0898 15.8086 L 7.0547 15.8086 L 7.6172 16.3789 L 7.6172 17.7539 L 7.0547 18.3281 L 5.0938 18.3281 L 5.0938 19.5195 L 4.0898 19.5195 Z M 10.5156 18.6484 L 10.7227 18.4414 L 10.7227 16.8203 L 10.5156 16.6133 L 9.3477 16.6133 L 9.1406 16.8203 L 9.1406 18.4414 L 9.3477 18.6484 Z M 8.1445 18.9492 L 8.1445 16.3789 L 8.6992 15.8086 L 11.1602 15.8086 L 11.7227 16.3789 L 11.7227 18.9492 L 11.1602 19.5195 L 8.6992 19.5195 Z M 14.7344 17.3984 L 14.875 17.2539 L 14.875 16.7109 L 14.7344 16.5664 L 13.3828 16.5664 L 13.3828 17.3984 Z M 12.3789 15.8086 L 15.375 15.8086 L 15.8789 16.3203 L 15.8789 17.5039 L 15.3984 17.9961 L 16.0313 19.5195 L 14.9141 19.5195 L 14.4453 18.1719 L 13.3828 18.1719 L 13.3828 19.5195 L 12.3789 19.5195 Z M 17.3789 16.668 L 16.2188 16.668 L 16.2188 15.8086 L 19.5391 15.8086 L 19.5391 16.668 L 18.3828 16.668 L 18.3828 19.5195 L 17.3789 19.5195 L 17.3789 16.668 M 20.082 19.6211 L 20.082 19.0977 L 20.3438 18.8359 L 22.4688 18.8359 L 22.5469 18.7578 L 22.5469 18.2031 L 22.4922 18.1406 L 20.5195 18.1406 L 20.082 17.6953 L 20.082 16.4219 L 20.5859 15.9102 L 23.4453 15.9102 L 23.4453 16.4727 L 23.2383 16.6875 L 21.168 16.6875 L 21.0859 16.7695 L 21.0859 17.3086 L 21.1445 17.3672 L 23.1133 17.3672 L 23.5469 17.8164 L 23.5469 19.1055 L 23.043 19.6211 L 20.082 19.6211 Z"},{name:"jellyfin",path:"M12 .002C8.826.002-1.398 18.537.16 21.666c1.56 3.129 22.14 3.094 23.682 0C25.384 18.573 15.177 0 12 0zm7.76 18.949c-1.008 2.028-14.493 2.05-15.514 0C3.224 16.9 9.92 4.755 12.003 4.755c2.081 0 8.77 12.166 7.759 14.196zM12 9.198c-1.054 0-4.446 6.15-3.93 7.189.518 1.04 7.348 1.027 7.86 0 .511-1.027-2.874-7.19-3.93-7.19z"},{name:"kijk",path:"M19.5051 14.5813C18.3413 15.5829 17.1659 16.3763 16.0112 16.94 14.6307 17.6141 13.2811 17.956 12 17.956 7.4971 17.956 3.4816 13.8181 1.9157 11.9739A23.7339 23.7339 90 014.4949 9.3696C5.6587 8.3683 6.8341 7.5749 7.9888 7.0109 9.3693 6.3368 10.7189 5.9952 12 5.9952 16.5029 5.9952 20.5184 10.1328 22.0843 11.9773A23.7288 23.7288 90 0119.5051 14.5813ZM12 4.5C5.3725 4.5 0 11.9755 0 11.9755S5.3725 19.4509 12 19.4509 24 11.9755 24 11.9755 18.6275 4.5 12 4.5ZM11.4315 9.9397C11.4955 9.9397 11.5469 9.9917 11.5469 10.0557V13.8779C11.5469 13.9419 11.4952 13.9939 11.4315 13.9939H10.1952A.1157.1157 90 0110.0797 13.8779V10.0557C10.0797 9.9917 10.1315 9.9397 10.1952 9.9397H11.4315ZM9.5221 10.072 8.4128 11.8576 8.4099 11.8624A.192.192 90 008.3819 11.9611.192.192 90 008.4085 12.0571L8.4099 12.0592 8.4125 12.064 9.5219 13.8499A.0893.0893 90 019.4469 13.988H8.1336A.1144.1144 90 018.0365 13.9347C7.7947 13.5517 7.1544 12.5165 7.1544 12.5165V13.872C7.1544 13.936 7.1027 13.988 7.0389 13.988H5.8437A.1157.1157 90 015.7285 13.872V10.0499C5.7285 9.9859 5.78 9.9339 5.8437 9.9339H7.0389C7.1029 9.9339 7.1544 9.9859 7.1544 10.0499V11.4053S7.7944 10.3699 8.0365 9.9872C8.0579 9.9536 8.0941 9.9339 8.1336 9.9339H9.4472A.0893.0893 90 019.5219 10.072ZM18.0776 9.9339C18.1413 9.9339 18.1928 9.9859 18.1928 10.0499V13.872C18.1928 13.936 18.1411 13.988 18.0776 13.988H16.8824A.1157.1157 90 0116.7669 13.872V12.5165S16.1269 13.5517 15.8848 13.9347A.1144.1144 90 0115.7877 13.988H14.4741A.0893.0893 90 0114.3992 13.8499L15.5085 12.064C15.5096 12.0624 15.5107 12.0611 15.5115 12.0592L15.5131 12.0568A.192.192 90 0015.5392 11.9608.192.192 90 0015.5131 11.8648L15.5115 11.8624 15.5088 11.8576 14.3992 10.072A.0896.0896 90 0114.4741 9.9339H15.7877C15.8272 9.9339 15.8635 9.9536 15.8848 9.9872 16.1267 10.3699 16.7669 11.4053 16.7669 11.4053V10.0499C16.7669 9.9859 16.8187 9.9339 16.8824 9.9339H18.0776ZM13.7085 9.9397C13.7723 9.9397 13.824 9.9917 13.824 10.0557V13.9731C13.824 14.2749 13.7493 14.564 13.5947 14.7981L12.8787 15.8741A.1149.1149 90 0112.6848 15.8709L11.9664 14.7144A.1165.1165 90 0111.9683 14.5885L12.2653 14.1413C12.3248 14.0525 12.3565 13.9477 12.3565 13.8405V10.0557C12.3565 9.9917 12.4083 9.9397 12.472 9.9397H13.7085Z"},{name:"max",path:"M 3.7443 8 C 3.0949 8 2.4381 8.2932 1.5957 8.9574 L 1.5957 8.167 L 0 8.167 L 0 14.4756 L 1.6959 14.4756 L 1.6959 10.5531 C 2.4381 9.9557 2.7758 9.7664 3.0541 9.7664 C 3.3844 9.7664 3.5996 9.9742 3.5996 10.5012 L 3.5996 14.4756 L 5.2955 14.4756 L 5.2955 10.542 C 6.0377 9.9557 6.368 9.7664 6.6537 9.7664 C 6.984 9.7664 7.1992 9.9742 7.1992 10.5012 L 7.1992 14.4756 L 8.8951 14.4756 L 8.8951 9.8926 C 8.8951 8.4713 8.1047 8 7.3439 8 C 6.6945 8 6.0377 8.2746 5.173 8.9463 C 4.8947 8.2412 4.2898 8 3.7443 8 Z M 12.3426 8 C 10.6578 8 9.2588 9.4807 9.2588 11.3213 C 9.2588 13.1619 10.6578 14.6426 12.3426 14.6426 C 13.1775 14.6426 13.8975 14.3271 14.4504 13.6443 L 14.4504 14.4756 L 16.0684 14.4756 L 16.0684 8.167 L 14.4504 8.167 L 14.4504 8.9982 C 13.8975 8.3154 13.1775 8 12.3426 8 Z M 16.3652 8.167 C 17.0629 9.284 17.857 10.2822 18.7811 11.2805 C 17.857 12.3195 17.0629 13.4031 16.3652 14.4756 L 18.41 14.4756 C 18.8961 13.674 19.4416 12.9504 20.0687 12.2676 C 20.6848 12.9504 21.2006 13.674 21.683 14.4756 L 23.75 14.4756 C 23.0412 13.3697 22.2693 12.3195 21.3416 11.2805 C 22.2582 10.2822 23.0412 9.2506 23.75 8.167 L 21.7238 8.167 C 21.2191 8.9686 20.6736 9.6402 20.0687 10.3008 C 19.449 9.6402 18.9072 8.9686 18.41 8.167 Z M 12.5986 9.4621 C 13.608 9.4621 14.4207 10.2896 14.4207 11.3213 C 14.4207 12.3529 13.608 13.1805 12.5986 13.1805 C 11.593 13.1805 10.7803 12.3529 10.7803 11.3213 C 10.7803 10.2896 11.593 9.4621 12.5986 9.4621 Z M 12.5986 9.8814 C 11.8268 9.8814 11.1996 10.5234 11.1996 11.3213 C 11.1996 12.1191 11.8268 12.7611 12.5986 12.7611 C 13.3705 12.7611 13.9977 12.1191 13.9977 11.3213 C 13.9977 10.5234 13.3705 9.8814 12.5986 9.8814 Z M 12.5986 9.8814 Z"},{name:"mlbtv",path:"M 23.2539 7.0039 C 23.2656 6.293 22.6953 5.7109 21.9883 5.7031 C 21.9805 5.7031 21.9727 5.7031 21.9648 5.7031 L 16.3828 5.7031 L 19.5859 11.0625 L 19.8789 11.1016 L 20.0664 11.3438 L 20.0664 11.5742 L 20.2695 11.6172 L 20.457 11.8711 L 20.457 12.0898 L 20.6641 12.1289 L 20.875 12.3594 L 20.875 12.8672 C 21.1289 13.0977 21.4102 13.2852 21.7188 13.4297 C 22 13.5391 22.0313 13.9922 22.2031 14.2344 C 22.4141 14.5859 22.707 14.7266 22.6445 14.9258 C 22.5039 15.4492 21.9648 16.3398 21.4648 16.3789 L 19.4805 16.3789 L 19.4805 17.2305 L 21.9648 17.2305 C 22.6836 17.2266 23.2617 16.6445 23.2578 15.9258 L 23.2578 7.0039 M 9.6016 16.3945 L 8.6445 16.3945 C 8.6445 13.9922 9.4531 12.6641 10.4258 12.3984 C 10.5586 12.375 10.4922 11.7188 10.3242 11.5195 L 9.7656 11.5195 C 9.6758 11.5195 9.7266 11.3477 9.7266 11.3477 L 10.1797 10.3789 L 10.1211 10.1094 L 8.4414 10.1094 L 9.8203 9.1445 C 9.8828 6.5938 12.4961 6.3945 14.0664 7.457 C 15.0039 8.0781 15.0742 9.3086 15.0039 10.1563 C 14.9922 10.2109 14.7578 10.1758 14.7578 10.1758 C 14.7578 10.1758 14.6016 11.1133 15.0156 11.1133 L 16.8516 11.1133 C 17.5977 11.082 18.3203 11.5898 18.3203 11.5898 L 18.4961 10.9453 L 14.4766 5.7031 L 1.9961 5.7031 C 1.6523 5.6992 1.3203 5.8359 1.0742 6.0781 C 0.832 6.3242 0.6953 6.6563 0.6992 7.0039 L 0.6992 15.9297 C 0.6953 16.2734 0.8281 16.6094 1.0742 16.8516 C 1.3203 17.0977 1.6523 17.2344 1.9961 17.2344 L 10.0977 17.2344 C 9.9023 16.8945 9.6758 16.5078 9.6055 16.3945 M 2.5 14.5 C 2.5 14.0078 2.8945 13.6094 3.3867 13.6094 C 3.875 13.6094 4.2734 14.0078 4.2734 14.5 C 4.2734 14.9883 3.875 15.3867 3.3867 15.3867 L 3.3789 15.3867 C 2.8945 15.3867 2.5 14.9961 2.5 14.5117 C 2.5 14.5078 2.5 14.5039 2.5 14.5 Z"},{name:"nba",path:"M 7.8555 21.1602 C 7.5547 20.8906 7.7539 20.7734 7.7383 20.6563 C 7.5391 19.8203 6.8672 19.3203 7.2188 19.0547 C 7.1484 18.8438 7.0664 18.6367 6.9688 18.4336 C 5.9336 17.8477 5.0625 16.8789 4.9141 16.7461 C 4.7617 16.6133 4.4297 16.3438 4.3633 16.1953 C 4.2969 16.043 2.9063 14.2383 2.625 13.6211 L 2.1406 13.5547 C 1.9219 12.6367 1.1719 11.8672 1.1523 10.9648 C 1.1758 10.543 1.25 10.1289 1.3711 9.7266 C 1.4688 9.5781 1.5859 9.4414 1.7227 9.3242 L 1.7227 9.0742 C 0.6523 9.1094 0.9531 8.9922 0.7695 8.5742 C 0.5859 8.1563 0.7344 8.2227 0.7852 8.0234 C 0.9375 7.4375 1.4023 6.5195 1.6055 6.1016 C 1.8047 5.6836 1.8711 5.3828 1.8711 5.3828 C 2.6758 3.7617 2.9766 3.8789 3.9258 3.7773 L 3.9766 3.7109 C 4.9297 3.6758 4.7813 3.5938 4.9141 2.6758 C 4.7813 2.7422 4.7305 2.3906 4.7305 2.3906 C 4.6445 1.8711 4.8789 1.9727 4.9805 1.957 C 4.9961 1.1016 5.0977 0.8203 5.7148 0.5859 L 2.4922 0.5859 C 1.4375 0.5859 0.5859 1.4375 0.5859 2.4883 L 0.5859 21.5078 C 0.5859 22.5625 1.4375 23.4141 2.4922 23.4141 L 8.1055 23.4141 C 7.4531 23.0625 7.8398 22.4141 7.8555 21.1602 M 21.5078 0.5859 L 6.2852 0.5859 C 6.5156 0.6484 6.7148 0.7969 6.8359 1.0039 C 7.0703 1.0195 7.3555 1.5547 6.918 2.3242 C 7.1211 2.457 6.9688 2.6406 6.8203 2.8594 C 6.668 3.0742 6.7344 3.0586 6.6172 3.043 C 6.4531 3.3945 6.25 3.7266 6.1016 3.7422 C 6.0352 3.8203 6.0273 3.9297 6.082 4.0117 C 6.3086 4.1016 6.5156 4.2266 6.7031 4.3789 L 6.7031 4.4609 C 6.8672 4.5625 6.9531 4.6445 7.1367 4.7461 C 7.5859 5.0313 8.1563 5.5469 8.0898 7.3203 C 8.2227 7.7031 8.2734 8.457 8.3906 8.707 C 8.5078 8.957 8.793 9.4922 8.8594 9.9258 C 8.8594 9.9258 8.9258 10.5781 9.0078 10.6641 L 9.0586 10.6641 C 9.4414 10.7461 9.375 10.7969 9.4102 10.8633 L 9.5078 10.9453 C 9.6094 10.9961 9.7773 11.0469 9.7773 11.2305 L 9.8594 11.3633 C 9.9102 11.4453 9.957 11.5273 9.9961 11.6172 C 10.1289 11.9922 10.1289 12.4063 9.9961 12.7852 L 9.9961 12.8359 C 9.8477 13.2031 9.5742 13.5039 9.2266 13.6875 L 9.1914 13.6875 L 9.1406 13.7227 C 8.918 13.8281 8.6719 13.8867 8.4219 13.8867 C 7.4883 13.7656 6.832 12.9063 6.957 11.9727 C 7.0391 11.3594 7.4453 10.8398 8.0234 10.6133 C 7.8203 10.1289 7.4219 9.3438 7.3047 9.0938 C 7.1875 8.8398 6.9023 7.2188 6.8516 6.9023 C 6.8008 6.5859 6.1172 7.3203 6.1172 7.3555 C 6.1172 7.3867 5.582 8.6914 5.5664 8.7578 C 5.5547 8.8281 5.5469 8.9023 5.5469 8.9766 C 5.5469 8.9766 5.8008 9.0078 5.9336 9.4258 C 6.0664 9.8438 6.5 11.3984 6.5 11.3984 L 6.3828 11.5156 C 6.918 13.3047 6.7344 14.0742 6.9688 14.6055 C 7.2031 15.1406 7.3555 15.2422 7.6055 15.8789 C 7.8555 16.5117 7.9883 18.1172 8.0742 18.1836 C 8.3555 18.5508 8.5234 18.8359 8.5234 19.0352 C 8.5234 19.2383 8.2734 19.8555 8.375 20.2227 C 8.4727 20.5898 8.457 20.9063 8.5586 20.9922 C 8.6563 21.0742 8.6406 21.1758 8.6055 21.2422 C 8.5898 21.2734 8.5781 21.3086 8.5742 21.3438 C 8.7227 21.9102 9.2422 22.8633 8.4219 23.3633 L 8.375 23.3984 L 21.543 23.3984 C 22.582 23.3906 23.4219 22.5508 23.4336 21.5117 L 23.4336 2.4922 C 23.4219 1.4336 22.5664 0.5859 21.5078 0.5859 Z M 21.5078 0.5859 M 15.793 5.1133 L 19.2383 5.1133 L 18.5352 16.6289 L 17.7813 5.1133 L 21.1406 5.1133 L 19.6563 18.9023 L 17.2461 18.9023 Z M 15.3438 6.8359 L 13.8867 6.8359 L 13.8867 18.8867 L 12.0352 18.8867 L 12.0352 6.8359 L 10.6133 6.8359 L 10.6133 5.0977 L 15.3438 5.0977 Z M 3.543 22.2266 L 3.543 18.7852 L 4.2109 18.7852 C 4.5977 18.7852 4.8281 18.9844 4.8281 19.4727 L 4.8281 19.9883 C 4.8281 20.3047 4.7305 20.457 4.5977 20.5391 C 4.7539 20.6563 4.8438 20.8438 4.8281 21.043 L 4.8281 21.543 C 4.8281 22.0117 4.5781 22.2266 4.2109 22.2266 Z M 4.0117 20.7227 L 4.0117 21.793 L 4.1953 21.793 C 4.3438 21.793 4.3945 21.7109 4.3945 21.543 L 4.3945 20.957 C 4.3945 20.793 4.3438 20.7227 4.1953 20.7227 Z M 4.0117 19.2188 L 4.0117 20.3555 L 4.1797 20.3555 C 4.3438 20.3555 4.3789 20.3047 4.3789 20.1055 L 4.3789 19.4375 C 4.3789 19.2695 4.3281 19.2031 4.1797 19.2031 L 4.0117 19.2031 Z M 5.9336 21.5273 L 5.5156 21.5273 L 5.4648 22.2266 L 4.9961 22.2266 L 5.4141 18.7852 L 6.0664 18.7852 L 6.4688 22.2266 L 5.9844 22.2266 Z M 5.7148 19.168 L 5.6992 19.168 C 5.6641 19.5859 5.6172 20.3047 5.5977 20.5391 L 5.5469 21.1406 L 5.8984 21.1406 L 5.8477 20.5391 C 5.832 20.3047 5.7656 19.5859 5.7148 19.168 M 2.1875 22.2266 L 1.7891 22.2266 L 1.7891 18.7852 L 2.4219 18.7852 L 2.9414 21.6094 C 2.8906 20.9414 2.8398 20.1211 2.8398 19.4219 L 2.8398 18.7852 L 3.2422 18.7852 L 3.2422 22.2266 L 2.6563 22.2266 L 2.1406 19.4727 C 2.1719 20.1055 2.1875 20.625 2.1875 21.1406 Z M 2.1875 22.2266 Z"},{name:"npo",path:"M23.4519 10.6902C24.1664 11.4046 24.1664 12.5775 23.4519 13.2964L13.2964 23.4519C12.582 24.1664 11.4092 24.1664 10.6902 23.4519L.5347 13.2964C-.1798 12.582-.1798 11.4092.5347 10.6902L10.6902.5347C11.4046-.1798 12.5775-.1798 13.2964.5347L23.4519 10.6902ZM10.9239 2.3771 9.9263 3.3747C9.3511 3.9498 9.3511 4.8935 9.9263 5.4731L10.9239 6.4707C11.499 7.0459 12.4427 7.0459 13.0224 6.4707L14.02 5.4731C14.5951 4.898 14.5951 3.9543 14.02 3.3747L13.0224 2.3771C12.4427 1.8019 11.499 1.8019 10.9239 2.3771ZM13.1616 4.0398C13.3728 4.2509 13.3728 4.5924 13.1616 4.8037L12.3528 5.6124C12.1416 5.8237 11.8001 5.8237 11.5889 5.6124L10.7801 4.8037C10.5688 4.5924 10.5688 4.2509 10.7801 4.0398L11.5889 3.2309C11.8001 3.0197 12.1416 3.0197 12.3528 3.2309L13.1616 4.0398ZM7.2167 6.0843 6.2191 7.0818C5.6439 7.657 5.6439 8.6006 6.2191 9.1803L7.0369 9.9981 7.2167 10.1779 8.749 11.7102C8.9602 11.9215 9.3016 11.9215 9.5084 11.7102 9.7196 11.499 9.7151 11.1576 9.5084 10.9508L8.9871 10.4206C9.1039 10.3532 9.2163 10.2723 9.3152 10.1734L10.3127 9.1758C10.8879 8.6006 10.8879 7.657 10.3127 7.0773L9.3152 6.0798C8.7354 5.5091 7.7919 5.5091 7.2167 6.0843ZM9.4545 7.7469C9.6656 7.9581 9.6656 8.2997 9.4545 8.5108L8.6456 9.3197C8.4344 9.5309 8.0929 9.5309 7.8817 9.3197L7.7964 9.2342 7.0728 8.5108C6.8617 8.2997 6.8617 7.9581 7.0728 7.7469L7.8817 6.938C8.0929 6.7269 8.4344 6.7269 8.6456 6.938L9.4545 7.7469ZM3.451 9.8499 2.4535 10.8475C1.8784 11.4227 1.8784 12.3663 2.4535 12.946L2.467 12.9594 2.9522 13.4448 4.179 14.667C4.3902 14.8782 4.7317 14.8782 4.9385 14.667 5.1496 14.4557 5.1451 14.1143 4.9385 13.9076L3.7116 12.6809 3.3073 12.2764C3.0961 12.0652 3.0961 11.7237 3.3073 11.5125L4.1161 10.7036C4.3273 10.4925 4.6688 10.4925 4.88 10.7036L5.2844 11.1081 6.5111 12.3348C6.7224 12.546 7.0639 12.546 7.2705 12.3348 7.4818 12.1237 7.4773 11.7821 7.2705 11.5754L6.0438 10.3487 5.5585 9.8634 5.545 9.8499C4.9699 9.2747 4.0262 9.2747 3.451 9.8499Z"},{name:"nrktv",path:"M21.6896 6.8901C21.5139 6.5927 21.5038 6.4097 21.6732 6.1225L24 2.3139H20.772C20.772 2.3139 18.8327 5.4829 18.5675 5.9232 18.3049 6.3628 18.3163 6.6368 18.5783 7.0885 18.8434 7.5399 20.772 10.6862 20.772 10.6862H24C24 10.6862 21.715 6.937 21.6896 6.8901M15.066 10.6862H18.0016V2.3139H15.066M13.2146 2.1535C12.2962 2.1535 11.5528 2.9039 11.5528 3.83 11.5528 4.7559 12.2962 5.5084 13.2146 5.5084 14.1345 5.5084 14.881 4.7559 14.881 3.83 14.881 2.9039 14.1345 2.1535 13.2146 2.1535M8.4165 10.6862H11.3505V2.3139H8.4165M0 10.6862H2.9285V2.3139H-.0414M6.6341 3.659C6.4838 2.8918 5.8128 2.3139 5.0084 2.3139H3.1222L5.0175 10.6862H8.2057ZM0 13.3139V14.2914H2.5989V21.6861H3.6779V14.2914H6.2793V13.3139M12.1731 13.3139 9.9187 20.4641 7.7101 13.3139H6.5931L9.2756 21.6861H10.5456L13.2595 13.3139 Z"},{name:"paramount",path:"M7.6519 3.4867 7.2368 3.0901 7.4931 2.5755 6.9777 2.8346 6.5777 2.4416 6.671 2.988 6.1597 3.2496 6.7367 3.3405 6.8285 3.9031 7.0833 3.3984ZM9.1307 2.3332 9.4803 1.8825 8.9266 2.0371 8.61 1.5778 8.595 2.1318 8.0415 2.2902 8.5896 2.4891 8.569 3.0602 8.9199 2.6118 9.461 2.8049ZM5.9611 4.3735 5.4774 4.0588 5.6269 3.5086 5.1745 3.8586 4.7045 3.548 4.9004 4.0688 4.4496 4.4163 5.0362 4.4015 5.2362 4.9358 5.3869 4.393ZM11.1977 2.0426 11.6265 1.6605 11.0523 1.7122 10.8345 1.2 10.707 1.7429 10.1357 1.7969 10.6344 2.0929 10.5029 2.6481 10.9344 2.2734 11.4278 2.5645ZM2.678 7.4355 3.2043 7.2059 2.633 7.0928 2.5602 6.5278 2.2739 7.0178 1.723 6.9012 2.1053 7.3114 1.819 7.8003 2.3561 7.5695 2.7426 7.9931ZM1.8391 9.3077 2.3132 8.9847 1.7283 8.9785 1.5474 8.4395 1.3624 8.975.7963 8.9615 1.2526 9.2931 1.0677 9.826 1.5474 9.5018 2.0145 9.8445ZM4.4963 5.6934 3.9591 5.4749 3.9975 4.9072 3.6206 5.336 3.1013 5.1173 3.3959 5.5914 3.0219 6.0164 3.5919 5.8924 3.892 6.3787 3.9344 5.821ZM1.2618 11.2663 1.6605 10.861 1.0891 10.9641.8042 10.4692.7288 11.0255.1697 11.1201.6809 11.362.6041 11.9199 1.0138 11.5095 1.5372 11.76ZM1.099 13.3023 1.4128 12.8294.87 13.0383.4961 12.6036.5263 13.1673 0 13.3637.5495 13.5036.5824 14.064.9043 13.586 1.4677 13.7362ZM1.1904 16.8054 1.4368 17.3153 1.0218 17.6924 1.5836 17.6222 1.8302 18.1283 1.9453 17.5683 2.5236 17.5006 2.018 17.2315 2.1261 16.6799 1.7054 17.0708ZM1.0876 15.0527.634 14.6951.7751 15.2441.2941 15.5353.8629 15.5711 1.0012 16.1148 1.2246 15.5856 1.8084 15.625 1.3629 15.27 1.5795 14.748ZM16.507 2.5754 17.0223 2.8346 17.4223 2.4416 17.3291 2.988 17.8404 3.2496 17.2633 3.3405 17.1715 3.9031 16.9167 3.3984 16.3481 3.4867 16.7632 3.0901ZM15.0734 2.0371 15.39 1.5778 15.4051 2.1318 15.9586 2.2902 15.4105 2.4891 15.4309 3.0602 15.0802 2.6118 14.5389 2.8049 14.8693 2.3332 14.5197 1.8825ZM18.3732 3.5086 18.8256 3.8586 19.2955 3.548 19.0996 4.0688 19.5505 4.4163 18.9638 4.4015 18.7638 4.9358 18.6131 4.393 18.0388 4.3735 18.5227 4.0588ZM12.9477 1.7121 13.1656 1.2 13.2931 1.7429 13.8645 1.7969 13.3658 2.0929 13.4972 2.6481 13.0657 2.2734 12.5724 2.5645 12.8024 2.0426 12.3737 1.6605ZM21.3671 7.0928 21.4398 6.5278 21.7261 7.0178 22.2768 6.9012 21.8948 7.3114 22.1811 7.8003 21.644 7.5695 21.2574 7.9931 21.3219 7.4355 20.7956 7.2059ZM22.2717 8.9785 22.4526 8.4395 22.6377 8.975 23.2037 8.9615 22.7474 9.2931 22.9323 9.826 22.4526 9.5018 21.9855 9.8445 22.1608 9.3077 21.6868 8.9847ZM20.0025 4.9073 20.3794 5.336 20.8987 5.1173 20.604 5.5914 20.9781 6.0164 20.4082 5.8924 20.108 6.3787 20.0655 5.821 19.5037 5.6934 20.0409 5.4749ZM22.9109 10.9641 23.1958 10.4692 23.2712 11.0255 23.8303 11.1201 23.3192 11.362 23.396 11.9199 22.9863 11.5095 22.4627 11.76 22.7382 11.2663 22.3395 10.861ZM23.1299 13.0383 23.5039 12.6036 23.4737 13.1673 24 13.3637 23.4506 13.5036 23.4176 14.064 23.0957 13.586 22.5324 13.7362 22.9011 13.3023 22.5873 12.8294ZM22.9782 17.6923 22.4164 17.6222 22.1698 18.1283 22.0547 17.5683 21.4765 17.5006 21.982 17.2315 21.8739 16.6799 22.2946 17.0708 22.8096 16.8054 22.5632 17.3153ZM23.2249 15.244 23.7059 15.5353 23.1371 15.5711 22.9988 16.1148 22.7753 15.5856 22.1916 15.625 22.637 15.27 22.4205 14.748 22.9125 15.0527 23.366 14.6952ZM5.0813 16.6138 5.0473 16.5614 6.0387 14.9258 6.6053 14.0437 7.248 13.368 6.5461 14.7817 6.1656 15.0785ZM8.138 15.2082 8.3748 14.8688 8.5947 14.8123 9.2655 13.5343 9.3444 12.703 9.711 11.8831 9.6828 11.7755 9.1133 12.4937 8.9723 12.5447 7.9407 14.1111 8.0872 14.2638 7.0217 16.6389 7.7377 15.8982ZM9.5418 15.4514 9.4347 15.2704 8.5213 16.9217 8.3071 17.8491H8.4846L9.0682 17.1535 9.305 16.0678ZM13.1276 8.2619 12.3946 7.5418V9.9132L11.7857 11.5757 12.6126 12.1036 11.2031 15.9 11.4737 16.1337 10.7407 17.7887 11.6579 18.7841H13.041L12.8042 18.1809 14.8941 18.95H17.2656L16.7658 18.0866 16.5064 17.4081 16.4049 16.8952 17.6377 18.426H19.1562L18.7089 17.5022 18.0249 16.8086 16.3035 13.0347 15.5368 12.8011 15.315 13.0498H15.1801L14.7953 12.0357 14.4106 11.3534 13.8792 10.4975ZM11.9381 3.5225C6.6995 3.5225 2.4529 7.7821 2.4529 13.0366 2.4529 14.4803 2.7734 15.8488 3.3472 17.0746L6.9689 12.907 7.2818 12.8053 8.6771 10.8374 9.2859 10.3115 10.1992 8.878 10.7489 8.3521 11.6368 7.1052 12.195 6.6811 13.2351 7.4275 13.7509 8.386 14.4106 10.3539 15.1802 11.7195 16.7952 12.4406 18.2582 15.4347 18.6134 16.6308 18.9601 16.8851 19.2645 17.2414 19.8297 18.3169C20.8363 16.8061 21.4233 14.9901 21.4233 13.0366 21.4233 7.7821 17.1767 3.5225 11.9381 3.5225ZM18.849 19.502H18.3886L18.2825 19.7472 18.1032 20.162H17.887L17.8228 20.3027H18.0444L17.7774 20.9087C17.5868 21.3348 17.2843 21.7549 17.1114 21.7549 17.0748 21.7549 17.052 21.7375 17.052 21.6986 17.052 21.6621 17.0619 21.6224 17.1069 21.5161 17.1616 21.3855 17.2498 21.2004 17.3155 21.0633 17.4108 20.8656 17.5645 20.5551 17.5645 20.4006 17.5645 20.2452 17.468 20.1269 17.2797 20.1269 17.067 20.1269 16.8762 20.2582 16.7 20.4453L16.8144 20.162H16.379L16.0247 20.9814C15.884 21.2726 15.594 21.7543 15.4146 21.7543 15.3773 21.7543 15.3616 21.7309 15.3616 21.6932 15.3616 21.6728 15.3715 21.6302 15.3874 21.5931 15.4034 21.5558 15.6151 21.0552 15.6151 21.0552L15.9985 20.1596H15.5321L15.1595 21.0307C15.0426 21.3004 14.7512 21.7562 14.5644 21.7562 14.5264 21.7562 14.5016 21.7366 14.5016 21.6886 14.5016 21.6407 14.5363 21.5553 14.5631 21.4913L14.7583 21.055 14.759 21.0552 15.1625 20.1597H14.696L14.605 20.3614H14.6046C14.5377 20.497 14.4195 20.6588 14.2372 20.6588 14.1485 20.6588 14.1082 20.623 14.0864 20.588 14.0592 20.2863 13.873 20.1254 13.5947 20.1254 13.2098 20.1254 12.9356 20.358 12.7555 20.638 12.6354 20.8252 12.5536 21.0283 12.4811 21.2622 12.316 21.5382 12.1416 21.7543 12.0064 21.7543 11.9718 21.7543 11.9504 21.7332 11.9504 21.6869 11.9504 21.6351 11.9952 21.5333 12.0125 21.4952L12.3145 20.8389C12.3986 20.6356 12.4572 20.5014 12.4572 20.3699 12.4572 20.2282 12.3603 20.127 12.2026 20.127 11.984 20.127 11.745 20.2544 11.5575 20.4678 11.5638 20.438 11.5669 20.4035 11.5669 20.3649 11.5669 20.2094 11.4919 20.1269 11.3304 20.1269 11.1301 20.1269 10.9245 20.2474 10.7362 20.4689L10.8611 20.162H10.4356L10.079 20.9814C9.9088 21.3675 9.6372 21.7543 9.4823 21.7543 9.4462 21.7543 9.4256 21.7354 9.4256 21.6883 9.4256 21.6125 9.5051 21.4312 9.5371 21.3565L10.0089 20.2633C10.0441 20.1817 9.8173 20.1312 9.5291 20.1312 9.2331 20.1312 8.9307 20.2814 8.7068 20.4698 8.5505 20.6013 8.4347 20.6684 8.3748 20.6684 8.3458 20.6684 8.3327 20.6521 8.3327 20.6331 8.3327 20.5657 8.4899 20.3779 8.4899 20.2354 8.4899 20.1705 8.4555 20.1269 8.3678 20.1269 8.1983 20.1269 7.9996 20.2928 7.8517 20.4641L7.9765 20.1618H7.5636L7.2078 20.9814C7.0375 21.3675 6.7583 21.771 6.6036 21.771 6.5676 21.771 6.5468 21.7519 6.5468 21.7049 6.5468 21.632 6.6231 21.4518 6.6662 21.3565L7.138 20.2633C7.1732 20.1817 6.9466 20.1312 6.6584 20.1312 6.233 20.1312 5.8184 20.4239 5.596 20.7236 5.3535 21.0497 5.1892 21.3945 5.1855 21.6758 5.1824 21.9013 5.2971 22.0435 5.5284 22.0435 5.7859 22.0435 5.9916 21.8349 6.1146 21.6791 6.1117 21.6954 6.1001 21.7528 6.1001 21.7724 6.1001 21.9297 6.1616 22.0435 6.3483 22.0435 6.5135 22.0435 6.7342 21.9024 6.9117 21.6777L6.7682 22.0106H7.2187L7.6601 20.99C7.8041 20.6578 7.9714 20.4855 8.0163 20.4855 8.0308 20.4855 8.0371 20.492 8.0371 20.5047 8.0371 20.5402 7.9696 20.6333 7.9696 20.7206 7.9696 20.8099 8.0172 20.8709 8.138 20.8709 8.2344 20.8709 8.3428 20.823 8.4382 20.7628 8.2116 21.0774 8.0597 21.406 8.0562 21.6759 8.0532 21.9012 8.1682 22.0436 8.3994 22.0436 8.6436 22.0436 8.8674 21.8102 8.9904 21.6543A.8034.8034 90 008.9815 21.7623C8.9815 21.9155 9.0664 22.0435 9.2398 22.0435 9.4301 22.0435 9.5873 21.9214 9.7785 21.6832L9.6372 22.0106H10.0986L10.5195 21.0351C10.7036 20.6105 10.9533 20.3868 11.0766 20.3868 11.1131 20.3868 11.1376 20.4068 11.1376 20.4503 11.1376 20.4765 11.1265 20.5247 11.0997 20.5885L10.4825 22.0106 10.9549 22.0094 11.386 21.0169C11.5714 20.5918 11.7765 20.3815 11.9288 20.3815 11.9749 20.3815 11.9946 20.4058 11.9946 20.4572 11.9946 20.4857 11.9858 20.5332 11.9501 20.613L11.5371 21.5121C11.5027 21.589 11.4691 21.6995 11.4691 21.7849 11.4691 21.9211 11.5432 22.0435 11.7491 22.0435 12.0169 22.0435 12.2229 21.8371 12.4527 21.5259L12.4538 21.5925C12.4709 21.8396 12.6074 22.053 12.9638 22.053 13.3861 22.053 13.7281 21.7543 13.9358 21.2823 14.029 21.0705 14.074 20.8898 14.0864 20.753 14.1258 20.7731 14.1751 20.7857 14.2372 20.7857 14.2955 20.7857 14.3644 20.7739 14.436 20.7363L14.3626 20.899C14.2781 21.0794 14.1839 21.2799 14.114 21.4471 14.0625 21.5704 14.0315 21.686 14.0315 21.7633 14.0315 21.9323 14.122 22.0514 14.3101 22.0514 14.4986 22.0514 14.7576 21.8708 14.9397 21.6177H14.9454C14.9349 21.6681 14.9246 21.7397 14.9246 21.7776 14.9246 21.9168 14.9664 22.0504 15.1589 22.0504 15.3819 22.0504 15.5539 21.8856 15.7233 21.68L15.5804 22.0106H16.0469L16.4186 21.1508C16.6291 20.6655 16.8415 20.3737 17.0382 20.3737 17.0802 20.3737 17.1019 20.4021 17.1019 20.4446 17.1019 20.5255 16.9887 20.7483 16.8816 20.974 16.7848 21.1774 16.713 21.3329 16.6626 21.4553 16.6182 21.5637 16.5817 21.6944 16.5817 21.7797 16.5817 21.9292 16.6632 22.0435 16.8424 22.0435 17.1108 22.0435 17.3857 21.7793 17.5296 21.5757 17.4966 21.6698 17.4758 21.7839 17.4758 21.8738 17.4758 22.1477 17.639 22.2853 17.8644 22.2853 18.0234 22.2853 18.1609 22.2289 18.2825 22.1428 18.4588 22.018 18.6007 21.8302 18.7211 21.6559L18.6418 21.578C18.5304 21.7383 18.4082 21.8922 18.2825 21.9869 18.2038 22.0465 18.1238 22.0828 18.0445 22.0828 17.9487 22.0828 17.8872 22.0325 17.8872 21.9048 17.8872 21.779 17.9439 21.6098 18.0322 21.3849 18.0369 21.3739 18.1623 21.0868 18.2825 20.8101 18.3844 20.5759 18.4826 20.3489 18.5015 20.3028H18.8041L18.8653 20.162H18.5642ZM5.7447 21.7561C5.6781 21.7561 5.6335 21.7334 5.6318 21.6452 5.6351 21.4124 5.8227 21.0031 6.0596 20.6754 6.2237 20.4484 6.4398 20.2808 6.67 20.2808L6.3768 20.9467C6.1596 21.4501 5.9204 21.7561 5.7448 21.7561ZM8.6157 21.7561C8.5491 21.7561 8.5042 21.7334 8.5027 21.6452 8.5059 21.4124 8.6935 21.0031 8.9304 20.6754 9.0944 20.4484 9.3105 20.2808 9.5407 20.2808L9.2475 20.9467H9.2482C9.0275 21.4574 8.7994 21.7561 8.6157 21.7561ZM13.2333 21.6984C13.1293 21.8473 13.0401 21.8903 12.9629 21.8903 12.8568 21.8903 12.8253 21.7998 12.8383 21.6673 12.8615 21.4348 13.0485 20.8979 13.3111 20.5263 13.4305 20.3571 13.513 20.2867 13.6021 20.2867 13.69 20.2867 13.7212 20.364 13.718 20.4608 13.7097 20.7129 13.4903 21.3297 13.2333 21.6984ZM4.5481 20.6415C4.7102 20.6225 4.9754 20.5695 5.0763 20.5329 5.6999 20.3591 6.4062 19.9418 6.4062 19.201 6.4062 18.3477 5.5018 17.9385 4.4239 17.9385 3.2736 17.9385 2.2186 18.4483 1.8272 19.236 1.7238 19.4445 1.6661 19.672 1.6661 19.9152 1.6661 20.1349 1.7196 20.3324 1.8272 20.4917 1.9932 20.7375 2.2891 20.8919 2.7261 20.8919 3.2589 20.8919 3.6835 20.5994 3.6835 20.0908 3.6835 20.0908 3.6913 19.9479 3.5254 19.9479 3.3892 19.9479 3.3542 20.0415 3.3574 20.0908 3.3768 20.4906 3.141 20.808 2.7176 20.808 2.2447 20.808 2.0459 20.4061 2.0459 19.9751 2.0459 19.0943 2.7106 18.5106 3.4021 18.2606 3.7566 18.1312 4.0418 18.0847 4.4137 18.0847 5.1959 18.0847 5.8357 18.3855 5.8357 19.1879 5.8357 19.8602 5.2714 20.4321 4.5929 20.4799L4.6197 20.3875C4.7588 19.8949 4.9265 19.3562 5.2033 18.9554 5.2196 18.9303 5.2485 18.8927 5.2801 18.8528L5.2422 18.8055C5.1928 18.834 5.1045 18.8984 5.0693 18.9259 3.7711 19.9368 3.7319 22.774 2.0033 22.774 1.9406 22.774 1.8821 22.7691 1.8272 22.7603 1.4665 22.7023 1.2778 22.4601 1.279 22.1235 1.2793 22.0574 1.3018 21.9662 1.3018 21.9144 1.3018 21.8271 1.2426 21.7366 1.1129 21.7366.9586 21.7366.8954 21.8565.8925 22.0333.8843 22.5389 1.2556 22.8313 1.8272 22.884 1.8896 22.8898 1.955 22.967 2.0217 22.8927 3.3701 22.8927 4.1989 21.8763 4.5481 20.6415M21.3734 19.2275 20.7897 20.4889H19.5284L19.1581 21.2891H20.4194L19.8357 22.5505H20.636L21.2197 21.2891H22.4811L22.8514 20.4888H21.59L22.1737 19.2275Z"},{name:"peacock",path:"M6 12.7V7c.699-3.725 5.849-3.806 6.5 0 .401 2.234-.975 3.582-2.511 4.094Zm0 9.6V14.25L7 15.3l5-1.95c1.763-.665 3.812-3.119 3.489-6.35C14.3-.5 4.299-.5 3 7V22.3M18 1.5a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Z"},{name:"primevideo",path:"M10.5404 24C8.6114 23.8847 6.7246 23.3486 4.9953 22.4245 4.0043 21.9206 3.1033 21.2346 2.3328 20.3973 1.7161 19.7304 1.4078 19.2945 1.3491 18.9899 1.3174 18.8334 1.3432 18.7144 1.4211 18.6499 1.5195 18.6415 1.6179 18.6332 1.7163 18.6249 1.8497 18.6796 2.0389 18.8139 2.3132 19.0424 3.9381 20.3973 6.1992 21.3794 8.7148 21.8153 11.8436 22.3549 15.0469 22.0922 18.0628 21.0485 18.6011 20.8542 18.9437 20.7019 19.4968 20.4131 19.859 20.2188 19.9715 20.1715 20.089 20.1663 20.2309 20.1505 20.2358 20.1558 20.3141 20.245 20.4267 20.3763 20.4218 20.5496 20.2994 20.7492 20.1869 20.933 19.9862 21.1483 19.6877 21.4057 18.1558 22.7291 15.6646 23.6797 12.9924 23.958 12.5127 24.0105 10.9613 24.0315 10.5404 24ZM20.5637 22.435C20.4071 22.2932 20.4365 22.1356 20.6861 21.6893 20.9996 21.1528 21.2309 20.5659 21.3713 19.9509 21.4251 19.5833 21.337 19.4625 20.9602 19.389 20.6078 19.326 19.7807 19.3733 19.257 19.4888 19.1591 19.5098 18.9878 19.5256 18.8752 19.5256 18.6795 19.5256 18.655 19.5256 18.606 19.4625 18.5678 19.4127 18.5425 19.3529 18.5326 19.2892 18.5228 19.1947 18.5326 19.1684 18.606 19.0792 19.2394 18.5242 20.0349 18.2266 20.8525 18.2389 21.6209 18.2389 22.2424 18.4385 22.448 18.7536 22.5214 18.8691 22.5263 18.8796 22.5361 19.263 22.541 19.5466 22.5361 19.7199 22.5018 19.8984 22.3886 20.516 22.146 21.0979 21.7922 21.6 21.5444 21.9179 21.258 22.1988 20.9406 22.435 20.7448 22.54 20.6714 22.54 20.5637 22.435ZM11.6139 7.4537C11.5755 7.4363 11.5447 7.4055 11.5274 7.3669 11.5101 7.3206 11.5043 6.3482 11.5043 4.7158 11.5043 2.5336 11.5043 2.1342 11.5389 2.0879 11.5735 2.0416 11.6139 2.0358 12.0692 2.0301 12.4035 2.0243 12.5879 2.0301 12.634 2.0532 12.709 2.0821 12.7205 2.1111 12.8069 2.5742L12.8703 2.8173C12.8819 2.8231 12.928 2.7536 12.9799 2.6552 13.1412 2.331 13.4064 2.0879 13.7291 1.9722 13.8502 1.9259 13.9424 1.9143 14.1787 1.9143 14.4957 1.9143 14.6225 1.9374 14.8876 2.0706 15.1187 2.2161 15.3123 2.4144 15.4525 2.6494 15.5101 2.7478 15.5562 2.8231 15.5678 2.8231 15.5735 2.8231 15.6196 2.771 15.6657 2.7073 15.8837 2.3676 16.2052 2.1077 16.5822 1.9664 16.884 1.8834 17.2025 1.8834 17.5044 1.9664 18.0346 2.1516 18.3459 2.5452 18.5418 3.2803 18.5879 3.4829 18.5937 3.5408 18.5994 5.422 18.611 7.1006 18.5994 7.3727 18.5706 7.419 18.536 7.4653 18.5015 7.4711 17.9482 7.4769 17.3833 7.4827 17.3545 7.4827 17.2911 7.4306L17.2219 7.3727 17.2104 5.6246C17.2046 3.8997 17.2046 3.8707 17.147 3.7029 17.0317 3.3556 16.8415 3.2051 16.5245 3.2051 16.2018 3.2051 15.9712 3.3787 15.8502 3.7203 15.7637 3.9634 15.7522 4.2759 15.7522 5.8446 15.7522 7.3438 15.7522 7.3785 15.6945 7.4306 15.6484 7.4769 15.6139 7.4827 15.0778 7.4827 14.5015 7.4827 14.4381 7.4711 14.3862 7.3785 14.3539 6.8196 14.3443 6.2596 14.3574 5.6999 14.3574 4.0791 14.3516 3.8823 14.2652 3.6161 14.1499 3.2456 13.6888 3.0835 13.3257 3.2861 13.0894 3.4135 12.9626 3.6797 12.9222 4.1486 12.9049 4.2817 12.8934 5.0632 12.8934 5.8851V7.3785L12.8358 7.4306C12.7781 7.4769 12.7493 7.4827 12.2248 7.4827 11.9193 7.4827 11.6484 7.4653 11.6139 7.4537ZM.3458 9.1671C.31 9.1565.2767 9.1388.2479 9.115.2018 9.0861.2018 8.8835.2018 5.613.2018 3.7087.2133 2.14.219 2.1227.2709 2.0474.3631 2.0301.8127 2.0301 1.0721 2.0301 1.2969 2.0416 1.3199 2.0474 1.3833 2.0706 1.4064 2.14 1.4755 2.4758 1.5101 2.6494 1.5505 2.7999 1.562 2.8115 1.5735 2.8231 1.6139 2.7652 1.6542 2.6841 1.7464 2.5105 2.0173 2.2211 2.196 2.1227 2.4922 1.9451 2.8403 1.8756 3.1816 1.9259 3.9655 2.0474 4.5072 2.7189 4.7493 3.8534 4.8069 4.1428 4.8242 5.1037 4.7724 5.4741 4.7135 6.0632 4.4852 6.6223 4.1153 7.0833 3.7868 7.4306 3.4813 7.5869 3.0605 7.6042 2.7551 7.6274 2.5533 7.5927 2.3228 7.4769 2.0818 7.3418 1.8778 7.1489 1.7291 6.9154 1.6984 6.8598 1.6596 6.809 1.6139 6.7649 1.6023 6.7649 1.5908 7.2685 1.5908 7.8879 1.5908 8.513 1.5793 9.0398 1.5678 9.0745 1.5274 9.1729 1.4237 9.1903.8876 9.1903.6167 9.1903.3689 9.1845.3458 9.1729ZM2.709 6.3771C2.8992 6.3192 3.0778 6.1224 3.1816 5.8793 3.2969 5.6015 3.343 5.3294 3.3603 4.8953 3.3891 4.1428 3.2162 3.5061 2.928 3.2572 2.8358 3.1761 2.5937 3.0835 2.4842 3.0835 1.9251 3.0835 1.562 3.726 1.562 4.7216 1.562 5.4336 1.7061 5.9372 1.977 6.215 2.1729 6.406 2.4438 6.4697 2.7147 6.3771ZM21.1528 7.5869C20.2331 7.3991 19.5127 6.6801 19.3199 5.7578 18.9914 4.4496 19.3487 3.072 20.196 2.3831 20.9772 1.733 22.1092 1.7354 22.8876 2.3889 23.2104 2.6783 23.4006 2.9446 23.5793 3.3845 23.7234 3.7434 23.781 4.056 23.7983 4.5538 23.8098 4.7853 23.8041 4.9995 23.7983 5.0342 23.7579 5.1905 23.8386 5.1789 22.196 5.1789 21.3718 5.1789 20.6917 5.1905 20.6801 5.2021 20.6513 5.2484 20.7493 5.7114 20.8242 5.914 20.928 6.1861 21.1239 6.3945 21.3257 6.4523 21.758 6.5739 22.1729 6.3771 22.3113 5.9777 22.4092 5.7056 22.4208 5.6883 22.5303 5.6767 22.611 5.6709 23.1989 5.7925 23.5562 5.8793 23.7061 5.9198 23.7234 5.9951 23.6254 6.2382 23.5216 6.516 23.3833 6.7418 23.1931 6.9444 22.7967 7.3835 22.2266 7.6232 21.6369 7.5984 21.4352 7.6042 21.2162 7.5984 21.147 7.5869ZM22.3631 4.1717C22.3631 3.9113 22.2018 3.4308 22.0461 3.2456 21.9213 3.114 21.7487 3.0388 21.5677 3.0372 21.2969 3.0372 21.0894 3.1646 20.9337 3.425 20.8415 3.5929 20.732 3.9171 20.7032 4.1197L20.6859 4.2528H22.3631ZM5.5505 7.4306 5.4813 7.3727V4.7448C5.4813 2.3253 5.4813 2.1053 5.5216 2.0764 5.5793 2.0301 6.4784 2.0069 6.5879 2.0532 6.6744 2.0879 6.7032 2.1516 6.7666 2.5047 6.7954 2.661 6.8242 2.7941 6.8415 2.8057 6.8473 2.8173 6.8992 2.7478 6.9453 2.6552 7.0605 2.441 7.3199 2.1632 7.4986 2.0764 7.8352 1.918 8.2159 1.8812 8.5764 1.9722 8.7896 2.0301 8.8761 2.1053 8.8761 2.2269 8.8761 2.3137 8.7032 3.0372 8.6283 3.2746 8.5706 3.4482 8.536 3.4656 8.2824 3.3672 8.0933 3.2813 7.8902 3.2303 7.683 3.2167 7.2969 3.2167 7.049 3.4193 6.9337 3.8534 6.8876 3.9865 6.8819 4.2007 6.8703 5.7057 6.8929 6.283 6.8775 6.8611 6.8242 7.4364 6.7954 7.4595 6.6398 7.4711 6.2017 7.4769 5.6369 7.4827 5.6138 7.4769 5.5504 7.4306ZM9.3545 7.4537C9.3233 7.4443 9.2966 7.4237 9.2796 7.3959 9.268 7.3669 9.2507 2.6552 9.2623 2.1748 9.2623 2.0416 9.343 2.0243 9.9885 2.0243 10.6283 2.0243 10.6398 2.0301 10.6513 2.1979V4.8258C10.6513 7.3438 10.6513 7.3785 10.5994 7.4306 10.5533 7.4769 10.5188 7.4827 9.977 7.4827 9.66 7.4827 9.3775 7.4711 9.3487 7.4537ZM9.7234 1.6191C9.4958 1.5469 9.3081 1.3835 9.2046 1.1676 9.1222.9415 9.1222.6933 9.2046.4672 9.2796.2993 9.4409.1373 9.6081.062 9.8353-.0202 10.084-.0202 10.3113.062 10.4957.1488 10.6801.3514 10.7435.5482 10.8012.745 10.7839 1.0229 10.6974 1.2139 10.6167 1.3875 10.4265 1.5496 10.2363 1.6075 10.098 1.648 9.8329 1.6538 9.7234 1.6191ZM9.7194 16.2724C9.0674 16.1565 8.5202 15.533 8.2989 14.6612 8.1484 13.9852 8.1405 13.2877 8.2757 12.6087 8.4561 11.8197 8.8578 11.2404 9.4109 10.9976 10.0703 10.6771 10.8789 10.8909 11.268 11.4887 11.3379 11.588 11.4077 11.6652 11.4194 11.6542 11.4369 11.6487 11.4485 11.2073 11.4485 10.5341 11.4485 9.4472 11.4485 9.4251 11.5009 9.3755 11.5533 9.3258 11.5766 9.3203 12.1587 9.3313 12.3731 9.3168 12.5885 9.3298 12.7991 9.3699 12.8574 9.4251 12.869 9.9327 12.8574 13.0115L12.8457 16.0682 12.7875 16.1234C12.7409 16.1786 12.7235 16.1786 12.2519 16.1786 12.0751 16.1836 11.8982 16.1781 11.7221 16.162 11.6523 16.1344 11.6057 16.0296 11.5475 15.7151 11.5317 15.612 11.5064 15.5105 11.4718 15.4116L11.3845 15.5551C11.268 15.7648 10.9595 16.0462 10.715 16.162 10.6102 16.2117 10.4588 16.2613 10.3831 16.2724 10.2143 16.3055 9.8941 16.3055 9.7194 16.2724ZM10.8605 15.1027C11.2855 14.9095 11.5067 14.2695 11.4601 13.3922 11.4194 12.6032 11.1691 12.1397 10.7324 12.0239 10.6333 11.9898 10.5254 11.986 10.4239 12.0128 9.9989 12.1011 9.766 12.4598 9.6787 13.1439 9.6257 13.5718 9.6533 14.0052 9.7602 14.424 9.8592 14.7771 10.0338 15.0089 10.2783 15.1192 10.4239 15.1854 10.7033 15.1744 10.8605 15.1027ZM20.6817 16.2613C19.9915 16.0852 19.4172 15.6316 19.1099 15.0199 18.9718 14.7334 18.8739 14.4311 18.8188 14.1205 18.6616 13.0722 18.976 12.057 19.6397 11.4556 19.932 11.1704 20.3102 10.9777 20.7225 10.9038 22.1896 10.6224 23.4587 11.759 23.5286 13.4308 23.5723 14.0903 23.3972 14.7463 23.0279 15.3068 22.7241 15.7386 22.2777 16.0627 21.7588 16.2282 21.405 16.3027 21.0398 16.3139 20.6817 16.2613ZM21.4677 15.1468C21.7064 15.0364 21.8868 14.7606 21.9858 14.3743 22.0324 14.1757 22.044 14.0709 22.044 13.5908 22.044 13.1439 22.0324 13.0005 21.9974 12.8515 21.8635 12.3163 21.6365 12.0349 21.2872 11.9632 20.8215 11.8749 20.4605 12.2004 20.3266 12.8184 20.1636 13.5633 20.2626 14.4902 20.5478 14.8985 20.6293 15.0144 20.8156 15.1578 20.9321 15.1965 21.0485 15.2296 21.3571 15.2075 21.4677 15.1468ZM15.5004 16.2613C15.2693 16.2249 15.0478 16.1462 14.8484 16.0296 14.1848 15.6345 13.7426 14.9786 13.6433 14.2419 13.5851 13.9164 13.5851 13.3095 13.6433 12.9894 13.7519 12.2614 14.1706 11.6073 14.8018 11.1797 15.154 10.9783 15.555 10.8662 15.9661 10.8542 16.1874 10.8542 16.5483 10.9204 16.7579 10.9976 17.3241 11.2351 17.7679 11.6755 17.9921 12.2225 18.1668 12.6142 18.2366 12.9784 18.2424 13.4915 18.2424 13.8391 18.2424 13.8833 18.1959 13.9329 18.1493 13.9881 18.1376 13.9881 16.6182 13.9881H15.0871V14.0709C15.0871 14.2198 15.1569 14.5178 15.2442 14.7054 15.3432 14.9316 15.4655 15.0751 15.6401 15.1578 15.8264 15.2516 16.1233 15.2516 16.3271 15.1689 16.4901 15.1026 16.6764 14.9151 16.7346 14.7661L16.8103 14.5619C16.8394 14.4737 16.8569 14.4626 16.9384 14.4571 17.0548 14.4461 17.9863 14.6392 18.0736 14.6888 18.1609 14.744 18.1376 14.8544 17.9921 15.1468 17.8477 15.4372 17.6345 15.6921 17.3692 15.8917 16.9617 16.1786 16.6356 16.2779 16.0593 16.2889 15.7973 16.2944 15.6168 16.2889 15.5004 16.2668ZM16.7754 13.0722C16.7987 13.0556 16.7987 13.017 16.7637 12.8349 16.6764 12.3991 16.4959 12.1066 16.2398 11.9963 15.8613 11.8308 15.4247 12.0515 15.2384 12.5039 15.1569 12.7246 15.0871 13.0391 15.122 13.0722 15.1569 13.1053 16.7171 13.1053 16.7754 13.0722ZM1.9707 16.1289C1.9183 16.0737 1.8951 16.0075 1.7379 15.4503 1.5252 14.7115 1.3078 13.974 1.0858 13.2377L.591 11.5494C.527 11.3342.4746 11.1411.4746 11.108.4746 10.9976.5444 10.9811 1.2023 10.9811 1.7553 10.9811 1.8252 10.9866 1.8776 11.0252 1.9242 11.0638 1.9649 11.2073 2.1396 11.9466L2.5005 13.4971C2.6344 14.0488 2.7916 14.733 2.7916 14.7661 2.7916 14.8488 2.8324 14.7661 2.8615 14.6281L3.2923 12.7798C3.6416 11.29 3.6882 11.0804 3.7347 11.0362 3.7697 11.0031 3.8628 10.9921 4.3926 10.9866 5.0563 10.9866 5.1319 10.9921 5.1494 11.0969 5.1552 11.1521 5.0679 11.4666 4.672 12.8074L4.1073 14.7275C4.02 15.042 3.9501 15.2682 3.7464 15.9413 3.7173 16.0351 3.6765 16.1234 3.6532 16.1455 3.6241 16.1786 3.5019 16.1841 2.8149 16.1841 2.0581 16.1841 2.0115 16.1841 1.9707 16.1344ZM6.0285 16.1289 5.9586 16.0737 5.9644 13.5743C5.9703 11.2183 5.9761 11.0749 6.0227 11.0362 6.0634 10.9976 6.1274 10.9921 6.6456 10.9811 7.1404 10.9811 7.2452 10.9811 7.3093 11.0142L7.3908 11.0528V13.5357C7.3908 15.3234 7.3791 16.0462 7.3617 16.0903 7.3432 16.1239 7.312 16.1495 7.2743 16.162 7.2452 16.1731 6.9658 16.1786 6.6572 16.1786 6.1333 16.1786 6.0925 16.1786 6.0285 16.1234ZM6.436 10.5838C6.2031 10.5286 5.9703 10.3245 5.9004 10.1093 5.8422 9.9603 5.8422 9.7231 5.9004 9.5575 5.9412 9.403 6.1275 9.1989 6.2846 9.1216 6.4418 9.0444 6.8435 9.0334 7.0124 9.0996 7.2045 9.1823 7.3267 9.2872 7.4199 9.4527 7.4839 9.5906 7.4956 9.6293 7.4956 9.8279 7.4956 10.0927 7.4432 10.2141 7.2918 10.3686 7.1346 10.5231 6.9716 10.5893 6.7271 10.6003 6.6107 10.6003 6.4826 10.6003 6.436 10.5838Z"},{name:"pia",path:"M 24 12 C 24 18.628906 18.628906 24 12 24 C 5.371094 24 0 18.628906 0 12 C 0 5.371094 5.371094 0 12 0 C 18.628906 0 24 5.371094 24 12 Z M 24 12 M 11.40625 8.695312 C 11.40625 8.332031 10.96875 8.152344 10.710938 8.40625 C 10.457031 8.664062 10.636719 9.101562 11 9.101562 C 11.222656 9.101562 11.40625 8.917969 11.402344 8.695312 M 13.003906 8.289062 C 12.640625 8.289062 12.457031 8.726562 12.714844 8.984375 C 12.972656 9.238281 13.40625 9.058594 13.40625 8.695312 C 13.40625 8.472656 13.226562 8.289062 13.003906 8.289062 M 12.566406 9.363281 C 12.242188 9.652344 11.757812 9.652344 11.4375 9.363281 C 11.332031 9.277344 11.199219 9.425781 11.292969 9.519531 C 11.691406 9.894531 12.3125 9.894531 12.707031 9.519531 C 12.75 9.480469 12.75 9.414062 12.710938 9.375 C 12.671875 9.332031 12.609375 9.328125 12.566406 9.363281 M 16.304688 10.933594 L 16.304688 10.929688 C 16.304688 10.550781 16.054688 10.21875 15.691406 10.117188 L 15.691406 9.390625 C 15.691406 7.414062 14.089844 5.8125 12.113281 5.8125 L 11.976562 5.8125 C 10 5.8125 8.394531 7.414062 8.394531 9.390625 L 8.394531 10.097656 C 7.996094 10.171875 7.707031 10.515625 7.703125 10.921875 C 7.59375 11.105469 7.535156 11.316406 7.535156 11.53125 L 7.535156 16.121094 C 7.535156 16.667969 7.902344 17.144531 8.429688 17.289062 C 8.570312 17.605469 8.886719 17.8125 9.234375 17.8125 L 10.238281 17.8125 C 10.570312 17.8125 10.875 17.625 11.027344 17.328125 L 12.871094 17.328125 C 13.019531 17.625 13.324219 17.8125 13.65625 17.8125 L 14.660156 17.8125 C 15 17.8125 15.308594 17.617188 15.457031 17.3125 C 16.039062 17.214844 16.464844 16.710938 16.464844 16.121094 L 16.464844 11.53125 C 16.464844 11.324219 16.410156 11.117188 16.304688 10.933594 Z M 13.113281 15.382812 C 13.136719 15.539062 13.089844 15.695312 12.988281 15.816406 C 12.886719 15.933594 12.738281 16.003906 12.578125 16.003906 L 11.421875 16.003906 C 11.265625 16.003906 11.113281 15.933594 11.011719 15.816406 C 10.910156 15.695312 10.863281 15.539062 10.886719 15.382812 L 11.109375 13.871094 C 10.691406 13.515625 10.527344 12.949219 10.6875 12.421875 C 10.847656 11.898438 11.300781 11.519531 11.84375 11.460938 C 12.445312 11.390625 13.019531 11.722656 13.261719 12.277344 C 13.5 12.832031 13.351562 13.480469 12.890625 13.871094 Z M 13.246094 10.324219 L 10.761719 10.324219 C 10.605469 10.167969 10.390625 10.082031 10.171875 10.082031 L 9.75 10.082031 L 9.75 9.332031 C 9.75 8.09375 10.753906 7.089844 11.992188 7.089844 L 12.101562 7.089844 C 13.339844 7.089844 14.339844 8.09375 14.339844 9.332031 L 14.339844 10.082031 L 13.835938 10.082031 C 13.613281 10.082031 13.402344 10.167969 13.246094 10.324219 Z M 12.730469 15.457031 C 12.742188 15.496094 12.734375 15.535156 12.707031 15.570312 C 12.683594 15.601562 12.644531 15.617188 12.605469 15.617188 L 11.402344 15.617188 C 11.363281 15.617188 11.324219 15.601562 11.300781 15.566406 C 11.273438 15.535156 11.265625 15.496094 11.277344 15.457031 L 11.507812 13.785156 C 11.507812 13.761719 11.503906 13.738281 11.496094 13.714844 C 11.476562 13.683594 11.453125 13.660156 11.421875 13.636719 C 11.417969 13.632812 11.417969 13.632812 11.414062 13.628906 C 11.070312 13.375 10.925781 12.933594 11.058594 12.527344 C 11.191406 12.121094 11.566406 11.84375 11.992188 11.839844 C 12.421875 11.839844 12.800781 12.109375 12.9375 12.515625 C 13.074219 12.917969 12.9375 13.367188 12.59375 13.621094 C 12.59375 13.625 12.59375 13.628906 12.582031 13.636719 C 12.550781 13.660156 12.527344 13.683594 12.507812 13.714844 C 12.503906 13.722656 12.5 13.734375 12.5 13.746094 Z M 12.730469 15.457031 Z"},{name:"rakutentv",path:"M6.886 1.2781V1.4302C6.6426 1.2781 6.4448 1.1868 6.1405 1.1868 5.2429 1.1868 4.5734 1.9931 4.5734 2.9973 4.5734 4.0015 5.258 4.8079 6.1405 4.8079 6.4296 4.8079 6.6426 4.7166 6.886 4.5644V4.7166H7.662V1.2781H6.886ZM6.1405 3.9863C5.6993 3.9863 5.3797 3.5603 5.3797 3.0125 5.3797 2.4648 5.6993 2.0388 6.1405 2.0388 6.5817 2.0388 6.886 2.4648 6.886 3.0125 6.9013 3.545 6.5817 3.9863 6.1405 3.9863ZM13.1545 1.2781V3.3016C13.1545 3.682 12.8958 4.0015 12.5155 4.0015 12.1351 4.0015 11.8764 3.682 11.8764 3.3016V1.2781H11.0853V3.3016C11.0853 4.1384 11.6483 4.8079 12.4851 4.8079 12.8654 4.8079 13.1545 4.5949 13.1545 4.5949V4.7166H13.9305V1.2781H13.1545ZM20.4576 4.7318V2.693C20.4576 2.3126 20.7163 1.9931 21.0966 1.9931 21.477 1.9931 21.7357 2.3126 21.7357 2.693V4.7166H22.5268V2.693C22.5268 1.8562 21.9638 1.1868 21.127 1.1868 20.7467 1.1868 20.4576 1.3998 20.4576 1.3998V1.2781H19.6816V4.7318H20.4576ZM2.3216 4.7318V3.3929H2.8998L3.9039 4.7318H4.9233L3.7061 3.119C4.0865 2.8452 4.3299 2.4039 4.3299 1.9018 4.3299 1.0803 3.6605.4108 2.8389.4108H1.5V4.7166H2.3216ZM2.3216 1.2324H2.8541C3.2192 1.2324 3.5235 1.5367 3.5235 1.9018 3.5235 2.267 3.2192 2.5713 2.8541 2.5713H2.3216V1.2324ZM16.0606 3.9102C15.9844 3.9559 15.9084 4.0015 15.8019 4.0015 15.6802 4.0015 15.4367 3.9102 15.4367 3.5755V2.0996H16.1061V1.2781H15.4367L15.4367.4108H14.6608L14.6608 1.2781H14.2499V2.0996H14.6608V3.5907C14.6608 4.3666 15.2389 4.8231 15.8323 4.8231 16.0453 4.8231 16.3496 4.747 16.593 4.61L16.0606 3.9102ZM9.6095 2.8908 10.9636 1.2781 9.8682 1.2781 8.9248 2.48 8.9248.137 8.1184.137 8.1184 4.7318 8.9248 4.7318 8.9248 3.3168 10.0812 4.7318 11.1766 4.7318M17.8711 1.1868C16.9582 1.1868 16.3191 1.9779 16.3191 2.9973 16.3191 4.0623 17.1408 4.8079 17.9472 4.8079 18.3579 4.8079 18.8905 4.6709 19.3317 4.0319L18.6471 3.6363C18.1145 4.4275 17.2168 4.0319 17.1104 3.2408L19.3622 3.2408C19.5599 2.0084 18.7535 1.1868 17.8711 1.1868ZM18.5558 2.5561H17.1408C17.3081 1.7497 18.4036 1.7041 18.5558 2.5561ZM5.8822 5.221 6.858 6.2007 18.1252 5.221 5.8822 5.221ZM10.0372 12.0377C9.9862 11.5775 9.9862 11.373 10.3439 11.1686 10.5996 11.0152 11.8776 10.2484 14.2803 9.5327 14.587 9.4305 14.8427 9.4816 14.9959 9.6861 15.1493 9.8905 15.2005 10.1973 15.0982 10.4529 14.8937 10.9641 14.8427 11.373 15.0471 11.5775 15.2516 11.7309 15.4561 11.782 16.0695 11.4753 16.8875 11.0664 17.8077 9.9928 17.7565 8.2547 17.7565 7.6412 17.5009 7.1812 17.092 6.8744 16.683 6.6188 16.1206 6.5165 15.5583 6.5165 14.0246 6.5165 13.2578 6.8744 11.2641 7.6412 8.4524 8.6637 4.9251 9.7883 2.9825 10.2995 2.1646 10.504 1.5 11.0664 1.5 11.8843 1.5 13.1623 3.0336 13.5202 4.1072 13.1623 4.3117 13.1112 6.5099 12.2932 7.2767 12.191 7.379 12.191 7.4301 12.2421 7.4301 12.2932 7.4301 12.3955 7.4812 13.5202 7.5322 13.9802 7.6346 16.0762 7.7879 20.1659 7.7879 20.4215 7.839 20.9839 7.839 22.6709 8.7592 22.6709 9.6283 22.6709 10.0372 21.7507 10.2417 20.4215M21.5906 8.6637C20.4149 8.6637 19.3413 10.8107 18.5233 12.7022 17.5009 15.1049 16.9386 17.252 16.6318 17.9677 16.3763 17.252 15.6605 15.2072 15.3027 14.4915 14.6893 13.2134 14.0758 12.2421 13.2578 12.2421 12.7978 12.2421 12.2866 12.4977 12.2866 13.3157 12.2866 13.878 12.5421 14.5937 12.7978 15.2583 12.9 15.4628 14.4336 19.2457 14.6382 19.9614 14.6382 19.9614 15.405 22.2619 15.4561 22.4664 15.9161 23.8466 16.3252 24 16.6318 24 17.092 24 17.7565 23.7955 18.0633 22.4152 18.2677 21.5462 18.5745 20.5237 18.8301 19.6547 19.2901 18.1722 20.4149 15.3094 21.1817 13.5713 21.7951 12.191 22.5108 10.5551 22.5108 9.5327 22.5108 9.1748 22.3063 8.6637 21.5906 8.6637Z"},{name:"rakutenviki",path:"M7.5496 3.24 7.5496 8.2824 8.47 8.2824 8.47 6.7261 9.7889 8.2824 11.0422 8.2824 9.2623 6.2699 10.7968 4.4964 9.5435 4.4964 8.47 5.8152 8.47 3.24 7.5496 3.24zM.0007 3.5526.0007 8.2824C0 8.2832.9349 8.2824.9349 8.2824L.9349 6.8167 1.5961 6.8167 2.7414 8.2824 3.9133 8.2824 2.529 6.5136C2.9602 6.216 3.2447 5.7319 3.2447 5.1839 3.2447 4.2838 2.4838 3.5526 1.5461 3.5526L.0007 3.5526zM14.9986 3.5526 14.9986 4.4948 14.5252 4.4948 14.5252 5.3933 14.9986 5.3933 14.9986 7.0278C14.9986 7.8734 15.6612 8.3778 16.3284 8.3778 16.5772 8.3778 16.9228 8.2987 17.2033 8.1385L16.6127 7.3872C16.5326 7.4393 16.4311 7.4795 16.3144 7.4795 16.168 7.4795 15.8924 7.3722 15.8924 7.0153L15.8924 5.395 16.658 5.395 16.658 4.4964 15.8924 4.4964 15.8924 3.5526 14.9986 3.5526zM18.6786 4.3994C17.6434 4.3994 16.902 5.2726 16.902 6.3886 16.902 7.5614 17.8339 8.3792 18.7675 8.3792 19.2396 8.3792 19.844 8.2238 20.3521 7.531L19.5614 7.0933C18.9509 7.9582 17.9335 7.5202 17.8158 6.6542L20.3911 6.6542C20.6105 5.2943 19.6972 4.3994 18.6786 4.3994zM5.3027 4.4026C4.2848 4.4026 3.5134 5.295 3.5134 6.3902 3.5134 7.4848 4.2857 8.3762 5.3027 8.3762 5.633 8.3762 5.8751 8.2793 6.1448 8.1138L6.1448 8.2824 7.0402 8.2824 7.0402 4.4948C7.0402 4.4964 6.1448 4.4964 6.1448 4.4964L6.1448 4.6651C5.8751 4.5004 5.6339 4.4026 5.3027 4.4026zM22.4006 4.4026C21.9607 4.4026 21.6413 4.6354 21.6413 4.6354L21.6413 4.4964 20.7458 4.4964 20.7458 8.2824C20.7458 8.2832 21.6413 8.2824 21.6413 8.2824L21.6413 6.0574C21.6413 5.6406 21.9396 5.2885 22.3741 5.2885 22.8078 5.2885 23.107 5.6406 23.107 6.0574L23.107 8.2824 24.0008 8.2824 24.0008 6.0574C24.0008 5.1445 23.3503 4.4026 22.4006 4.4026zM.9349 4.451 1.5444 4.451C1.9645 4.451 2.3086 4.7797 2.3086 5.1839 2.3086 5.5895 1.9645 5.9184 1.5444 5.9184L.9349 5.9184.9349 4.451zM10.9483 4.4964 10.9483 6.7214C10.9483 7.6345 11.5987 8.3778 12.5484 8.3778 12.9883 8.3778 13.3079 8.1433 13.3079 8.1433L13.3079 8.2841 14.2031 8.2841 14.2031 4.4964 13.3079 4.4964 13.3079 6.7214C13.3079 7.1384 13.0093 7.4921 12.575 7.4921 12.1414 7.4921 11.842 7.1384 11.842 6.7214L11.842 4.4964 10.9483 4.4964zM18.6596 5.2166C19.0172 5.2103 19.3727 5.4323 19.4599 5.9011L17.8488 5.9011C17.9428 5.458 18.3022 5.2231 18.6596 5.2166zM5.3027 5.3152C5.8042 5.3152 6.159 5.7901 6.159 6.3902 6.1582 6.9894 5.8042 7.4639 5.3027 7.4639 4.801 7.4639 4.4338 6.9901 4.4338 6.3902 4.4338 5.791 4.801 5.3152 5.3027 5.3152zM4.9933 9.3108 6.1559 10.478 19.5787 9.3108 4.9933 9.3108zM-.001 12.4141 3.2604 20.8412 5.262 20.8412 8.4857 12.4141 5.9543 12.4141 4.2604 17.9332 2.5432 12.4141-.001 12.4141zM9.2935 12.4141 9.2935 20.8412 11.703 20.8412 11.703 12.4141 9.2935 12.4141zM13.0687 12.4141 13.0687 20.8412 15.4783 20.8412 15.4783 18.4082 16.1441 17.7426 18.3176 20.8412 21.085 20.8412 17.677 16.1878 20.8631 12.4141 18.1458 12.4141 15.4783 15.619 15.4783 12.4141 13.0687 12.4141zM21.5912 12.4141 21.5912 20.8412 24.0008 20.8412 24.0008 12.4141 21.5912 12.4141z"},{name:"showtime",path:"M12 0C8.3317 0 5.0504 1.6476 2.8492 4.2412 3.1847 4.2547 3.4606 4.3319 3.4606 4.3319 6.2608 5.0435 6.2609 7.956 6.2609 8.8696L3.6522 8.8696C3.6522 8.8696 3.6522 6.7826 2.3478 6.7826 2.0551 6.7826 1.8376 6.892 1.6712 7.0282 1.5982 7.0882 1.4345 7.2822 1.3594 7.5754 1.2096 8.1639 1.2172 9.169 2.3478 10.1739 3.8337 11.4944 6.7826 12.7174 6.7826 15.8478 6.7826 18.277 5.0607 19.5718 3.5717 19.7894 3.5717 19.7894 3.3445 19.8327 2.9266 19.8536 5.1273 22.3934 8.376 24 12 24 15.6464 24 18.9094 22.3696 21.1101 19.8026 18.6485 19.558 16.6957 16.1635 16.6957 12 16.6957 7.8365 18.6485 4.442 21.1101 4.1974 18.9094 1.6304 15.6464 0 12 0zM7.8261 4.6957 10.4348 4.6957 10.4348 10.6957 13.0435 10.6957 13.0435 4.6957 15.6522 4.6957 15.6522 19.8261 13.0435 19.8261 13.0435 13.3043 10.4348 13.3043 10.4348 19.8261 7.8261 19.8261 7.8261 4.6957zM21.6522 6.7826A5.2174 2.3478 90 0019.3043 12 5.2174 2.3478 90 0021.6522 17.2174 5.2174 2.3478 90 0024 12 5.2174 2.3478 90 0021.6522 6.7826zM.0061 11.2174C.0061 11.2174-.0288 13.6831.373 14.8696.9693 16.6304 1.6394 17.2174 2.7575 17.2174 3.5771 17.2174 4.1739 16.6957 4.1739 15.587 4.1739 14.3463 2.6362 13.6105 1.5734 12.8071.5701 12.049.0061 11.2174.0061 11.2174z"},{name:"starplus",path:"m10.9 8.58l-.79 2.399H7.601l2.002 1.472s.989-.637 2.199-.879c-1.76 1.298-2.729 2.596-2.729 2.596l-.219.682l2.045-1.473l2.026 1.473l-.772-2.399l2.047-1.472h-2.53zm-8.14.748c-.902 0-1.563.593-1.563 1.385c0 .55.265.969.881 1.299l.703.351c.396.176.573.331.573.617c0 .309-.243.528-.573.528c-.352 0-.658-.199-.812-.639L1 13.156c.22.814.901 1.3 1.781 1.3c.946 0 1.674-.617 1.674-1.476c0-.682-.374-1.121-1.078-1.43l-.66-.33c-.33-.131-.442-.31-.442-.507c0-.242.2-.44.53-.44c.286 0 .506.156.66.53l.924-.418c-.264-.66-.793-1.057-1.63-1.057zm11.728.067v4.972h1.078v-1.98l1.342 1.98h1.233l-1.409-1.98c.682-.088 1.254-.705 1.254-1.453c0-.99-.66-1.54-1.76-1.54zm-9.75.007v.979h1.098v3.994h1.098v-3.994h1.08v-.979zm15.586.534v1.537H18.73v1.02h1.594v1.525h1.07v-1.526H23v-1.02h-1.605V9.937zm-4.758.404h.66c.419 0 .682.22.682.572c0 .396-.263.66-.681.66h-.66z"},{name:"stremio",path:"M12.6527.2686 12.6527.2686 23.7314 11.3473C23.9035 11.5209 24 11.7556 24 12 24 12.2445 23.9035 12.479 23.7314 12.6527L12.6527 23.7314C12.479 23.9035 12.2445 24 12 24 11.7556 24 11.5209 23.9035 11.3473 23.7314L.2686 12.6527C.0965 12.479 0 12.2445 0 12 0 11.7556.0965 11.5209.2686 11.3473L11.3473.2686C11.5209.0965 11.7556 0 12 0 12.2445 0 12.479.0965 12.6527.2686M16.1357 12.543C16.2199 12.4849 16.2888 12.4072 16.3363 12.3167 16.3838 12.2261 16.4087 12.1254 16.4087 12.0231 16.4087 11.9208 16.3838 11.8201 16.3363 11.7295 16.2888 11.6389 16.2199 11.5613 16.1357 11.5033L11.2549 8.0895C11.1597 8.0228 11.0482 7.9835 10.9322 7.9758 10.8163 7.9681 10.7005 7.9924 10.5974 8.046 10.4943 8.0997 10.4079 8.1806 10.3477 8.2799 10.2874 8.3792 10.2555 8.4932 10.2556 8.6094V15.4368C10.2555 15.553 10.2874 15.6669 10.3477 15.7663 10.4079 15.8657 10.4943 15.9465 10.5974 16.0001 10.7005 16.0538 10.8163 16.0781 10.9322 16.0704 11.0482 16.0627 11.1597 16.0234 11.2549 15.9567L16.1357 12.543Z"},{name:"surfshark",path:"M 24 12 C 24 18.628906 18.628906 24 12 24 C 5.371094 24 0 18.628906 0 12 C 0 5.371094 5.371094 0 12 0 C 18.628906 0 24 5.371094 24 12 Z M 24 12M 16.546875 8.351562 L 16.546875 8.34375 C 16.539062 8.242188 16.53125 8.125 16.527344 8 C 16.511719 7.765625 16.496094 7.515625 16.480469 7.320312 C 16.457031 7.1875 16.425781 7.070312 16.386719 6.960938 C 16.148438 6.429688 15.683594 6.175781 15.191406 6.054688 C 14.964844 6.015625 14.691406 6.007812 14.398438 6 L 11.570312 6 C 9.75 6.097656 8.984375 7.152344 8.78125 7.714844 C 7.984375 10.097656 7.484375 13.1875 7.128906 15.414062 C 7.121094 15.460938 7.113281 15.5 7.105469 15.542969 L 6.988281 16.601562 C 6.980469 16.769531 7 16.953125 7.042969 17.128906 C 7.265625 17.773438 7.941406 18.320312 9.425781 17.777344 C 10.832031 17.167969 12.488281 16.410156 14.199219 15.558594 C 15.175781 14.996094 16.605469 13.703125 16.679688 12.066406 C 16.667969 10.859375 16.628906 9.589844 16.546875 8.351562 Z M 14.289062 9.246094 C 14.289062 9.386719 14.175781 9.5 14.035156 9.5 C 13.183594 9.5 12.496094 10.191406 12.496094 11.039062 L 12.496094 11.980469 C 12.496094 13.5625 11.214844 14.84375 9.636719 14.84375 C 9.496094 14.84375 9.386719 14.730469 9.386719 14.59375 L 9.386719 13.8125 C 9.386719 13.671875 9.5 13.558594 9.640625 13.558594 C 10.492188 13.558594 11.179688 12.871094 11.179688 12.019531 L 11.179688 11.078125 C 11.179688 9.5 12.460938 8.21875 14.042969 8.21875 C 14.179688 8.21875 14.289062 8.328125 14.289062 8.464844 Z M 14.289062 9.246094 Z"},{name:"tv2play",path:"M 2.26,9.74 C 2.26,8.33 2.48,7.12 3.04,5.81 3.42,4.92 3.95,4.09 4.58,3.36 7.90,-0.52 13.66,-1.11 17.76,1.86 19.66,3.24 21.11,5.51 21.53,7.82 21.78,9.18 21.70,10.58 21.70,11.95 21.70,11.95 16.75,11.95 16.75,11.95 16.75,11.09 16.80,9.74 16.69,8.93 16.53,7.78 15.86,6.48 14.98,5.73 14.49,5.33 13.99,5.01 13.39,4.80 12.95,4.65 12.37,4.55 11.90,4.56 9.18,4.59 7.20,7.15 7.20,9.74 7.20,9.74 2.26,9.74 2.26,9.74 Z M 2.26,24.00 C 2.26,24.00 2.26,19.73 2.26,19.73 2.26,19.63 2.25,19.49 2.28,19.39 2.33,19.26 2.48,19.12 2.57,19.01 2.57,19.01 3.28,18.19 3.28,18.19 3.28,18.19 6.42,14.59 6.42,14.59 6.42,14.59 8.14,12.62 8.14,12.62 8.29,12.45 8.64,12.00 8.83,11.93 8.92,11.90 9.07,11.90 9.17,11.90 9.17,11.90 15.17,11.90 15.17,11.90 15.17,11.90 14.27,12.96 14.27,12.96 14.27,12.96 12.30,15.22 12.30,15.22 12.30,15.22 10.00,17.86 10.00,17.86 10.00,17.86 8.64,19.39 8.64,19.39 8.64,19.39 21.70,19.39 21.70,19.39 21.70,19.39 21.70,24.00 21.70,24.00 21.70,24.00 2.26,24.00 2.26,24.00 Z"},{name:"viaplay",path:"M1.2766 6.6383C.4742 8.2432 0 10.0669 0 11.9999 0 13.9331.4742 15.7568 1.2766 17.3617L11.9999 11.9999ZM11.9999 0C9.0456 0 6.3465 1.0577 4.231 2.845L16.7781 9.5927V14.4073L4.231 21.155C6.31 22.9422 9.0456 24 11.9999 24 18.6383 24 24 18.6383 24 11.9999 24 5.3617 18.6383 0 11.9999 0Z"},{name:"videoland",path:"M12 23.7692 24 3 17.0433 3 12 12.6586 6.9567 3 0 3ZM12 23.7692 Z"},{name:"vudu",path:"M 6.0971 6.9926 L 5.0469 6.9926 C 4.8725 6.9963 4.7129 7.1039 4.6535 7.2709 C 4.6535 7.282 4.6535 7.2895 4.6535 7.3006 C 4.2602 8.4324 3.915 9.4047 3.518 10.5365 C 3.4141 10.8371 3.3102 11.134 3.1914 11.4346 C 3.184 11.4605 3.1654 11.4828 3.1395 11.4939 C 3.0949 11.4939 3.0949 11.4605 3.0838 11.4309 C 2.8389 10.7221 2.5939 10.017 2.3416 9.3119 L 1.6217 7.2561 C 1.6254 7.2486 1.6254 7.2412 1.6217 7.2338 C 1.5475 7.0854 1.399 6.9926 1.2357 6.9926 L 0.1707 6.9926 C 0.0854 6.9852 0.0111 7.0482 0 7.1336 C -0.0037 7.1633 0.0037 7.193 0.0148 7.2189 C 0.6271 8.9297 1.2357 10.6404 1.8443 12.3475 L 1.9705 12.7 C 2.1486 13.2195 2.6348 13.5646 3.1803 13.5609 L 3.3213 13.5609 C 3.5551 13.5498 3.7889 13.5201 4.0227 13.4682 L 4.4531 12.2287 L 6.2566 7.2301 C 6.2641 7.2078 6.2678 7.1893 6.2752 7.1707 C 6.2863 7.0854 6.227 7.0037 6.1416 6.9926 C 6.1268 6.9926 6.1156 6.9926 6.1008 6.9926 M 11.9418 7.4416 C 11.9418 7.2152 11.7674 7.0297 11.5447 7.0111 L 10.4574 7.0111 L 10.4574 7.6123 C 10.4574 8.7441 10.4574 9.7498 10.4574 10.8854 C 10.4611 11.0004 10.45 11.1154 10.424 11.2268 C 10.3424 11.635 10.0455 11.9578 9.6484 12.0729 C 9.0436 12.2695 8.3904 11.9393 8.1937 11.3307 C 8.1566 11.2119 8.1381 11.0895 8.1381 10.967 C 8.1381 10.184 8.1381 8.5104 8.1381 7.6049 L 8.1381 7 C 8.1381 7 7.0545 7 7.0471 7 C 6.8244 7.0148 6.65 7.2041 6.65 7.4268 L 6.65 7.6457 C 6.65 8.8221 6.65 9.8314 6.65 11.0301 C 6.6574 12.4773 7.8301 13.6426 9.2699 13.6314 C 9.4406 13.6314 9.6076 13.6129 9.7746 13.5795 C 10.4203 13.4719 11.0029 13.1193 11.4037 12.5998 C 11.7451 12.1693 11.9344 11.6387 11.9418 11.0857 C 11.9418 10.4586 11.9418 9.8314 11.9418 9.2006 Z M 11.9418 7.4416 M 23.75 7.4416 C 23.75 7.2189 23.5793 7.0297 23.3566 7.0111 L 22.2656 7.0111 L 22.2656 7.6123 C 22.2656 8.7441 22.2656 9.7498 22.2656 10.8854 C 22.2656 11.0004 22.2545 11.1154 22.2285 11.2268 C 22.1506 11.6312 21.85 11.9578 21.4529 12.0729 C 20.8518 12.2732 20.2023 11.943 20.002 11.3381 C 19.9611 11.2193 19.9426 11.0932 19.9426 10.967 C 19.9426 10.184 19.9426 8.5104 19.9426 7.6049 L 19.9426 7 C 19.9426 7 18.8627 7 18.8479 7 C 18.6289 7.0186 18.4582 7.2041 18.4545 7.4268 L 18.4545 7.6457 C 18.4545 8.8221 18.4545 9.8314 18.4545 11.0301 C 18.4656 12.4773 19.6383 13.6426 21.0744 13.6314 C 21.2451 13.6314 21.4158 13.6129 21.5828 13.5795 C 22.2285 13.4719 22.8074 13.1193 23.2082 12.5998 C 23.5533 12.1693 23.7426 11.6387 23.7463 11.0857 C 23.7463 10.4586 23.7463 9.8314 23.7463 9.2006 L 23.7463 7.4416 Z M 23.75 7.4416 M 16.1352 11.5385 C 15.8457 11.8873 15.4338 12.1062 14.9885 12.1471 C 14.8994 12.1508 14.8104 12.1508 14.7213 12.1471 L 13.9531 12.1471 C 13.8604 12.1471 13.8566 12.1471 13.8566 12.0506 L 13.8566 8.4584 C 13.8566 8.373 13.8566 8.373 13.942 8.373 C 14.2686 8.373 14.5691 8.373 14.8809 8.373 C 15.4375 8.3916 15.9496 8.6811 16.2539 9.1486 C 16.4506 9.4381 16.5656 9.7795 16.5805 10.132 C 16.6213 10.6404 16.4617 11.1451 16.1352 11.5385 M 16.5693 7.4898 C 16.1018 7.1893 15.56 7.0223 15.0033 7.0074 C 14.7436 7.0074 14.4875 7.0074 14.224 7.0074 L 12.8473 7.0074 C 12.6098 7.0074 12.4205 7.2004 12.4205 7.4379 L 12.4205 13.1156 C 12.4205 13.3531 12.6098 13.5461 12.8473 13.5461 L 14.9143 13.5461 C 15.0701 13.5461 15.226 13.5313 15.3818 13.5016 C 16.0053 13.4088 16.5842 13.1305 17.0443 12.7037 C 17.9016 11.9541 18.2912 10.8 18.0686 9.6793 C 17.9127 8.7701 17.3672 7.976 16.5805 7.5047 M 19.0334 14.4293 C 18.4656 14.4553 18.024 14.9451 18.0463 15.5166 C 18.0686 16.0881 18.5473 16.5297 19.115 16.5074 C 19.6717 16.4852 20.1096 16.025 20.1021 15.4646 C 20.1133 14.9117 19.6791 14.4479 19.1262 14.4293 L 19.0334 14.4293 M 19.616 15.5092 C 19.6049 15.6354 19.5492 15.7578 19.4639 15.8506 L 19.4342 15.8803 C 19.1967 16.1029 18.8256 16.0918 18.6029 15.8543 C 18.3803 15.6205 18.3914 15.2457 18.6289 15.023 C 18.8627 14.8004 19.2338 14.8115 19.4564 15.049 C 19.4564 15.049 19.4564 15.049 19.4602 15.049 C 19.5529 15.1492 19.6086 15.2791 19.616 15.4164 Z M 19.616 15.5092 M 16.818 15.3199 L 16.818 15.7727 L 17.2633 15.7727 L 17.2633 15.9285 C 17.1557 16.0102 17.0295 16.051 16.8959 16.051 C 16.6027 16.0621 16.3541 15.832 16.343 15.5352 C 16.3393 15.5129 16.3393 15.4906 16.343 15.4721 C 16.3207 15.1752 16.5396 14.9154 16.8365 14.8932 L 16.8959 14.8932 C 17.0703 14.8969 17.2299 14.9934 17.3152 15.1455 L 17.7457 14.9229 C 17.575 14.6111 17.2484 14.4256 16.8959 14.4367 C 16.3281 14.4219 15.8568 14.8746 15.842 15.4424 C 15.8271 15.9953 16.2428 16.4629 16.792 16.5037 L 16.8959 16.5037 C 17.1965 16.5037 17.4859 16.3887 17.7012 16.1734 C 17.7346 16.14 17.7568 16.0881 17.7605 16.0361 L 17.7605 15.3199 Z M 16.818 15.3199 M 15.3187 14.485 L 15.2779 14.485 C 15.1666 14.4924 15.0812 14.5852 15.0775 14.6965 L 15.0775 15.5797 L 14.276 14.485 L 13.7416 14.485 L 13.7416 16.4777 L 14.2537 16.4777 L 14.2537 15.3311 L 15.0924 16.4777 L 15.5822 16.4777 L 15.5822 14.485 Z M 15.3187 14.485 M 12.8139 14.485 L 12.1607 14.485 L 11.4111 16.4814 L 11.9937 16.4814 L 12.0939 16.192 L 12.8732 16.192 L 12.9252 16.3404 C 12.9586 16.4221 13.0328 16.474 13.1182 16.4777 L 13.5561 16.4777 Z M 12.2387 15.743 L 12.491 14.9896 L 12.7396 15.743 Z M 12.2387 15.743 M 10.3943 14.485 L 9.5557 14.485 L 9.5557 16.2699 C 9.5631 16.385 9.6559 16.4777 9.7709 16.4814 L 10.3943 16.4814 C 10.9398 16.5111 11.4111 16.0918 11.4408 15.5389 C 11.4742 14.9896 11.0549 14.5184 10.5057 14.485 C 10.4686 14.485 10.4314 14.485 10.3943 14.485 M 10.3943 16.0361 L 10.0678 16.0361 L 10.0678 14.9229 L 10.3943 14.9229 C 10.6764 14.908 10.9139 15.1232 10.9324 15.4053 L 10.9324 15.4646 C 10.9324 15.7615 10.6912 16.0361 10.398 16.0361 C 10.3943 16.0361 10.398 16.0324 10.398 16.0324 L 10.4018 16.0287 M 8.9063 14.485 C 8.7949 14.4887 8.7021 14.5777 8.6984 14.6891 L 8.6984 15.5797 L 7.8783 14.485 L 7.3439 14.485 L 7.3439 16.4777 L 7.8523 16.4777 L 7.8523 15.3311 L 8.6947 16.4852 L 9.1883 16.4852 L 9.1883 14.485 Z M 8.9063 14.485 M 6.4311 14.485 L 5.7779 14.485 L 5.032 16.4777 L 5.6258 16.4777 L 5.726 16.1883 L 6.5127 16.1883 L 6.5646 16.3404 C 6.598 16.4184 6.6723 16.4703 6.7576 16.4777 L 7.1918 16.4777 Z M 5.8559 15.743 L 6.1119 14.9896 L 6.3605 15.743 Z M 5.8559 15.743 M 5.2213 14.908 L 5.2213 14.459 L 3.6961 14.459 L 3.6961 16.448 L 4.2342 16.448 L 4.2342 15.7578 L 4.7686 15.7578 C 4.865 15.7467 4.9355 15.6687 4.943 15.5723 L 4.943 15.3051 L 4.2416 15.3051 L 4.2416 14.908 Z M 5.2213 14.908 M 0.3971 15.3941 L 3.2471 15.3941 L 3.2471 15.55 L 0.3971 15.55 Z M 0.3971 15.3941 M 20.5549 15.3941 L 23.4049 15.3941 L 23.4049 15.55 L 20.5549 15.55 Z M 20.5549 15.3941 Z"},{name:"waiputv",path:"M 10.087,7.672 10.009,7.801 V 7.863 A 3.161,3.161 0 0 0 9.786,9.016 v 4.67 a 3.064,3.064 0 0 0 0.375,1.46 c 0.034,0.061 0.07,0.119 0.107,0.177 a 2.8,2.8 0 0 0 1.33,1.093 l 0.175,0.069 a 2.766,2.766 0 0 0 2.323,-0.247 l 3.841,-2.3 a 2.952,2.952 0 0 0 0.347,-0.242 2.827,2.827 0 0 0 0.772,-0.977 l 0.065,-0.136 v -0.017 a 3.126,3.126 0 0 0 0.236,-1.177 V 6.716 A 3.074,3.074 0 0 0 18.983,5.257 2.833,2.833 0 0 0 17.545,3.976 L 17.372,3.908 a 2.917,2.917 0 0 0 -0.888,-0.149 0.485,0.485 0 0 0 -0.093,0.006 2.865,2.865 0 0 0 -1.344,0.39 l -0.948,0.567 v 0 l -2.891,1.73 a 2.842,2.842 0 0 0 -1.121,1.22 z m 5.3,-2.953 a 2.2,2.2 0 0 1 1.1,-0.3 2.235,2.235 0 0 1 0.683,0.116 0.04,0.04 0 0 0 0.027,0.014 2.193,2.193 0 0 1 1.21,1.026 2.407,2.407 0 0 1 0.293,1.141 v 4.671 a 2.435,2.435 0 0 1 -0.223,1.012 0.054,0.054 0 0 0 -0.014,0.043 2.2,2.2 0 0 1 -0.863,0.939 l -3.842,2.3 a 2.115,2.115 0 0 1 -1.782,0.187 0.042,0.042 0 0 0 -0.027,-0.014 2.182,2.182 0 0 1 -1.21,-1.026 2.4,2.4 0 0 1 -0.293,-1.143 V 9.016 A 2.442,2.442 0 0 1 10.667,8 c 0,-0.015 0.014,-0.015 0.014,-0.043 A 2.2,2.2 0 0 1 11.544,7.018 Z M 9.565,14.933 A 3.05,3.05 0 0 1 9.19,13.473 V 8.8 A 3.119,3.119 0 0 1 9.413,7.652 V 7.593 L 9.491,7.464 A 2.846,2.846 0 0 1 10.61,6.245 L 13.5,4.516 A 2.5,2.5 0 0 0 12.434,3.659 C 12.364,3.629 12.292,3.602 12.219,3.578 A 0.038,0.038 0 0 1 12.188,3.562 H 12.17 A 2.573,2.573 0 0 0 11.392,3.433 2.653,2.653 0 0 0 10.11,3.77 L 5.635,6.322 A 2.486,2.486 0 0 0 4.629,7.365 v 0.016 c 0,0.015 -0.015,0.015 -0.015,0.031 A 2.609,2.609 0 0 0 4.353,8.536 v 5.189 a 2.547,2.547 0 0 0 0.347,1.269 2.518,2.518 0 0 0 1.411,1.14 0.047,0.047 0 0 1 0.031,0.016 h 0.016 a 2.535,2.535 0 0 0 0.777,0.128 2.641,2.641 0 0 0 1.282,-0.336 L 9.677,15.11 A 1.924,1.924 0 0 1 9.565,14.933 Z m 7.5,2.467 -0.047,-0.018 A 0.8,0.8 0 0 0 16.776,17.341 H 16.75 a 0.773,0.773 0 0 0 -0.366,0.106 l -0.258,0.155 v 0 l -0.788,0.471 a 0.785,0.785 0 0 0 -0.3,0.333 l -0.021,0.035 v 0.017 a 0.863,0.863 0 0 0 -0.061,0.313 v 1.272 a 0.833,0.833 0 0 0 0.1,0.4 c 0.01,0.017 0.019,0.033 0.03,0.049 a 0.757,0.757 0 0 0 0.361,0.3 l 0.047,0.019 a 0.8,0.8 0 0 0 0.242,0.04 0.783,0.783 0 0 0 0.392,-0.108 l 1.047,-0.626 a 0.664,0.664 0 0 0 0.094,-0.066 0.781,0.781 0 0 0 0.211,-0.266 l 0.017,-0.038 v -0.006 a 0.855,0.855 0 0 0 0.065,-0.32 v -1.274 a 0.847,0.847 0 0 0 -0.1,-0.4 0.779,0.779 0 0 0 -0.396,-0.347 z m 0.314,2.02 a 0.668,0.668 0 0 1 -0.061,0.275 v 0.012 a 0.6,0.6 0 0 1 -0.235,0.256 l -1.047,0.626 A 0.573,0.573 0 0 1 15.55,20.64 h -0.007 a 0.6,0.6 0 0 1 -0.33,-0.28 0.652,0.652 0 0 1 -0.08,-0.312 V 18.772 A 0.656,0.656 0 0 1 15.2,18.5 v -0.012 a 0.6,0.6 0 0 1 0.235,-0.256 l 1.047,-0.626 a 0.607,0.607 0 0 1 0.3,-0.083 0.621,0.621 0 0 1 0.186,0.032 h 0.007 a 0.6,0.6 0 0 1 0.33,0.279 0.667,0.667 0 0 1 0.08,0.312 z m -2.591,0.569 v -1.273 a 0.841,0.841 0 0 1 0.06,-0.313 v -0.017 l 0.022,-0.035 a 0.77,0.77 0 0 1 0.3,-0.332 l 0.788,-0.472 A 0.694,0.694 0 0 0 15.667,17.313 L 15.609,17.291 H 15.6 a 0.73,0.73 0 0 0 -0.212,-0.035 0.722,0.722 0 0 0 -0.349,0.092 l -1.221,0.7 a 0.67,0.67 0 0 0 -0.274,0.284 v 0 l -0.005,0.009 a 0.722,0.722 0 0 0 -0.071,0.306 v 1.414 a 0.691,0.691 0 0 0 0.478,0.657 h 0.009 a 0.664,0.664 0 0 0 0.212,0.035 0.724,0.724 0 0 0 0.349,-0.091 l 0.4,-0.227 c -0.01,-0.016 -0.02,-0.032 -0.029,-0.048 a 0.837,0.837 0 0 1 -0.098,-0.398 z m 4.768,-0.361 H 19.52 a 0.253,0.253 0 0 1 -0.173,-0.045 0.182,0.182 0 0 1 -0.05,-0.147 V 18.4 h 0.243 a 0.22,0.22 0 0 0 0,-0.44 H 19.3 v -0.284 a 0.24,0.24 0 0 0 -0.48,0 v 0 0.287 h -0.242 a 0.22,0.22 0 0 0 0,0.44 h 0.242 v 1.035 a 0.616,0.616 0 0 0 0.176,0.494 0.76,0.76 0 0 0 0.5,0.149 h 0.063 a 0.226,0.226 0 0 0 0,-0.451 z M 21.979,18.3 A 0.24911945,0.24911945 0 0 0 21.518,18.111 L 21.036,19.37 20.555,18.114 V 18.107 A 0.25,0.25 0 0 0 20.094,18.3 l 0.675,1.591 a 0.3,0.3 0 0 0 0.159,0.16 0.294,0.294 0 0 0 0.382,-0.159 l 0.673,-1.6 z M 18.1,19.58 a 0.25,0.25 0 0 0 0,0.5 v 0 a 0.25,0.25 0 0 0 0,-0.5 z M 6.9,17.959 A 0.238,0.238 0 0 0 6.662,18.196 V 18.31 A 0.744,0.744 0 0 0 5.99,17.957 v 0 a 1.06,1.06 0 0 0 0,2.118 0.744,0.744 0 0 0 0.672,-0.349 v 0.113 A 0.237,0.237 0 0 0 6.88,20.075 H 6.92 A 0.237,0.237 0 0 0 7.137,19.839 V 18.185 A 0.238,0.238 0 0 0 6.9,17.959 Z m -0.311,1.357 a 0.565,0.565 0 0 1 -0.531,0.32 0.6,0.6 0 0 1 -0.607,-0.593 v -0.014 0 a 0.6,0.6 0 0 1 0.577,-0.621 h 0.023 a 0.588,0.588 0 0 1 0.556,0.353 0.628,0.628 0 0 1 0.054,0.28 0.7,0.7 0 0 1 -0.074,0.275 z m -2.016,-1.36 a 0.254,0.254 0 0 0 -0.244,0.185 v 0 L 4,19.316 3.653,18.2 v 0 A 0.25,0.25 0 0 0 3.436,18.025 H 3.4 a 0.251,0.251 0 0 0 -0.225,0.188 v 0 L 2.833,19.313 2.5,18.134 v 0 a 0.25110356,0.25110356 0 1 0 -0.484,0.134 l 0.011,0.035 v 0.009 l 0.5,1.569 v 0 a 0.289,0.289 0 0 0 0.248,0.194 H 2.818 A 0.29,0.29 0 0 0 3.08,19.868 v 0 l 0.33,-1.052 0.333,1.045 v 0 a 0.29,0.29 0 0 0 0.253,0.21 h 0.042 a 0.29,0.29 0 0 0 0.26,-0.194 v 0 l 0.518,-1.6 v 0 A 0.3,0.3 0 0 0 4.826,18.21 0.254,0.254 0 0 0 4.571,17.956 Z m -2.321,0 z m 5.606,0.007 H 7.813 A 0.238,0.238 0 0 0 7.59,18.2 v 1.656 0 a 0.237,0.237 0 0 0 0.473,0 v 0 -1.66 A 0.237,0.237 0 0 0 7.856,17.961 Z M 7.828,17.1 a 0.248,0.248 0 1 0 0.247,0.249 v 0 A 0.248,0.248 0 0 0 7.828,17.1 Z m 1.863,0.855 v 0 a 0.83,0.83 0 0 0 -0.7,0.353 v -0.129 a 0.22305605,0.22305605 0 0 0 -0.446,-0.01 v 0 2.395 a 0.237,0.237 0 0 0 0.218,0.228 H 8.8 a 0.237,0.237 0 0 0 0.216,-0.236 v -0.809 a 0.772,0.772 0 0 0 0.679,0.328 1.062,1.062 0 0 0 0,-2.12 z m 0.518,1.061 A 0.6,0.6 0 0 1 9.624,19.631 H 9.6 A 0.6,0.6 0 0 1 9,19.031 V 19.016 A 0.636,0.636 0 0 1 9.17,18.576 0.6,0.6 0 0 1 9.6,18.4 v 0 a 0.6,0.6 0 0 1 0.611,0.589 v 0.026 z m 2.489,-1 v 0 a 0.232,0.232 0 0 0 -0.136,-0.058 h -0.044 a 0.238,0.238 0 0 0 -0.217,0.235 v 0.923 c 0,0.284 -0.116,0.509 -0.458,0.509 -0.342,0 -0.436,-0.229 -0.436,-0.523 V 18.185 A 0.239,0.239 0 0 0 11.19,17.955 H 11.147 A 0.238,0.238 0 0 0 10.93,18.19 v 1.031 a 0.746,0.746 0 0 0 0.636,0.844 0.673,0.673 0 0 0 0.142,0.006 0.641,0.641 0 0 0 0.621,-0.327 v 0.107 a 0.224,0.224 0 1 0 0.448,0 V 18.2 A 0.236,0.236 0 0 0 12.7,18.026 Z"},{name:"wow",path:"M2.0563 15.263C2.7042 15.263 3.0046 14.8968 3.2582 14.3896L4.4037 12.0985 4.9859 14.1925C5.2112 15 5.5117 15.263 6.0845 15.263S7.0234 15.0752 7.3427 14.2957L8.2065 12.1738C8.2535 14.1549 9.6807 15.4413 11.6244 15.4413S14.892 14.1738 15.1643 12.5587L15.4647 14.2489C15.5962 14.9531 15.9248 15.263 16.4882 15.263S17.3802 15.0375 17.6619 14.5212L18.9765 12.0985 19.4929 14.2676C19.6525 14.9248 19.9436 15.263 20.5258 15.263S21.3896 15.0282 21.6431 14.5305L23.8591 10.2112A1.2019 1.2019 90 0023.9999 9.6385C23.9999 9.1315 23.6056 8.737 23.0234 8.737S22.1596 9.0188 21.9342 9.5165L20.8826 11.7699 20.3192 9.554C20.1971 9.0564 19.9154 8.737 19.3615 8.737 19.0046 8.737 18.6478 8.8404 18.3192 9.4601L17.1173 11.7794 16.7042 9.5727C16.6103 8.9907 16.1971 8.737 15.7089 8.737A.9671.9671 90 0014.7042 9.7324 1.784 1.784 90 0014.7323 10.061L14.7699 10.2489C14.2723 9.3099 13.2488 8.5587 11.8497 8.5587 10.892 8.5587 9.8028 8.9248 9.1267 9.8169A1.8122 1.8122 90 009.1361 9.5915C9.1267 9.1032 8.8075 8.737 8.2253 8.737S7.3802 8.9907 7.1737 9.5165L6.2535 11.9296 5.6431 9.5727C5.5117 9.0846 5.2582 8.737 4.7042 8.737S3.8779 8.9154 3.5962 9.5352L2.5446 11.9483 2.0187 9.5727C1.8873 8.9907 1.4741 8.737.9765 8.737S-.0282 9.1409-.0001 9.7324A.9014.9014 90 00.0375 9.986L.9671 14.1174C1.1079 14.7184 1.3333 15.263 2.0563 15.263ZM10.1784 12.061C10.1784 11.1596 10.8544 10.446 11.6995 10.446S13.2206 11.0846 13.2206 12.0141 12.5915 13.554 11.6995 13.554 10.1784 12.8968 10.1784 12.061Z"}],u=[{type:"button",name:"power",tap_action:{action:"key",key:"POWER"},icon:"mdi:power"},{type:"button",name:"sleep",tap_action:{action:"key",key:"SLEEP"},icon:"mdi:power-sleep"},{type:"button",name:"resume",tap_action:{action:"key",key:"RESUME"},icon:"mdi:power-on"},{type:"button",name:"wakeup",tap_action:{action:"key",key:"RESUME"},icon:"mdi:power-on"},{type:"button",name:"suspend",tap_action:{action:"key",key:"SUSPEND"},icon:"mdi:power-off"},{type:"button",name:"home",tap_action:{action:"key",key:"HOME"},icon:"mdi:home"},{type:"button",name:"move_home",tap_action:{action:"key",key:"MOVE_HOME"},icon:"mdi:home-import-outline"},{type:"button",name:"back",tap_action:{action:"key",key:"BACK"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"MENU"},icon:"mdi:menu"},{type:"button",name:"settings",tap_action:{action:"key",key:"SETTINGS"},icon:"mdi:cog"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VOLUME_UP"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VOLUME_DOWN"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"MUTE"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"UP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"DOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"LEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"RIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"CENTER"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"CENTER"},up:{tap_action:{action:"key",key:"UP"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"DOWN"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"LEFT"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"RIGHT"},hold_action:{action:"repeat"}}},{type:"button",name:"fast_forward",tap_action:{action:"key",key:"FAST_FORWARD"},icon:"mdi:fast-forward"},{type:"button",name:"rewind",tap_action:{action:"key",key:"REWIND"},icon:"mdi:rewind"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:search-web"},{type:"button",name:"delete",tap_action:{action:"key",key:"input keyevent 67"},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"enter",tap_action:{action:"key",key:"ENTER"},icon:"mdi:magnify"},{type:"button",name:"red",tap_action:{action:"key",key:"RED"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"GREEN"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"YELLOW"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"BLUE"},icon:"mdi:alpha-b-box"},{type:"button",name:"component_1",tap_action:{action:"key",key:"COMPONENT1"},icon:"mdi:video-input-component"},{type:"button",name:"component_2",tap_action:{action:"key",key:"COMPONENT2"},icon:"mdi:video-input-component"},{type:"button",name:"composite_1",tap_action:{action:"key",key:"COMPOSITE1"},icon:"mdi:video-input-component"},{type:"button",name:"composite_2",tap_action:{action:"key",key:"COMPOSITE2"},icon:"mdi:video-input-component"},{type:"button",name:"hdmi_1",tap_action:{action:"key",key:"HDMI1"},icon:"mdi:video-input-hdmi"},{type:"button",name:"hdmi_2",tap_action:{action:"key",key:"HDMI2"},icon:"mdi:video-input-hdmi"},{type:"button",name:"hdmi_3",tap_action:{action:"key",key:"HDMI3"},icon:"mdi:video-input-hdmi"},{type:"button",name:"hdmi_4",tap_action:{action:"key",key:"HDMI4"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input",tap_action:{action:"key",key:"INPUT"},icon:"mdi:import"},{type:"button",name:"vga",tap_action:{action:"key",key:"VGA"},icon:"mdi:serial-port"},{type:"button",name:"end",tap_action:{action:"key",key:"END"},icon:"mdi:arrow-collapse-right"},{type:"button",name:"escape",tap_action:{action:"key",key:"ESCAPE"},icon:"mdi:exit-to-app"},{type:"button",name:"pairing",tap_action:{action:"key",key:"PAIRING"},icon:"mdi:bluetooth-audio"},{type:"button",name:"home",tap_action:{action:"key",key:"HOME"},icon:"mdi:home"},{type:"button",name:"sys_up",tap_action:{action:"key",key:"SYSUP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up-circle"},{type:"button",name:"sys_down",tap_action:{action:"key",key:"SYSDOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down-circle"},{type:"button",name:"sys_left",tap_action:{action:"key",key:"SYSLEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left-circle"},{type:"button",name:"sys_right",tap_action:{action:"key",key:"SYSRIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right-circle"},{type:"button",name:"text",tap_action:{action:"key",key:"TEXT"},icon:"mdi:text"},{type:"button",name:"top",tap_action:{action:"key",key:"TOP"},icon:"mdi:arrow-collapse-up"}],p=[{type:"button",name:"appletv",tap_action:{action:"source",source:"com.apple.atve.amazon.appletv"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"com.crunchyroll.crunchyroid"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"com.dazn"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"com.discovery.discoveryplus.firetv"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"com.disney.disneyplus"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"tv.emby.embyatv"},icon:"mdi:emby"},{type:"button",name:"f1tv",tap_action:{action:"source",source:"com.formulaone.production"},icon:"f1tv"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"com.foxsports.videogo"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"com.hulu.plus"},icon:"mdi:hulu"},{type:"button",name:"jellyfin",tap_action:{action:"source",source:"org.jellyfin.androidtv"},icon:"jellyfin"},{type:"button",name:"kodi",tap_action:{action:"source",source:"org.xbmc.kodi"},icon:"mdi:kodi"},{type:"button",name:"max",tap_action:{action:"source",source:"com.hbo.hbonow"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"com.bamnetworks.mobile.android.gameday.atbat"},icon:"mlbtv"},{type:"button",name:"netflix",tap_action:{action:"source",source:"com.netflix.ninja"},icon:"mdi:netflix"},{type:"button",name:"nrktv",tap_action:{action:"source",source:"no.nrk.tv"},icon:"nrktv"},{type:"button",name:"pandora",tap_action:{action:"source",source:"com.pandora.android.gtv"},icon:"mdi:pandora"},{type:"button",name:"paramount",tap_action:{action:"source",source:"com.cbs.ott"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"com.peacocktv.peacockfiretv"},icon:"peacock"},{type:"button",name:"pia",tap_action:{action:"source",source:"com.privateinternetaccess.android"},icon:"pia"},{type:"button",name:"plex",tap_action:{action:"source",source:"com.plexapp.android"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"com.amazon.firebat"},icon:"primevideo"},{type:"button",name:"skyshowtime",tap_action:{action:"source",source:"com.skyshowtime.skyshowtime.google"},icon:"showtime"},{type:"button",name:"spotify",tap_action:{action:"source",source:"com.spotify.tv.android"},icon:"mdi:spotify"},{type:"button",name:"steam",tap_action:{action:"source",source:"com.valvesoftware.steamlink"},icon:"mdi:steam"},{type:"button",name:"stremio",tap_action:{action:"source",source:"com.stremio.tv"},icon:"stremio"},{type:"button",name:"surfshark",tap_action:{action:"source",source:"com.surfshark.vpnclient.android"},icon:"surfshark"},{type:"button",name:"viaplay",tap_action:{action:"source",source:"com.viaplay.android"},icon:"viaplay"},{type:"button",name:"videoland",tap_action:{action:"source",source:"nl.rtl.videoland.v2.firetv"},icon:"videoland"},{type:"button",name:"vlc",tap_action:{action:"source",source:"org.videolan.vlc"},icon:"mdi:vlc"},{type:"button",name:"vudu",tap_action:{action:"source",source:"com.fandango.vudu.firetv"},icon:"vudu"},{type:"button",name:"waiputv",tap_action:{action:"source",source:"de.exaring.waipu.firetv.live"},icon:"waiputv"},{type:"button",name:"wow",tap_action:{action:"source",source:"de.sky.online"},icon:"wow"},{type:"button",name:"youtube",tap_action:{action:"source",source:"com.amazon.firetv.youtube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"com.amazon.firetv.tv"},icon:"mdi:youtube-tv"}],h=[{type:"button",name:"home",tap_action:{action:"key",key:"Input.Home"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"Input.Back"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"Input.ContextMenu"},icon:"mdi:menu"},{type:"button",name:"volume_up",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Application.SetVolume",volume:"increment"}},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Application.SetVolume",volume:"decrement"}},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Application.SetMute",mute:"toggle"}},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"Input.Up"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"Input.Down"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"Input.Left"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"Input.Right"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"Input.Select"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"Input.Select"},up:{tap_action:{action:"key",key:"Input.Up"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"Input.Down"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"Input.Left"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"Input.Right"},hold_action:{action:"repeat"}}},{type:"button",name:"play",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:1,play:!0}},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:1,play:!1}},icon:"mdi:pause"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:1}},icon:"mdi:play-pause"},{type:"button",name:"music_play_pause",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:0}},icon:"mdi:music"},{type:"button",name:"picture_play_pause",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:2}},icon:"mdi:image"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:kodi"},{type:"button",name:"info",tap_action:{action:"key",key:"Input.Info"},icon:"mdi:information"},{type:"button",name:"codec",tap_action:{action:"key",key:"Input.ShowCodec"},icon:"mdi:information-box"},{type:"button",name:"osd",tap_action:{action:"key",key:"Input.ShowOSD"},icon:"mdi:television-guide"},{type:"button",name:"process_info",tap_action:{action:"key",key:"Input.ShowPlayerProcessInfo"},icon:"mdi:information-variant-circle"}],d=[],m=[{type:"button",name:"power",tap_action:{action:"key",key:"power"},icon:"mdi:power"},{type:"button",name:"home",tap_action:{action:"key",key:"home"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"back"},icon:"mdi:keyboard-backspace"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"volume_up"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"volume_down"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"volume_mute"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"up"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"down"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"left"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"right"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"select"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"select"},up:{tap_action:{action:"key",key:"up"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"down"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"left"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"right"},hold_action:{action:"repeat"}}},{type:"button",name:"play",tap_action:{action:"key",key:"play"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"play"},icon:"mdi:pause"},{type:"button",name:"play_pause",tap_action:{action:"key",key:"play"},icon:"mdi:play-pause"},{type:"button",name:"forward",tap_action:{action:"key",key:"forward"},icon:"mdi:fast-forward"},{type:"button",name:"reverse",tap_action:{action:"key",key:"reverse"},icon:"mdi:rewind"},{type:"button",name:"replay",tap_action:{action:"key",key:"replay"},icon:"mdi:replay"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:search-web"},{type:"button",name:"delete",tap_action:{action:"key",key:"backspace"},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"enter",tap_action:{action:"key",key:"enter"},icon:"mdi:magnify"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"channel_up"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"channel_down"},icon:"mdi:arrow-down-circle"},{type:"button",name:"find_remote",tap_action:{action:"key",key:"find_remote"},icon:"mdi:remote-tv"},{type:"button",name:"info",tap_action:{action:"key",key:"info"},icon:"mdi:asterisk"},{type:"button",name:"input_av1",tap_action:{action:"key",key:"input_av1"},icon:"mdi:import"},{type:"button",name:"input_hdmi1",tap_action:{action:"key",key:"input_hdmi1"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input_hdmi2",tap_action:{action:"key",key:"input_hdmi2"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input_hdmi3",tap_action:{action:"key",key:"input_hdmi3"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input_hdmi4",tap_action:{action:"key",key:"input_hdmi4"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input_tuner",tap_action:{action:"key",key:"input_tuner"},icon:"mdi:video-input-antenna"},{type:"button",name:"literal",tap_action:{action:"key",key:"literal"},icon:"mdi:alphabetical"}],f=[{type:"button",name:"appletv",tap_action:{action:"source",source:"Apple TV"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"Crunchyroll"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"DAZN Live Sports Streaming"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"discovery+ | Stream TV Shows"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"Disney Plus"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"Emby"},icon:"mdi:emby"},{type:"button",name:"f1tv",tap_action:{action:"source",source:"F1 TV"},icon:"f1tv"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"FOX Sports"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"Hulu"},icon:"mdi:hulu"},{type:"button",name:"jellyfin",tap_action:{action:"source",source:"Jellyfin"},icon:"jellyfin"},{type:"button",name:"max",tap_action:{action:"source",source:"Max"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"MLB"},icon:"mlbtv"},{type:"button",name:"nba",tap_action:{action:"source",source:"NBA"},icon:"nba"},{type:"button",name:"netflix",tap_action:{action:"source",source:"Netflix"},icon:"mdi:netflix"},{type:"button",name:"pandora",tap_action:{action:"source",source:"Pandora"},icon:"mdi:pandora"},{type:"button",name:"paramount",tap_action:{action:"source",source:"Paramount Plus"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"Peacock TV"},icon:"peacock"},{type:"button",name:"plex",tap_action:{action:"source",source:"Plex - Free Movies & TV"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"Prime Video"},icon:"primevideo"},{type:"button",name:"spotify",tap_action:{action:"source",source:"Spotify"},icon:"mdi:spotify"},{type:"button",name:"vudu",tap_action:{action:"source",source:"Fandango at Home"},icon:"vudu"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"YouTube TV"},icon:"mdi:youtube-tv"}],y=[{type:"button",name:"power",tap_action:{action:"key",key:"KEY_POWER"},icon:"mdi:power"},{type:"button",name:"power_on",tap_action:{action:"key",key:"KEY_POWERON"},icon:"mdi:power-on"},{type:"button",name:"power_off",tap_action:{action:"key",key:"KEY_POWEROFF"},icon:"mdi:power-off"},{type:"button",name:"home",tap_action:{action:"key",key:"KEY_HOME"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"KEY_RETURN"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"KEY_MENU"},icon:"mdi:menu"},{type:"button",name:"top_menu",tap_action:{action:"key",key:"KEY_TOPMENU"},icon:"mdi:backburger"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"KEY_VOLUP"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"KEY_VOLDOWN"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"KEY_MUTE"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"KEY_UP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"KEY_DOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"KEY_LEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"KEY_RIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"KEY_ENTER"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"KEY_ENTER"},up:{tap_action:{action:"key",key:"KEY_UP"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"KEY_DOWN"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"KEY_LEFT"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"KEY_RIGHT"},hold_action:{action:"repeat"}}},{type:"button",name:"play",tap_action:{action:"key",key:"KEY_PLAY"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"KEY_PAUSE"},icon:"mdi:pause"},{type:"button",name:"rewind",tap_action:{action:"key",key:"KEY_REWIND"},icon:"mdi:rewind"},{type:"button",name:"fast_forward",tap_action:{action:"key",key:"KEY_FF"},icon:"mdi:fast-forward"},{type:"button",name:"stop",tap_action:{action:"key",key:"KEY_STOP"},icon:"mdi:stop"},{type:"button",name:"record",tap_action:{action:"key",key:"KEY_REC"},icon:"mdi:record"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"KEY_CHUP"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"KEY_CHDOWN"},icon:"mdi:arrow-down-circle"},{type:"button",name:"channel_previous",tap_action:{action:"key",key:"KEY_PRECH"},icon:"mdi:arrow-left-circle"},{type:"button",name:"channel_favorites",tap_action:{action:"key",key:"KEY_FAVCH"},icon:"mdi:star-circle"},{type:"button",name:"channel_list",tap_action:{action:"key",key:"KEY_CH_LIST"},icon:"mdi:list-box"},{type:"button",name:"red",tap_action:{action:"key",key:"KEY_RED"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"KEY_GREEN"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"KEY_YELLOW"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"KEY_CYAN"},icon:"mdi:alpha-b-box"},{type:"button",name:"n0",tap_action:{action:"key",key:"KEY_0"},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"key",key:"KEY_1"},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"key",key:"KEY_2"},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"key",key:"KEY_3"},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"key",key:"KEY_4"},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"key",key:"KEY_5"},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"key",key:"KEY_6"},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"key",key:"KEY_7"},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"key",key:"KEY_8"},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"key",key:"KEY_9"},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"info",tap_action:{action:"key",key:"KEY_INFO"},icon:"mdi:information"},{type:"button",name:"guide",tap_action:{action:"key",key:"KEY_GUIDE"},icon:"mdi:television-box"},{type:"button",name:"captions",tap_action:{action:"key",key:"KEY_CAPTION"},icon:"mdi:closed-caption"},{type:"button",name:"tools",tap_action:{action:"key",key:"KEY_TOOLS"},icon:"mdi:hammer-screwdriver"},{type:"button",name:"contents",tap_action:{action:"key",key:"KEY_CONTENTS"},icon:"mdi:table-of-contents"},{type:"button",name:"disc_menu",tap_action:{action:"key",key:"KEY_DISC_MENU"},icon:"mdi:dots-horizontal-circle"},{type:"button",name:"dvr_menu",tap_action:{action:"key",key:"KEY_DVR_MENU"},icon:"mdi:dots-vertical-circle"},{type:"button",name:"help",tap_action:{action:"key",key:"KEY_HELP"},icon:"mdi:help"},{type:"button",name:"live",tap_action:{action:"key",key:"KEY_LIVE"},icon:"mdi:debug-step-over"},{type:"button",name:"quick_replay",tap_action:{action:"key",key:"KEY_QUICK_REPLAY"},icon:"mdi:replay"},{type:"button",name:"still_picture",tap_action:{action:"key",key:"KEY_STILL_PICTURE"},icon:"mdi:image"},{type:"button",name:"instant_replay",tap_action:{action:"key",key:"KEY_INSTANT_REPLAY"},icon:"mdi:replay"},{type:"button",name:"source",tap_action:{action:"key",key:"KEY_SOURCE"},icon:"mdi:import"},{type:"button",name:"auto_program",tap_action:{action:"key",key:"KEY_AUTO_PROGRAM"},icon:"mdi:refresh-auto"},{type:"button",name:"channel_magic",tap_action:{action:"key",key:"KEY_MAGIC_CHANNEL"},icon:"mdi:auto-fix"},{type:"button",name:"component_1",tap_action:{action:"key",key:"KEY_COMPONENT1"},icon:"mdi:video-input-component"},{type:"button",name:"component_2",tap_action:{action:"key",key:"KEY_COMPONENT2"},icon:"mdi:video-input-component"},{type:"button",name:"av_1",tap_action:{action:"key",key:"KEY_AV1"},icon:"mdi:video-input-component"},{type:"button",name:"av_2",tap_action:{action:"key",key:"KEY_AV2"},icon:"mdi:video-input-component"},{type:"button",name:"av_2",tap_action:{action:"key",key:"KEY_AV2"},icon:"mdi:video-input-component"},{type:"button",name:"svideo_1",tap_action:{action:"key",key:"KEY_SVIDEO1"},icon:"mdi:video-input-svideo"},{type:"button",name:"svideo_2",tap_action:{action:"key",key:"KEY_SVIDEO2"},icon:"mdi:video-input-svideo"},{type:"button",name:"svideo_3",tap_action:{action:"key",key:"KEY_SVIDEO3"},icon:"mdi:video-input-svideo"},{type:"button",name:"hdmi",tap_action:{action:"key",key:"KEY_HDMI"},icon:"mdi:video-input-hdmi"},{type:"button",name:"fm_radio",tap_action:{action:"key",key:"KEY_FM_RADIO"},icon:"mdi:radio-fm"},{type:"button",name:"dvi",tap_action:{action:"key",key:"KEY_DVI"},icon:"mdi:serial-port"},{type:"button",name:"dvr",tap_action:{action:"key",key:"KEY_DVR"},icon:"mdi:record-rec"},{type:"button",name:"tv",tap_action:{action:"key",key:"KEY_TV"},icon:"mdi:television"},{type:"button",name:"antenna",tap_action:{action:"key",key:"KEY_ANTENA"},icon:"mdi:video-input-antenna"},{type:"button",name:"dtv",tap_action:{action:"key",key:"KEY_DTV"},icon:"mdi:alpha-d-box"},{type:"button",name:"ambient",tap_action:{action:"key",key:"KEY_AMBIENT"},icon:"mdi:television-ambient-light"},{type:"button",name:"3d",tap_action:{action:"key",key:"KEY_PANNEL_CHDOWN"},icon:"mdi:video-3d"},{type:"button",name:"anynet",tap_action:{action:"key",key:"KEY_ANYNET"},icon:"mdi:hdmi-port"},{type:"button",name:"energy_saving",tap_action:{action:"key",key:"KEY_ESAVING"},icon:"mdi:leaf"},{type:"button",name:"sleep_timer",tap_action:{action:"key",key:"KEY_SLEEP"},icon:"mdi:power-sleep"},{type:"button",name:"dtv_signal",tap_action:{action:"key",key:"KEY_DTV_SIGNAL"},icon:"mdi:alpha-d-circle"},{type:"button",name:"pip_toggle",tap_action:{action:"key",key:"KEY_PIP_ONOFF"},icon:"mdi:picture-in-picture-top-right"},{type:"button",name:"pip_swap",tap_action:{action:"key",key:"KEY_PIP_SWAP"},icon:"mdi:picture-in-picture-bottom-right-outline"},{type:"button",name:"pip_size",tap_action:{action:"key",key:"KEY_PIP_SIZE"},icon:"mdi:picture-in-picture-top-right-outline"},{type:"button",name:"pip_channel_up",tap_action:{action:"key",key:"KEY_PIP_CHUP"},icon:"mdi:arrow-up-circle-outline"},{type:"button",name:"pip_channel_down",tap_action:{action:"key",key:"KEY_PIP_CHDOWN"},icon:"mdi:arrow-down-circle-outline"},{type:"button",name:"pip_small",tap_action:{action:"key",key:"KEY_AUTO_ARC_PIP_SMALL"},icon:"mdi:image"},{type:"button",name:"pip_wide",tap_action:{action:"key",key:"KEY_AUTO_ARC_PIP_WIDE"},icon:"mdi:panorama"},{type:"button",name:"pip_bottom_right",tap_action:{action:"key",key:"KEY_AUTO_ARC_PIP_RIGHT_BOTTOM"},icon:"mdi:picture-in-picture-bottom-right"},{type:"button",name:"pip_scan",tap_action:{action:"key",key:"KEY_PIP_SCAN"},icon:"mdi:picture-in-picture-bottom-right-outline"},{type:"button",name:"vcr",tap_action:{action:"key",key:"KEY_VCR_MODE"},icon:"mdi:vhs"},{type:"button",name:"catv",tap_action:{action:"key",key:"KEY_CATV_MODE"},icon:"mdi:video-input-antenna"},{type:"button",name:"dss",tap_action:{action:"key",key:"KEY_DSS_MODE"},icon:"mdi:alpha-d-box"},{type:"button",name:"tv",tap_action:{action:"key",key:"KEY_TV_MODE"},icon:"mdi:television"},{type:"button",name:"dvd",tap_action:{action:"key",key:"KEY_DVD_MODE"},icon:"mdi:disc"},{type:"button",name:"stb",tap_action:{action:"key",key:"KEY_STB_MODE"},icon:"mdi:audio-video"},{type:"button",name:"pc",tap_action:{action:"key",key:"KEY_PCMODE"},icon:"mdi:desktop-tower"},{type:"button",name:"teletext_mix",tap_action:{action:"key",key:"KEY_TTX_MIX"},icon:"mdi:text"},{type:"button",name:"teletext_subface",tap_action:{action:"key",key:"KEY_"},icon:"mdi:text-box-outline"},{type:"button",name:"aspect_ratio",tap_action:{action:"key",key:"KEY_ASPECT"},icon:"mdi:aspect-ratio"},{type:"button",name:"picture_size",tap_action:{action:"key",key:"KEY_PICTURE_SIZE"},icon:"mdi:image-size-select-large"},{type:"button",name:"aspect_ratio_4_3",tap_action:{action:"key",key:"KEY_4_3"},icon:"mdi:image"},{type:"button",name:"aspect_ratio_16_9",tap_action:{action:"key",key:"KEY_16_9"},icon:"mdi:image-area"},{type:"button",name:"picture_mode",tap_action:{action:"key",key:"KEY_PMODE"},icon:"mdi:image-text"},{type:"button",name:"picture_mode_panorama",tap_action:{action:"key",key:"KEY_PANORAMA"},icon:"mdi:panorama-variant"},{type:"button",name:"picture_mode_dynamic",tap_action:{action:"key",key:"KEY_DYNAMIC"},icon:"mdi:image-auto-adjust"},{type:"button",name:"picture_mode_standard",tap_action:{action:"key",key:"KEY_STANDARD"},icon:"mdi:image"},{type:"button",name:"picture_mode_movie",tap_action:{action:"key",key:"KEY_MOVIE1"},icon:"mdi:movie"},{type:"button",name:"picture_mode_game",tap_action:{action:"key",key:"KEY_GAME"},icon:"mdi:controller"},{type:"button",name:"picture_mode_custom",tap_action:{action:"key",key:"KEY_CUSTOM"},icon:"mdi:image-plus"},{type:"button",name:"clock",tap_action:{action:"key",key:"KEY_CLOCK_DISPLAY"},icon:"mdi:clock"},{type:"button",name:"clock_timer_setup",tap_action:{action:"key",key:"KEY_SETUP_CLOCK_TIMER"},icon:"mdi:clock-alert"},{type:"button",name:"subtitle",tap_action:{action:"key",key:"KEY_SUB_TITLE"},icon:"mdi:subtitles"},{type:"button",name:"zoom_move",tap_action:{action:"key",key:"KEY_ZOOM_MOVE"},icon:"mdi:magnify-plus-cursor"},{type:"button",name:"zoom_in",tap_action:{action:"key",key:"KEY_ZOOM_IN"},icon:"mdi:magnify-plus"},{type:"button",name:"zoom_out",tap_action:{action:"key",key:"KEY_ZOOM_OUT"},icon:"mdi:magnify-minus"},{type:"button",name:"zoom_1",tap_action:{action:"key",key:"KEY_ZOOM1"},icon:"mdi:magnify-plus-outline"},{type:"button",name:"zoom_2",tap_action:{action:"key",key:"KEY_ZOOM2"},icon:"mdi:magnify-minus-outline"}],_=[{type:"button",name:"appletv",tap_action:{action:"source",source:"Apple TV"},icon:"appletv"},{type:"button",name:"dazn",tap_action:{action:"source",source:"DAZN"},icon:"dazn"},{type:"button",name:"disney",tap_action:{action:"source",source:"Disney+"},icon:"disney"},{type:"button",name:"hulu",tap_action:{action:"source",source:"Hulu"},icon:"mdi:hulu"},{type:"button",name:"netflix",tap_action:{action:"source",source:"Netflix"},icon:"mdi:netflix"},{type:"button",name:"max",tap_action:{action:"source",source:"Max"},icon:"max"},{type:"button",name:"paramount",tap_action:{action:"source",source:"Paramount+"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"Peacock TV"},icon:"peacock"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"Prime Video"},icon:"primevideo"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"YouTube TV"},icon:"mdi:youtube-tv"}],b=[{type:"button",name:"home",tap_action:{action:"key",key:"HOME"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"BACK"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"MENU"},icon:"mdi:menu"},{type:"button",name:"dash",tap_action:{action:"key",key:"DASH"},icon:"mdi:view-dashboard-variant"},{type:"button",name:"exit",tap_action:{action:"key",key:"EXIT"},icon:"mdi:exit-to-app"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VOLUMEUP"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VOLUMEDOWN"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"MUTE"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"UP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"DOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"LEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"RIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"ENTER"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"ENTER"},up:{tap_action:{action:"key",key:"UP"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"DOWN"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"LEFT"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"RIGHT"},hold_action:{action:"repeat"}}},{type:"button",name:"play",tap_action:{action:"key",key:"PLAY"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"PAUSE"},icon:"mdi:pause"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"CHANNELUP"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"CHANNELDOWN"},icon:"mdi:arrow-down-circle"},{type:"button",name:"red",tap_action:{action:"key",key:"RED"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"GREEN"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"YELLOW"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"BLUE"},icon:"mdi:alpha-b-box"},{type:"button",name:"n0",tap_action:{action:"key",key:"0"},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"key",key:"1"},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"key",key:"2"},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"key",key:"3"},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"key",key:"4"},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"key",key:"5"},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"key",key:"6"},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"key",key:"7"},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"key",key:"8"},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"key",key:"9"},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"asterisk",tap_action:{action:"key",key:"ASTERISK"},icon:"mdi:asterisk"},{type:"button",name:"info",tap_action:{action:"key",key:"INFO"},icon:"mdi:information"},{type:"button",name:"guide",tap_action:{action:"key",key:"GUIDE"},icon:"mdi:television-box"},{type:"button",name:"captions",tap_action:{action:"key",key:"CC"},icon:"mdi:closed-caption"}],v=[{type:"button",name:"disney",tap_action:{action:"source",source:"Disney+"},icon:"disney"},{type:"button",name:"netflix",tap_action:{action:"key",key:"NETFLIX"},icon:"mdi:netflix"},{type:"button",name:"primevideo",tap_action:{action:"key",key:"AMAZON"},icon:"primevideo"},{type:"button",name:"rakutentv",tap_action:{action:"source",source:"Rakuten TV"},icon:"rakutentv"},{type:"button",name:"waiputv",tap_action:{action:"source",source:"waipu.tv"},icon:"waiputv"},{type:"button",name:"wow",tap_action:{action:"source",source:"WOW"},icon:"wow"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"youtube"}]},626:(t,e,n)=>{"use strict";function i(t){let e=[];for(const n in t)if("object"==typeof t[n]){const o=i(t[n]);e=e.concat(o.map((t=>n+"."+t)))}else e.push(n);return e}function o(t,e){const n=e.split(".");if(null!=t)return 1==n.length?t[n[0]]:o(t[n[0]],n.splice(1).join("."))}function a(t,e,n){const i=e.split(".");return 1==i.length?t[i[0]]=n:(i[0]in t&&"object"==typeof t[i[0]]||(/^-?\d+$/.test(i[1])?t[i[0]]=new Array(parseInt(i[1])):t[i[0]]={}),a(t[i[0]],i.splice(1).join("."),n)),t}function r(t,...e){function n(t){return t&&"object"==typeof t&&!Array.isArray(t)}if(!e.length)return t;const i=e.shift();if(n(t)&&n(i))for(const e in i)n(i[e])?(t[e]||Object.assign(t,{[e]:{}}),r(t[e],i[e])):Object.assign(t,{[e]:i[e]});return r(t,...e)}n.d(e,{vz:()=>o,HD:()=>a,b$:()=>i,XO:()=>c,D9:()=>r});var s=n(792);function c(t){let e,n;switch(t){case"LG webOS":e=s.CI,n=s.Mo;break;case"Samsung TV":e=s.ks,n=s.Qz;break;case"Kodi":e=s.np,n=s.rl;break;case"Roku":e=s.j0,n=s.$S;break;case"Apple TV":e=s.qz,n=s._6;break;case"Fire TV":e=s.iu,n=s.ci;break;case"Sony BRAVIA":e=s.J7,n=s.hd;break;default:e=s.$i,n=s.tz}return[structuredClone(e),structuredClone(n)]}},1:(t,e,n)=>{"use strict";n.d(e,{mN:()=>x,AH:()=>c,W3:()=>w,Ec:()=>E});const i=globalThis,o=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),r=new WeakMap;class s{constructor(t,e,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&r.set(e,t))}return t}toString(){return this.cssText}}const c=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[i+1]),t[0]);return new s(n,t,a)},l=(t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),o=i.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=n.cssText,t.appendChild(e)}},u=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,a))(e)})(t):t,{is:p,defineProperty:h,getOwnPropertyDescriptor:d,getOwnPropertyNames:m,getOwnPropertySymbols:f,getPrototypeOf:y}=Object,_=globalThis,b=_.trustedTypes,v=b?b.emptyScript:"",g=_.reactiveElementPolyfillSupport,k=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},E=(t,e)=>!p(t,e),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:E};Symbol.metadata??=Symbol("metadata"),_.litPropertyMetadata??=new WeakMap;class x extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=C){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(t,n,e);void 0!==i&&h(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){const{get:i,set:o}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return i?.call(this)},set(e){const a=i?.call(this);o.call(this,e),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??C}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;const t=y(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){const t=this.properties,e=[...m(t),...f(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$ES(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$E_??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$E_?.delete(t)}_$ES(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return l(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$E_?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$E_?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$EO(t,e){const n=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,n);if(void 0!==i&&!0===n.reflect){const o=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(e,n.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const n=this.constructor,i=n._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=n.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=i,this[i]=o.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){if(n??=this.constructor.getPropertyOptions(t),!(n.hasChanged??E)(this[t],e))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,e,n){this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Em!==t&&(this._$ET??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t)!0!==n.wrapped||this._$AL.has(e)||void 0===this[e]||this.C(e,this[e],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$E_?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$Ej()}catch(e){throw t=!1,this._$Ej(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$E_?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ej(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$ET&&=this._$ET.forEach((t=>this._$EO(t,this[t]))),this._$Ej()}updated(t){}firstUpdated(t){}}x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[k("elementProperties")]=new Map,x[k("finalized")]=new Map,g?.({ReactiveElement:x}),(_.reactiveElementVersions??=[]).push("2.0.3")},703:(t,e,n)=>{"use strict";n.d(e,{o:()=>$n,X:()=>Nn});var i=n(894);function o(t,e){try{if(e){if(t.entities[e]){if(t.entities[e].area_id)return t.entities[e].area_id;e=t.entities[e].device_id??e}if(t.devices[e])return t.devices[e].area_id;for(const n in t.areas)if(t.areas[n].name==e)return n}return}catch{return}}function a(t,e){try{if(e){let n=e;if(t.entities[e]&&(n=t.entities[e].area_id??n,e=t.entities[e].device_id??e),t.devices[e]&&(n=t.devices[e].area_id??n),t.areas[n])return t.areas[n].name}return}catch{return}}function r(t,e){try{const n=[];if(e){const i=s(t,e);for(const e of i)for(const i in t.entities)t.entities[i].device_id==e&&n.push(i);n.sort()}return n}catch{return[]}}function s(t,e){try{const n=[];if(e){if(!(e in t.areas))for(const n in t.areas)if(t.areas[n].name==e){e=n;break}for(const i in t.devices)t.devices[i].area_id==e&&n.push(i);n.sort()}return n}catch{return[]}}function c(t,e){return!!Array.isArray(t)&&t?.includes(e)}function l(t,e,n,i){"object"!=typeof n||Array.isArray(n)||(i=n.with_unit??i,n=n.rounded??void 0);try{const o=t.states[e];let a=o?.state;if(i&&null==n&&(n=!0),n&&!isNaN(o?.state)){const n=t.entities[e]?.display_precision??0;a=Number(a).toPrecision(n)}return i&&o?.attributes?.unit_of_measurement&&(a=`${a} ${o?.attributes?.unit_of_measurement}`),a}catch{return}}function u(t,e,n){try{return t.states[e].attributes[n]}catch{return}}function p(t,e){try{const n=l(t,e);return!![!1,0,-0,""].includes(n)||Boolean(n)}catch{return!1}}function h(t){const e={};for(const n in t.states){const[i,o]=n.split(".");e[i]=e[i]??{},e[i][o]=t.states[n]}return e}function d(t,e){try{const n=[];if(e)for(const i in t.entities)t.entities[i].device_id==e&&n.push(i);return n}catch{return[]}}function m(t,e,n){try{return t.devices[e]?.[n]??u(t,e,n)}catch{return}}function f(t,e){try{if(e){if(t.entities[e])return t.entities[e].device_id;for(const n in t.devices){const i=t.devices[n];if(i.name==e||i.name_by_user==e)return n}}return}catch{return}}function y(t,e,n=!1){if(t[0]==e[0]&&t[1]==e[1])return 0;const i=1/298.257223563,o=6356752.314245,a=Math.atan((1-i)*Math.tan(t[0]*Math.PI/180)),r=Math.atan((1-i)*Math.tan(e[0]*Math.PI/180));let s=(e[1]-t[1])*Math.PI/180,c=s;const l=Math.sin(a),u=Math.cos(a),p=Math.sin(r),h=Math.cos(r);let d=0,m=0,f=0,y=0,_=0;for(let t=0;t<200;t++){const e=Math.sin(c),n=Math.cos(c);if(m=Math.sqrt((h*e)**2+(u*p-l*h*n)**2),0==m)return 0;y=l*p+u*h*n,_=Math.atan2(m,y);const o=u*h*e/m;d=1-o**2,f=0!=d?y-2*l*p/d:0;const a=i/16*d*(4+i*(4-3*d)),r=c;if(c=s+(1-a)*i*o*(_+a*m*(f+a*y*(2*f**2-1))),Math.abs(c-r)<1e-12)break;if(199==t)return null}const b=272331606109.84375*d/o**2,v=b/1024*(256+b*(b*(74-47*b)-128));let g=o*(1+b/16384*(4096+b*(b*(320-175*b)-768)))*(_-v*m*(f+v/4*(y*(2*f**2-1)-v/6*f*(4*m**2-3)*(4*f**2-3))))/1e3;return n&&(g*=.621371),g}function _(t,...e){function n(e){if(e.startsWith("zone."))return t.states[e].attributes.persons??[];let n=Object.keys(t.states).filter((t=>t==e||t.split(".")[0]==e));if("zone"==e){let e=[];for(const i of n)e.push(...t.states[i].attributes.persons??[]);n=Array.from(new Set(e))}return n}let i,o;if(1==e.length)i=[t.states["zone.home"].attributes.latitude,t.states["zone.home"].attributes.longitude],o=0;else if("number"==typeof e[0]){if("number"!=typeof e[1]||2==e.length)return null;i=[e[0],e[1]],o=2}else if("object"==typeof e[0]){if(Array.isArray(e[0])||!e[0].attributes)return null;i=[e[0].attributes.latitude,e[0].attributes.longitude],o=1}else{if("string"!=typeof e[0])return null;i=[t.states[e[0]].attributes.latitude,t.states[e[0]].attributes.longitude],o=1}let a=[];for(let t=o;te[t][n].entity_id));else for(const o of n)i.push(...Object.keys(e[t][o]).map((n=>e[t][o][n].entity_id)))}for(const t of i)a.push(...n(t))}else"string"==typeof e[t]&&a.push(...n(e[t]));a=Array.from(new Set(a));let r=null,s=1/0;for(const e of a){let n;n="string"==typeof e?t.states[e]:e;const o=n.attributes.latitude,a=n.attributes.longitude;if(null!=o&&null!=a){const t=y(i,[o,a])??1/0;t<=s&&(r=n,s=t)}}return r}function b(t,e){try{let n=e;if(t.entities[e]&&(n=t.entities[e].area_id??n,e=t.entities[e].device_id??e),e){if(t.devices[e]&&(n=t.devices[e].area_id??n),t.areas[n])return t.areas[n].floor_id;for(const n in t.areas)if(t.areas[n].name==e)return t.areas[n].floor_id}return}catch{return}}function v(t,e){if(t.floors[e])return t.floors[e].name;const n=b(t,e);return n?t.floors[n].name:void 0}function g(t,e){try{const n=[];if(e){let i;if(t.floors[e])i=e;else for(const n in t.floors)if(t.floors[n].name==e){i=n;break}if(!i)return[];for(const e in t.areas)t.areas[e].floor_id==i&&n.push(e)}return n}catch{return[]}}function k(t,...e){const n=[];for(let i of e.flat(1/0))if("string"==typeof i&&(i=t.states[i]),i)if(Array.isArray(i.attributes?.entity_id))n.push(...k(t,...i.attributes?.entity_id));else if(i?.attributes?.persons)n.push(...k(t,...i.attributes.persons));else if(i.entity_id)n.push(i);else{const e=Object.values(i);if(e[0]?.entity_id)n.push(...e);else for(const i of e){const e=Object.values(i);for(const i of e)i?.attributes?.persons?n.push(...k(t,...i.attributes.persons)):n.push(i)}}return n.filter(((t,e,n)=>e==n.findIndex((e=>e.entity_id==t.entity_id)))).sort(((t,e)=>t.entity_id.localeCompare(e.entity_id)))}function w(t,e,n,i,o){if("object"!=typeof n||Array.isArray(n)||(o=n.if_none??o,i=n.if_false??i,n=n.if_true??void 0),o){const n=Nn(t,e);if([void 0,null,"undefined","null","None"].includes(n))return o}return Nn(t,`\n\t\t{% if ${e} %}\n\t\t${n??!0}\n\t\t{% else %}\n\t\t${i??!1}\n\t\t{% endif %}\n\t`)}const E={};function C(t,e){try{return e?t.entities[e]?.labels??t.devices[e]?.labels??t.areas[e]?.labels??[]:Object.keys(E)}catch{return[]}}function x(t){for(const e in E)if(E[e].name==t)return e}function L(t){return E[t]?.name}function T(t,e){try{const n=[];let i;if(e){if(i=E[e]?e:x(e),!i)return[];for(const e in t.areas)(t.areas[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function A(t,e){try{const n=[];if(e){let i;if(i=E[e]?e:x(e),!i)return[];for(const e in t.devices)(t.devices[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function S(t,e){try{const n=[];if(e){let i;if(i=E[e]?e:x(e),!i)return[];for(const e in t.entities)(t.entities[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function O(t){return t.toString()}function M(t){if(t.toString().includes("NaN"))throw Error("Result returned NaN.")}function $(t){return t!=1/0&&!isNaN(t)}function I(t,e){if("number"==typeof t)return 0!=t;if("boolean"==typeof t)return t;if(t=t.toLowerCase(),["true","yes","on","enable","1"].includes(t))return!0;if(["false","no","off","disable","0"].includes(t))return!1;if(e)return e;throw Error("Invalid input")}function N(t,e=Math.E,n){try{const n=Math.log(t)/Math.log(e);return M(n.toString()),n}catch(t){if(n)return n;throw t}}function D(t,e){try{const e=Math.sin(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function P(t,e){try{const e=Math.cos(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function R(t,e){try{const e=Math.tan(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function F(t,e){try{const e=Math.asin(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function j(t,e){try{const e=Math.acos(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function U(t,e){try{const e=Math.atan(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function K(t,e,n){try{const n=Math.atan2(t,e);return M(n.toString()),n}catch(t){if(n)return n;throw t}}function V(t,e){try{const e=Math.sqrt(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function B(...t){return Math.max(...t.flat(1/0))}function H(...t){return Math.min(...t.flat(1/0))}function Y(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");return t.reduce(((t,e)=>t+e))/t.length}catch(t){if(e)return e;throw t}}function Z(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");if(!t.length)throw Error("Empty array provided");t=t.sort(((t,e)=>t-e));const e=Math.floor(t.length/2);return t.length%2?t[e]:(t[e-1]+t[e])/2}catch(t){if(e)return e;throw t}}function z(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");if(!t.length)throw Error("Empty array provided");const e={};for(const n of t)e[n]||(e[n]=0),e[n]++;let n=t[0],i=0;for(const t in e)e[t]>i&&(n=Number(t),i=e[t]);return n}catch(t){if(e)return e;throw t}}const q=Math.E,W=Math.PI,G=2*Math.PI;function X(t,e,n){try{return t.formatEntityState(t.states[e],n)}catch{return n??t.states[e]?.state??void 0}}function J(t,e,n){try{return t.formatEntityAttributeName(t.states[e],n)}catch{return n??t.states[e]?.attributes?.[n]??void 0}}function Q(t,e,n,i){try{return t.formatEntityAttributeValue(t.states[e],n,i)}catch{return i??t.states[e]?.attributes?.[n]??void 0}}const tt=new Date,et=new Date;function nt(t,e,n,i){function o(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return o.floor=e=>(t(e=new Date(+e)),e),o.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),o.round=t=>{const e=o(t),n=o.ceil(t);return t-e(e(t=new Date(+t),null==n?1:Math.floor(n)),t),o.range=(n,i,a)=>{const r=[];if(n=o.ceil(n),a=null==a?1:Math.floor(a),!(n0))return r;let s;do{r.push(s=new Date(+n)),e(n,a),t(n)}while(snt((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,i)=>{if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););})),n&&(o.count=(e,i)=>(tt.setTime(+e),et.setTime(+i),t(tt),t(et),Math.floor(n(tt,et))),o.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?o.filter(i?e=>i(e)%t==0:e=>o.count(0,e)%t==0):o:null)),o}const it=864e5,ot=6048e5;function at(t){return nt((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ot))}const rt=at(0),st=at(1),ct=at(2),lt=at(3),ut=at(4),pt=at(5),ht=at(6);function dt(t){return nt((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/ot))}rt.range,st.range,ct.range,lt.range,ut.range,pt.range,ht.range;const mt=dt(0),ft=dt(1),yt=dt(2),_t=dt(3),bt=dt(4),vt=dt(5),gt=dt(6),kt=(mt.range,ft.range,yt.range,_t.range,bt.range,vt.range,gt.range,nt((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/it),(t=>t.getDate()-1))),wt=(kt.range,nt((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/it),(t=>t.getUTCDate()-1))),Et=(wt.range,nt((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/it),(t=>Math.floor(t/it)))),Ct=(Et.range,nt((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear())));Ct.every=t=>isFinite(t=Math.floor(t))&&t>0?nt((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,Ct.range;const xt=nt((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Lt(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Tt(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function At(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}xt.every=t=>isFinite(t=Math.floor(t))&&t>0?nt((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,xt.range;var St,Ot,Mt,$t,It,Nt={"-":"",_:" ",0:"0"},Dt=/^\s*\d+/,Pt=/^%/,Rt=/[\\^$*+?|[\]().{}]/g;function Ft(t,e,n){var i=t<0?"-":"",o=(i?-t:t)+"",a=o.length;return i+(a[t.toLowerCase(),e])))}function Vt(t,e,n){var i=Dt.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function Bt(t,e,n){var i=Dt.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function Ht(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function Yt(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function Zt(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function zt(t,e,n){var i=Dt.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function qt(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Wt(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function Gt(t,e,n){var i=Dt.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function Xt(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Jt(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function Qt(t,e,n){var i=Dt.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function te(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function ee(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function ne(t,e,n){var i=Dt.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function ie(t,e,n){var i=Dt.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function oe(t,e,n){var i=Dt.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function ae(t,e,n){var i=Pt.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function re(t,e,n){var i=Dt.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function se(t,e,n){var i=Dt.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function ce(t,e){return Ft(t.getDate(),e,2)}function le(t,e){return Ft(t.getHours(),e,2)}function ue(t,e){return Ft(t.getHours()%12||12,e,2)}function pe(t,e){return Ft(1+kt.count(Ct(t),t),e,3)}function he(t,e){return Ft(t.getMilliseconds(),e,3)}function de(t,e){return he(t,e)+"000"}function me(t,e){return Ft(t.getMonth()+1,e,2)}function fe(t,e){return Ft(t.getMinutes(),e,2)}function ye(t,e){return Ft(t.getSeconds(),e,2)}function _e(t){var e=t.getDay();return 0===e?7:e}function be(t,e){return Ft(rt.count(Ct(t)-1,t),e,2)}function ve(t){var e=t.getDay();return e>=4||0===e?ut(t):ut.ceil(t)}function ge(t,e){return t=ve(t),Ft(ut.count(Ct(t),t)+(4===Ct(t).getDay()),e,2)}function ke(t){return t.getDay()}function we(t,e){return Ft(st.count(Ct(t)-1,t),e,2)}function Ee(t,e){return Ft(t.getFullYear()%100,e,2)}function Ce(t,e){return Ft((t=ve(t)).getFullYear()%100,e,2)}function xe(t,e){return Ft(t.getFullYear()%1e4,e,4)}function Le(t,e){var n=t.getDay();return Ft((t=n>=4||0===n?ut(t):ut.ceil(t)).getFullYear()%1e4,e,4)}function Te(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Ft(e/60|0,"0",2)+Ft(e%60,"0",2)}function Ae(t,e){return Ft(t.getUTCDate(),e,2)}function Se(t,e){return Ft(t.getUTCHours(),e,2)}function Oe(t,e){return Ft(t.getUTCHours()%12||12,e,2)}function Me(t,e){return Ft(1+wt.count(xt(t),t),e,3)}function $e(t,e){return Ft(t.getUTCMilliseconds(),e,3)}function Ie(t,e){return $e(t,e)+"000"}function Ne(t,e){return Ft(t.getUTCMonth()+1,e,2)}function De(t,e){return Ft(t.getUTCMinutes(),e,2)}function Pe(t,e){return Ft(t.getUTCSeconds(),e,2)}function Re(t){var e=t.getUTCDay();return 0===e?7:e}function Fe(t,e){return Ft(mt.count(xt(t)-1,t),e,2)}function je(t){var e=t.getUTCDay();return e>=4||0===e?bt(t):bt.ceil(t)}function Ue(t,e){return t=je(t),Ft(bt.count(xt(t),t)+(4===xt(t).getUTCDay()),e,2)}function Ke(t){return t.getUTCDay()}function Ve(t,e){return Ft(ft.count(xt(t)-1,t),e,2)}function Be(t,e){return Ft(t.getUTCFullYear()%100,e,2)}function He(t,e){return Ft((t=je(t)).getUTCFullYear()%100,e,2)}function Ye(t,e){return Ft(t.getUTCFullYear()%1e4,e,4)}function Ze(t,e){var n=t.getUTCDay();return Ft((t=n>=4||0===n?bt(t):bt.ceil(t)).getUTCFullYear()%1e4,e,4)}function ze(){return"+0000"}function qe(){return"%"}function We(t){return+t}function Ge(t){return Math.floor(+t/1e3)}St=function(t){var e=t.dateTime,n=t.date,i=t.time,o=t.periods,a=t.days,r=t.shortDays,s=t.months,c=t.shortMonths,l=Ut(o),u=Kt(o),p=Ut(a),h=Kt(a),d=Ut(r),m=Kt(r),f=Ut(s),y=Kt(s),_=Ut(c),b=Kt(c),v={a:function(t){return r[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:ce,e:ce,f:de,g:Ce,G:Le,H:le,I:ue,j:pe,L:he,m:me,M:fe,p:function(t){return o[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:We,s:Ge,S:ye,u:_e,U:be,V:ge,w:ke,W:we,x:null,X:null,y:Ee,Y:xe,Z:Te,"%":qe},g={a:function(t){return r[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Ae,e:Ae,f:Ie,g:He,G:Ze,H:Se,I:Oe,j:Me,L:$e,m:Ne,M:De,p:function(t){return o[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:We,s:Ge,S:Pe,u:Re,U:Fe,V:Ue,w:Ke,W:Ve,x:null,X:null,y:Be,Y:Ye,Z:ze,"%":qe},k={a:function(t,e,n){var i=d.exec(e.slice(n));return i?(t.w=m.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=p.exec(e.slice(n));return i?(t.w=h.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=_.exec(e.slice(n));return i?(t.m=b.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.m=y.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return C(t,e,n,i)},d:Jt,e:Jt,f:oe,g:qt,G:zt,H:te,I:te,j:Qt,L:ie,m:Xt,M:ee,p:function(t,e,n){var i=l.exec(e.slice(n));return i?(t.p=u.get(i[0].toLowerCase()),n+i[0].length):-1},q:Gt,Q:re,s:se,S:ne,u:Bt,U:Ht,V:Yt,w:Vt,W:Zt,x:function(t,e,i){return C(t,n,e,i)},X:function(t,e,n){return C(t,i,e,n)},y:qt,Y:zt,Z:Wt,"%":ae};function w(t,e){return function(n){var i,o,a,r=[],s=-1,c=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in a||(a.w=1),"Z"in a?(o=(i=Tt(At(a.y,0,1))).getUTCDay(),i=o>4||0===o?ft.ceil(i):ft(i),i=wt.offset(i,7*(a.V-1)),a.y=i.getUTCFullYear(),a.m=i.getUTCMonth(),a.d=i.getUTCDate()+(a.w+6)%7):(o=(i=Lt(At(a.y,0,1))).getDay(),i=o>4||0===o?st.ceil(i):st(i),i=kt.offset(i,7*(a.V-1)),a.y=i.getFullYear(),a.m=i.getMonth(),a.d=i.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),o="Z"in a?Tt(At(a.y,0,1)).getUTCDay():Lt(At(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(o+5)%7:a.w+7*a.U-(o+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,Tt(a)):Lt(a)}}function C(t,e,n,i){for(var o,a,r=0,s=e.length,c=n.length;r=c)return-1;if(37===(o=e.charCodeAt(r++))){if(o=e.charAt(r++),!(a=k[o in Nt?e.charAt(r++):o])||(i=a(t,n,i))<0)return-1}else if(o!=n.charCodeAt(i++))return-1}return i}return v.x=w(n,v),v.X=w(i,v),v.c=w(e,v),g.x=w(n,g),g.X=w(i,g),g.c=w(e,g),{format:function(t){var e=w(t+="",v);return e.toString=function(){return t},e},parse:function(t){var e=E(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",g);return e.toString=function(){return t},e},utcParse:function(t){var e=E(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Ot=St.format,Mt=St.parse,$t=St.utcFormat,It=St.utcParse;var Xe="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||$t(Xe);var Je=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:It(Xe);const Qe=Je,tn=["weeks","days","hours","minutes","seconds","milliseconds"],en={weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001};function nn(t){return"object"==typeof t&&!Array.isArray(t)}class on{constructor(t=0,e=0,n=0,i=0,o=0,a=0){this.days=0,this.seconds=0,this.milliseconds=0;let r={days:t,seconds:e,milliseconds:n,minutes:i,hours:o,weeks:a};nn(t)&&(delete r.days,Object.assign(r,t));let s=0;if(tn.forEach((t=>{s+=(r[t]??0)*en[t]})),sthis.maxSeconds)throw RangeError("value out of range, must have magnitude less than 999999999 days");if(s.toString().includes(".")){const t=s.toString();this.milliseconds=Math.trunc(parseFloat(`0.${t.split(".")[1]}`)/en.milliseconds),t.startsWith("-")&&(this.milliseconds*=-1),s=Math.trunc(s)}this.days=Math.trunc(s/en.days),this.days=this.days||0,this.seconds=s-this.days*en.days,this.seconds=this.seconds||0}total_seconds(){return this.days*en.days+this.seconds+this.milliseconds*en.milliseconds}valueOf(){return this.total_seconds()}toString(){return`${0!=this.days?`${this.days} day${Math.abs(this.days)>1?"s,":","}`:""} ${$t("%-H:%M:%S"+(this.milliseconds?".%f":""))(new Date(1e3*this.valueOf()))}`.trim()}static get min(){return new on(-1e8)}get minSeconds(){return-864e10}static get max(){return new on(1e8)}get maxSeconds(){return 864e10}static get resolution(){return new on({milliseconds:1})}}class an{constructor(t=0,e=0,n=0,i=0){this.hour=0,this.minute=0,this.second=0,this.millisecond=0;let o={hour:t,minute:e,second:n,millisecond:i};nn(t)&&(delete o.hour,Object.assign(o,t));for(const t in o)if(!Number.isInteger(o[t]))throw TypeError("'float' object cannot be interpreted as an integer");if((o.hour??0)<0||(o.hour??0)>23)throw RangeError("hour must be in 0..23");if((o.minute??0)<0||(o.minute??0)>59)throw RangeError("minute must be in 0..59");if((o.second??0)<0||(o.second??0)>59)throw RangeError("second must be in 0..59");if((o.millisecond??0)<0||(o.millisecond??0)>999)throw RangeError("millisecond must be in 0..999");Object.assign(this,o)}replace(t=this.hour,e=this.minute,n=this.second,i=this.millisecond){let o={hour:t,minute:e,second:n,millisecond:i};return nn(t)&&(delete o.hour,Object.assign(o,t)),new an(o.hour??this.hour,o.minute??this.minute,o.second??this.second,o.millisecond??this.millisecond)}isoformat(t="auto"){let e;switch(t){case"hours":e="%H";break;case"minutes":e="%H:%M";break;case"seconds":e="%H:%M:%S";break;case"milliseconds":e="%H:%M:%S.%f";break;default:e="%H:%M:%S"+(this.millisecond?".%f":"")}return this.strftime(e)}valueOf(){return this.hour*en.hours+this.minute*en.minutes+this.second*en.seconds+this.millisecond*en.milliseconds}toString(){return this.isoformat()}strftime(t){return $t(t)(this.jsDate)}get jsDate(){return new Date(1e3*this.valueOf())}static get min(){return new an(0,0,0,0)}static get max(){return new an(23,59,59,999)}static get resolution(){return on.resolution}static fromisoformat(t){const e=Qe(`1970-01-01T${t}`);if(e)return new an(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());throw SyntaxError("Unable to parse date string")}}const rn=100,sn=9999,cn=36160,ln=3652059,un=["year","month","day","hour","minute","second","millisecond"];class pn{constructor(t,e,n,i=0,o=0,a=0,r=0,s=!1){this.year=1970,this.month=1,this.day=1,this.hour=0,this.minute=0,this.second=0,this.millisecond=0,this.utc=!1;const c={year:t,month:e,day:n,hour:i,minute:o,second:a,millisecond:r,utc:s};if(nn(t)&&(delete c.year,Object.assign(c,t)),!c.year||!c.month||!c.day)throw SyntaxError("Missing required argument year, month, or day");for(const t in c)if(un.includes(t)&&!Number.isInteger(c[t]))throw TypeError(`Argument ${t} value ${c[t]} is not an integer`);if(c.yearsn)throw RangeError(`year ${c.year} is out of range`);if(c.month<1||c.month>12)throw RangeError(`month ${c.month} is out of range`);if(c.day<1||c.day>new Date(c.year,c.month,0).getDate())throw RangeError(`day ${n} is out of range for month`);if((c.hour??0)<0||(c.hour??0)>23)throw RangeError("hour must be in 0..23");if((c.minute??0)<0||(c.minute??0)>59)throw RangeError("minute must be in 0..59");if((c.second??0)<0||(c.second??0)>59)throw RangeError("second must be in 0..59");if((c.millisecond??0)<0||(c.millisecond??0)>999)throw RangeError("millisecond must be in 0..999");Object.assign(this,c)}date(){return new hn(this.year,this.month,this.day)}time(){return new an(this.hour,this.minute,this.second,this.millisecond)}replace(t=this.year,e=this.month,n=this.day,i=this.hour,o=this.minute,a=this.second,r=this.millisecond){const s={year:t,month:e,day:n,hour:i,minute:o,second:a,millisecond:r};return nn(t)&&(delete s.year,Object.assign(s,t)),new pn({year:s.year??this.year,month:s.month??this.month,day:s.day??this.day,hour:s.hour??this.hour,minute:s.minute??this.minute,second:s.second??this.second,millisecond:s.millisecond??this.millisecond})}toordinal(){return this.date().toordinal()}timestamp(){let t;return t=this.utc?Date.UTC(this.year,this.month-1,this.day||1,this.hour||0,this.minute||0,this.second||0,this.millisecond||0):this.jsDate.getTime(),t/1e3}weekday(){return this.date().weekday()}isoweekday(){return this.weekday()+1}isocalendar(){const[t,e,n]=$t("%G-%V-%u")(this.jsDate).split("-");return[Number(t),Number(e),Number(n)]}isoformat(t="T",e="auto"){const n={sep:t,timespec:e};let i;switch(nn(t)&&(delete n.sep,Object.assign(n,t),n.sep=n.sep??"T"),n.timespec){case"hours":i=`%Y-%m-%d${n.sep}%H`;break;case"minutes":i=`%Y-%m-%d${n.sep}%H:%M`;break;case"seconds":i=`%Y-%m-%d${n.sep}%H:%M:%S`;break;case"milliseconds":i=`%Y-%m-%d${n.sep}%H:%M:%S.%f`;break;default:i=`%Y-%m-%d${n.sep}%H:%M:%S${this.millisecond?".%f":""}`}return this.strftime(i)}valueOf(){return this.timestamp()}toString(){return this.isoformat(" ")}ctime(){return Ot("%a %b %-e %H:%M:%S %Y")(this.jsDate)}strftime(t){return this.utc?$t(t)(this.jsDate):Ot(t)(this.jsDate)}get jsDate(){return this.utc?new Date(1e3*this.valueOf()):new Date(this.year,this.month-1,this.day||1,this.hour||0,this.minute||0,this.second||0,this.millisecond||0)}static get min(){return new pn(rn,1,1)}static get max(){return new pn(sn,12,31,23,59,59,999)}static get resolution(){return on.resolution}static today(){return pn.now()}static now(){return pn.fromjsdate(new Date)}static utcnow(){return pn.utcfromjsdate(new Date)}static fromtimestamp(t){const e=new Date(1e3*t);return pn.fromjsdate(e)}static utcfromtimestamp(t){const e=new Date(1e3*t);return pn.utcfromjsdate(e)}static fromjsdate(t){return new pn({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()})}static utcfromjsdate(t){return new pn({year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),utc:!0})}static fromordinal(t){if(tln)throw RangeError(`ordinal ${t} is out of range`);return pn.fromtimestamp(hn.min.valueOf()+new on({days:t-cn}).valueOf())}static combine(t,e){return new pn({year:t.year,month:t.month,day:t.day,hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})}static fromisoformat(t){const e=Qe(t);if(e)return pn.fromjsdate(e);throw SyntaxError("Unable to parse date string")}static fromisocalendar(t,e,n){return pn.strptime(`${t}-${e}-${n}`,"%G-%V-%u")}static strptime(t,e,n=!1){const i=(n?It:Mt)(e)(t);if(!i)throw Error(`'${t}' does not match format '${e}'`);return n?pn.utcfromjsdate(i):pn.fromjsdate(i)}}class hn{constructor(t,e,n){if(this.year=1970,this.month=1,this.day=1,!Number.isInteger(t)||tsn)throw RangeError(`year ${t} is out of range`);if(!Number.isInteger(e)||e<1||e>12)throw RangeError(`month ${e} is out of range`);if(!Number.isInteger(n)||n<1||n>new Date(t,e,0).getDate())throw RangeError(`day ${n} is out of range for month`);Object.assign(this,{year:t,month:e,day:n})}replace(t=this.year,e=this.month,n=this.day){const i={year:t,month:e,day:n};return nn(t)&&(delete i.year,Object.assign(i,t)),new hn(i.year??this.year,i.month??this.month,i.day??this.day)}toordinal(){return Math.trunc((this.valueOf()+new on({days:719163}).total_seconds())/en.days)}weekday(){return(this.jsDate.getDay()+6)%7}isoweekday(){return this.weekday()+1}isocalendar(){const[t,e,n]=$t("%G-%V-%u")(this.jsDate).split("-");return[Number(t),Number(e),Number(n)]}isoformat(){return $t("%Y-%m-%d")(this.jsDate)}valueOf(){return this.jsDate.getTime()/1e3}toString(){return this.isoformat()}ctime(){return Ot("%a %b %-e 00:00:00 %Y")(this.jsDate)}strftime(t){return Ot(t)(this.jsDate)}get jsDate(){return new Date(this.year,this.month-1,this.day)}static get min(){return new hn(rn,1,1)}static get max(){return new hn(sn,12,31)}static get resolution(){return new on({days:1})}static today(){const t=pn.now();return new hn(t.year,t.month,t.day)}static fromtimestamp(t){const e=pn.fromtimestamp(t);return new hn(e.year,e.month,e.day)}static fromordinal(t){if(tln)throw RangeError(`ordinal ${t} is out of range`);return hn.fromtimestamp(hn.min.valueOf()+new on({days:t-cn}).valueOf())}static fromisoformat(t){const e=Qe(t);if(e)return new hn(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate());throw SyntaxError("Unable to parse date string")}static fromisocalendar(t,e,n){const i=pn.strptime(`${t}-${e}-${n}`,"%G-%V-%u");return new hn(Number(i.year),Number(i.month),Number(i.day))}}const dn=(...t)=>new on(...t);dn.min=on.min,dn.max=on.max,dn.resolution=on.resolution;const mn=(...t)=>new hn(...t);mn.min=hn.min,mn.max=hn.max,mn.resolution=hn.resolution,mn.today=hn.today,mn.fromtimestamp=hn.fromtimestamp,mn.fromordinal=hn.fromordinal,mn.fromisoformat=hn.fromisoformat,mn.fromisocalendar=hn.fromisocalendar;const fn=(...t)=>new pn(...t);fn.min=pn.min,fn.max=pn.max,fn.resolution=pn.resolution,fn.today=pn.today,fn.now=pn.now,fn.utcnow=pn.utcnow,fn.fromtimestamp=pn.fromtimestamp,fn.utcfromtimestamp=pn.utcfromtimestamp,fn.fromjsdate=pn.fromjsdate,fn.utcfromjsdate=pn.utcfromjsdate,fn.fromordinal=pn.fromordinal,fn.combine=pn.combine,fn.fromisoformat=pn.fromisoformat,fn.fromisocalendar=pn.fromisocalendar,fn.strptime=pn.strptime;const yn=(...t)=>new an(...t);yn.min=an.min,yn.max=an.max,yn.resolution=an.resolution,yn.fromisoformat=an.fromisoformat;const _n={MINYEAR:rn,MAXYEAR:sn,MINYEAR_ORDINAL:cn,MAXYEAR_ORDINAL:ln,timedelta:dn,date:mn,datetime:fn,time:yn};function bn(){return _n.datetime.now()}function vn(t="00:00"){const[e,n,i,o]=t.split(":"),a=_n.datetime.now(),r=_n.datetime(a.year,a.month,a.day,Number(e??0),Number(n??0),Number(i??0),Number(o??0));return M(r.toString()),r}function gn(t,e=void 0,n=!0){"object"!=typeof e||Array.isArray(e)||(n=e.utc??n,e=e.fallback??void 0);try{let e;if("string"==typeof t)if(/[^\d]/g.test(t)){t=t.replace(/T/g," ");const i=["%Y-%m-%d %H:%M:%S.%f%Z","%Y-%m-%d %H:%M:%S.%f","%Y-%m-%d %H:%M:%S%Z","%Y-%m-%d %H:%M:%S"];for(const o of i)try{e=_n.datetime.strptime(t,o,n);break}catch{}e||(t=parseFloat(t))}else t=parseFloat(t);else e="number"==typeof t?n?_n.datetime.utcfromtimestamp(t):_n.datetime.fromtimestamp(t):t instanceof hn?_n.datetime(t.year,t.month,t.day):t;return M((e??"NaN").toString()),e}catch(t){if(e)return e;throw t}}function kn(t,e){try{let e;return"string"==typeof t?(t.includes(" ")||t.includes("T")||(t+=" 00:00:00"),e=Date.parse(t)/1e3):e="number"==typeof t?_n.datetime.utcfromtimestamp(t).jsDate.getTime()/1e3:t.jsDate.getTime()/1e3,M(e.toString()),e}catch(t){if(e)return e;throw t}}function wn(t){return _n.datetime.fromjsdate(_n.datetime(t).jsDate)}function En(t,e=1,n=!1){if(!(t instanceof pn))return t;let i=bn().valueOf()-wn(t).valueOf();if(n&&(i*=-1),i<=0)return t;(0==e||e>6)&&(e=6);const o={year:31536e3,month:2592e3,day:86400,hour:3600,minute:60,second:1},a=Object.keys(o);let r="",s=!1;for(let t=0;t0)&&(s=!0,r+=` ${n} ${a[t]}${1!=n?"s":""}`,i-=n*o[a[t]])}return r.trim()}function Cn(t,e=1){return En(t,e)}function xn(t,e=1){return En(t,e,!0)}const Ln={states:l,state_attr:u,has_value:p,state_translated:X,attr_name_translated:J,attr_value_translated:Q,expand:k,device_entities:d,device_attr:m,device_id:f,floor_id:b,floor_name:v,floor_areas:g,area_id:o,area_name:a,area_entities:r,area_devices:s,labels:C,label_areas:T,label_devices:A,label_entities:S,iif:w,closest:_},Tn={label_id:x,label_name:L,today_at:vn,as_datetime:gn,as_timestamp:kn,as_local:wn,time_since:Cn,time_until:xn,timestamp_local:function(t,e){try{const e=_n.datetime.fromtimestamp(t).strftime("%Y-%m-%dT%H:%M:%S%Z");return M(e),e}catch(t){if(e)return e;throw t}},timestamp_utc:function(t,e){try{const e=_n.datetime.utcfromtimestamp(t).strftime("%Y-%m-%dT%H:%M:%S%Z");return M(e),e}catch(t){if(e)return e;throw t}},timestamp_custom:function(t,e,n=!0,i=void 0){"object"!=typeof n||Array.isArray(n)||(i=n.fallback??i,n=n.local??!0);try{const i=(n?_n.datetime.fromtimestamp(t):_n.datetime.utcfromtimestamp(t)).strftime(e);return M(i),i}catch(t){if(i)return i;throw t}},to_json:function(t,e=!1,n=!1,i=!1){"object"!=typeof e||Array.isArray(e)||(i=e.sort_keys??i,n=e.pretty_print??n,e=e.ensure_ascii??!1),i&&(t=Object.keys(t).sort().reduce(((e,n)=>(e[n]=t[n],e)),{}));let o=JSON.stringify(t,void 0,n?2:void 0);return e&&(o=o.replace(/[\u007F-\uFFFF]/g,(t=>`\\u'${("0000"+t.charCodeAt(0).toString(16)).substring(-4)}`))),o},from_json:function(t){return JSON.parse(t)},closest:_,contains:c,is_number:$,bool:I,log:N,sin:D,cos:P,tan:R,asin:F,acos:j,atan:U,atan2:K,sqrt:V,max:B,min:H,average:Y,median:Z,statistical_mode:z,bitwise_and:function(t,e){return t&e},bitwise_or:function(t,e){return t|e},bitwise_xor:function(t,e){return t^e},bitwise_not:function(t){return~t},ord:function(t){if(1==t.length)return t.codePointAt(0);throw Error("Expected a character, but received a string")},multiply:function(t,e){return Number(t)*Number(e)},add:function(t,e){return Number(t)+Number(e)},regex_replace:function(t,e="",n=""){return t.replace(new RegExp(e,"g"),n)},regex_findall:function(t,e=""){return t.match(new RegExp(e,"g"))??[]},regex_findall_index:function(t,e="",n=0){return(t.match(new RegExp(e,"g"))??[])[n]},str:O},An={states:l,is_state:function(t,e,n){try{const i=l(t,e);return Array.isArray(n)?n.includes(i):i==n}catch{return!1}},state_attr:u,is_state_attr:function(t,e,n,i){try{return u(t,e,n)==i}catch{return!1}},has_value:p,state_translated:X,attr_name_translated:J,attr_value_translated:Q,expand:k,is_hidden_entity:function(t,e){try{return t.entities[e].hidden??!1}catch{return!1}},device_entities:d,device_attr:m,is_device_attr:function(t,e,n,i){try{return null!=i&&m(t,e,n)==i}catch{return!1}},device_id:f,floors:function(t){return Object.keys(t.floors)},floor_id:b,floor_name:v,floor_areas:g,areas:function(t){try{return Object.keys(t.areas)}catch{return[]}},area_id:o,area_name:a,area_entities:r,area_devices:s,integration_entities:function(t,e){try{const n=[];if(e){for(const i in t.entities)t.entities[i].platform==e&&n.push(i);n.sort()}return n}catch{return[]}},labels:C,label_areas:T,label_devices:A,label_entities:S,iif:w,distance:function(t,...e){try{let n,i,o,a,r=0;if("string"==typeof e[0])n=t.states[e[0]].attributes.latitude,o=t.states[e[0]].attributes.longitude,r=1;else if("object"!=typeof e[0]||Array.isArray(e[0])){if("number"!=typeof e[0])return null;if("number"!=typeof e[1])throw Error("Latitude provided but not longitude 1");n=e[0],o=e[1],r=2}else n=e[0].attributes.latitude,o=e[0].attributes.longitude,r=1;if("string"==typeof e[r])i=t.states[e[r]].attributes.latitude,a=t.states[e[r]].attributes.longitude;else if("object"!=typeof e[r]||Array.isArray(e[r]))if("number"==typeof e[r]){if("number"!=typeof e[r+1])throw Error("Latitude provided but not longitude 2");i=e[r],a=e[r+1]}else i=t.states["zone.home"].attributes.latitude,a=t.states["zone.home"].attributes.longitude;else i=e[r].attributes.latitude,a=e[r].attributes.longitude;return y([n,o],[i,a],"mi"==t.config.unit_system.length)}catch{return null}},closest:_},Sn={label_id:x,label_name:L,now:bn,utcnow:function(){return _n.datetime.utcnow()},today_at:vn,as_datetime:gn,as_timestamp:kn,as_local:wn,strptime:function(t,e,n=void 0,i=!1){"object"!=typeof n||Array.isArray(n)||n instanceof pn||n instanceof hn||(i=n.utc??i,n=n.fallback??void 0);try{e=e.replace(/%z/g,"%Z");const n=_n.datetime.strptime(t,e,i);return M(n.toString()),n}catch(t){if(n)return n;throw t}},time_since:Cn,time_until:xn,as_timedelta:function(t){try{let e;if(t.includes(":")||t.includes(" ")||/^\d*\.?\d*$/.test(t)){let n,i;t.includes(" ")?t.includes("days")?[n,i]=t.split(" days "):[n,i]=t.split(" "):(n=0,i=t);const[o,a,r]=i.split(":").reverse();e=_n.timedelta(Number(n),Number(o.replace(",",".")??0),0,Number(a??0),Number(r??0))}else{if(!t.startsWith("P"))return null;{const n=t.replace(/P|T/g,"").match(/(\d*?)[A-Z]/g);if(!n)return null;const i={};for(const t of n){const e=t.match(/^(\d*)/),n=t.match(/[A-Z]$/);e&&n&&(i[n[0]]=parseFloat(e[0]))}e=_n.timedelta(i.D,i.S,0,i.M,i.H,i.W)}}return M(e.toString()),e}catch{return null}},float:function(t,e){try{const e=parseFloat(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}},is_number:$,int:function(t,e){try{const e=parseInt(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}},bool:I,log:N,sin:D,cos:P,tan:R,asin:F,acos:j,atan:U,atan2:K,sqrt:V,max:B,min:H,average:Y,median:Z,statistical_mode:z,set:function(...t){return new Set(t.flat(1/0))},list:function(...t){return t.map((t=>Array.from(t))).flat(1/0)},zip:function(...t){if(t.length>1)return t[0].map(((e,n)=>{const i=[e];for(let e=1;et.name.localeCompare(e.name)));for(const t of e)E[t.label_id]=t}}(t),$n=t,"string"==typeof e&&(e.includes("{{")&&e.includes("}}")||e.includes("{%")&&e.includes("%}"))?(e=In.renderString(structuredClone(e),{hass:t,_states:h(t),...n}).trim(),[void 0,null,"undefined","null","None"].includes(e)?"":"true"==e.toLowerCase()||"false"!=e.toLowerCase()&&e):e}},740:(t,e,n)=>{"use strict";n.d(e,{XX:()=>U,c0:()=>C,qy:()=>E});const i=globalThis,o=i.trustedTypes,a=o?o.createPolicy("lit-html",{createHTML:t=>t}):void 0,r="$lit$",s=`lit$${(Math.random()+"").slice(9)}$`,c="?"+s,l=`<${c}>`,u=document,p=()=>u.createComment(""),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,m="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,y=/-->/g,_=/>/g,b=RegExp(`>|${m}(?:([^\\s"'>=/]+)(${m}*=${m}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),v=/'/g,g=/"/g,k=/^(?:script|style|textarea|title)$/i,w=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),E=w(1),C=(w(2),Symbol.for("lit-noChange")),x=Symbol.for("lit-nothing"),L=new WeakMap,T=u.createTreeWalker(u,129);function A(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==a?a.createHTML(e):e}const S=(t,e)=>{const n=t.length-1,i=[];let o,a=2===e?"":"",c=f;for(let e=0;e"===p[0]?(c=o??f,h=-1):void 0===p[1]?h=-2:(h=c.lastIndex-p[2].length,u=p[1],c=void 0===p[3]?b:'"'===p[3]?g:v):c===g||c===v?c=b:c===y||c===_?c=f:(c=b,o=void 0);const m=c===b&&t[e+1].startsWith("/>")?" ":"";a+=c===f?n+l:h>=0?(i.push(u),n.slice(0,h)+r+n.slice(h)+s+m):n+s+(-2===h?e:m)}return[A(t,a+(t[n]||"")+(2===e?"":"")),i]};class O{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let a=0,l=0;const u=t.length-1,h=this.parts,[d,m]=S(t,e);if(this.el=O.createElement(d,n),T.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=T.nextNode())&&h.length0){i.textContent=o?o.emptyScript:"";for(let n=0;nd(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==x&&h(this._$AH)?this._$AA.nextSibling.data=t:this.$(u.createTextNode(t)),this._$AH=t}g(t){const{values:e,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=O.createElement(A(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new $(i,this),n=t.u(this.options);t.p(e),this.$(n),this._$AH=t}}_$AC(t){let e=L.get(t.strings);return void 0===e&&L.set(t.strings,e=new O(t)),e}T(t){d(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const o of t)i===e.length?e.push(n=new I(this.k(p()),this.k(p()),this,this.options)):n=e[i],n._$AI(o),i++;i2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=x}_$AI(t,e=this,n,i){const o=this.strings;let a=!1;if(void 0===o)t=M(this,t,e,0),a=!h(t)||t!==this._$AH&&t!==C,a&&(this._$AH=t);else{const i=t;let r,s;for(t=o[0],r=0;r{const i=n?.renderBefore??e;let o=i._$litPart$;if(void 0===o){const t=n?.renderBefore??null;i._$litPart$=o=new I(e.insertBefore(p(),t),t,void 0,n??{})}return o._$AI(t),o}},385:(t,e,n)=>{"use strict";n.d(e,{EM:()=>i,Ls:()=>l,MZ:()=>s,wk:()=>c});const i=t=>(e,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)};var o=n(1);const a={attribute:!0,type:String,converter:o.W3,reflect:!1,hasChanged:o.Ec},r=(t=a,e,n)=>{const{kind:i,metadata:o}=n;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),r.set(n.name,t),"accessor"===i){const{name:i}=n;return{set(n){const o=e.get.call(this);e.set.call(this,n),this.requestUpdate(i,o,t)},init(e){return void 0!==e&&this.C(i,void 0,t),e}}}if("setter"===i){const{name:i}=n;return function(n){const o=this[i];e.call(this,n),this.requestUpdate(i,o,t)}}throw Error("Unsupported decorator location: "+i)};function s(t){return(e,n)=>"object"==typeof n?r(t,e,n):((t,e,n)=>{const i=e.hasOwnProperty(n);return e.constructor.createProperty(n,i?{...t,wrapped:!0}:t),i?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}function c(t){return s({...t,state:!0,attribute:!1})}function l(t){return(e,n)=>{const i="function"==typeof e?e:e[n];Object.assign(i,t)}}},670:(t,e,n)=>{"use strict";n.d(e,{WF:()=>a,AH:()=>i.AH,qy:()=>o.qy});var i=n(1),o=n(740);class a extends i.mN{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,o.XX)(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return o.c0}}a._$litElement$=!0,a.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:a});const r=globalThis.litElementPolyfillSupport;r?.({LitElement:a}),(globalThis.litElementVersions??=[]).push("4.0.3")}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(t,e)=>{for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var __webpack_exports__={};(()=>{"use strict";var t=__webpack_require__(670),e=__webpack_require__(385),n=__webpack_require__(703);function i(t){return null==t}var o={isNothing:i,isObject:function(t){return"object"==typeof t&&null!==t},toArray:function(t){return Array.isArray(t)?t:i(t)?[]:[t]},repeat:function(t,e){var n,i="";for(n=0;ns&&(e=i-s+(a=" ... ").length),n-i>s&&(n=i+s-(r=" ...").length),{str:a+t.slice(e,n).replace(/\t/g,"→")+r,pos:i-e+a.length}}function l(t,e){return o.repeat(" ",e-t.length)+t}var u=function(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),"number"!=typeof e.indent&&(e.indent=1),"number"!=typeof e.linesBefore&&(e.linesBefore=3),"number"!=typeof e.linesAfter&&(e.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,a=[0],r=[],s=-1;n=i.exec(t.buffer);)r.push(n.index),a.push(n.index+n[0].length),t.position<=n.index&&s<0&&(s=a.length-2);s<0&&(s=a.length-1);var u,p,h="",d=Math.min(t.line+e.linesAfter,r.length).toString().length,m=e.maxLength-(e.indent+d+3);for(u=1;u<=e.linesBefore&&!(s-u<0);u++)p=c(t.buffer,a[s-u],r[s-u],t.position-(a[s]-a[s-u]),m),h=o.repeat(" ",e.indent)+l((t.line-u+1).toString(),d)+" | "+p.str+"\n"+h;for(p=c(t.buffer,a[s],r[s],t.position,m),h+=o.repeat(" ",e.indent)+l((t.line+1).toString(),d)+" | "+p.str+"\n",h+=o.repeat("-",e.indent+d+3+p.pos)+"^\n",u=1;u<=e.linesAfter&&!(s+u>=r.length);u++)p=c(t.buffer,a[s+u],r[s+u],t.position-(a[s]-a[s+u]),m),h+=o.repeat(" ",e.indent)+l((t.line+u+1).toString(),d)+" | "+p.str+"\n";return h.replace(/\n$/,"")},p=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],h=["scalar","sequence","mapping"],d=function(t,e){if(e=e||{},Object.keys(e).forEach((function(e){if(-1===p.indexOf(e))throw new s('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=function(t){var e={};return null!==t&&Object.keys(t).forEach((function(n){t[n].forEach((function(t){e[String(t)]=n}))})),e}(e.styleAliases||null),-1===h.indexOf(this.kind))throw new s('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function m(t,e){var n=[];return t[e].forEach((function(t){var e=n.length;n.forEach((function(n,i){n.tag===t.tag&&n.kind===t.kind&&n.multi===t.multi&&(e=i)})),n[e]=t})),n}function f(t){return this.extend(t)}f.prototype.extend=function(t){var e=[],n=[];if(t instanceof d)n.push(t);else if(Array.isArray(t))n=n.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new s("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(e=e.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit))}e.forEach((function(t){if(!(t instanceof d))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new s("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(t){if(!(t instanceof d))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(f.prototype);return i.implicit=(this.implicit||[]).concat(e),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=m(i,"implicit"),i.compiledExplicit=m(i,"explicit"),i.compiledTypeMap=function(){var t,e,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(t){t.multi?(n.multi[t.kind].push(t),n.multi.fallback.push(t)):n[t.kind][t.tag]=n.fallback[t.tag]=t}for(t=0,e=arguments.length;t=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),w=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),E=/^[-+]?[0-9]+e/,C=new d("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!w.test(t)||"_"===t[t.length-1])},construct:function(t){var e,n;return n="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:n*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||o.isNegativeZero(t))},represent:function(t,e){var n;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(o.isNegativeZero(t))return"-0.0";return n=t.toString(10),E.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),x=y.extend({implicit:[_,b,k,C]}),L=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),T=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),A=new d("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==L.exec(t)||null!==T.exec(t))},construct:function(t){var e,n,i,o,a,r,s,c,l=0,u=null;if(null===(e=L.exec(t))&&(e=T.exec(t)),null===e)throw new Error("Date resolve error");if(n=+e[1],i=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(n,i,o));if(a=+e[4],r=+e[5],s=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(u=-u)),c=new Date(Date.UTC(n,i,o,a,r,s,l)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(t){return t.toISOString()}}),S=new d("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",M=new d("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,i=0,o=t.length,a=O;for(n=0;n64)){if(e<0)return!1;i+=6}return i%8==0},construct:function(t){var e,n,i=t.replace(/[\r\n=]/g,""),o=i.length,a=O,r=0,s=[];for(e=0;e>16&255),s.push(r>>8&255),s.push(255&r)),r=r<<6|a.indexOf(i.charAt(e));return 0==(n=o%4*6)?(s.push(r>>16&255),s.push(r>>8&255),s.push(255&r)):18===n?(s.push(r>>10&255),s.push(r>>2&255)):12===n&&s.push(r>>4&255),new Uint8Array(s)},predicate:function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function(t){var e,n,i="",o=0,a=t.length,r=O;for(e=0;e>18&63],i+=r[o>>12&63],i+=r[o>>6&63],i+=r[63&o]),o=(o<<8)+t[e];return 0==(n=a%3)?(i+=r[o>>18&63],i+=r[o>>12&63],i+=r[o>>6&63],i+=r[63&o]):2===n?(i+=r[o>>10&63],i+=r[o>>4&63],i+=r[o<<2&63],i+=r[64]):1===n&&(i+=r[o>>2&63],i+=r[o<<4&63],i+=r[64],i+=r[64]),i}}),$=Object.prototype.hasOwnProperty,I=Object.prototype.toString,N=new d("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,i,o,a,r=[],s=t;for(e=0,n=s.length;e>10),56320+(t-65536&1023))}for(var st=new Array(256),ct=new Array(256),lt=0;lt<256;lt++)st[lt]=at(lt)?1:0,ct[lt]=at(lt);function ut(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||j,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function pt(t,e){var n={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return n.snippet=u(n),new s(e,n)}function ht(t,e){throw pt(t,e)}function dt(t,e){t.onWarning&&t.onWarning.call(null,pt(t,e))}var mt={YAML:function(t,e,n){var i,o,a;null!==t.version&&ht(t,"duplication of %YAML directive"),1!==n.length&&ht(t,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&ht(t,"ill-formed argument of the YAML directive"),o=parseInt(i[1],10),a=parseInt(i[2],10),1!==o&&ht(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=a<2,1!==a&&2!==a&&dt(t,"unsupported YAML version of the document")},TAG:function(t,e,n){var i,o;2!==n.length&&ht(t,"TAG directive accepts exactly two arguments"),i=n[0],o=n[1],X.test(i)||ht(t,"ill-formed tag handle (first argument) of the TAG directive"),U.call(t.tagMap,i)&&ht(t,'there is a previously declared suffix for "'+i+'" tag handle'),J.test(o)||ht(t,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch(e){ht(t,"tag prefix is malformed: "+o)}t.tagMap[i]=o}};function ft(t,e,n,i){var o,a,r,s;if(e1&&(t.result+=o.repeat("\n",e-1))}function wt(t,e){var n,i,o=t.tag,a=t.anchor,r=[],s=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=r),i=t.input.charCodeAt(t.position);0!==i&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,ht(t,"tab characters must not be used in indentation")),45===i)&&nt(t.input.charCodeAt(t.position+1));)if(s=!0,t.position++,vt(t,!0,-1)&&t.lineIndent<=e)r.push(null),i=t.input.charCodeAt(t.position);else if(n=t.line,xt(t,e,B,!1,!0),r.push(t.result),vt(t,!0,-1),i=t.input.charCodeAt(t.position),(t.line===n||t.lineIndent>e)&&0!==i)ht(t,"bad indentation of a sequence entry");else if(t.lineIndente?f=1:t.lineIndent===e?f=0:t.lineIndente?f=1:t.lineIndent===e?f=0:t.lineIndente)&&(_&&(r=t.line,s=t.lineStart,c=t.position),xt(t,e,H,!0,o)&&(_?f=t.result:y=t.result),_||(_t(t,h,d,m,f,y,r,s,c),m=f=y=null),vt(t,!0,-1),l=t.input.charCodeAt(t.position)),(t.line===a||t.lineIndent>e)&&0!==l)ht(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===a?ht(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?ht(t,"repeat of an indentation width identifier"):(p=e+a-1,u=!0)}if(et(r)){do{r=t.input.charCodeAt(++t.position)}while(et(r));if(35===r)do{r=t.input.charCodeAt(++t.position)}while(!tt(r)&&0!==r)}for(;0!==r;){for(bt(t),t.lineIndent=0,r=t.input.charCodeAt(t.position);(!u||t.lineIndentp&&(p=t.lineIndent),tt(r))h++;else{if(t.lineIndent0){for(o=r,a=0;o>0;o--)(r=ot(s=t.input.charCodeAt(++t.position)))>=0?a=(a<<4)+r:ht(t,"expected hexadecimal character");t.result+=rt(a),t.position++}else ht(t,"unknown escape sequence");n=i=t.position}else tt(s)?(ft(t,n,i,!0),kt(t,vt(t,!1,e)),n=i=t.position):t.position===t.lineStart&>(t)?ht(t,"unexpected end of the document within a double quoted scalar"):(t.position++,i=t.position)}ht(t,"unexpected end of the stream within a double quoted scalar")}(t,d)?_=!0:function(t){var e,n,i;if(42!==(i=t.input.charCodeAt(t.position)))return!1;for(i=t.input.charCodeAt(++t.position),e=t.position;0!==i&&!nt(i)&&!it(i);)i=t.input.charCodeAt(++t.position);return t.position===e&&ht(t,"name of an alias node must contain at least one character"),n=t.input.slice(e,t.position),U.call(t.anchorMap,n)||ht(t,'unidentified alias "'+n+'"'),t.result=t.anchorMap[n],vt(t,!0,-1),!0}(t)?(_=!0,null===t.tag&&null===t.anchor||ht(t,"alias node should not have any properties")):function(t,e,n){var i,o,a,r,s,c,l,u,p=t.kind,h=t.result;if(nt(u=t.input.charCodeAt(t.position))||it(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(nt(i=t.input.charCodeAt(t.position+1))||n&&it(i)))return!1;for(t.kind="scalar",t.result="",o=a=t.position,r=!1;0!==u;){if(58===u){if(nt(i=t.input.charCodeAt(t.position+1))||n&&it(i))break}else if(35===u){if(nt(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&>(t)||n&&it(u))break;if(tt(u)){if(s=t.line,c=t.lineStart,l=t.lineIndent,vt(t,!1,-1),t.lineIndent>=e){r=!0,u=t.input.charCodeAt(t.position);continue}t.position=a,t.line=s,t.lineStart=c,t.lineIndent=l;break}}r&&(ft(t,o,a,!1),kt(t,t.line-s),o=a=t.position,r=!1),et(u)||(a=t.position+1),u=t.input.charCodeAt(++t.position)}return ft(t,o,a,!1),!!t.result||(t.kind=p,t.result=h,!1)}(t,d,K===n)&&(_=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===f&&(_=c&&wt(t,m))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&ht(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),l=0,u=t.implicitTypes.length;l"),null!==t.result&&h.kind!==t.kind&&ht(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+h.kind+'", not "'+t.kind+'"'),h.resolve(t.result,t.tag)?(t.result=h.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):ht(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||_}function Lt(t){var e,n,i,o,a=t.position,r=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(o=t.input.charCodeAt(t.position))&&(vt(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==o));){for(r=!0,o=t.input.charCodeAt(++t.position),e=t.position;0!==o&&!nt(o);)o=t.input.charCodeAt(++t.position);for(i=[],(n=t.input.slice(e,t.position)).length<1&&ht(t,"directive name must not be less than one character in length");0!==o;){for(;et(o);)o=t.input.charCodeAt(++t.position);if(35===o){do{o=t.input.charCodeAt(++t.position)}while(0!==o&&!tt(o));break}if(tt(o))break;for(e=t.position;0!==o&&!nt(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(e,t.position))}0!==o&&bt(t),U.call(mt,n)?mt[n](t,n,i):dt(t,'unknown document directive "'+n+'"')}vt(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,vt(t,!0,-1)):r&&ht(t,"directives end mark is expected"),xt(t,t.lineIndent-1,H,!1,!0),vt(t,!0,-1),t.checkLineBreaks&&W.test(t.input.slice(a,t.position))&&dt(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&>(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,vt(t,!0,-1)):t.position=55296&&i<=56319&&e+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function fe(t){return/^\n* /.test(t)}var ye=1,_e=2,be=3,ve=4,ge=5;function ke(t,e,n,i,o){t.dump=function(){if(0===e.length)return t.quotingType===re?'""':"''";if(!t.noCompatMode&&(-1!==ie.indexOf(e)||oe.test(e)))return t.quotingType===re?'"'+e+'"':"'"+e+"'";var a=t.indent*Math.max(1,n),r=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),c=i||t.flowLevel>-1&&n>=t.flowLevel;switch(function(t,e,n,i,o,a,r,s){var c,l,u=0,p=null,h=!1,d=!1,m=-1!==i,f=-1,y=pe(l=me(t,0))&&l!==Mt&&!ue(l)&&l!==Ht&&l!==qt&&l!==Yt&&l!==Bt&&l!==Gt&&l!==Xt&&l!==Qt&&l!==ee&&l!==Ft&&l!==Ut&&l!==Vt&&l!==Pt&&l!==te&&l!==Zt&&l!==zt&&l!==Kt&&l!==Rt&&l!==jt&&l!==Wt&&l!==Jt&&function(t){return!ue(t)&&t!==Yt}(me(t,t.length-1));if(e||r)for(c=0;c=65536?c+=2:c++){if(!pe(u=me(t,c)))return ge;y=y&&de(u,p,s),p=u}else{for(c=0;c=65536?c+=2:c++){if((u=me(t,c))===It)h=!0,m&&(d=d||c-f-1>i&&" "!==t[f+1],f=c);else if(!pe(u))return ge;y=y&&de(u,p,s),p=u}d=d||m&&c-f-1>i&&" "!==t[f+1]}return h||d?n>9&&fe(t)?ge:r?a===re?ge:_e:d?ve:be:!y||r||o(t)?a===re?ge:_e:ye}(e,c,t.indent,r,(function(e){return function(t,e){var n,i;for(n=0,i=t.implicitTypes.length;n"+we(e,t.indent)+Ee(ce(function(t,e){for(var n,i,o,a=/(\n+)([^\n]*)/g,r=(o=-1!==(o=t.indexOf("\n"))?o:t.length,a.lastIndex=o,Ce(t.slice(0,o),e)),s="\n"===t[0]||" "===t[0];i=a.exec(t);){var c=i[1],l=i[2];n=" "===l[0],r+=c+(s||n||""===l?"":"\n")+Ce(l,e),s=n}return r}(e,r),a));case ge:return'"'+function(t){for(var e,n="",i=0,o=0;o=65536?o+=2:o++)i=me(t,o),!(e=ne[i])&&pe(i)?(n+=t[o],i>=65536&&(n+=t[o+1])):n+=e||ae(i);return n}(e)+'"';default:throw new s("impossible error: invalid scalar style")}}()}function we(t,e){var n=fe(t)?String(e):"",i="\n"===t[t.length-1];return n+(!i||"\n"!==t[t.length-2]&&"\n"!==t?i?"":"-":"+")+"\n"}function Ee(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function Ce(t,e){if(""===t||" "===t[0])return t;for(var n,i,o=/ [^ ]/g,a=0,r=0,s=0,c="";n=o.exec(t);)(s=n.index)-a>e&&(i=r>a?r:s,c+="\n"+t.slice(a,i),a=i+1),r=s;return c+="\n",t.length-a>e&&r>a?c+=t.slice(a,r)+"\n"+t.slice(r+1):c+=t.slice(a),c.slice(1)}function xe(t,e,n,i){var o,a,r,s="",c=t.tag;for(o=0,a=n.length;o tag resolver accepts not "'+l+'" style');i=c.represent[l](e,l)}t.dump=i}return!0}return!1}function Te(t,e,n,i,o,a,r){t.tag=null,t.dump=n,Le(t,n,!1)||Le(t,n,!0);var c,l=St.call(t.dump),u=i;i&&(i=t.flowLevel<0||t.flowLevel>e);var p,h,d="[object Object]"===l||"[object Array]"===l;if(d&&(h=-1!==(p=t.duplicates.indexOf(n))),(null!==t.tag&&"?"!==t.tag||h||2!==t.indent&&e>0)&&(o=!1),h&&t.usedDuplicates[p])t.dump="*ref_"+p;else{if(d&&h&&!t.usedDuplicates[p]&&(t.usedDuplicates[p]=!0),"[object Object]"===l)i&&0!==Object.keys(t.dump).length?(function(t,e,n,i){var o,a,r,c,l,u,p="",h=t.tag,d=Object.keys(n);if(!0===t.sortKeys)d.sort();else if("function"==typeof t.sortKeys)d.sort(t.sortKeys);else if(t.sortKeys)throw new s("sortKeys must be a boolean or a function");for(o=0,a=d.length;o1024)&&(t.dump&&It===t.dump.charCodeAt(0)?u+="?":u+="? "),u+=t.dump,l&&(u+=le(t,e)),Te(t,e+1,c,!0,l)&&(t.dump&&It===t.dump.charCodeAt(0)?u+=":":u+=": ",p+=u+=t.dump));t.tag=h,t.dump=p||"{}"}(t,e,t.dump,o),h&&(t.dump="&ref_"+p+t.dump)):(function(t,e,n){var i,o,a,r,s,c="",l=t.tag,u=Object.keys(n);for(i=0,o=u.length;i1024&&(s+="? "),s+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Te(t,e,r,!1,!1)&&(c+=s+=t.dump));t.tag=l,t.dump="{"+c+"}"}(t,e,t.dump),h&&(t.dump="&ref_"+p+" "+t.dump));else if("[object Array]"===l)i&&0!==t.dump.length?(t.noArrayIndent&&!r&&e>0?xe(t,e-1,t.dump,o):xe(t,e,t.dump,o),h&&(t.dump="&ref_"+p+t.dump)):(function(t,e,n){var i,o,a,r="",s=t.tag;for(i=0,o=n.length;i",t.dump=c+" "+t.dump)}return!0}function Ae(t,e){var n,i,o=[],a=[];for(Se(t,o,a),n=0,i=a.length;n=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};class Be extends t.WF{constructor(){super(...arguments),this.baseTabIndex=0,this.entryIndex=-1,this.actionsTabIndex=0,this.touchpadTabIndex=2,this.guiMode=!0,this.yamlStringsCache={},this.people=[],this.BASE_TABS=["general","layout","actions","icons"],this.TOUCHPAD_TABS=["up","down","center","left","right"],this.DEFAULT_KEYS=[],this.DEFAULT_SOURCES=[],this.DEFAULT_ACTIONS=[]}static get properties(){return{hass:{},config:{}}}setConfig(t){this.config=t}configChanged(t){t=this.autofillDefaultFields(t);const e=new Event("config-changed",{bubbles:!0,composed:!0});e.detail={config:t},this.dispatchEvent(e),this.requestUpdate()}entriesChanged(t){let e;e=3===this.baseTabIndex?"custom_icons":"custom_actions",this.configChanged({...this.config,[e]:t})}entryChanged(t){let e,n,i;if(3===this.baseTabIndex)e=structuredClone(this.config.custom_icons??[]),n=e[this.entryIndex],i={...n,...t};else switch(e=structuredClone(this.config.custom_actions??[]),n=e[this.entryIndex],this.renderTemplate(n?.type,this.getEntryContext(n))){case"touchpad":if(2!=this.touchpadTabIndex){i={...n,[this.TOUCHPAD_TABS[this.touchpadTabIndex]]:{...n[this.TOUCHPAD_TABS[this.touchpadTabIndex]],...t}};break}default:i={...n,...t}}e[this.entryIndex]=i,this.entriesChanged(e)}toggleGuiMode(t){this.yamlString=void 0,this.configChanged(this.config),this.guiMode=!this.guiMode}get activeEntry(){if(this.entryIndex<0)return;let t;return 3===this.baseTabIndex?(this.config.custom_icons??[])[this.entryIndex]:(t=(this.config.custom_actions??[])[this.entryIndex],"touchpad"===this.renderTemplate(t?.type,this.getEntryContext(t))&&2!=this.touchpadTabIndex?t[this.TOUCHPAD_TABS[this.touchpadTabIndex]]??{}:t)}get yaml(){if(null==this.yamlString){let t="";switch(this.baseTabIndex){case 3:case 2:t=$e(this.activeEntry);break;case 1:t=$e(this.config.rows)}this.yamlString=["{}","[]"].includes(t.trim())?"":t}return this.yamlString??""}set yaml(t){this.yamlString=t;try{const t=Me(this.yaml);switch(this.baseTabIndex){case 3:{const e=structuredClone(this.config.custom_icons??[]);e[this.entryIndex]=t,this.entriesChanged(e);break}case 2:{const e=structuredClone(this.config.custom_actions??[]);switch(this.renderTemplate(e[this.entryIndex].type,this.getEntryContext(t))){case"touchpad":if(2!=this.touchpadTabIndex){e[this.entryIndex]={...e[this.entryIndex],[this.TOUCHPAD_TABS[this.touchpadTabIndex]]:t};break}default:e[this.entryIndex]=t}this.entriesChanged(e);break}case 1:this.configChanged({...this.config,rows:t})}this.errors=void 0}catch(t){this.errors=[t.message]}}handleYamlCodeChanged(t){t.stopPropagation();const e=t.detail.value;e!=this.yaml&&(this.yaml=e)}handleStyleCodeChanged(t){t.stopPropagation();const e=t.detail.value;this.entryIndex>-1&&this.activeEntry?e!=this.activeEntry?.styles&&this.entryChanged({styles:e}):e!=this.config.styles&&this.configChanged({...this.config,styles:e})}handleActionCodeChanged(t){t.stopPropagation();const e=t.target.id,n=t.detail.value;if(this.yamlStringsCache[e]=n,this.activeEntry)try{const t=Me(n);if(JSON.stringify(t??{}).includes("null"))return;this.entryChanged({[e]:t}),this.errors=void 0}catch(t){this.errors=[t.message]}}handleEvalCodeChanged(t){t.stopPropagation();const e=t.target.id,n=t.detail.value;this.activeEntry&&this.entryChanged({type:this.activeEntry.type,name:this.activeEntry.name,[e]:{...this.activeEntry[e],eval:n}})}handleBaseTabSelected(t){this.yamlStringsCache={},this.yamlString=void 0,this.entryIndex=-1,this.guiMode=!0;const e=t.detail.index;this.baseTabIndex!=e&&(this.baseTabIndex=e)}handleActionsTabSelected(t){this.yamlStringsCache={};const e=t.detail.index;this.actionsTabIndex!=e&&(this.actionsTabIndex=e)}handleTouchpadTabSelected(t){this.yamlString=void 0,this.yamlStringsCache={};const e=t.detail.index;this.touchpadTabIndex!=e&&(this.touchpadTabIndex=e,this.setActionsTab(this.entryIndex))}handleSelectorChange(t){this.yamlStringsCache={};const e=t.target.id;let n=t.detail.value;switch(e.endsWith(".confirmation.exemptions")&&(n=(n??[]).map((t=>({user:t})))),this.baseTabIndex){case 3:case 2:this.entryChanged((0,Ke.HD)(structuredClone(this.activeEntry),e,n));break;default:this.configChanged({...this.config,[e]:n})}null==n&&setTimeout((()=>{this.configChanged(this.config)}),100)}handleLayoutActionListItemDragStart(t){t.stopPropagation(),t.isTrusted&&t.dataTransfer&&t.dataTransfer.setData("text/plain","- "+t.currentTarget.innerText)}addEntry(t){const e=t.detail.index;let n;switch(this.baseTabIndex){case 3:n=structuredClone(this.config.custom_icons)??[],n.push({name:`custom_icon_${(this.config.custom_icons??[]).length}`,path:""});break;default:{const t=Re[e];n=structuredClone(this.config.custom_actions)??[];let i=t;const o=this.config.custom_actions?.filter((e=>e.type==t));o&&o.length&&(i+=`_${(this.config.custom_actions??[]).length}`),n.push({type:Re[e],name:i});break}}this.entriesChanged(n);const i=this.shadowRoot?.querySelector(".features");i&&setTimeout((()=>i.scrollTop=i.scrollHeight),100)}removeEntry(t){const e=t.currentTarget.index;let n;n=3===this.baseTabIndex?this.config.custom_icons??[]:this.config.custom_actions??[],n=structuredClone(n),n.splice(e,1),this.entriesChanged(n)}moveEntry(t){let e;t.stopPropagation(),e=3===this.baseTabIndex?this.config.custom_icons??[]:this.config.custom_actions??[],e=structuredClone(e);const{oldIndex:n,newIndex:i}=t.detail;e.splice(i,0,e.splice(n,1)[0]),this.entriesChanged(e)}copyEntry(t){let e;e=3===this.baseTabIndex?this.config.custom_icons??[]:this.config.custom_actions??[],e=structuredClone(e);const n=t.currentTarget.index,i=structuredClone(e[n]);i.name=`${i.name}_copy`,e.splice(n,1,e[n],i),this.entriesChanged(e)}editEntry(t){this.yamlStringsCache={},this.yamlString=void 0;const e=t.currentTarget.index;3===this.baseTabIndex||(this.setActionsTab(e),this.touchpadTabIndex=2),this.entryIndex=e}exitEditEntry(t){this.yamlStringsCache={},this.yamlString=void 0,this.entryIndex=-1}setActionsTab(t){let e=this.config.custom_actions?.[t]??{type:"button",name:""};const n=e.type;"touchpad"==n&&2!=this.touchpadTabIndex&&(e=e[this.TOUCHPAD_TABS[this.touchpadTabIndex]]??{});const i=this.getEntryContext(e);"none"!=this.renderTemplate(e?.momentary_start_action?.action??"none",i)||"none"!=this.renderTemplate(e?.momentary_end_action?.action??"none",i)?"touchpad"==n&&2==this.touchpadTabIndex?this.actionsTabIndex=2:this.actionsTabIndex=1:"touchpad"!=n||"none"==this.renderTemplate(e?.multi_tap_action?.action??"none",i)&&"none"==this.renderTemplate(e?.multi_double_tap_action?.action??"none",i)&&"none"==this.renderTemplate(e?.multi_hold_action?.action??"none",i)?this.actionsTabIndex=0:this.actionsTabIndex=1}buildIconElement(e,n){let i=t.qy``,o=this.renderTemplate(e.icon??e.path??"",n);if(!o.includes(":")){const t=(this.config.custom_icons??[]).filter((t=>t.name==o))[0]??Ue.o$.filter((t=>t.name==o))[0];o=t?.path??o}if(!o.length)switch(this.renderTemplate(e?.type,n)){case"touchpad":o="mdi:gesture-tap-button";break;case"slider":o=this.renderTemplate(e?.vertical??!1,n)?"mdi:tune-vertical-variant":"mdi:tune-variant";break;default:o="mdi:circle-small"}return i=o.includes(":")?t.qy``:t.qy``,i}buildEntryList(){let e,n;return 3===this.baseTabIndex?(e=this.config.custom_icons??[],n="Custom Icons"):(e=this.config.custom_actions??[],n="Custom Actions"),t.qy`
${n}
${e.map(((e,n)=>{const i=this.getEntryContext(e),o=this.buildIconElement(e,i),a=this.renderTemplate(e.label,i),r=this.renderTemplate(e.type,i),s=this.renderTemplate(e.name,i);return t.qy`
${o}
${r} ⸱ ${s} ${a?` ⸱ ${a}`:""} ${i.config.entity?t.qy`${i.config.entity}${i.config.attribute?` ⸱ ${i.config.attribute}`:""}`:""}
`}))}
`}buildAddEntryButton(){return 3===this.baseTabIndex?t.qy``:t.qy`${Re.map((e=>t.qy`${e}`))}`}buildEntryHeader(){let e;return e=3===this.baseTabIndex?"SVG Icon":this.renderTemplate(this.config.custom_actions?.[this.entryIndex]?.type??"button",this.getEntryContext(this.activeEntry??{type:"button",name:""})),t.qy`
${e}
`}buildSelector(e,n,i,o){const a={...this.hass,localize:(t,e)=>({"ui.panel.lovelace.editor.action-editor.actions.repeat":"Repeat","ui.panel.lovelace.editor.action-editor.actions.fire-dom-event":"Fire DOM event","ui.panel.lovelace.editor.action-editor.actions.eval":"Evaluate JS","ui.panel.lovelace.editor.action-editor.actions.key":"Key","ui.panel.lovelace.editor.action-editor.actions.source":"Source","ui.panel.lovelace.editor.action-editor.actions.keyboard":"Keyboard","ui.panel.lovelace.editor.action-editor.actions.textbox":"Textbox","ui.panel.lovelace.editor.action-editor.actions.search":"Search"}[t]??this.hass.localize(t,e))};let r;switch(this.baseTabIndex){case 3:case 2:r=(0,Ke.vz)(this.activeEntry,n);break;case 1:break;default:r=this.config[n]}return n.endsWith(".confirmation.exemptions")&&(r=(r??[]).map((t=>t.user))),t.qy``}buildMainFeatureOptions(e=t.qy``){const n=this.renderTemplate(this.activeEntry.autofill_entity_id??this.config.autofill_entity_id??je.$6,this.getEntryContext(this.activeEntry)),i=(Array.isArray(this.activeEntry?.tap_action?.target?.entity_id)?this.activeEntry?.tap_action?.target?.entity_id?.[0]:this.activeEntry?.tap_action?.target?.entity_id)??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id;return t.qy`${this.buildSelector("Name","name",{text:{}})} ${this.buildSelector("Entity","entity_id",{entity:{}},n?i:void 0)} ${this.hass.states[this.activeEntry?.entity_id??(n?i:"")??""]?this.buildSelector("Attribute","value_attribute",{attribute:{entity_id:this.activeEntry?.entity_id??i}},n?"state":void 0):""}
${e} ${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},this.config.autofill_entity_id??je.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},n?this.config.haptics??je.Xy:je.Xy)}
`}buildAppearancePanel(e=t.qy``){return t.qy`
Appearance
${this.buildAlertBox("Change the feature appearance based on its value using a template like '{{ value | float }}'.")} ${e}${this.buildCodeEditor("css")}
`}buildCommonAppearanceOptions(){const e=this.getEntryContext(this.activeEntry??{type:"button",name:""});let n,i=this.renderTemplate(this.activeEntry?.icon??"",e);if(i&&!i.includes(":")){const e=(this.config.custom_icons??[]).filter((t=>t.name==i))[0]??Ue.o$.filter((t=>t.name==i))[0];i=e?.path??i,n=t.qy``}return t.qy`${this.buildSelector("Label","label",{text:{multiline:!0}})}
${this.buildSelector("Icon","icon",{icon:{}})}${n??""}${this.buildSelector("Units","unit_of_measurement",{text:{}})}
`}buildInteractionsPanel(e){return t.qy`
Interactions
${e}
`}buildActionOption(e,n,i,o=!1){const a=this.getEntryContext(this.activeEntry??{}),r=this.renderTemplate(this.activeEntry.autofill_entity_id??this.config.autofill_entity_id??je.$6,a),s=this.renderTemplate(this.activeEntry?.[n]?.action??"none",a),c=this.renderTemplate(this.activeEntry?.[n]?.platform??this.config.platform??"Android TV",a);return t.qy`
${this.buildSelector(e,n,i)} ${"none"!=s&&"double_tap_action"==n?this.buildSelector("Double tap window","double_tap_action.double_tap_window",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.double_tap_window:void 0)??je.jc):"none"!=s&&"multi_double_tap_action"==n?this.buildSelector("Double tap window","multi_double_tap_action.double_tap_window",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.double_tap_window:void 0)??je.jc):"hold_action"==n&&this.activeEntry.hold_action?t.qy`
${this.buildSelector("Hold time","hold_action.hold_time",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.hold_time:void 0)??je.At)} ${"repeat"==this.renderTemplate(this.activeEntry?.hold_action?.action,a)?this.buildSelector("Repeat delay","hold_action.repeat_delay",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.repeat_delay:void 0)??je.a3):""}
`:"multi_hold_action"==n&&this.activeEntry.multi_hold_action?t.qy`
${this.buildSelector("Hold time","multi_hold_action.hold_time",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.hold_time:void 0)??je.At)} ${"repeat"==this.renderTemplate(this.activeEntry?.multi_hold_action?.action,a)?this.buildSelector("Repeat delay","multi_hold_action.repeat_delay",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.repeat_delay:void 0)??je.a3):""}
`:""} ${"key"==s?t.qy`
${["Kodi","LG webOS"].includes(c)?this.buildSelector("Media Player ID",`${n}.media_player_id`,{entity:{filter:{domain:"media_player"}}},r?this.config.media_player_id:void 0):this.buildSelector("Remote ID",`${n}.remote_id`,{entity:{filter:{domain:"remote"}}},r?this.config.remote_id:void 0)} ${this.buildSelector("Platform",`${n}.platform`,{select:{mode:"dropdown",options:Ne,reorder:!1}},r?this.config.platform??"Android TV":"Android TV")}
${this.buildSelector("Key",`${n}.key`,{text:{}})}`:""} ${"source"==s?t.qy`
${["Android TV"].includes(c)?this.buildSelector("Remote ID",`${n}.remote_id`,{entity:{filter:{domain:"remote"}}},r?this.config.remote_id:void 0):this.buildSelector("Media Player ID",`${n}.media_player_id`,{entity:{filter:{domain:"media_player"}}},r?this.config.media_player_id:void 0)} ${this.buildSelector("Platform",`${n}.platform`,{select:{mode:"dropdown",options:Ne,reorder:!1}},r?this.config.platform??"Android TV":"Android TV")}
${this.buildSelector("Source",`${n}.source`,{text:{}})}`:""} ${["keyboard","textbox","search"].includes(s)?t.qy`
${this.buildSelector("Keyboard ID",`${n}.keyboard_id`,{entity:{filter:{domain:["remote","media_player"]}}},r?this.config.keyboard_id:void 0)} ${this.buildSelector("Platform",`${n}.platform`,{select:{mode:"dropdown",options:Ie,reorder:!1}},r&&Ie.includes(this.config.platform)?this.config.platform:"Android TV")}
${["Android TV","Roku"].includes(c)?t.qy`
${this.buildSelector("Remote ID",`${n}.remote_id`,{entity:{filter:{domain:"remote"}}},r?this.config.remote_id:void 0)} ${"Roku"==c?this.buildSelector("Media Player ID",`${n}.media_player_id`,{entity:{filter:{domain:"media_player"}}},r?this.config.media_player_id:void 0):""}
`:""} ${this.buildSelector("Prompt",`${n}.keyboard_prompt`,{text:{}})}`:""} ${"more-info"==s?this.buildSelector("Entity",`${n}.target.entity_id`,{entity:{}},r?this.activeEntry?.entity_id??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id:void 0):""} ${"toggle"==s?this.buildSelector("Target",`${n}.target`,{target:{}}):""} ${o||"fire-dom-event"==s?this.buildCodeEditor("action",n):""} ${"eval"==s?t.qy`${this.buildAlertBox("Evaluating raw JavaScript strings in browser is considered extremely unsafe. Do not use unless you know what you're doing!","warning")} ${this.buildCodeEditor("eval",n)}`:""} ${"none"!=s?t.qy`${this.buildSelector("Confirmation",`${n}.confirmation`,{boolean:{}},!1)} ${this.activeEntry?.[n]?.confirmation?t.qy`${this.buildSelector("Text",`${n}.confirmation.text`,{text:{}})} ${this.buildSelector("Exemptions",`${n}.confirmation.exemptions`,{select:{multiple:!0,mode:"list",options:this.people,reorder:!1}})}`:""}`:""}
`}buildTabBar(e,n,i){return t.qy`${i.map((e=>t.qy``))}`}buildButtonGuiEditor(){const e=this.buildTabBar(this.actionsTabIndex,this.handleActionsTabSelected,["default","momentary"]);let n;const i=De.concat();i.splice(De.indexOf("repeat"),1);const o={ui_action:{actions:i}};return n=1===this.actionsTabIndex?t.qy`${e} ${this.buildActionOption("Start behavior (optional)","momentary_start_action",o)} ${this.buildAlertBox("Set the action below, and then use the code editor to set a data field to the seconds the feature was held down using a template like '{{ hold_secs | float }}'.")} ${this.buildActionOption("End behavior (optional)","momentary_end_action",o,!0)}`:t.qy`${e} ${this.buildActionOption("Tap behavior (optional)","tap_action",o)} ${this.buildActionOption("Double tap behavior (optional)","double_tap_action",o)} ${this.buildActionOption("Hold behavior (optional)","hold_action",{ui_action:{actions:De}})}`,t.qy`${this.buildMainFeatureOptions()} ${this.buildAppearancePanel(this.buildCommonAppearanceOptions())} ${this.buildInteractionsPanel(n)}`}buildButtonPadGuiEditor(){return t.qy`Coming Soon!`}buildSliderGuiEditor(){const e=De.concat();e.splice(De.indexOf("repeat"),1);const n=this.getEntryContext(this.activeEntry??{}),i=Number(this.renderTemplate(this.activeEntry?.range?.[0],n)),o=Number(this.renderTemplate(this.activeEntry?.range?.[0],n)),a=Number(this.renderTemplate(this.activeEntry?.step,n)),r=this.renderTemplate(this.activeEntry?.unit_of_measurement,n);return t.qy`${this.buildMainFeatureOptions(t.qy`${this.buildSelector("Min","range.0",{number:{max:o??void 0,step:a,mode:"box",unit_of_measurement:r},RANGE_MIN:je.HB})} ${this.buildSelector("Max","range.1",{number:{min:i??void 0,step:a,mode:"box",unit_of_measurement:r},RANGE_MAX:je.bQ})} ${this.buildSelector("Step","step",{number:{min:0,step:a??Math.min(1,((o??je.bQ)-(i??je.HB))/je.zM),mode:"box",unit_of_measurement:r},STEP:je.RZ})} ${this.buildSelector("Update after action delay","value_from_hass_delay",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},je.s$)}`)} ${this.buildAppearancePanel(t.qy`${this.buildCommonAppearanceOptions()}${this.buildSelector("Vertical","vertical",{boolean:{}},!1)}`)} ${this.buildInteractionsPanel(t.qy`${this.buildAlertBox()} ${this.buildActionOption("Behavior","tap_action",{ui_action:{actions:e}},!0)}`)}`}buildTouchpadGuiEditor(){const e=["default","multi-touch"];2==this.touchpadTabIndex&&e.push("momentary");const n=this.buildTabBar(this.actionsTabIndex,this.handleActionsTabSelected,e);let i;const o=De.concat();o.splice(De.indexOf("repeat"),1);const a={ui_action:{actions:o}};switch(this.actionsTabIndex){case 2:i=t.qy`${n} ${this.buildActionOption("Start behavior (optional)","momentary_start_action",a)} ${this.buildAlertBox("Set the action below, and then use the code editor to set a data field to the seconds the feature was held down using a template like '{{ hold_secs | float }}'.")} ${this.buildActionOption("End behavior (optional)","momentary_end_action",a,!0)}`;break;case 1:i=t.qy`${n} ${this.buildActionOption(`Multi-touch ${2==this.touchpadTabIndex?"tap":"swipe"} behavior (optional)`,"multi_tap_action",a)} ${2==this.touchpadTabIndex?this.buildActionOption("Multi-touch double tap behavior (optional)","multi_double_tap_action",a):""} ${this.buildActionOption("Multi-touch hold behavior (optional)","multi_hold_action",{ui_action:{actions:De}})}`;break;default:i=t.qy`${n} ${this.buildActionOption((2==this.touchpadTabIndex?"Tap":"Swipe")+" behavior (optional)","tap_action",a)} ${2==this.touchpadTabIndex?this.buildActionOption("Double tap behavior (optional)","double_tap_action",a):""} ${this.buildActionOption("Hold behavior (optional)","hold_action",{ui_action:{actions:De}})}`}const r=this.buildTabBar(this.touchpadTabIndex,this.handleTouchpadTabSelected,this.TOUCHPAD_TABS);return t.qy`${r} ${2==this.touchpadTabIndex?this.buildMainFeatureOptions():""} ${this.buildAppearancePanel(this.buildCommonAppearanceOptions())} ${this.buildInteractionsPanel(i)}`}buildIconGuiEditor(){return t.qy`
${this.buildAlertBox("Icons must be resized to 24x24px to display correctly. Use a tool like https://yqnn.github.io/svg-path-editor/ to edit your SVG paths. If correctly sized the icon will perfectly fit in the preview ouline below.","info")} ${this.buildSelector("Name","name",{text:{}})} ${this.buildSelector("SVG Path","path",{text:{multiline:!0}})}
`}buildEntryGuiEditor(){let e;if(3===this.baseTabIndex)e=this.buildIconGuiEditor();else switch(this.config.custom_actions?.[this.entryIndex]?.type){case"slider":e=this.buildSliderGuiEditor();break;case"touchpad":e=this.buildTouchpadGuiEditor();break;default:e=this.buildButtonGuiEditor()}return t.qy`
${e}
`}buildCodeEditor(e,n){let i,o,a,r,s,c;switch(e){case"css":c="jinja2",o=(this.entryIndex>-1?this.activeEntry?.styles:this.config.styles)??"",a=this.handleStyleCodeChanged,i="CSS Styles",r=!0,s=!1;break;case"action":c="yaml",a=this.handleActionCodeChanged,n=n??"tap_action",o=this.yamlStringsCache[n]??$e(this.activeEntry?.[n]??{}),o="{}"==o.trim()?"":o,r=!0,s=!1;break;case"layout":c="yaml",o=this.yaml,a=this.handleYamlCodeChanged,o="[]"==o.trim()?"":o,r=!1,s=!1;break;case"eval":c="jinja2",o=this.yamlStringsCache[`${n}.eval`]??(this.activeEntry?.[n]).eval??"",a=this.handleEvalCodeChanged,r=!1,s=!1;break;default:c="yaml",o=this.yaml,a=this.handleYamlCodeChanged,r=!0,s=!0}return t.qy`
${i?t.qy`
${i}
`:""}
`}buildEntryEditor(){let e;return e=this.guiMode?this.buildEntryGuiEditor():this.buildCodeEditor("yaml"),t.qy`${this.buildEntryHeader()}
${e}
`}buildLayoutEditor(){const e=Array.from(new Set([...this.config.custom_actions?.map((t=>t.name))??[],...this.customActionsFromFile?.map((t=>t.name))??[]])),n=e.map((t=>this.config.custom_actions?.filter((e=>e.name==t))[0]??this.customActionsFromFile?.filter((e=>e.name==t))[0]??{type:"button",name:""})),i=this.DEFAULT_KEYS.filter((t=>!e.includes(t.name))),o=this.DEFAULT_SOURCES.filter((t=>!e.includes(t.name)));return t.qy`
${this.buildCodeEditor("layout")}
${n?.length?t.qy`
Custom Actions
    ${n.map((e=>{const n=this.getEntryContext(e),i=this.buildIconElement(e,n);return t.qy`
  • ${i} ${e.name}
  • `}))}

`:""}
${i.length?t.qy`
Default Keys
    ${i.map((e=>{const n=this.getEntryContext(e),i=this.buildIconElement(e,n);return t.qy`
  • ${i} ${e.name}
  • `}))}
`:""} ${o.length?t.qy`
Default Sources
    ${o.map((e=>{const n=this.getEntryContext(e),i=this.buildIconElement(e,n);return t.qy`
  • ${i} ${e.name}
  • `}))}
`:""}
`}buildGeneralEditor(){return t.qy`
Media Platform and Entity IDs
${this.buildSelector("Platform","platform",{select:{mode:"dropdown",options:Ne,reorder:!1}},"Android TV")} ${this.buildSelector("Remote ID","remote_id",{entity:{filter:{domain:"remote"}}})} ${this.buildSelector("Keyboard ID","keyboard_id",{entity:{filter:{domain:["remote","media_player"]}}})} ${this.buildSelector("Media Player ID","media_player_id",{entity:{filter:{domain:"media_player"}}})}
Action Timings
${this.buildSelector("Hold time","hold_time",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},je.At)} ${this.buildSelector("Repeat delay","repeat_delay",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},je.a3)} ${this.buildSelector("Double tap window","double_tap_window",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},je.jc)}
Miscellaneous
${this.buildCodeEditor("css")}
${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},je.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},je.Xy)}
${this.buildSelector("Title","title",{text:{}})}
${this.buildSelector("Custom Actions File","custom_actions_file",{text:{}})}
`}buildErrorPanel(){return t.qy`${this.errors&&this.errors.length>0?t.qy`
${this.hass.localize("ui.errors.config.error_detected")}:
    ${this.errors.map((e=>t.qy`
  • ${e}
  • `))}
`:""}`}buildAlertBox(e="Set the action below, and then use the code editor to set a data field to the feature's new value using a template like '{{ value | float }}'.",n="info"){return t.qy``}buildPeopleList(){this.people=[];const t=Object.keys(this.hass.states).filter((t=>t.startsWith("person.")));for(const e of t)this.people.push({value:this.hass.states[e].attributes.user_id,label:this.hass.states[e].attributes.friendly_name??this.hass.states[e].attributes.id??e})}fetchCustomActionsFromFile(t){if(!this.customActionsFromFile&&t){t=`${t.startsWith("/")?"":"/"}${t}`;try{const e=t.split(".").pop()?.toLowerCase();this.hass.fetchWithAuth(t).then((t=>"json"==e?t.json():t.text())).then((t=>{const n="json"==e?t:Me(t);if(!Array.isArray(n))throw TypeError(n);this.customActionsFromFile=n,this.requestUpdate()}))}catch(e){console.error(`File ${t} is not a valid JSON or YAML array\n${e}`),this.customActionsFromFile=[]}}}render(){if(!this.hass||!this.config)return t.qy``;const e={config:{...this.config,entity:(0,n.X)(this.hass,this.config.remote_id??this.config.media_player_id??this.config.keyboard_id??""),attribute:"state"}};this.buildPeopleList(),this.fetchCustomActionsFromFile((0,n.X)(this.hass,this.config.custom_actions_file??""));const i=(0,n.X)(this.hass,this.config.platform??"Android TV",e),[o,a]=(0,Ke.XO)(i);this.DEFAULT_KEYS=o,this.DEFAULT_SOURCES=a,this.DEFAULT_ACTIONS=[...o,...a];const r=this.buildTabBar(this.baseTabIndex,this.handleBaseTabSelected,this.BASE_TABS);let s;switch(this.baseTabIndex){case 3:case 2:s=this.entryIndex>-1&&this.activeEntry?t.qy`${this.buildEntryEditor()}`:t.qy`${this.buildEntryList()}${this.buildAddEntryButton()}`;break;case 1:s=this.buildLayoutEditor();break;default:s=this.buildGeneralEditor()}return t.qy`${r}${s}${this.buildErrorPanel()}`}renderTemplate(t,e){e={render:t=>this.renderTemplate(t,e),...e};const i=(0,n.X)(this.hass,t,e);if(i!=t)return i;if("string"==typeof t)for(const n of["VALUE","HOLD_SECS","UNIT"]){if(t==n)return e[n];t.includes(n)&&(t=t.replace(new RegExp(n,"g"),e[n]??""))}return t}getEntryContext(t){const e={VALUE:0,HOLD_SECS:0,UNIT:"",value:0,hold_secs:0,unit:"",config:{...t,entity:"",attribute:""}};e.config.attribute=this.renderTemplate(t?.value_attribute??"state",e),e.config.entity=this.renderTemplate(t?.entity_id??(Array.isArray(t?.tap_action?.target?.entity_id)?t?.tap_action?.target?.entity_id?.[0]:t?.tap_action?.target?.entity_id)??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id,e);const n=this.renderTemplate(t?.unit_of_measurement,e);e.UNIT=n,e.unit=n;const i=this.getFeatureValue(e.config.entity,e.config.attribute);return e.VALUE=i,e.value=i,e}getFeatureValue(t,e){if(this.hass.states[t]){if("state"!=e&&e){let n;const i=e.match(/\[\d+\]$/);if(i){const o=parseInt(i[0].replace(/\[|\]/g,""));return e=e.replace(i[0],""),n=this.hass.states[t].attributes[e],n&&Array.isArray(n)&&n.length?n[o]:void 0}if(n=this.hass.states[t].attributes[e],null!=n||"elapsed"==e)switch(e){case"brightness":return Math.round(100*parseInt(n??0)/255);case"elapsed":if(t.startsWith("timer.")){const e=this.hass.states[t].attributes.duration.split(":"),n=3600*parseInt(e[0])+60*parseInt(e[1])+parseInt(e[2]);if("idle"==this.hass.states[t].state)return 0;if("active"==this.hass.states[t].state){const e=(Date.parse(this.hass.states[t].attributes.finishes_at)-Date.now())/1e3,i=Math.floor(n-e);return Math.min(i,n)}{const e=this.hass.states[t].attributes.remaining.split(":"),i=3600*parseInt(e[0])+60*parseInt(e[1])+parseInt(e[2]);return Math.floor(n-i)}}default:return n}return n}return this.hass.states[t].state}return""}updatePlatform(t){switch(t){case"KODI":case"Kodi":return"Kodi";case"ROKU":case"Roku":return"Roku";case"FIRE":case"FIRETV":case"FIRE_TV":case"FIRE TV":case"Fire TV":return"Fire TV";case"BRAVIA":case"Sony BRAVIA":return"Sony BRAVIA";case"APPLE TV":case"Apple TV":return"Apple TV";case"SAMSUNG TV":case"Samsung TV":return"Samsung TV";case"WEBOS":case"LG webOS":return"LG webOS";case"ANDROID":case"ANDROIDTV":case"ANDROID_TV":case"ANDROID TV":case"Android TV":return"Android TV";default:return}}autofillDefaultFields(t){const e=structuredClone(t),n=[];for(const t of e.custom_actions??[])n.push(this.autofillDefaultEntryFields(e,t));return e.custom_actions=n,e}autofillDefaultEntryFields(t,e,n,i){const o=this.getEntryContext(e);if(this.renderTemplate(e.autofill_entity_id??t.autofill_entity_id??je.$6,o)){if(n&&i){const t=structuredClone([...this.customActionsFromFile??[],...this.DEFAULT_ACTIONS].filter((t=>t.name==n))[0])??{},o=t[i];e={...o,...e}}else{const t=structuredClone([...this.customActionsFromFile??[],...this.DEFAULT_ACTIONS].filter((t=>t.name==this.renderTemplate(e.name,o)))[0])??{};e={...t,...e,value_attribute:e.value_attribute??t.value_attribute}}for(const t of Pe)if(e[t]){const n=e[t]??{};switch(this.renderTemplate(n.action,o)){case"keyboard":case"textbox":case"search":case"key":case"source":break;case"toggle":case"more-info":case"service":case"perform-action":for(const t of["entity_id","device_id","area_id","label_id"])n.data?.[t]&&(n.target=n.target??{},n.target[t]=n.data?.[t],delete n.data?.[t]);default:delete n.keyboard_id,delete n.keyboard_prompt,delete n.remote_id,delete n.media_player_id,delete n.platform}e[t]=n}if("touchpad"==this.renderTemplate(e.type,o))for(const n of Fe)e[n]&&(e[n]=this.autofillDefaultEntryFields(t,e[n]??{},this.renderTemplate(e.name,o),n))}return e}handleUpdateDeprecatedConfig(){const t=this.updateDeprecatedFields(this.config);this.configChanged(t)}updateDeprecatedFields(t=this.config){const e=structuredClone(t);if("adb_id"in e&&(e.keyboard_id=e.adb_id,delete e.adb_id),"keyboard_mode"in e&&(e.platform=e.keyboard_mode,delete e.keyboard_mode),e.platform=this.updatePlatform(e.platform),"enable_button_feedback"in e&&(e.haptics=e.enable_button_feedback),"button_haptics"in e&&(e.haptics=e.button_haptics),!e.rows){const n=[],i=Object.keys(e).filter((t=>t.includes("_row")));for(const o of i){let i=t[o];"string"==typeof i&&(i=[i]),"volume_row"==o?i=["volume_"+i[0]]:"navigation_row"==o&&(i=["navigation_"+i[0]]),n.push(i),delete e[o]}e.rows=n}const n=JSON.stringify(e.rows??[]).replace(/vol_buttons/g,"volume_buttons").replace(/nav_buttons/g,"navigation_buttons").replace(/d_pad/g,"dpad").replace(/direction_pad/g,"dpad").replace(/num_pad/g,"numpad").replace(/number_pad/g,"numpad").replace(/x_pad/g,"xpad").replace(/gamepad/g,"xpad").replace(/xgamepad/g,"xpad").replace(/x_gamepad/g,"xpad").replace(/n_pad/g,"npad").replace(/ngamepad/g,"npad").replace(/n_gamepad/g,"npad").replace(/volume_slider/g,"slider").replace(/nav_touchpad/g,"touchpad").replace(/navigation_touchpad/g,"touchpad");if(e.rows=JSON.parse(n),!Array.isArray(e.custom_icons)&&"object"==typeof e.custom_icons&&null!=e.custom_icons){const t=[];for(const n of Object.keys(e.custom_icons))t.push({name:n,path:e?.custom_icons?.[n]});e.custom_icons=t}let i=[];if(Array.isArray(e.custom_actions)||"object"!=typeof e.custom_actions||null==e.custom_actions)i=e.custom_actions??[];else for(const t of Object.keys(e.custom_actions))i.push({...e.custom_actions?.[t],name:t});for(const t of["custom_keys","custom_sources"])if(t in e){for(const n of Object.keys(e[t]))i.push({...e[t]?.[n],name:n});delete e[t]}const o=i.findIndex((t=>"slider"==t.name)),a=i[o]??{type:"slider",name:"slider"};let r=!1;if("slider_style"in e){let t=a.styles??"";t+="\n:host {";const n=e.slider_style;for(const e in n)t+=`\n ${e}: ${n[e]};`;t+="\n}",a.styles=t.trim(),delete e.slider_style,r=!0}if("tooltip"in a){let t=a.styles??"";t+=`\n.tooltip {\n display: {{ "initial" if render(${a.tooltip}) else "none" }};\n}`,a.styles=t.trim(),r=!0}if("slider_range"in e&&(a.range=e.slider_range,delete e.slider_range,r=!0),"slider_step"in e&&(a.step=e.slider_step,delete e.slider_step,r=!0),"slider_attribute"in e&&(a.value_attribute=e.slider_attribute,delete e.slider_attribute,r=!0),"enable_slider_feedback"in e&&(a.haptics=e.enable_slider_feedback,delete e.enable_slider_feedback,r=!0),"slider_haptics"in e&&(a.haptics=e.slider_haptics,delete e.slider_haptics,r=!0),"slider_id"in e){e.media_player_id||(e.media_player_id=e.slider_id),a.entity_id=a.entity_id??e.slider_id??t.media_player_id??"";const n=a.tap_action??this.DEFAULT_KEYS.filter((t=>"slider"==t.name))[0].tap_action;if(n){const t=n.data??{},i=n.target??{};"entity_id"in i||(i.entity_id=t.entity_id??e.slider_id,delete t.entity_id),n.data=t,n.target=i}a.tap_action=n,delete e.slider_id,r=!0}if(r){const t=this.DEFAULT_KEYS.filter((t=>"slider"==t.name))[0];o>-1?i[o]={...structuredClone(t),...a}:i.push({...structuredClone(t),...a})}const s=i.findIndex((t=>"touchpad"==t.name)),c=i[s]??{type:"touchpad",name:"touchpad"};let l=!1;if("touchpad_style"in e){let t=c.styles??"";t+="\ntoucharea {";const n=e.touchpad_style;for(const e in n)t+=`\n ${e}: ${n[e]};`;t+="\n}",c.styles=t.trim(),delete e.touchpad_style,l=!0}if("touchpad_height"in e){let t=c.styles??"";t+=`\ntoucharea {\n height: ${e.touchpad_height};\n}`,c.styles=t.trim(),delete e.touchpad_height,l=!0}"enable_touchpad_feedback"in e&&(c.haptics=e.enable_touchpad_feedback,delete e.enable_touchpad_feedback,l=!0),"touchpad_haptics"in e&&(c.haptics=e.touchpad_haptics,delete e.touchpad_haptics,l=!0),"enable_double_click"in e&&(c.double_tap_action={action:"key",key:e.double_click_keycode??"BACK"},delete e.enable_double_click,delete e.double_click_keycode,l=!0),"long_click_keycode"in e&&(c.hold_action={action:"key",key:e.long_click_keycode??"DPAD_CENTER"},l=!0);const u=this.DEFAULT_KEYS.filter((t=>"touchpad"==t.name))[0];if(e.rows.toString().includes("touchpad")){const t=i.filter((t=>"center"==t.name))[0];if(t){for(const e of Pe)t[e]?c[e]=t[e]:u[e]&&!c[e]&&(c[e]=u[e]);l=!0}for(const t of Fe){const n=i.filter((e=>e.name==t))[0];!c[t]&&n&&e.rows.toString().includes("touchpad")&&(c[t]=n,delete c[t]?.icon,l=!0)}}if(l){for(const t of Fe)c[t]||(c[t]=structuredClone(u[t]??{}),delete c[t]?.type,delete c[t]?.icon);s>-1?i[s]={...structuredClone(u),...c}:i.push({...structuredClone(u),...c})}for(const[t,e]of i.entries()){const n=this.updateDeprecatedActionFields(e,i);for(const t of Fe)n[t]&&(n[t]=this.updateDeprecatedActionFields(n[t],i));i[t]=n}if(e.style){let t=e.styles??"";t+="\n:host {";const n=e.style;for(const e in n)t+=`\n ${e}: ${n[e]};`;t+="\n}",e.styles=t.trim(),delete e.style}if(e.button_style){let t=e.styles??"";t+="\nremote-button {";const n=e.button_style;for(const e in n)t+=`\n ${e}: ${n[e]};`;t+="\n}",e.styles=t.trim(),delete e.button_style}if(e.row_styles){let t=e.styles??"";const n=e.row_styles;for(const e in n){if(e.includes("-"))t+=`\n#${e} {`;else if("rows"==e)t+="\n.row {";else{if("columns"!=e)continue;t+="\n.column {"}for(const i in n[e])t+=`\n ${i}: ${n[e][i]};`;t+="\n}"}e.styles=t.trim(),delete e.row_styles}return e.custom_actions=i,e}updateDeprecatedActionFields(t,e){let n=structuredClone(t);"svg_path"in n&&(n.icon=n.svg_path);const i=["key","source","service","service_data","data","target","navigation_path","navigation_replace","url_path","confirmation","pipeline_id","start_listening"],o=n.tap_action??{};let a=!1;for(const t of i)t in n&&(a=!0,o[t]=n[t],delete n[t]);a&&(n.tap_action=o);for(const t of Pe)if(t in n){const e=n[t];e&&(e.action?"call-service"==e.action&&(e.action="perform-action",e.perform_action=e.service??"",delete e.service):e.key?e.action="key":e.source?e.action="source":e.perform_action?e.action="perform-action":e.service?(e.action="perform-action",e.perform_action=e.service,delete e.service):e.navigation_path?e.action="navigate":e.url_path?e.action="url":e.browser_mod?e.action="fire-dom-event":e.pipeline_id||e.start_listening?e.action="assist":e.action="none",e.service_data&&(e.data={...e.service_data,...e.data},delete e.service_data),n[t]=e)}if(n.type=(n.type??"button").toLowerCase(),n.style){let t=n.styles??"";t+="\n:host {";const e=n.style;for(const n in e)t+=`\n ${n}: ${e[n]};`;t+="\n}",n.styles=t.trim(),delete n.style}if("template"in t){const i=e?.filter((e=>t.template==e.name))[0]??this.DEFAULT_ACTIONS.filter((e=>t.template==e.name))[0]??{};n=(0,Ke.D9)(structuredClone(i),t),delete n.template}return n}static get styles(){return t.AH`:host{display:flex;flex-direction:column;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}.content{padding:12px;display:inline-flex;flex-direction:column;gap:24px;box-sizing:border-box;width:100%}.action-options{display:inline-flex;flex-direction:column;gap:8px;box-sizing:border-box;width:100%}ha-expansion-panel{display:block;border-radius:6px;border:solid 1px var(--outline-color);--ha-card-border-radius:6px;--expansion-panel-content-padding:0}ha-icon{display:flex;color:var(--secondary-text-color)}.add-list-item{margin:0 18px 12px}ha-button{width:fit-content;--mdc-icon-size:100%}ha-list-item{text-transform:capitalize}.features{max-height:480px;overflow:auto;overflow-y:scroll}.feature-list-item{display:flex;align-items:center;pointer-events:none}.handle{display:flex;align-items:center;cursor:move;cursor:grab;padding-right:8px;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction);pointer-events:all}.feature-list-item-content{height:60px;font-size:16px;display:flex;align-items:center;justify-content:flex-start;flex-grow:1;gap:8px;overflow:hidden}.primary:first-letter{text-transform:capitalize}.feature-list-item-label{display:flex;flex-direction:column}.secondary{font-size:12px;color:var(--secondary-text-color)}.copy-icon,.edit-icon,.remove-icon{color:var(--secondary-text-color);pointer-events:all;--mdc-icon-button-size:36px}.header{display:inline-flex;justify-content:space-between;align-items:center}.text-icon{color:var(--mdc-dialog-content-ink-color,rgba(0,0,0,.6))}.back-title{display:flex;align-items:center;font-size:18px}.wrapper{width:100%}.gui-editor{display:inline-flex;flex-direction:column;gap:24px;padding:8px 0;width:100%}.yaml-editor{display:inline-flex;flex-direction:column;padding:8px 0;width:100%}ha-code-editor{--code-mirror-max-height:calc(100vh - 245px)}.layout-editor{display:flex;flex-direction:column;font-weight:500}.actions-list-container{background:var(--code-editor-background-color,var(--mdc-text-field-fill-color,#f5f5f5));padding:4px;border-radius:4px}.default-action-lists-container{display:flex;flex-direction:row}.action-list-container{max-height:285px;overflow:scroll}.custom-action-list-container{max-height:190px}.action-list{columns:1;-webkit-columns:1;-moz-columns:1;margin-top:4px;padding-left:4px}.custom-action-list{columns:2;-webkit-columns:2;-moz-columns:2}.action-list-item::marker{content:''}.action-list-item{display:flex;flex-direction:row;align-items:center;gap:4px;padding:2px 0}.action-list-item-label{width:100%;background:0 0;border:none;outline:0;font-family:monospace;font-size:14px}.error,.info{word-break:break-word;margin-top:8px}.error{color:var(--error-color)}.error ul{margin:4px 0}.error li,.warning li{white-space:pre-wrap}.title-header{font-size:20px;font-weight:500;padding:12px 4px}.panel-header{display:inline-flex;gap:4px}.style-header{font-size:var(--mdc-typography-body1-font-size,1rem);font-weight:500;padding:8px}.form{display:grid;grid-template-columns:repeat(var(--form-grid-column-count,auto-fit),minmax(var(--form-grid-min-width,200px),1fr));gap:24px 8px}.actions-form{display:grid;grid-template-columns:repeat(var(--form-grid-column-count,auto-fit),minmax(var(--form-grid-min-width,200px),1fr));gap:8px}.selector-margin{margin:8px 0}.custom-icon-picked{position:absolute;padding:16px;pointer-events:none}.custom-icon-preview{align-self:center;outline:1px dashed var(--primary-color);--mdc-icon-size:50%}`}}Ve([(0,e.MZ)()],Be.prototype,"hass",void 0),Ve([(0,e.MZ)()],Be.prototype,"config",void 0),Ve([(0,e.wk)()],Be.prototype,"baseTabIndex",void 0),Ve([(0,e.wk)()],Be.prototype,"entryIndex",void 0),Ve([(0,e.wk)()],Be.prototype,"actionsTabIndex",void 0),Ve([(0,e.wk)()],Be.prototype,"touchpadTabIndex",void 0),Ve([(0,e.wk)()],Be.prototype,"guiMode",void 0),Ve([(0,e.wk)()],Be.prototype,"errors",void 0);var He=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};let Ye=class extends t.WF{constructor(){super(...arguments),this.onKeyDownFired=!1}getRokuId(t){return(this.config?.keyboard_id??"").split(".")[0]!=t?"media_player"===t?this.config?.media_player_id:this.config?.remote_id:this.config?.keyboard_id}forceCursorToEnd(){this.textarea.selectionStart=this.textarea.value.length,this.textarea.selectionEnd=this.textarea.value.length}forceCursorToEndEvent(t){t.preventDefault(),this.forceCursorToEnd()}kodiOnKeyDown(t){if(t.stopImmediatePropagation(),["Backspace","Enter"].includes(t.key)){const t=this.textarea?.value??"";this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:t,done:!1})}}kodiOnInput(t){t.stopImmediatePropagation();const e=this.textarea?.value??"";this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:e,done:!1})}rokuOnKeyDown(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.key,n={Backspace:"backspace",Enter:"enter"}[e??""];n&&(this.onKeyDownFired=!0,this.hass.callService("remote","send_command",{entity_id:this.getRokuId("remote"),command:n}),"Enter"==e&&this.closeDialog())}rokuOnInput(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.inputType??"",n=t.data??"";if(n&&"insertText"==e)this.hass.callService("remote","send_command",{entity_id:this.config?.keyboard_id,command:`Lit_${n}`});else if(!this.onKeyDownFired){const t={deleteContentBackward:"backspace",insertLineBreak:"enter"}[e??""];t&&this.hass.callService("remote","send_command",{entity_id:this.getRokuId("remote"),command:t})}this.onKeyDownFired=!1}adbOnKeyDown(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.key,n={Backspace:"67",Enter:"66"}[e??""];n&&(this.onKeyDownFired=!0,this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input keyevent ${n}`}),"Enter"==e&&this.closeDialog())}adbOnInput(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.inputType??"",n=t.data??"";if(n&&"insertText"==e)this.androidTvSendText(n);else if(!this.onKeyDownFired){const t={deleteContentBackward:"67",insertLineBreak:"66"}[e??""];t&&this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input keyevent ${t}`})}this.onKeyDownFired=!1}androidTvOnKeyDown(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.key,n={Backspace:"DEL",Enter:"ENTER"}[e??""];n&&(this.onKeyDownFired=!0,this.hass.callService("remote","send_command",{entity_id:this.config?.remote_id,command:n}),"Enter"==e&&this.closeDialog())}androidTvOnInput(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.inputType??"",n=t.data??"";if(n&&"insertText"==e)this.androidTvSendText(n);else if(!this.onKeyDownFired){const t={deleteContentBackward:"DEL",insertLineBreak:"ENTER"}[e??""];t&&(this.hass.callService("remote","send_command",{entity_id:this.config?.remote_id,command:t}),"insertLineBreak"==e&&this.closeDialog())}this.onKeyDownFired=!1}androidTvSendText(t){this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input text "${t}"`})}keyboardOnPaste(t){t.stopImmediatePropagation(),"Kodi"!=this.config?.platform&&this.forceCursorToEnd();const e=t.clipboardData?.getData("Text");if(e)switch(this.config?.platform){case"Kodi":this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:this.textarea?.value??"",done:!1});break;case"Roku":this.hass.callService("remote","send_command",{entity_id:this.config?.keyboard_id,command:`Lit_${e}`});break;default:this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input text "${e}"`})}}search(t){const e=this.textarea?.value;if(e)switch(this.config?.platform){case"Kodi":this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:e,done:!0});break;case"Roku":this.hass.callService("roku","search",{entity_id:this.getRokuId("media_player"),keyword:e});break;default:this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`am start -a "android.search.action.GLOBAL_SEARCH" --es query "${e}"`})}this.closeDialog()}textBox(t){const e=this.textarea?.value;if(e)switch(this.config?.platform){case"Kodi":this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:e,done:!1});break;case"Roku":this.hass.callService("remote","send_command",{entity_id:this.getRokuId("remote"),command:`Lit_${e}`});break;default:this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input text "${e}"`})}this.closeDialog()}enterDialog(){switch(this.config?.platform){case"Kodi":this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:this.textarea?.value??"",done:!0});break;case"Roku":this.hass.callService("remote","send_command",{entity_id:this.getRokuId("remote"),command:"enter"});break;case"Fire TV":case"Sony BRAVIA":this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:"input keyevent 66"});break;default:this.hass.callService("remote","send_command",{entity_id:this.config?.remote_id,command:"ENTER"})}this.closeDialog()}showDialog(t){this.config=t.detail,"media_player"===(this.config?.keyboard_id??"").split(".")[0]?(this.domain="androidtv",this.service="adb_command"):(this.domain="remote",this.service="send_command");const e=this.shadowRoot?.querySelector("dialog");if(e){try{e.showModal()}catch{e.close(),e.showModal()}window.addEventListener("popstate",(()=>this.closeDialog()))}this.textarea=this.shadowRoot?.querySelector("textarea");const n=this.textarea;"Kodi"==this.config?.platform&&"search"==this.config?.action&&this.hass.callService("kodi","call_method",{entity_id:this.config.keyboard_id,method:"Addons.ExecuteAddon",addonid:"script.globalsearch"}),setTimeout((()=>{n&&n.focus()}),.4)}cancelDialog(t){t.preventDefault(),this.closeDialog()}closeDialog(t){const e=this.shadowRoot?.querySelector("dialog");if(e){try{e.close()}catch{e.showModal(),e.close()}window.removeEventListener("popstate",(()=>this.closeDialog()))}this.textarea&&(this.textarea.value="",this.textarea.blur()),this.config=void 0,this.domain=void 0,this.service=void 0,this.textarea=void 0}buildDialogButton(e,n){return t.qy`
${e}
`}render(){let e,n,i,o,a,r=t.qy``;switch(this.config?.action){case"search":e="Search for something...",r=t.qy`${this.buildDialogButton("Close",this.closeDialog)}${this.buildDialogButton("Search",this.search)}`;break;case"textbox":e="Type something...",r=t.qy`${this.buildDialogButton("Close",this.closeDialog)}${this.buildDialogButton("Send",this.textBox)}`;break;default:switch(a=this.forceCursorToEndEvent,this.config?.platform){case"Kodi":n=this.kodiOnInput,i=this.kodiOnKeyDown,a=void 0;break;case"Roku":n=this.rokuOnInput,i=this.rokuOnKeyDown;break;case"Fire TV":case"Sony BRAVIA":n=this.adbOnInput,i=this.adbOnKeyDown;break;default:n=this.androidTvOnInput,i=this.androidTvOnKeyDown}e="Type something...",o=this.keyboardOnPaste,r=t.qy`${this.buildDialogButton("Close",this.closeDialog)}${this.buildDialogButton("Enter",this.enterDialog)}`}e=this.config?.keyboard_prompt??e;const s=t.qy``;return t.qy`${s}
${r}
`}static get styles(){return t.AH`:host{-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}dialog{height:0;width:0;display:inline-flex;flex-direction:column;position:fixed;border:none;background:var(--ha-card-background,var(--card-background-color,#fff));border-radius:var(--ha-card-border-radius,12px);opacity:0;transition:all .1s ease-in-out;pointer-events:none}dialog[open]{height:fit-content;width:85%;opacity:1;transition:all .1s ease-in-out;pointer-events:all}textarea{position:relative;height:180px;padding:8px;outline:0;background:0 0;border:none;resize:none;font-family:inherit;font-weight:500;font-size:30px}.buttons{height:36px;display:inline-flex;flex-direction:row;justify-content:space-between;margin:0 12px}.button{height:100%;width:min-content;align-content:center;cursor:pointer;border-radius:var(--mdc-shape-small,4px);overflow:hidden}button{height:100%;width:100%;background:0 0;opacity:1;border:none;overflow:hidden;cursor:pointer;padding:0}@media (hover:hover){button:hover{background:var(--ha-ripple-color);opacity:var(--md-ripple-hover-opacity)}}button:active{background:var(--ha-ripple-color);opacity:var(--md-ripple-pressed-opacity)}.button span{font-family:inherit;font-size:var(--paper-font-body1_-_font-size);font-weight:600;text-transform:uppercase;color:var(--mdc-theme-primary,#6200ee);user-select:none;-webkit-user-select:none;-moz-user-select:none;position:relative;top:-32px;padding:0 8px;pointer-events:none}dialog::backdrop{background:#000;opacity:.7}`}};He([(0,e.MZ)()],Ye.prototype,"hass",void 0),He([(0,e.wk)()],Ye.prototype,"config",void 0),Ye=He([(0,e.EM)("keyboard-dialog")],Ye);var Ze=__webpack_require__(44),ze=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};let qe=class extends Ze.W{constructor(){super(...arguments),this.clickCount=0,this.hold=!1}onClick(t){if(t.stopImmediatePropagation(),this.clickCount++,"none"!=this.renderTemplate(this.config.double_tap_action?.action??"none")){if(this.clickCount>1)this.fireHapticEvent("success"),this.sendAction("double_tap_action"),this.endAction();else if(!this.clickTimer){const t=this.config.double_tap_action?.double_tap_window?this.renderTemplate(this.config.double_tap_action?.double_tap_window):je.jc;this.clickTimer=setTimeout((()=>{this.fireHapticEvent("light"),this.sendAction("tap_action"),this.endAction()}),t)}}else this.fireHapticEvent("light"),this.sendAction("tap_action"),this.endAction()}onStart(t){if(this.cancelRippleToggle(),this.swiping=!1,"targetTouches"in t?(this.initialX=t.targetTouches[0].clientX,this.initialY=t.targetTouches[0].clientY):(this.initialX=t.clientX,this.initialY=t.clientY),"none"!=this.renderTemplate(this.config.momentary_start_action?.action??"none"))this.fireHapticEvent("light"),this.momentaryStart=performance.now(),this.sendAction("momentary_start_action");else if("none"!=this.renderTemplate(this.config.momentary_end_action?.action??"none"))this.fireHapticEvent("light"),this.momentaryStart=performance.now();else if(!this.holdTimer){const t=this.renderTemplate(this.config.hold_action?.hold_time??je.At);this.holdTimer=setTimeout((()=>{if(!this.swiping)if(this.hold=!0,"repeat"==this.renderTemplate(this.config.hold_action?.action)){const t=this.renderTemplate(this.config.hold_action?.repeat_delay??je.a3);this.holdInterval||(this.holdInterval=setInterval((()=>{this.fireHapticEvent("selection"),this.sendAction("tap_action")}),t))}else this.fireHapticEvent("medium"),this.sendAction("hold_action")}),t)}}onEnd(t){this.swiping||("none"!=this.renderTemplate(this.config.momentary_end_action?.action??"none")?(this.fireHapticEvent("selection"),this.momentaryEnd=performance.now(),this.sendAction("momentary_end_action"),this.endAction()):"none"!=this.renderTemplate(this.config.momentary_start_action?.action??"none")?this.endAction():this.hold?(t.stopImmediatePropagation(),t.preventDefault(),this.endAction()):this.onClick(t)),this.toggleRipple()}onMove(t){let e,n;"targetTouches"in t?(e=t.targetTouches[0].clientX,n=t.targetTouches[0].clientY):(e=t.clientX,n=t.clientY);const i=(this.initialX??e)-e,o=(this.initialY??n)-n;Math.abs(Math.abs(i)-Math.abs(o))>24&&(this.endAction(),this.swiping=!0)}onMouseLeave(t){this.endAction(),this.swiping=!0,this.toggleRipple()}onTouchCancel(t){this.endAction(),this.toggleRipple()}endAction(){clearTimeout(this.clickTimer),this.clickTimer=void 0,this.clickCount=0,clearTimeout(this.holdTimer),clearInterval(this.holdInterval),this.holdTimer=void 0,this.holdInterval=void 0,this.hold=!1,super.endAction()}render(){return this.setValue(),t.qy` ${this.buildStyles(this.config.styles)}`}static get styles(){return[super.styles,t.AH`:host{align-content:center;text-align:center}button{display:flex;height:inherit;width:inherit;border-radius:var(--size,48px);overflow:visible;cursor:pointer;pointer-events:all;position:relative;opacity:1;padding:0;background:rgb(0,0,0,0);border:none;flex-direction:column;align-content:center;text-align:center;justify-content:center;align-items:center;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}`]}};ze([(0,e.MZ)()],qe.prototype,"config",void 0),qe=ze([(0,e.EM)("remote-button")],qe);var We=__webpack_require__(740);class Ge{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const Xe="important",Je=" !"+Xe,Qe=(tn=class extends Ge{constructor(t){if(super(t),1!==t.type||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,n)=>{const i=t[n];return null==i?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`}),"")}update(t,[e]){const{style:n}=t.element;if(void 0===this.ut)return this.ut=new Set(Object.keys(e)),this.render(e);for(const t of this.ut)null==e[t]&&(this.ut.delete(t),t.includes("-")?n.removeProperty(t):n[t]=null);for(const t in e){const i=e[t];if(null!=i){this.ut.add(t);const e="string"==typeof i&&i.endsWith(Je);t.includes("-")||e?n.setProperty(t,e?i.slice(0,-11):i,e?Xe:""):n[t]=i}}return We.c0}},(...t)=>({_$litDirective$:tn,values:t}));var tn,en=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};let nn=class extends Ze.W{constructor(){super(...arguments),this.showTooltip=!1,this.thumbOffset=0,this.sliderOn=!0,this.currentValue=this.value,this.speed=.02,this.range=[je.HB,je.bQ],this.step=je.RZ,this.sliderWidth=0,this.sliderHeight=0,this.vertical=!1,this.thumbWidth=50,this.resizeObserver=new ResizeObserver((t=>{for(const e of t)this.sliderWidth=this.vertical?e.contentRect.height:e.contentRect.width,this.sliderHeight=this.vertical?e.contentRect.width:e.contentRect.height,this.setThumbOffset()})),this.rtl=!1}onInput(t){const e=t.currentTarget;if(this.swiping)null==this.value&&(this.getValueFromHass=!0),this.setValue(),this.currentValue=this.value??0,this.setThumbOffset(),this.showTooltip=!1;else{clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,this.value=e.value,this.fireHapticEvent("selection");const t=parseFloat(this.oldValue??this.value??"0"),n=parseFloat(e.value??t);this.newValue=n,this.currentValue=t,this.setThumbOffset(),this.showTooltip=!0,n>this.range[0]&&(this.sliderOn=!0),clearInterval(this.intervalId),this.intervalId=void 0;let i=t;t>n?this.intervalId=setInterval((()=>{i-=this.speed,this.currentValue=i,this.setThumbOffset(),n>=i&&(clearInterval(this.intervalId),this.intervalId=void 0,this.currentValue=n,this.setThumbOffset())}),je.hI):t{i+=this.speed,this.currentValue=i,this.setThumbOffset(),n<=i&&(clearInterval(this.intervalId),this.intervalId=void 0,this.currentValue=n,this.setThumbOffset())}),je.hI)):this.currentValue=n,this.oldValue=n}}onStart(t){const e=t.currentTarget;this.swiping||(clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,this.currentValue=e.value,this.value=e.value,this.setThumbOffset(),this.showTooltip=!0,this.sliderOn=!0)}onEnd(t){this.setThumbOffset(),this.showTooltip=!1,this.setValue(),this.swiping?(this.getValueFromHass=!0,this.setValue(),this.currentValue=this.value??0,this.setThumbOffset(),this.setSliderState(this.currentValue)):(this.newValue||0==this.newValue||(this.newValue=Number(this.value)),this.precision||(this.newValue=Math.trunc(this.newValue)),this.value=this.newValue,this.fireHapticEvent("light"),this.sendAction("tap_action")),this.endAction(),this.resetGetValueFromHass()}onMove(t){if(!this.vertical){let e,n;e="clientX"in t?t.clientX:t.touches[0].clientX,n="clientY"in t?t.clientY:t.touches[0].clientY,null==this.initialY&&(this.initialY=n),null==this.initialX?this.initialX=e:Math.abs(e-this.initialX)this.range[0]}endAction(){clearInterval(this.valueUpdateInterval),this.valueUpdateInterval=void 0,super.endAction()}buildBackground(){const e={};return this.vertical&&(e.transform=`rotateZ(${this.rtl?"90":"270"}deg)`,e.width=`${this.sliderWidth}px`,e.height=`var(--background-height, ${this.sliderHeight}px)`),t.qy`
`}buildTooltip(){return t.qy`
`}buildSliderStyles(e){let n,i;const o=this.shadowRoot?.querySelector(".container");if(o){const t=getComputedStyle(o);n=t.getPropertyValue("height"),i=t.getPropertyValue("width")}const a=`'${this.renderTemplate("{{ value }}{{ unit }}",e)}'`;let r,s;this.vertical?(r=`translate(calc(-0.3 * ${i??"var(--height)"} - 0.8em - 18px), calc(-1 * var(--thumb-offset)))`,s="translateY(calc(-1 * var(--thumb-offset)))"):(r=`translate(var(--thumb-offset), calc(-0.5 * ${n??"var(--height)"} - 0.4em - 10px))`,s="translateX(var(--thumb-offset))");const c=`\n\t\t:host {\n\t\t\t--tooltip-label: ${a};\n\t\t\t--tooltip-transform: ${r};\n\t\t\t--icon-transform: ${s};\n\t\t}\n\t\t${this.rtl?"\n\t\t.slider::-webkit-slider-thumb {\n\t\t\tscale: -1;\n\t\t}\n\t\t.slider::-moz-range-thumb {\n\t\t\tscale: -1;\n\t\t}\n\t\t":""}\n\t\t`;return t.qy``}buildSlider(e=this.config,n){const i=n.value;this.setSliderState(i);const o={};return"none"==this.renderTemplate(e.tap_action?.action,n)&&(o["pointer-events"]="none"),this.vertical&&(o.transform=`rotateZ(${this.rtl?"90":"270"}deg)`,o.height=`${this.sliderHeight}px`,o.width=`${this.sliderWidth}px`,o["touch-action"]="none"),t.qy``}render(){this.setValue(),this.getValueFromHass&&(this.currentValue=this.value);const e={VALUE:this.getValueFromHass?this.value:this.currentValue,value:this.getValueFromHass?this.value:this.currentValue};this.config.range&&(this.range[0]=parseFloat(this.renderTemplate(this.config.range[0],e)??je.HB),this.range[1]=parseFloat(this.renderTemplate(this.config.range[1],e)??je.bQ)),this.speed=(this.range[1]-this.range[0])/50,this.config.step?this.step=Number(this.renderTemplate(this.config.step,e)):this.step=(this.range[1]-this.range[0])/je.zM;const n=this.step.toString().split(".");n.length>1?this.precision=n[1].length:this.precision=0,this.vertical=1==this.renderTemplate(this.config.vertical??!1,e),this.resizeObserver.observe(this);const i={},o=this.shadowRoot?.querySelector("input");if(o){const t=getComputedStyle(o),e=t.getPropertyValue("--thumb-width"),n=t.getPropertyValue("--height");this.thumbWidth=e?parseInt(e.replace(/[^0-9]+/g,"")):parseInt(n.replace(/[^0-9]+/g,"")),this.vertical&&(this.style.setProperty("width","fit-content"),this.style.setProperty("align-self","stretch"),i.height=`${this.sliderWidth}px`,i.width="var(--height)")}return this.rtl="rtl"==getComputedStyle(this).direction,this.setThumbOffset(),this.style.setProperty("--thumb-offset",`calc(${this.rtl&&!this.vertical?"-1 * ":""}${this.thumbOffset}px)`),t.qy`
${this.buildBackground()}${this.buildSlider(void 0,e)} ${this.buildIcon(this.config.icon,e)} ${this.buildLabel(this.config.label,e)}
${this.buildTooltip()}${this.buildSliderStyles(e)} ${this.buildStyles(this.config.styles,e)}`}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver.disconnect()}static get styles(){return[super.styles,t.AH`:host{display:flex;flex-flow:column;flex-grow:0;place-content:center space-evenly;align-items:center;position:relative;height:unset;width:100%;border:none;border-radius:25px;padding:0;box-sizing:border-box;line-height:0;outline:0;overflow:visible;font-size:inherit;color:inherit;pointer-events:none;--color:var(--primary-text-color);--height:48px}.container{all:inherit;overflow:hidden;height:var(--height);align-self:center;color:var(--background,var(--primary-background-color))}.background{position:absolute;width:inherit;height:var(--background-height,100%);background:var( +(()=>{var __webpack_modules__={894:function(t){var e;"undefined"!=typeof self&&self,e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e,n){"use strict";var i=Array.prototype,o=Object.prototype,a={"&":"&",'"':""","'":"'","<":"<",">":">","\\":"\"},r=/[&"'<>\\]/g;function s(t,e){return o.hasOwnProperty.call(t,e)}function c(t){return a[t]}function l(t,e,n){var i,o,a;if(t instanceof Error&&(t=(o=t).name+": "+o.message),Object.setPrototypeOf?(i=new Error(t),Object.setPrototypeOf(i,l.prototype)):(i=this,Object.defineProperty(i,"message",{enumerable:!1,writable:!0,value:t})),Object.defineProperty(i,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(i,this.constructor),o){var r=Object.getOwnPropertyDescriptor(o,"stack");(a=r&&(r.get||function(){return r.value}))||(a=function(){return o.stack})}else{var s=new Error(t).stack;a=function(){return s}}return Object.defineProperty(i,"stack",{get:function(){return a.call(i)}}),Object.defineProperty(i,"cause",{value:o}),i.lineno=e,i.colno=n,i.firstUpdate=!0,i.Update=function(t){var e="("+(t||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?e+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(e+=" [Line "+this.lineno+"]")),e+="\n ",this.firstUpdate&&(e+=" "),this.message=e+(this.message||""),this.firstUpdate=!1,this},i}function u(t){return"[object Function]"===o.toString.call(t)}function p(t){return"[object Array]"===o.toString.call(t)}function d(t){return"[object String]"===o.toString.call(t)}function h(t){return"[object Object]"===o.toString.call(t)}function m(t){var e,n=(e=t)?"string"==typeof e?e.split("."):[e]:[];return function(t){for(var e=t,i=0;it.length)r=o.slice(0,t.length),o.slice(r.length,l).forEach((function(t,n){n2?o-2:0),r=2;r0||!n)&&process.stdout.write(" ".repeat(e));var a=o===i.length-1?"":"\n";process.stdout.write(""+t+a)}))}t.exports={Node:c,Root:p,NodeList:u,Value:l,Literal:d,Symbol:h,Group:m,Array:f,Pair:y,Dict:_,Output:U,Capture:j,TemplateData:K,If:v,IfAsync:g,InlineIf:k,For:w,AsyncEach:E,AsyncAll:C,Macro:x,Caller:T,Import:L,FromImport:A,FunCall:S,Filter:O,FilterAsync:M,KeywordArgs:I,Block:$,Super:D,Extends:P,Include:N,Set:R,Switch:V,Case:F,LookupVal:b,BinOp:H,In:Y,Is:Z,Or:z,And:q,Not:W,Add:X,Concat:G,Sub:J,Mul:Q,Div:tt,FloorDiv:et,Mod:nt,Pow:it,Neg:ot,Pos:at,Compare:rt,CompareOperand:st,CallExtension:ct,CallExtensionAsync:lt,printNodes:function t(e,n){if(n=n||0,ut(e.typename+": ",n),e instanceof u)ut("\n"),e.children.forEach((function(e){t(e,n+2)}));else if(e instanceof ct)ut(e.extName+"."+e.prop+"\n"),e.args&&t(e.args,n+2),e.contentArgs&&e.contentArgs.forEach((function(e){t(e,n+2)}));else{var i=[],o=null;e.iterFields((function(t,e){t instanceof c?i.push([e,t]):(o=o||{})[e]=t})),o?ut(JSON.stringify(o,null,2)+"\n",null,!0):ut("\n"),i.forEach((function(e){var i=e[0],o=e[1];ut("["+i+"] =>",n+2),t(o,n+4)}))}}}},function(t,e){},function(t,e,n){"use strict";function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var o=n(8),a=n(17),r=n(3),s=n(0).TemplateError,c=n(2).Frame,l=n(1).Obj,u={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},p=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,i(e,n);var a=o.prototype;return a.init=function(t,e){this.templateName=t,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=e},a.fail=function(t,e,n){throw void 0!==e&&(e+=1),void 0!==n&&(n+=1),new s(t,e,n)},a._pushBuffer=function(){var t=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=t,this._emit("var "+this.buffer+' = "";'),t},a._popBuffer=function(){this.buffer=this.bufferStack.pop()},a._emit=function(t){this.codebuf.push(t)},a._emitLine=function(t){this._emit(t+"\n")},a._emitLines=function(){for(var t=this,e=arguments.length,n=new Array(e),i=0;i0&&o._emit(","),o.compile(t,e)})),i&&this._emit(i)},a._compileExpression=function(t,e){this.assertType(t,r.Literal,r.Symbol,r.Group,r.Array,r.Dict,r.FunCall,r.Caller,r.Filter,r.LookupVal,r.Compare,r.InlineIf,r.In,r.Is,r.And,r.Or,r.Not,r.Add,r.Concat,r.Sub,r.Mul,r.Div,r.FloorDiv,r.Mod,r.Pow,r.Neg,r.Pos,r.Compare,r.NodeList),this.compile(t,e)},a.assertType=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i0&&i._emit(","),t){i._emitLine("function(cb) {"),i._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var o=i._pushBuffer();i._withScopedSyntax((function(){i.compile(t,e),i._emitLine("cb(null, "+o+");")})),i._popBuffer(),i._emitLine("return "+o+";"),i._emitLine("}")}else i._emit("null")})),n){var c=this._tmpid();this._emitLine(", "+this._makeCallback(c)),this._emitLine(this.buffer+" += runtime.suppressValue("+c+", "+s+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+s+" && env.opts.autoescape);\n")},a.compileCallExtensionAsync=function(t,e){this.compileCallExtension(t,e,!0)},a.compileNodeList=function(t,e){this._compileChildren(t,e)},a.compileLiteral=function(t){if("string"==typeof t.value){var e=t.value.replace(/\\/g,"\\\\");e=(e=(e=(e=(e=e.replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u2028/g,"\\u2028"),this._emit('"'+e+'"')}else null===t.value?this._emit("null"):this._emit(t.value.toString())},a.compileSymbol=function(t,e){var n=t.value,i=e.lookup(n);i?this._emit(i):this._emit('runtime.contextOrFrameLookup(context, frame, "'+n+'")')},a.compileGroup=function(t,e){this._compileAggregate(t,e,"(",")")},a.compileArray=function(t,e){this._compileAggregate(t,e,"[","]")},a.compileDict=function(t,e){this._compileAggregate(t,e,"{","}")},a.compilePair=function(t,e){var n=t.key,i=t.value;n instanceof r.Symbol?n=new r.Literal(n.lineno,n.colno,n.value):n instanceof r.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,e),this._emit(": "),this._compileExpression(i,e)},a.compileInlineIf=function(t,e){this._emit("("),this.compile(t.cond,e),this._emit("?"),this.compile(t.body,e),this._emit(":"),null!==t.else_?this.compile(t.else_,e):this._emit('""'),this._emit(")")},a.compileIn=function(t,e){this._emit("runtime.inOperator("),this.compile(t.left,e),this._emit(","),this.compile(t.right,e),this._emit(")")},a.compileIs=function(t,e){var n=t.right.name?t.right.name.value:t.right.value;this._emit('env.getTest("'+n+'").call(context, '),this.compile(t.left,e),t.right.args&&(this._emit(","),this.compile(t.right.args,e)),this._emit(") === true")},a._binOpEmitter=function(t,e,n){this.compile(t.left,e),this._emit(n),this.compile(t.right,e)},a.compileOr=function(t,e){return this._binOpEmitter(t,e," || ")},a.compileAnd=function(t,e){return this._binOpEmitter(t,e," && ")},a.compileAdd=function(t,e){return this._binOpEmitter(t,e," + ")},a.compileConcat=function(t,e){return this._binOpEmitter(t,e,' + "" + ')},a.compileSub=function(t,e){return this._binOpEmitter(t,e," - ")},a.compileMul=function(t,e){return this._binOpEmitter(t,e," * ")},a.compileDiv=function(t,e){return this._binOpEmitter(t,e," / ")},a.compileMod=function(t,e){return this._binOpEmitter(t,e," % ")},a.compileNot=function(t,e){this._emit("!"),this.compile(t.target,e)},a.compileFloorDiv=function(t,e){this._emit("Math.floor("),this.compile(t.left,e),this._emit(" / "),this.compile(t.right,e),this._emit(")")},a.compilePow=function(t,e){this._emit("Math.pow("),this.compile(t.left,e),this._emit(", "),this.compile(t.right,e),this._emit(")")},a.compileNeg=function(t,e){this._emit("-"),this.compile(t.target,e)},a.compilePos=function(t,e){this._emit("+"),this.compile(t.target,e)},a.compileCompare=function(t,e){var n=this;this.compile(t.expr,e),t.ops.forEach((function(t){n._emit(" "+u[t.type]+" "),n.compile(t.expr,e)}))},a.compileLookupVal=function(t,e){this._emit("runtime.memberLookup(("),this._compileExpression(t.target,e),this._emit("),"),this._compileExpression(t.val,e),this._emit(")")},a._getNodeName=function(t){switch(t.typename){case"Symbol":return t.value;case"FunCall":return"the return value of ("+this._getNodeName(t.name)+")";case"LookupVal":return this._getNodeName(t.target)+'["'+this._getNodeName(t.val)+'"]';case"Literal":return t.value.toString();default:return"--expression--"}},a.compileFunCall=function(t,e){this._emit("(lineno = "+t.lineno+", colno = "+t.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(t.name,e),this._emit(', "'+this._getNodeName(t.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(t.args,e,"[","])"),this._emit(")")},a.compileFilter=function(t,e){var n=t.name;this.assertType(n,r.Symbol),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(t.args,e),this._emit(")")},a.compileFilterAsync=function(t,e){var n=t.name,i=t.symbol.value;this.assertType(n,r.Symbol),e.set(i,i),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(t.args,e),this._emitLine(", "+this._makeCallback(i)),this._addScopeLevel()},a.compileKeywordArgs=function(t,e){this._emit("runtime.makeKeywordArgs("),this.compileDict(t,e),this._emit(")")},a.compileSet=function(t,e){var n=this,i=[];t.targets.forEach((function(t){var o=t.value,a=e.lookup(o);null==a&&(a=n._tmpid(),n._emitLine("var "+a+";")),i.push(a)})),t.value?(this._emit(i.join(" = ")+" = "),this._compileExpression(t.value,e),this._emitLine(";")):(this._emit(i.join(" = ")+" = "),this.compile(t.body,e),this._emitLine(";")),t.targets.forEach((function(t,e){var o=i[e],a=t.value;n._emitLine('frame.set("'+a+'", '+o+", true);"),n._emitLine("if(frame.topLevel) {"),n._emitLine('context.setVariable("'+a+'", '+o+");"),n._emitLine("}"),"_"!==a.charAt(0)&&(n._emitLine("if(frame.topLevel) {"),n._emitLine('context.addExport("'+a+'", '+o+");"),n._emitLine("}"))}))},a.compileSwitch=function(t,e){var n=this;this._emit("switch ("),this.compile(t.expr,e),this._emit(") {"),t.cases.forEach((function(t,i){n._emit("case "),n.compile(t.cond,e),n._emit(": "),n.compile(t.body,e),t.body.children.length&&n._emitLine("break;")})),t.default&&(this._emit("default:"),this.compile(t.default,e)),this._emit("}")},a.compileIf=function(t,e,n){var i=this;this._emit("if("),this._compileExpression(t.cond,e),this._emitLine(") {"),this._withScopedSyntax((function(){i.compile(t.body,e),n&&i._emit("cb()")})),t.else_?(this._emitLine("}\nelse {"),this._withScopedSyntax((function(){i.compile(t.else_,e),n&&i._emit("cb()")}))):n&&(this._emitLine("}\nelse {"),this._emit("cb()")),this._emitLine("}")},a.compileIfAsync=function(t,e){this._emit("(function(cb) {"),this.compileIf(t,e,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},a._emitLoopBindings=function(t,e,n,i){var o=this;[{name:"index",val:n+" + 1"},{name:"index0",val:n},{name:"revindex",val:i+" - "+n},{name:"revindex0",val:i+" - "+n+" - 1"},{name:"first",val:n+" === 0"},{name:"last",val:n+" === "+i+" - 1"},{name:"length",val:i}].forEach((function(t){o._emitLine('frame.set("loop.'+t.name+'", '+t.val+");")}))},a.compileFor=function(t,e){var n=this,i=this._tmpid(),o=this._tmpid(),a=this._tmpid();if(e=e.push(),this._emitLine("frame = frame.push();"),this._emit("var "+a+" = "),this._compileExpression(t.arr,e),this._emitLine(";"),this._emit("if("+a+") {"),this._emitLine(a+" = runtime.fromIterator("+a+");"),t.name instanceof r.Array){this._emitLine("var "+i+";"),this._emitLine("if(runtime.isArray("+a+")) {"),this._emitLine("var "+o+" = "+a+".length;"),this._emitLine("for("+i+"=0; "+i+" < "+a+".length; "+i+"++) {"),t.name.children.forEach((function(o,r){var s=n._tmpid();n._emitLine("var "+s+" = "+a+"["+i+"]["+r+"];"),n._emitLine('frame.set("'+o+'", '+a+"["+i+"]["+r+"]);"),e.set(t.name.children[r].value,s)})),this._emitLoopBindings(t,a,i,o),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}"),this._emitLine("} else {");var s=t.name.children,c=s[0],l=s[1],u=this._tmpid(),p=this._tmpid();e.set(c.value,u),e.set(l.value,p),this._emitLine(i+" = -1;"),this._emitLine("var "+o+" = runtime.keys("+a+").length;"),this._emitLine("for(var "+u+" in "+a+") {"),this._emitLine(i+"++;"),this._emitLine("var "+p+" = "+a+"["+u+"];"),this._emitLine('frame.set("'+c.value+'", '+u+");"),this._emitLine('frame.set("'+l.value+'", '+p+");"),this._emitLoopBindings(t,a,i,o),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}"),this._emitLine("}")}else{var d=this._tmpid();e.set(t.name.value,d),this._emitLine("var "+o+" = "+a+".length;"),this._emitLine("for(var "+i+"=0; "+i+" < "+a+".length; "+i+"++) {"),this._emitLine("var "+d+" = "+a+"["+i+"];"),this._emitLine('frame.set("'+t.name.value+'", '+d+");"),this._emitLoopBindings(t,a,i,o),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("}")}this._emitLine("}"),t.else_&&(this._emitLine("if (!"+o+") {"),this.compile(t.else_,e),this._emitLine("}")),this._emitLine("frame = frame.pop();")},a._compileAsyncLoop=function(t,e,n){var i=this,o=this._tmpid(),a=this._tmpid(),s=this._tmpid(),c=n?"asyncAll":"asyncEach";if(e=e.push(),this._emitLine("frame = frame.push();"),this._emit("var "+s+" = runtime.fromIterator("),this._compileExpression(t.arr,e),this._emitLine(");"),t.name instanceof r.Array){var l=t.name.children.length;this._emit("runtime."+c+"("+s+", "+l+", function("),t.name.children.forEach((function(t){i._emit(t.value+",")})),this._emit(o+","+a+",next) {"),t.name.children.forEach((function(t){var n=t.value;e.set(n,n),i._emitLine('frame.set("'+n+'", '+n+");")}))}else{var u=t.name.value;this._emitLine("runtime."+c+"("+s+", 1, function("+u+", "+o+", "+a+",next) {"),this._emitLine('frame.set("'+u+'", '+u+");"),e.set(u,u)}this._emitLoopBindings(t,s,o,a),this._withScopedSyntax((function(){var a;n&&(a=i._pushBuffer()),i.compile(t.body,e),i._emitLine("next("+o+(a?","+a:"")+");"),n&&i._popBuffer()}));var p=this._tmpid();this._emitLine("}, "+this._makeCallback(p)),this._addScopeLevel(),n&&this._emitLine(this.buffer+" += "+p+";"),t.else_&&(this._emitLine("if (!"+s+".length) {"),this.compile(t.else_,e),this._emitLine("}")),this._emitLine("frame = frame.pop();")},a.compileAsyncEach=function(t,e){this._compileAsyncLoop(t,e)},a.compileAsyncAll=function(t,e){this._compileAsyncLoop(t,e,!0)},a._compileMacro=function(t,e){var n=this,i=[],o=null,a="macro_"+this._tmpid(),s=void 0!==e;t.args.children.forEach((function(e,a){a===t.args.children.length-1&&e instanceof r.Dict?o=e:(n.assertType(e,r.Symbol),i.push(e))}));var l,u=[].concat(i.map((function(t){return"l_"+t.value})),["kwargs"]),p=i.map((function(t){return'"'+t.value+'"'})),d=(o&&o.children||[]).map((function(t){return'"'+t.key.value+'"'}));l=s?e.push(!0):new c,this._emitLines("var "+a+" = runtime.makeMacro(","["+p.join(", ")+"], ","["+d.join(", ")+"], ","function ("+u.join(", ")+") {","var callerFrame = frame;","frame = "+(s?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),i.forEach((function(t){n._emitLine('frame.set("'+t.value+'", l_'+t.value+");"),l.set(t.value,"l_"+t.value)})),o&&o.children.forEach((function(t){var e=t.key.value;n._emit('frame.set("'+e+'", '),n._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+e+'")'),n._emit(' ? kwargs["'+e+'"] : '),n._compileExpression(t.value,l),n._emit(");")}));var h=this._pushBuffer();return this._withScopedSyntax((function(){n.compile(t.body,l)})),this._emitLine("frame = "+(s?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+h+");"),this._emitLine("});"),this._popBuffer(),a},a.compileMacro=function(t,e){var n=this._compileMacro(t),i=t.name.value;e.set(i,n),e.parent?this._emitLine('frame.set("'+i+'", '+n+");"):("_"!==t.name.value.charAt(0)&&this._emitLine('context.addExport("'+i+'");'),this._emitLine('context.setVariable("'+i+'", '+n+");"))},a.compileCaller=function(t,e){this._emit("(function (){");var n=this._compileMacro(t,e);this._emit("return "+n+";})()")},a._compileGetTemplate=function(t,e,n,i){var o=this._tmpid(),a=this._templateName(),r=this._makeCallback(o),s=n?"true":"false",c=i?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(t.template,e),this._emitLine(", "+s+", "+a+", "+c+", "+r),o},a.compileImport=function(t,e){var n=t.target.value,i=this._compileGetTemplate(t,e,!1,!1);this._addScopeLevel(),this._emitLine(i+".getExported("+(t.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(i)),this._addScopeLevel(),e.set(n,i),e.parent?this._emitLine('frame.set("'+n+'", '+i+");"):this._emitLine('context.setVariable("'+n+'", '+i+");")},a.compileFromImport=function(t,e){var n=this,i=this._compileGetTemplate(t,e,!1,!1);this._addScopeLevel(),this._emitLine(i+".getExported("+(t.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(i)),this._addScopeLevel(),t.names.children.forEach((function(t){var o,a,s=n._tmpid();t instanceof r.Pair?(o=t.key.value,a=t.value.value):a=o=t.value,n._emitLine("if(Object.prototype.hasOwnProperty.call("+i+', "'+o+'")) {'),n._emitLine("var "+s+" = "+i+"."+o+";"),n._emitLine("} else {"),n._emitLine("cb(new Error(\"cannot import '"+o+"'\")); return;"),n._emitLine("}"),e.set(a,s),e.parent?n._emitLine('frame.set("'+a+'", '+s+");"):n._emitLine('context.setVariable("'+a+'", '+s+");")}))},a.compileBlock=function(t){var e=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+t.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(e)),this._emitLine(this.buffer+" += "+e+";"),this._addScopeLevel()},a.compileSuper=function(t,e){var n=t.blockName.value,i=t.symbol.value,o=this._makeCallback(i);this._emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+o),this._emitLine(i+" = runtime.markSafe("+i+");"),this._addScopeLevel(),e.set(i,i)},a.compileExtends=function(t,e){var n=this._tmpid(),i=this._compileGetTemplate(t,e,!0,!1);this._emitLine("parentTemplate = "+i),this._emitLine("for(var "+n+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this._emitLine("}"),this._addScopeLevel()},a.compileInclude=function(t,e){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var n=this._compileGetTemplate(t,e,!1,t.ignoreMissing);this._emitLine("callback(null,"+n+");});"),this._emitLine("});");var i=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(i)),this._emitLine("callback(null,"+i+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},a.compileTemplateData=function(t,e){this.compileLiteral(t,e)},a.compileCapture=function(t,e){var n=this,i=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax((function(){n.compile(t.body,e)})),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=i},a.compileOutput=function(t,e){var n=this;t.children.forEach((function(i){i instanceof r.TemplateData?i.value&&(n._emit(n.buffer+" += "),n.compileLiteral(i,e),n._emitLine(";")):(n._emit(n.buffer+" += runtime.suppressValue("),n.throwOnUndefined&&n._emit("runtime.ensureDefined("),n.compile(i,e),n.throwOnUndefined&&n._emit(","+t.lineno+","+t.colno+")"),n._emit(", env.opts.autoescape);\n"))}))},a.compileRoot=function(t,e){var n=this;e&&this.fail("compileRoot: root node can't have frame"),e=new c,this._emitFuncBegin(t,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(t,e),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var i=[],o=t.findAll(r.Block);o.forEach((function(t,e){var o=t.name.value;if(-1!==i.indexOf(o))throw new Error('Block "'+o+'" defined more than once.');i.push(o),n._emitFuncBegin(t,"b_"+o);var a=new c;n._emitLine("var frame = frame.push(true);"),n.compile(t.body,a),n._emitFuncEnd()})),this._emitLine("return {"),o.forEach((function(t,e){var i="b_"+t.name.value;n._emitLine(i+": "+i+",")})),this._emitLine("root: root\n};")},a.compile=function(t,e){var n=this["compile"+t.typename];n?n.call(this,t,e):this.fail("compile: Cannot compile node: "+t.typename,t.lineno,t.colno)},a.getCode=function(){return this.codebuf.join("")},o}(l);t.exports={compile:function(t,e,n,i,r){void 0===r&&(r={});var s=new p(i,r.throwOnUndefined),c=(n||[]).map((function(t){return t.preprocess})).filter((function(t){return!!t})).reduce((function(t,e){return e(t)}),t);return s.compile(a.transform(o.parse(c,n,r),e,i)),s.getCode()},Compiler:p}},function(t,e,n){"use strict";function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var o=n(4),a=n(1).EmitterObj;t.exports=function(t){var e,n;function a(){return t.apply(this,arguments)||this}n=t,(e=a).prototype=Object.create(n.prototype),e.prototype.constructor=e,i(e,n);var r=a.prototype;return r.resolve=function(t,e){return o.resolve(o.dirname(t),e)},r.isRelative=function(t){return 0===t.indexOf("./")||0===t.indexOf("../")},a}(a)},function(t,e,n){"use strict";function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}var a=n(12),r=n(15),s=n(0),c=n(5),l=n(18),u=n(10),p=u.FileSystemLoader,d=u.WebLoader,h=u.PrecompiledLoader,m=n(20),f=n(21),y=n(1),_=y.Obj,b=y.EmitterObj,v=n(2),g=v.handleError,k=v.Frame,w=n(22);function E(t,e,n){a((function(){t(e,n)}))}var C={type:"code",obj:{root:function(t,e,n,i,o){try{o(null,"")}catch(t){o(g(t,null,null))}}}},x=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var n=e.prototype;return n.init=function(t,e){var n=this;e=this.opts=e||{},this.opts.dev=!!e.dev,this.opts.autoescape=null==e.autoescape||e.autoescape,this.opts.throwOnUndefined=!!e.throwOnUndefined,this.opts.trimBlocks=!!e.trimBlocks,this.opts.lstripBlocks=!!e.lstripBlocks,this.loaders=[],t?this.loaders=s.isArray(t)?t:[t]:p?this.loaders=[new p("views")]:d&&(this.loaders=[new d("/views")]),"undefined"!=typeof window&&window.nunjucksPrecompiled&&this.loaders.unshift(new h(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=f(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],s._entries(l).forEach((function(t){var e=t[0],i=t[1];return n.addFilter(e,i)})),s._entries(m).forEach((function(t){var e=t[0],i=t[1];return n.addTest(e,i)}))},n._initLoaders=function(){var t=this;this.loaders.forEach((function(e){e.cache={},"function"==typeof e.on&&(e.on("update",(function(n,i){e.cache[n]=null,t.emit("update",n,i,e)})),e.on("load",(function(n,i){t.emit("load",n,i,e)})))}))},n.invalidateCache=function(){this.loaders.forEach((function(t){t.cache={}}))},n.addExtension=function(t,e){return e.__name=t,this.extensions[t]=e,this.extensionsList.push(e),this},n.removeExtension=function(t){var e=this.getExtension(t);e&&(this.extensionsList=s.without(this.extensionsList,e),delete this.extensions[t])},n.getExtension=function(t){return this.extensions[t]},n.hasExtension=function(t){return!!this.extensions[t]},n.addGlobal=function(t,e){return this.globals[t]=e,this},n.getGlobal=function(t){if(void 0===this.globals[t])throw new Error("global not found: "+t);return this.globals[t]},n.addFilter=function(t,e,n){var i=e;return n&&this.asyncFilters.push(t),this.filters[t]=i,this},n.getFilter=function(t){if(!this.filters[t])throw new Error("filter not found: "+t);return this.filters[t]},n.addTest=function(t,e){return this.tests[t]=e,this},n.getTest=function(t){if(!this.tests[t])throw new Error("test not found: "+t);return this.tests[t]},n.resolveTemplate=function(t,e,n){return t.isRelative&&e&&t.isRelative(n)&&t.resolve?t.resolve(e,n):n},n.getTemplate=function(t,e,n,i,o){var a,r=this,c=this,l=null;if(t&&t.raw&&(t=t.raw),s.isFunction(n)&&(o=n,n=null,e=e||!1),s.isFunction(e)&&(o=e,e=!1),t instanceof L)l=t;else{if("string"!=typeof t)throw new Error("template names must be a string: "+t);for(var u=0;u0&&!this.skip(o.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",t.lineno,t.colno);var s=this.parsePrimary();if("_"===s.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",s.lineno,s.colno),this.skipSymbol("as")){var c=this.parsePrimary();i.addChild(new a.Pair(s.lineno,s.colno,s,c))}else i.addChild(s);n=this.parseWithContext()}return new a.FromImport(t.lineno,t.colno,e,i,n)},c.parseBlock=function(){var t=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",t.lineno,t.colno);var e=new a.Block(t.lineno,t.colno);e.name=this.parsePrimary(),e.name instanceof a.Symbol||this.fail("parseBlock: variable name expected",t.lineno,t.colno),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(e.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),e},c.parseExtends=function(){var t="extends",e=this.peekToken();this.skipSymbol(t)||this.fail("parseTemplateRef: expected "+t);var n=new a.Extends(e.lineno,e.colno);return n.template=this.parseExpression(),this.advanceAfterBlockEnd(e.value),n},c.parseInclude=function(){var t="include",e=this.peekToken();this.skipSymbol(t)||this.fail("parseInclude: expected "+t);var n=new a.Include(e.lineno,e.colno);return n.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(n.ignoreMissing=!0),this.advanceAfterBlockEnd(e.value),n},c.parseIf=function(){var t,e=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?t=new a.If(e.lineno,e.colno):this.skipSymbol("ifAsync")?t=new a.IfAsync(e.lineno,e.colno):this.fail("parseIf: expected if, elif, or elseif",e.lineno,e.colno),t.cond=this.parseExpression(),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("elif","elseif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elseif":case"elif":t.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),t.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":t.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return t},c.parseSet=function(){var t=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",t.lineno,t.colno);for(var e,n=new a.Set(t.lineno,t.colno,[]);(e=this.parsePrimary())&&(n.targets.push(e),this.skip(o.TOKEN_COMMA)););return this.skipValue(o.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(t.value)):this.skip(o.TOKEN_BLOCK_END)?(n.body=new a.Capture(t.lineno,t.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",t.lineno,t.colno),n},c.parseSwitch=function(){var t="switch",e="endswitch",n="case",i="default",o=this.peekToken();this.skipSymbol(t)||this.skipSymbol(n)||this.skipSymbol(i)||this.fail('parseSwitch: expected "switch," "case" or "default"',o.lineno,o.colno);var r=this.parseExpression();this.advanceAfterBlockEnd(t),this.parseUntilBlocks(n,i,e);var s,c=this.peekToken(),l=[];do{this.skipSymbol(n);var u=this.parseExpression();this.advanceAfterBlockEnd(t);var p=this.parseUntilBlocks(n,i,e);l.push(new a.Case(c.line,c.col,u,p)),c=this.peekToken()}while(c&&c.value===n);switch(c.value){case i:this.advanceAfterBlockEnd(),s=this.parseUntilBlocks(e),this.advanceAfterBlockEnd();break;case e:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new a.Switch(o.lineno,o.colno,r,l,s)},c.parseStatement=function(){var t=this.peekToken();if(t.type!==o.TOKEN_SYMBOL&&this.fail("tag name expected",t.lineno,t.colno),this.breakOnBlocks&&-1!==s.indexOf(this.breakOnBlocks,t.value))return null;switch(t.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var e=0;e0;){var c=r[0],l=r[1],u=r[2];u===t?i+=1:u===e&&(i-=1),0===i?(o+=l,this.tokens.backN(c.length-l.length)):o+=c}return new a.Output(s.lineno,s.colno,[new a.TemplateData(s.lineno,s.colno,o)])},c.parsePostfix=function(t){for(var e,n=this.peekToken();n;){if(n.type===o.TOKEN_LEFT_PAREN)t=new a.FunCall(n.lineno,n.colno,t,this.parseSignature());else if(n.type===o.TOKEN_LEFT_BRACKET)(e=this.parseAggregate()).children.length>1&&this.fail("invalid index"),t=new a.LookupVal(n.lineno,n.colno,t,e.children[0]);else{if(n.type!==o.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var i=this.nextToken();i.type!==o.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+i.value,i.lineno,i.colno),e=new a.Literal(i.lineno,i.colno,i.value),t=new a.LookupVal(n.lineno,n.colno,t,e)}n=this.peekToken()}return t},c.parseExpression=function(){return this.parseInlineIf()},c.parseInlineIf=function(){var t=this.parseOr();if(this.skipSymbol("if")){var e=this.parseOr(),n=t;(t=new a.InlineIf(t.lineno,t.colno)).body=n,t.cond=e,this.skipSymbol("else")?t.else_=this.parseOr():t.else_=null}return t},c.parseOr=function(){for(var t=this.parseAnd();this.skipSymbol("or");){var e=this.parseAnd();t=new a.Or(t.lineno,t.colno,t,e)}return t},c.parseAnd=function(){for(var t=this.parseNot();this.skipSymbol("and");){var e=this.parseNot();t=new a.And(t.lineno,t.colno,t,e)}return t},c.parseNot=function(){var t=this.peekToken();return this.skipSymbol("not")?new a.Not(t.lineno,t.colno,this.parseNot()):this.parseIn()},c.parseIn=function(){for(var t=this.parseIs();;){var e=this.nextToken();if(!e)break;var n=e.type===o.TOKEN_SYMBOL&&"not"===e.value;if(n||this.pushToken(e),!this.skipSymbol("in")){n&&this.pushToken(e);break}var i=this.parseIs();t=new a.In(t.lineno,t.colno,t,i),n&&(t=new a.Not(t.lineno,t.colno,t))}return t},c.parseIs=function(){var t=this.parseCompare();if(this.skipSymbol("is")){var e=this.skipSymbol("not"),n=this.parseCompare();t=new a.Is(t.lineno,t.colno,t,n),e&&(t=new a.Not(t.lineno,t.colno,t))}return t},c.parseCompare=function(){for(var t=["==","===","!=","!==","<",">","<=",">="],e=this.parseConcat(),n=[];;){var i=this.nextToken();if(!i)break;if(-1===t.indexOf(i.value)){this.pushToken(i);break}n.push(new a.CompareOperand(i.lineno,i.colno,this.parseConcat(),i.value))}return n.length?new a.Compare(n[0].lineno,n[0].colno,e,n):e},c.parseConcat=function(){for(var t=this.parseAdd();this.skipValue(o.TOKEN_TILDE,"~");){var e=this.parseAdd();t=new a.Concat(t.lineno,t.colno,t,e)}return t},c.parseAdd=function(){for(var t=this.parseSub();this.skipValue(o.TOKEN_OPERATOR,"+");){var e=this.parseSub();t=new a.Add(t.lineno,t.colno,t,e)}return t},c.parseSub=function(){for(var t=this.parseMul();this.skipValue(o.TOKEN_OPERATOR,"-");){var e=this.parseMul();t=new a.Sub(t.lineno,t.colno,t,e)}return t},c.parseMul=function(){for(var t=this.parseDiv();this.skipValue(o.TOKEN_OPERATOR,"*");){var e=this.parseDiv();t=new a.Mul(t.lineno,t.colno,t,e)}return t},c.parseDiv=function(){for(var t=this.parseFloorDiv();this.skipValue(o.TOKEN_OPERATOR,"/");){var e=this.parseFloorDiv();t=new a.Div(t.lineno,t.colno,t,e)}return t},c.parseFloorDiv=function(){for(var t=this.parseMod();this.skipValue(o.TOKEN_OPERATOR,"//");){var e=this.parseMod();t=new a.FloorDiv(t.lineno,t.colno,t,e)}return t},c.parseMod=function(){for(var t=this.parsePow();this.skipValue(o.TOKEN_OPERATOR,"%");){var e=this.parsePow();t=new a.Mod(t.lineno,t.colno,t,e)}return t},c.parsePow=function(){for(var t=this.parseUnary();this.skipValue(o.TOKEN_OPERATOR,"**");){var e=this.parseUnary();t=new a.Pow(t.lineno,t.colno,t,e)}return t},c.parseUnary=function(t){var e,n=this.peekToken();return e=this.skipValue(o.TOKEN_OPERATOR,"-")?new a.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(o.TOKEN_OPERATOR,"+")?new a.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),t||(e=this.parseFilter(e)),e},c.parsePrimary=function(t){var e,n=this.nextToken(),i=null;if(n?n.type===o.TOKEN_STRING?e=n.value:n.type===o.TOKEN_INT?e=parseInt(n.value,10):n.type===o.TOKEN_FLOAT?e=parseFloat(n.value):n.type===o.TOKEN_BOOLEAN?"true"===n.value?e=!0:"false"===n.value?e=!1:this.fail("invalid boolean: "+n.value,n.lineno,n.colno):n.type===o.TOKEN_NONE?e=null:n.type===o.TOKEN_REGEX&&(e=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==e?i=new a.Literal(n.lineno,n.colno,e):n.type===o.TOKEN_SYMBOL?i=new a.Symbol(n.lineno,n.colno,n.value):(this.pushToken(n),i=this.parseAggregate()),t||(i=this.parsePostfix(i)),i)return i;throw this.error("unexpected token: "+n.value,n.lineno,n.colno)},c.parseFilterName=function(){for(var t=this.expect(o.TOKEN_SYMBOL),e=t.value;this.skipValue(o.TOKEN_OPERATOR,".");)e+="."+this.expect(o.TOKEN_SYMBOL).value;return new a.Symbol(t.lineno,t.colno,e)},c.parseFilterArgs=function(t){return this.peekToken().type===o.TOKEN_LEFT_PAREN?this.parsePostfix(t).args.children:[]},c.parseFilter=function(t){for(;this.skip(o.TOKEN_PIPE);){var e=this.parseFilterName();t=new a.Filter(e.lineno,e.colno,e,new a.NodeList(e.lineno,e.colno,[t].concat(this.parseFilterArgs(t))))}return t},c.parseFilterStatement=function(){var t=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var e=this.parseFilterName(),n=this.parseFilterArgs(e);this.advanceAfterBlockEnd(t.value);var i=new a.Capture(e.lineno,e.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var o=new a.Filter(e.lineno,e.colno,e,new a.NodeList(e.lineno,e.colno,[i].concat(n)));return new a.Output(e.lineno,e.colno,[o])},c.parseAggregate=function(){var t,e=this.nextToken();switch(e.type){case o.TOKEN_LEFT_PAREN:t=new a.Group(e.lineno,e.colno);break;case o.TOKEN_LEFT_BRACKET:t=new a.Array(e.lineno,e.colno);break;case o.TOKEN_LEFT_CURLY:t=new a.Dict(e.lineno,e.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===o.TOKEN_RIGHT_PAREN||n===o.TOKEN_RIGHT_BRACKET||n===o.TOKEN_RIGHT_CURLY){this.nextToken();break}if(t.children.length>0&&(this.skip(o.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",e.lineno,e.colno)),t instanceof a.Dict){var i=this.parsePrimary();this.skip(o.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",e.lineno,e.colno);var r=this.parseExpression();t.addChild(new a.Pair(i.lineno,i.colno,i,r))}else{var s=this.parseExpression();t.addChild(s)}}return t},c.parseSignature=function(t,e){var n=this.peekToken();if(!e&&n.type!==o.TOKEN_LEFT_PAREN){if(t)return null;this.fail("expected arguments",n.lineno,n.colno)}n.type===o.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var i=new a.NodeList(n.lineno,n.colno),r=new a.KeywordArgs(n.lineno,n.colno),s=!1;;){if(n=this.peekToken(),!e&&n.type===o.TOKEN_RIGHT_PAREN){this.nextToken();break}if(e&&n.type===o.TOKEN_BLOCK_END)break;if(s&&!this.skip(o.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else{var c=this.parseExpression();this.skipValue(o.TOKEN_OPERATOR,"=")?r.addChild(new a.Pair(c.lineno,c.colno,c,this.parseExpression())):i.addChild(c)}s=!0}return r.children.length&&i.addChild(r),i},c.parseUntilBlocks=function(){for(var t=this.breakOnBlocks,e=arguments.length,n=new Array(e),i=0;i=","//","**"],R=M+this.current();switch(-1!==i.indexOf(N,R)&&(this.forward(),M=R,-1!==i.indexOf(N,R+this.current())&&(M=R+this.current(),this.forward())),M){case"(":P=m;break;case")":P=f;break;case"[":P=y;break;case"]":P=_;break;case"{":P=b;break;case"}":P=v;break;case",":P=k;break;case":":P=w;break;case"~":P=E;break;case"|":P=C;break;default:P=g}return O(P,M,e,n)}if((t=this._extractUntil(o+a)).match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var V=this._extract("0123456789");return O(x,t+"."+V,e,n)}return O("int",t,e,n)}if(t.match(/^(true|false)$/))return O(T,t,e,n);if("none"===t)return O(L,t,e,n);if("null"===t)return O(L,t,e,n);if(t)return O(A,t,e,n);throw new Error("Unexpected value while parsing: "+t)}var F,U=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((t=this._extractString(this.tags.BLOCK_START+"-"))||(t=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,O(l,t,e,n);if((t=this._extractString(this.tags.VARIABLE_START+"-"))||(t=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,O(p,t,e,n);t="";var j=!1;for(this._matches(this.tags.COMMENT_START)&&(j=!0,t=this._extractString(this.tags.COMMENT_START));null!==(F=this._extractUntil(U));){if(t+=F,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!j){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=t.length){var K=t.slice(-this.colno);if(/^\s+$/.test(K)&&!(t=t.slice(0,-this.colno)).length)return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!j)throw new Error("unexpected end of comment");t+=this._extractString(this.tags.COMMENT_END);break}t+=this.current(),this.forward()}if(null===F&&j)throw new Error("expected end of comment, got end of file");return O(j?h:c,t,e,n)},e._parseString=function(t){this.forward();for(var e="";!this.isFinished()&&this.current()!==t;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":e+="\n";break;case"t":e+="\t";break;case"r":e+="\r";break;default:e+=this.current()}this.forward()}else e+=n,this.forward()}return this.forward(),e},e._matches=function(t){return this.index+t.length>this.len?null:this.str.slice(this.index,this.index+t.length)===t},e._extractString=function(t){return this._matches(t)?(this.forwardN(t.length),t):null},e._extractUntil=function(t){return this._extractMatching(!0,t||"")},e._extract=function(t){return this._extractMatching(!1,t)},e._extractMatching=function(t,e){if(this.isFinished())return null;var n=e.indexOf(this.current());if(t&&-1===n||!t&&-1!==n){var i=this.current();this.forward();for(var o=e.indexOf(this.current());(t&&-1===o||!t&&-1!==o)&&!this.isFinished();)i+=this.current(),this.forward(),o=e.indexOf(this.current());return i}return""},e._extractRegex=function(t){var e=this.currentStr().match(t);return e?(this.forwardN(e[0].length),e):null},e.isFinished=function(){return this.index>=this.len},e.forwardN=function(t){for(var e=0;e1024){for(var e=0,n=o.length-a;e0&&r.length>o&&!r.warned){r.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=r.length,s=c,console&&console.warn&&console.warn(s)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=d.bind(i);return o.listener=n,i.wrapFn=o,o}function m(t,e,n){var i=t._events;if(void 0===i)return[];var o=i[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(r=e[0]),r instanceof Error)throw r;var s=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw s.context=r,s}var c=o[t];if(void 0===c)return!1;if("function"==typeof c)a(c,this,e);else{var l=c.length,u=y(c,l);for(n=0;n=0;a--)if(n[a]===e||n[a].listener===e){r=n[a].listener,o=a;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return m(this,t,!0)},s.prototype.rawListeners=function(t){return m(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,n){"use strict";var i=n(3),o=n(0),a=0;function r(){return"hole_"+a++}function s(t,e){for(var n=null,i=0;i=e)return t;var n=e-t.length,r=i.repeat(" ",n/2-n%2),s=i.repeat(" ",n/2);return o.copySafeness(t,r+t+s)},e.default=function(t,e,n){return n?t||e:void 0!==t?t:e},e.dictsort=function(t,e,n){if(!i.isObject(t))throw new i.TemplateError("dictsort filter: val must be an object");var o,a=[];for(var r in t)a.push([r,t[r]]);if(void 0===n||"key"===n)o=0;else{if("value"!==n)throw new i.TemplateError("dictsort filter: You can only sort by either key or value");o=1}return a.sort((function(t,n){var a=t[o],r=n[o];return e||(i.isString(a)&&(a=a.toUpperCase()),i.isString(r)&&(r=r.toUpperCase())),a>r?1:a===r?0:-1})),a},e.dump=function(t,e){return JSON.stringify(t,null,e)},e.escape=function(t){return t instanceof o.SafeString?t:(t=null==t?"":t,o.markSafe(i.escape(t.toString())))},e.safe=function(t){return t instanceof o.SafeString?t:(t=null==t?"":t,o.markSafe(t.toString()))},e.first=function(t){return t[0]},e.forceescape=function(t){return t=null==t?"":t,o.markSafe(i.escape(t.toString()))},e.groupby=function(t,e){return i.groupBy(t,e,this.env.opts.throwOnUndefined)},e.indent=function(t,e,n){if(""===(t=a(t,"")))return"";e=e||4;var r=t.split("\n"),s=i.repeat(" ",e),c=r.map((function(t,e){return 0!==e||n?""+s+t:t})).join("\n");return o.copySafeness(t,c)},e.join=function(t,e,n){return e=e||"",n&&(t=i.map(t,(function(t){return t[n]}))),t.join(e)},e.last=function(t){return t[t.length-1]},e.length=function(t){var e=a(t,"");return void 0!==e?"function"==typeof Map&&e instanceof Map||"function"==typeof Set&&e instanceof Set?e.size:!i.isObject(e)||e instanceof o.SafeString?e.length:i.keys(e).length:0},e.list=c,e.lower=function(t){return(t=a(t,"")).toLowerCase()},e.nl2br=function(t){return null==t?"":o.copySafeness(t,t.replace(/\r\n|\n/g,"
\n"))},e.random=function(t){return t[Math.floor(Math.random()*t.length)]},e.reject=l(!1),e.rejectattr=function(t,e){return t.filter((function(t){return!t[e]}))},e.select=l(!0),e.selectattr=function(t,e){return t.filter((function(t){return!!t[e]}))},e.replace=function(t,e,n,i){var a=t;if(e instanceof RegExp)return t.replace(e,n);void 0===i&&(i=-1);var r="";if("number"==typeof e)e=""+e;else if("string"!=typeof e)return t;if("number"==typeof t&&(t=""+t),"string"!=typeof t&&!(t instanceof o.SafeString))return t;if(""===e)return r=n+t.split("").join(n)+n,o.copySafeness(t,r);var s=t.indexOf(e);if(0===i||-1===s)return t;for(var c=0,l=0;s>-1&&(-1===i||l=o&&u.push(n),a.push(u)}return a},e.sum=function(t,e,n){return void 0===n&&(n=0),e&&(t=i.map(t,(function(t){return t[e]}))),n+t.reduce((function(t,e){return t+e}),0)},e.sort=o.makeMacro(["value","reverse","case_sensitive","attribute"],[],(function(t,e,n,o){var a=this,r=i.map(t,(function(t){return t})),s=i.getAttrGetter(o);return r.sort((function(t,r){var c=o?s(t):t,l=o?s(r):r;if(a.env.opts.throwOnUndefined&&o&&(void 0===c||void 0===l))throw new TypeError('sort: attribute "'+o+'" resolved to undefined');return!n&&i.isString(c)&&i.isString(l)&&(c=c.toLowerCase(),l=l.toLowerCase()),cl?e?-1:1:0})),r})),e.string=function(t){return o.copySafeness(t,t)},e.striptags=function(t,e){var n,i=u((t=a(t,"")).replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,""));return n=e?i.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):i.replace(/\s+/gi," "),o.copySafeness(t,n)},e.title=function(t){var e=(t=a(t,"")).split(" ").map((function(t){return s(t)}));return o.copySafeness(t,e.join(" "))},e.trim=u,e.truncate=function(t,e,n,i){var r=t;if(e=e||255,(t=a(t,"")).length<=e)return t;if(n)t=t.substring(0,e);else{var s=t.lastIndexOf(" ",e);-1===s&&(s=e),t=t.substring(0,s)}return t+=null!=i?i:"...",o.copySafeness(r,t)},e.upper=function(t){return(t=a(t,"")).toUpperCase()},e.urlencode=function(t){var e=encodeURIComponent;return i.isString(t)?e(t):(i.isArray(t)?t:i._entries(t)).map((function(t){var n=t[0],i=t[1];return e(n)+"="+e(i)})).join("&")};var p=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,d=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,h=/^https?:\/\/.*$/,m=/^www\./,f=/\.(?:org|net|com)(?:\:|\/|$)/;e.urlize=function(t,e,n){r(e)&&(e=1/0);var i=!0===n?' rel="nofollow"':"";return t.split(/(\s+)/).filter((function(t){return t&&t.length})).map((function(t){var n=t.match(p),o=n?n[1]:t,a=o.substr(0,e);return h.test(o)?'"+a+"":m.test(o)?'"+a+"":d.test(o)?''+o+"":f.test(o)?'"+a+"":t})).join("")},e.wordcount=function(t){var e=(t=a(t,""))?t.match(/\w+/g):null;return e?e.length:null},e.float=function(t,e){var n=parseFloat(t);return r(n)?e:n};var y=o.makeMacro(["value","default","base"],[],(function(t,e,n){void 0===n&&(n=10);var i=parseInt(t,n);return r(i)?e:i}));e.int=y,e.d=e.default,e.e=e.escape},function(t,e,n){"use strict";function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var o=function(t){var e,n;function o(e){var n;return(n=t.call(this)||this).precompiled=e||{},n}return n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,i(e,n),o.prototype.getSource=function(t){return this.precompiled[t]?{src:{type:"code",obj:this.precompiled[t]},path:t}:null},o}(n(6));t.exports={PrecompiledLoader:o}},function(t,e,n){"use strict";var i=n(2).SafeString;e.callable=function(t){return"function"==typeof t},e.defined=function(t){return void 0!==t},e.divisibleby=function(t,e){return t%e==0},e.escaped=function(t){return t instanceof i},e.equalto=function(t,e){return t===e},e.eq=e.equalto,e.sameas=e.equalto,e.even=function(t){return t%2==0},e.falsy=function(t){return!t},e.ge=function(t,e){return t>=e},e.greaterthan=function(t,e){return t>e},e.gt=e.greaterthan,e.le=function(t,e){return t<=e},e.lessthan=function(t,e){return t0)for(var o=t;oe;a+=n)i.push(a);return i},cycler:function(){return t=Array.prototype.slice.call(arguments),e=-1,{current:null,reset:function(){e=-1,this.current=null},next:function(){return++e>=t.length&&(e=0),this.current=t[e],this.current}};var t,e},joiner:function(t){return function(t){t=t||",";var e=!0;return function(){var n=e?"":t;return e=!1,n}}(t)}}}},function(t,e,n){var i=n(4);t.exports=function(t,e){function n(t,e){if(this.name=t,this.path=t,this.defaultEngine=e.defaultEngine,this.ext=i.extname(t),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}return n.prototype.render=function(e,n){t.render(this.name,e,n)},e.set("view",n),e.set("nunjucksEnv",t),t}},function(t,e,n){"use strict";var i=n(4),o=n(4),a=n(0)._prettifyError,r=n(5),s=n(7).Environment,c=n(24);function l(t,e){return!!Array.isArray(e)&&e.some((function(e){return t.match(e)}))}function u(t,e){(e=e||{}).isString=!0;var n=e.env||new s([]),i=e.wrapper||c;if(!e.name)throw new Error('the "name" option is required when compiling a string');return i([p(t,e.name,n)],e)}function p(t,e,n){var i,o=(n=n||new s([])).asyncFilters,c=n.extensionsList;e=e.replace(/\\/g,"/");try{i=r.compile(t,o,c,e,n.opts)}catch(t){throw a(e,!1,t)}return{name:e,template:i}}t.exports={precompile:function(t,e){var n=(e=e||{}).env||new s([]),a=e.wrapper||c;if(e.isString)return u(t,e);var r=i.existsSync(t)&&i.statSync(t),d=[],h=[];if(r.isFile())d.push(p(i.readFileSync(t,"utf-8"),e.name||t,n));else if(r.isDirectory()){!function n(a){i.readdirSync(a).forEach((function(r){var s=o.join(a,r),c=s.substr(o.join(t,"/").length),u=i.statSync(s);u&&u.isDirectory()?l(c+="/",e.exclude)||n(s):l(c,e.include)&&h.push(s)}))}(t);for(var m=0;mt.length||o>0&&r>=i||o<0&&r<=i);r+=o)a.push(n.memberLookup(t,r));return a}function h(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var m={pop:function(t){if(void 0===t)return this.pop();if(t>=this.length||t<0)throw new Error("KeyError");return this.splice(t,1)},append:function(t){return this.push(t)},remove:function(t){for(var e=0;e{"use strict";__webpack_require__.d(__webpack_exports__,{W:()=>BaseRemoteElement});var lit__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(670),lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(385),ha_nunjucks__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(703),_models_constants__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(290),_models_maps__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(63),_utils__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(626),__decorate=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};class BaseRemoteElement extends lit__WEBPACK_IMPORTED_MODULE_0__.WF{constructor(){super(...arguments),this.icons=[],this.renderRipple=!0,this.value=0,this.getValueFromHass=!0,this.unitOfMeasurement="",this.fireMouseEvent=!0,this.swiping=!1}fireHapticEvent(t){if(this.renderTemplate(this.config.haptics)??1){const e=new Event("haptic",{bubbles:!0,composed:!0});e.detail=t,window.dispatchEvent(e)}}endAction(){this.momentaryStart=void 0,this.momentaryEnd=void 0,this.swiping=!1,this.targetTouches=void 0,this.initialX=void 0,this.initialY=void 0,this.currentX=void 0,this.currentY=void 0,this.deltaX=void 0,this.deltaY=void 0}sendAction(t,e=this.config){let n;switch(t){case"drag_action":n=e.drag_action;break;case"multi_drag_action":n=e.multi_drag_action??e.drag_action;break;case"momentary_start_action":n=e.momentary_start_action;break;case"momentary_end_action":n=e.momentary_end_action;break;case"multi_hold_action":n=e.multi_hold_action??e.hold_action??e.multi_tap_action??e.tap_action;break;case"multi_double_tap_action":n=e.multi_double_tap_action??e.double_tap_action??e.multi_tap_action??e.tap_action;break;case"multi_tap_action":n=e.multi_tap_action??e.tap_action;break;case"hold_action":n=e.hold_action??e.tap_action;break;case"double_tap_action":n=e.double_tap_action??e.tap_action;break;default:n=e.tap_action}if(!n)return clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!0,void this.requestUpdate();if(n=this.deepRenderTemplate(n),n&&this.handleConfirmation(n))try{switch(n.action){case"navigate":this.navigate(n);break;case"url":this.url(n);break;case"assist":this.assist(n);break;case"more-info":this.moreInfo(n);break;case"toggle":this.toggle(n);break;case"call-service":case"perform-action":this.callService(n);break;case"source":this.source(n);break;case"key":this.key(n,t);break;case"fire-dom-event":this.fireDomEvent(n);break;case"eval":this.eval(n);break;case"textbox":case"search":case"keyboard":this.keyboard(n)}}catch(t){throw this.endAction(),t}else this.dispatchEvent(new CustomEvent("confirmation-failed"))}key(t,e){switch(t.platform){case"Unified Remote":break;case"Kodi":this.hass.callService("kodi","call_method",{entity_id:t.media_player_id,method:t.key});break;case"LG webOS":this.hass.callService("webostv","button",{entity_id:t.media_player_id,button:t.key});break;default:{const n={entity_id:t.remote_id??"",command:t.key??""};!e.includes("hold_action")||this.config.hold_action&&"none"!=this.config.hold_action.action||(n.hold_secs=.5),this.hass.callService("remote","send_command",n);break}}}source(t){switch(t.platform){case"Unified Remote":break;case"Fire TV":case"Roku":case"Kodi":case"Apple TV":case"Samsung TV":case"LG webOS":this.hass.callService("media_player","select_source",{entity_id:t.media_player_id,source:t.source});break;case"Sony BRAVIA":this.hass.callService("media_player","play_media",{entity_id:t.media_player_id,media_content_id:t.source,media_content_type:"app"});break;default:this.hass.callService("remote","turn_on",{entity_id:t.remote_id,activity:t.source})}}callService(t){const[e,n]=(t.perform_action??t.service).split(".");this.hass.callService(e,n,t.data,t.target)}navigate(t){const e=t.navigation_path??"",n=t.navigation_replace??!1;if(e.includes("//"))return void console.error('Protocol detected in navigation path. To navigate to another website use the action "url" with the key "url_path" instead.');1==n?window.history.replaceState(window.history.state?.root?{root:!0}:null,"",e):window.history.pushState(null,"",e);const i=new Event("location-changed",{bubbles:!1,cancelable:!0,composed:!1});i.detail={replace:1==n},window.dispatchEvent(i)}url(t){let e=t.url_path??"";e.includes("//")||(e=`https://${e}`),window.open(e)}assist(t){this.hass?.auth?.external?.config?.hasAssist?this.hass?.auth?.external?.fireMessage({type:"assist/show",payload:{pipeline_id:t.pipeline_id,start_listening:t.start_listening}}):window.open(`${window.location.href}?conversation=1`,"_self")}moreInfo(t){const e=new Event("hass-more-info",{bubbles:!0,cancelable:!0,composed:!0});e.detail={entityId:t.target?.entity_id??this.config.entity_id},this.dispatchEvent(e)}toggle(t){const e={...t.data,...t.target};if(Array.isArray(e.entity_id))for(const t of e.entity_id)this.toggleSingle(t);else e.entity_id?this.toggleSingle(e.entity_id):this.hass.callService("homeassistant","toggle",e)}toggleSingle(t){const e=["closed","locked","off"].includes(this.hass.states[t].state);let n,i=t.split(".")[0];switch(i){case"lock":n=e?"unlock":"lock";break;case"cover":n=e?"open_cover":"close_cover";break;case"button":case"input_button":n="press";break;case"scene":n="turn_on";break;case"valve":n=e?"open_valve":"close_valve";break;default:i="homeassistant",n=e?"turn_on":"turn_off"}this.hass.callService(i,n,{entity_id:t})}keyboard(t){const e=new Event("keyboard-dialog-open",{composed:!0,bubbles:!0});e.detail=t,this.getRootNode().querySelector("keyboard-dialog").shadowRoot?.querySelector("dialog")?.dispatchEvent(e)}fireDomEvent(t){const e=new Event(t.event_type??"ll-custom",{composed:!0,bubbles:!0});e.detail=t,this.dispatchEvent(e)}eval(action){eval(action.eval??"")}handleConfirmation(t){if(t.confirmation){let e=`Are you sure you want to run action '${t.action}'?`;return 1==t.confirmation?(this.fireHapticEvent("warning"),confirm(e)):(t.confirmation?.text&&(e=t.confirmation.text),!!t.confirmation?.exemptions?.map((t=>t.user)).includes(this.hass.user?.id)||(this.fireHapticEvent("warning"),confirm(e)))}return!0}firstUpdated(){this.addEventListener("confirmation-failed",this.confirmationFailed)}confirmationFailed(){clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!0,this.requestUpdate()}setValue(){if(this.entityId=this.renderTemplate(this.config.entity_id),this.unitOfMeasurement=this.renderTemplate(this.config.unit_of_measurement)??"",this.getValueFromHass&&this.entityId)if(clearInterval(this.valueUpdateInterval),this.valueUpdateInterval=void 0,this.valueAttribute=this.renderTemplate(this.config.value_attribute??"state").toLowerCase(),this.hass.states[this.entityId])if("state"==this.valueAttribute)this.value=this.hass.states[this.entityId].state;else{let t;const e=this.valueAttribute.match(/\[\d+\]$/);if(e){const n=parseInt(e[0].replace(/\[|\]/g,""));this.valueAttribute=this.valueAttribute.replace(e[0],""),t=this.hass.states[this.entityId]?.attributes?.[this.valueAttribute],t=t&&Array.isArray(t)&&t.length?t[n]:void 0}else t=this.hass.states[this.entityId]?.attributes?.[this.valueAttribute];if(null!=t||"elapsed"==this.valueAttribute)switch(this.valueAttribute){case"brightness":this.value=Math.round(100*parseInt(t??0)/255);break;case"media_position":try{const e=()=>{"playing"==this.hass.states[this.entityId].state?this.value=Math.min(Math.floor(Math.floor(t)+(Date.now()-Date.parse(this.hass.states[this.entityId].attributes?.media_position_updated_at))/1e3),Math.floor(this.hass.states[this.entityId].attributes?.media_duration)):this.value=t};e(),this.valueUpdateInterval=setInterval(e,500)}catch(e){console.error(e),this.value=t}break;case"elapsed":if(this.entityId.startsWith("timer.")){if("idle"==this.hass.states[this.entityId].state)this.value=0;else{const t=this.hass.states[this.entityId].attributes?.duration.split(":"),e=3600*parseInt(t[0])+60*parseInt(t[1])+parseInt(t[2]),n=Date.parse(this.hass.states[this.entityId].attributes?.finishes_at);try{const t=()=>{if("active"==this.hass.states[this.entityId].state){const t=(n-Date.now())/1e3,i=Math.floor(e-t);this.value=Math.min(i,e)}else{const t=this.hass.states[this.entityId].attributes?.remaining.split(":"),n=3600*parseInt(t[0])+60*parseInt(t[1])+parseInt(t[2]);this.value=Math.floor(e-n)}};t(),this.valueUpdateInterval=setInterval(t,500)}catch(t){console.error(t),this.value=0}}break}default:this.value=t}else this.value=t}else this.value=void 0}renderTemplate(t,e){let n=0;this.momentaryStart&&this.momentaryEnd&&(n=(this.momentaryEnd-this.momentaryStart)/1e3),e={VALUE:this.value,HOLD_SECS:n??0,UNIT:this.unitOfMeasurement,value:this.value,hold_secs:n??0,unit:this.unitOfMeasurement,initialX:this.initialX,initialY:this.initialY,currentX:this.currentX,currentY:this.currentY,deltaX:this.deltaX,deltaY:this.deltaY,config:{...this.config,entity:this.entityId,attribute:this.valueAttribute},...e};let i=(e={render:t=>this.renderTemplate(t,e),...e}).value;null!=i&&"number"==typeof i&&null!=this.precision&&(i=Number(i).toFixed(this.precision),e={...e,VALUE:i,value:i});const o=(0,ha_nunjucks__WEBPACK_IMPORTED_MODULE_2__.X)(this.hass,t,e);if(o!=t)return o;if("string"==typeof t)for(const n of["VALUE","HOLD_SECS","UNIT"]){if(t==n)return e[n];t.includes(n)&&(t=t.replace(new RegExp(n,"g"),e[n]??""))}return t}deepRenderTemplate(t,e){const n=structuredClone(t),i=(0,_utils__WEBPACK_IMPORTED_MODULE_4__.b$)(n);for(const t of i)(0,_utils__WEBPACK_IMPORTED_MODULE_4__.HD)(n,t,this.renderTemplate((0,_utils__WEBPACK_IMPORTED_MODULE_4__.vz)(n,t),e));return n}resetGetValueFromHass(){const t=this.renderTemplate(this.config.value_from_hass_delay??_models_constants__WEBPACK_IMPORTED_MODULE_5__.s$);this.getValueFromHassTimer=setTimeout((()=>{this.getValueFromHass=!0,this.requestUpdate()}),t)}buildIcon(t,e){t=this.renderTemplate(t??"",e);let n=lit__WEBPACK_IMPORTED_MODULE_0__.qy``;if(t)if(t.includes(":"))n=lit__WEBPACK_IMPORTED_MODULE_0__.qy``;else{const e=(this.icons??[]).filter((e=>e.name==t))[0]??_models_maps__WEBPACK_IMPORTED_MODULE_3__.o$.filter((e=>e.name==t))[0];n=lit__WEBPACK_IMPORTED_MODULE_0__.qy``}return lit__WEBPACK_IMPORTED_MODULE_0__.qy`
${n}
`}buildLabel(t,e){if(t){const n=this.renderTemplate(t,e);if(n)return lit__WEBPACK_IMPORTED_MODULE_0__.qy`
${n}
`}return""}buildRipple(){return this.renderRipple?lit__WEBPACK_IMPORTED_MODULE_0__.qy``:""}buildStyles(t,e){return t?lit__WEBPACK_IMPORTED_MODULE_0__.qy``:""}setTargetTouches(t){if(this.targetTouches)for(const e of t.targetTouches){const t=this.targetTouches.findIndex((t=>t.identifier==e.identifier));t>=0?this.targetTouches[t]=e:this.targetTouches.push(e)}else this.targetTouches=Array.from(t.targetTouches??[])}onStart(t){if("targetTouches"in t){let e=0,n=0;this.setTargetTouches(t);for(const t of this.targetTouches??[])e+=t.clientX,n+=t.clientY;this.initialX=e/(this.targetTouches?.length??1),this.initialY=n/(this.targetTouches?.length??1)}else this.initialX=t.clientX,this.initialY=t.clientY;this.currentX=this.initialX,this.currentY=this.initialY}onEnd(t){}onMove(t){let e=0,n=0;if("targetTouches"in t){this.setTargetTouches(t);for(const t of this.targetTouches??[])e+=t.clientX,n+=t.clientY;e/=this.targetTouches?.length??1,n/=this.targetTouches?.length??1}else e=t.clientX??0,n=t.clientY??0;this.deltaX=e-(this.currentX??e),this.deltaY=n-(this.currentY??n),this.currentX=e,this.currentY=n}onMouseDown(t){this.fireMouseEvent&&this.onStart(t)}onMouseUp(t){this.fireMouseEvent&&this.onEnd(t),this.fireMouseEvent=!0}onMouseMove(t){this.fireMouseEvent&&this.onMove(t)}onTouchStart(t){this.fireMouseEvent=!1,this.onStart(t)}onTouchEnd(t){this.fireMouseEvent=!1,this.onEnd(t)}onTouchMove(t){this.fireMouseEvent=!1,this.onMove(t)}onContextMenu(t){if(!this.fireMouseEvent)return t.preventDefault(),t.stopPropagation(),!1}toggleRipple(){this.cancelRippleToggle(),this.renderRippleTransition=setTimeout((()=>this.rippleTransition=!1),400),this.renderRippleOff=setTimeout((()=>this.renderRipple=!1),800),this.renderRippleOn=setTimeout((()=>this.cancelRippleToggle()),850)}cancelRippleToggle(){clearTimeout(this.renderRippleOff),clearTimeout(this.renderRippleOn),clearTimeout(this.renderRippleTransition),this.renderRippleOff=void 0,this.renderRippleOn=void 0,this.renderRippleTransition=void 0,this.rippleTransition=!0,this.renderRipple=!0}static get styles(){return lit__WEBPACK_IMPORTED_MODULE_0__.AH`:host{display:flex;flex-flow:column;place-content:center space-evenly;align-items:center;position:relative;border:none;border-radius:10px;padding:0;box-sizing:border-box;outline:0;overflow:visible;font-size:inherit;color:inherit;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}md-ripple.transition-on{opacity:1 transition: opacity 375ms linear}md-ripple.transition-off{opacity:0;transition:opacity 375ms linear}.icon{pointer-events:none;position:relative;flex-flow:column;place-content:center;display:var(--icon-display,inline-flex);transform:var(--icon-transform);color:var(--icon-color,var(--primary-text-color));filter:var(--icon-filter, none);height:var(--size,48px);width:var(--size,48px);--mdc-icon-size:var(--size, 48px)}ha-icon,svg{display:inline-flex;flex-direction:column;justify-content:center;text-align:center;align-items:center;vertical-align:middle;height:var(--size,48px);width:var(--size,48px);pointer-events:none}.label{position:relative;pointer-events:none;justify-content:center;align-items:center;height:15px;line-height:15px;width:inherit;margin:0;font-family:inherit;font-size:12px;font-weight:700;display:var(--label-display,inline-flex);transform:var(--label-transform);color:var(--label-color,inherit);filter:var(--label-filter, none)}`}}__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.MZ)()],BaseRemoteElement.prototype,"hass",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.MZ)()],BaseRemoteElement.prototype,"config",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.MZ)()],BaseRemoteElement.prototype,"icons",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"renderRipple",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"renderRippleOff",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"renderRippleOn",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"renderRippleTransition",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"rippleTransition",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.wk)()],BaseRemoteElement.prototype,"value",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.Ls)({passive:!0})],BaseRemoteElement.prototype,"onMouseDown",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.Ls)({passive:!0})],BaseRemoteElement.prototype,"onMouseMove",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.Ls)({passive:!0})],BaseRemoteElement.prototype,"onTouchStart",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.Ls)({passive:!0})],BaseRemoteElement.prototype,"onTouchMove",null)},290:(t,e,n)=>{"use strict";n.d(e,{$6:()=>r,At:()=>o,HB:()=>d,RZ:()=>p,Xy:()=>s,a3:()=>a,bQ:()=>h,hI:()=>l,jc:()=>i,s$:()=>c,zM:()=>u});const i=200,o=500,a=100,r=!0,s=!0,c=1e3,l=1,u=100,p=.01,d=0,h=1},63:(t,e,n)=>{"use strict";n.d(e,{$i:()=>i,tz:()=>o,qz:()=>a,_6:()=>r,J7:()=>s,hd:()=>c,o$:()=>l,iu:()=>u,ci:()=>p,zT:()=>h,nK:()=>d,np:()=>m,rl:()=>f,j0:()=>y,$S:()=>_,ks:()=>b,Qz:()=>v,i4:()=>g,oA:()=>k,CI:()=>w,Mo:()=>E});const i=[{type:"button",name:"power",tap_action:{action:"key",key:"POWER"},icon:"mdi:power"},{type:"button",name:"home",tap_action:{action:"key",key:"HOME"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"BACK"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"MENU"},icon:"mdi:menu"},{type:"button",name:"settings",tap_action:{action:"key",key:"SETTINGS"},icon:"mdi:cog"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VOLUME_UP"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VOLUME_DOWN"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"MUTE"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"DPAD_UP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"DPAD_DOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"DPAD_LEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"DPAD_RIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"DPAD_CENTER"},icon:"mdi:checkbox-blank-circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"DPAD_CENTER"},up:{tap_action:{action:"key",key:"DPAD_UP"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"DPAD_DOWN"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"DPAD_LEFT"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"DPAD_RIGHT"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"DPAD_CENTER"},drag_action:{action:"key",key:'DPAD_{{ ("RIGHT" if deltaX > 0 else "LEFT") if (deltaX | abs) > (deltaY | abs) else ("DOWN" if deltaY > 0 else "UP") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'DPAD_{{ ("RIGHT" if deltaX > 0 else "LEFT") if (deltaX | abs) > (deltaY | abs) else ("DOWN" if deltaY > 0 else "UP") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"key",key:"MEDIA_PLAY_PAUSE"},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"key",key:"MEDIA_PLAY"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"MEDIA_PAUSE"},icon:"mdi:pause"},{type:"button",name:"rewind",tap_action:{action:"key",key:"MEDIA_REWIND"},icon:"mdi:rewind"},{type:"button",name:"fast_forward",tap_action:{action:"key",key:"MEDIA_FAST_FORWARD"},icon:"mdi:fast-forward"},{type:"button",name:"previous",tap_action:{action:"key",key:"MEDIA_PREVIOUS"},icon:"mdi:skip-previous"},{type:"button",name:"next",tap_action:{action:"key",key:"MEDIA_NEXT"},icon:"mdi:skip-next"},{type:"button",name:"stop",tap_action:{action:"key",key:"MEDIA_STOP"},icon:"mdi:stop"},{type:"button",name:"record",tap_action:{action:"key",key:"MEDIA_RECORD"},icon:"mdi:record"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:google-assistant"},{type:"button",name:"delete",tap_action:{action:"key",key:"DEL"},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"forward_delete",tap_action:{action:"key",key:"FOWARD_DEL"},hold_action:{action:"repeat"},icon:"mdi:backspace-reverse"},{type:"button",name:"enter",tap_action:{action:"key",key:"ENTER"},icon:"mdi:magnify"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"CHANNEL_UP"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"CHANNEL_DOWN"},icon:"mdi:arrow-down-circle"},{type:"button",name:"red",tap_action:{action:"key",key:"PROG_RED"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"PROG_GREEN"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"PROG_YELLOW"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"PROG_BLUE"},icon:"mdi:alpha-b-box"},{type:"button",name:"a",tap_action:{action:"key",key:"BUTTON_A"},icon:"mdi:alpha-a-circle"},{type:"button",name:"b",tap_action:{action:"key",key:"BUTTON_B"},icon:"mdi:alpha-b-circle"},{type:"button",name:"x",tap_action:{action:"key",key:"BUTTON_X"},icon:"mdi:alpha-x-circle"},{type:"button",name:"y",tap_action:{action:"key",key:"BUTTON_Y"},icon:"mdi:alpha-y-circle"},{type:"button",name:"xpad",icon:"mdi:gamepad-circle"},{type:"button",name:"npad",icon:"mdi:gamepad-circle"},{type:"button",name:"n0",tap_action:{action:"key",key:"0"},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"key",key:"1"},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"key",key:"2"},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"key",key:"3"},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"key",key:"4"},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"key",key:"5"},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"key",key:"6"},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"key",key:"7"},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"key",key:"8"},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"key",key:"9"},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"f1",tap_action:{action:"key",key:"F1"},icon:"mdi:keyboard-f1"},{type:"button",name:"f2",tap_action:{action:"key",key:"F2"},icon:"mdi:keyboard-f2"},{type:"button",name:"f3",tap_action:{action:"key",key:"F3"},icon:"mdi:keyboard-f3"},{type:"button",name:"f4",tap_action:{action:"key",key:"F4"},icon:"mdi:keyboard-f4"},{type:"button",name:"f5",tap_action:{action:"key",key:"F5"},icon:"mdi:keyboard-f5"},{type:"button",name:"f6",tap_action:{action:"key",key:"F6"},icon:"mdi:keyboard-f6"},{type:"button",name:"f7",tap_action:{action:"key",key:"F7"},icon:"mdi:keyboard-f7"},{type:"button",name:"f8",tap_action:{action:"key",key:"F8"},icon:"mdi:keyboard-f8"},{type:"button",name:"f9",tap_action:{action:"key",key:"F9"},icon:"mdi:keyboard-f9"},{type:"button",name:"f10",tap_action:{action:"key",key:"F10"},icon:"mdi:keyboard-f10"},{type:"button",name:"f11",tap_action:{action:"key",key:"F11"},icon:"mdi:keyboard-f11"},{type:"button",name:"f12",tap_action:{action:"key",key:"F12"},icon:"mdi:keyboard-f12"},{type:"button",name:"info",tap_action:{action:"key",key:"INFO"},icon:"mdi:information"},{type:"button",name:"guide",tap_action:{action:"key",key:"GUIDE"},icon:"mdi:television-box"},{type:"button",name:"captions",tap_action:{action:"key",key:"CAPTIONS"},icon:"mdi:closed-caption"},{type:"button",name:"button_mode",tap_action:{action:"key",key:"BUTTON_MODE"},icon:"mdi:gesture-tap-button"},{type:"button",name:"explorer",tap_action:{action:"key",key:"EXPLORER"},icon:"mdi:folder-multiple"},{type:"button",name:"teletext",tap_action:{action:"key",key:"TV_TELETEXT"},icon:"mdi:card-text"},{type:"button",name:"tv",tap_action:{action:"key",key:"TV"},icon:"mdi:television-box"},{type:"button",name:"dvr",tap_action:{action:"key",key:"DVR"},icon:"mdi:audio-video"},{type:"button",name:"audio_track",tap_action:{action:"key",key:"MEDIA_AUDIO_TRACK"},icon:"mdi:waveform"}],o=[{type:"button",name:"appletv",tap_action:{action:"source",source:"https://tv.apple.com"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"crunchyroll://"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"https://open.dazn.com/"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"discoveryplus://"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"https://www.disneyplus.com"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"embyatv://tv.emby.embyatv/startapp"},icon:"mdi:emby"},{type:"button",name:"f1tv",tap_action:{action:"source",source:"com.formulaone.production"},icon:"f1tv"},{type:"button",name:"filmplus",tap_action:{action:"source",source:"com.guideplus.co"},icon:"filmplus"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"foxsports://live"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"hulu://"},icon:"mdi:hulu"},{type:"button",name:"jellyfin",tap_action:{action:"source",source:"org.jellyfin.androidtv"},icon:"jellyfin"},{type:"button",name:"kijk",tap_action:{action:"source",source:"com.talpa.kijk"},icon:"kijk"},{type:"button",name:"kodi",tap_action:{action:"source",source:"org.xbmc.kodi"},icon:"mdi:kodi"},{type:"button",name:"max",tap_action:{action:"source",source:"https://play.max.com"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"mlbatbat://"},icon:"mlbtv"},{type:"button",name:"nba",tap_action:{action:"source",source:"gametime://"},icon:"nba"},{type:"button",name:"netflix",tap_action:{action:"source",source:"netflix://"},icon:"mdi:netflix"},{type:"button",name:"npostart",tap_action:{action:"source",source:"nl.uitzendinggemist"},icon:"npo"},{type:"button",name:"nrktv",tap_action:{action:"source",source:"nrktv://"},icon:"nrktv"},{type:"button",name:"pandora",tap_action:{action:"source",source:"com.pandora.android.atv"},icon:"mdi:pandora"},{type:"button",name:"paramount",tap_action:{action:"source",source:"com.cbs.ott"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"com.peacocktv.peacockandroid"},icon:"peacock"},{type:"button",name:"pia",tap_action:{action:"source",source:"piavpn://"},icon:"pia"},{type:"button",name:"plex",tap_action:{action:"source",source:"plex://"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"https://app.primevideo.com"},icon:"primevideo"},{type:"button",name:"rakutentv",tap_action:{action:"source",source:"https://rakutentv.page.link"},icon:"rakutentv"},{type:"button",name:"rakutenviki",tap_action:{action:"source",source:"viki://home"},icon:"rakutenviki"},{type:"button",name:"skyshowtime",tap_action:{action:"source",source:"https://www.skyshowtime.com/deeplink"},icon:"showtime"},{type:"button",name:"spotify",tap_action:{action:"source",source:"spotify://"},icon:"mdi:spotify"},{type:"button",name:"starplus",tap_action:{action:"source",source:"https://www.starplus.com"},icon:"starplus"},{type:"button",name:"steam",tap_action:{action:"source",source:"com.valvesoftware.steamlink"},icon:"mdi:steam"},{type:"button",name:"stremio",tap_action:{action:"source",source:"stremio://"},icon:"stremio"},{type:"button",name:"surfshark",tap_action:{action:"source",source:"https://surfshark.com/locations-ul"},icon:"surfshark"},{type:"button",name:"tv2play",tap_action:{action:"source",source:"dk.tv2.tv2playtv://*.tv2.dk/android/dk.tv2.tv2playtv/callback"},icon:"tv2play"},{type:"button",name:"viaplay",tap_action:{action:"source",source:"viaplay://deeplink/film"},icon:"viaplay"},{type:"button",name:"videoland",tap_action:{action:"source",source:"videoland-v2://"},icon:"videoland"},{type:"button",name:"vlc",tap_action:{action:"source",source:"org.videolan.vlc"},icon:"mdi:vlc"},{type:"button",name:"vudu",tap_action:{action:"source",source:"vuduapp://"},icon:"vudu"},{type:"button",name:"waiputv",tap_action:{action:"source",source:"de.exaring.waipu"},icon:"waiputv"},{type:"button",name:"wow",tap_action:{action:"source",source:"de.sky.online"},icon:"wow"},{type:"button",name:"youtube",tap_action:{action:"source",source:"vnd.youtube://"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"https://tv.youtube.com"},icon:"mdi:youtube-tv"}],a=[{type:"button",name:"wakeup",tap_action:{action:"key",key:"wakeup"},icon:"mdi:power-on"},{type:"button",name:"suspend",tap_action:{action:"key",key:"suspend"},icon:"mdi:power-off"},{type:"button",name:"home",tap_action:{action:"key",key:"home"},icon:"mdi:home"},{type:"button",name:"menu",tap_action:{action:"key",key:"menu"},icon:"mdi:menu"},{type:"button",name:"top_menu",tap_action:{action:"key",key:"top_menu"},icon:"mdi:apple"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"volume_up"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"volume_down"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"up"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"down"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"left"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"right"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"select"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"select"},up:{tap_action:{action:"key",key:"up"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"down"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"left"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"right"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"select"},drag_action:{action:"key",key:'{{ ("right" if deltaX > 0 else "left") if (deltaX | abs) > (deltaY | abs) else ("down" if deltaY > 0 else "up") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'{{ ("right" if deltaX > 0 else "left") if (deltaX | abs) > (deltaY | abs) else ("down" if deltaY > 0 else "up") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"media_player.media_play_pause"},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"key",key:"play"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"pause"},icon:"mdi:pause"},{type:"button",name:"skip_backward",tap_action:{action:"key",key:"skip_backward"},icon:"mdi:skip-backward"},{type:"button",name:"skip_forward",tap_action:{action:"key",key:"skip_forward"},icon:"mdi:skip-forward"},{type:"button",name:"previous",tap_action:{action:"key",key:"previous"},icon:"mdi:skip-previous"},{type:"button",name:"next",tap_action:{action:"key",key:"next"},icon:"mdi:skip-next"}],r=[{type:"button",name:"allente",tap_action:{action:"source",source:"Allente"},icon:"allente"},{type:"button",name:"appletv",tap_action:{action:"source",source:"TV"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"Crunchyroll"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"DAZN"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"discovery+"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"Disney+"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"Emby"},icon:"mdi:emby"},{type:"button",name:"f1tv",tap_action:{action:"source",source:"F1 TV"},icon:"f1tv"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"FOX Sports"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"Hulu"},icon:"mdi:hulu"},{type:"button",name:"max",tap_action:{action:"source",source:"Max"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"MLB"},icon:"mlbtv"},{type:"button",name:"nba",tap_action:{action:"source",source:"NBA"},icon:"nba"},{type:"button",name:"netflix",tap_action:{action:"source",source:"Netflix"},icon:"mdi:netflix"},{type:"button",name:"npostart",tap_action:{action:"source",source:"NPO"},icon:"npo"},{type:"button",name:"nrktv",tap_action:{action:"source",source:"NRK TV"},icon:"nrktv"},{type:"button",name:"pandora",tap_action:{action:"source",source:"Pandora"},icon:"mdi:pandora"},{type:"button",name:"paramount",tap_action:{action:"source",source:"Paramount+"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"Peacock"},icon:"peacock"},{type:"button",name:"pia",tap_action:{action:"source",source:"PIA VPN"},icon:"pia"},{type:"button",name:"plex",tap_action:{action:"source",source:"Plex"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"Prime Video"},icon:"primevideo"},{type:"button",name:"skyshowtime",tap_action:{action:"source",source:"SkyShowtime"},icon:"showtime"},{type:"button",name:"spotify",tap_action:{action:"source",source:"Spotify"},icon:"mdi:spotify"},{type:"button",name:"steam",tap_action:{action:"source",source:"Steam Link"},icon:"mdi:steam"},{type:"button",name:"tv2play",tap_action:{action:"source",source:"TV 2 Play"},icon:"tv2play"},{type:"button",name:"viaplay",tap_action:{action:"source",source:"Viaplay"},icon:"viaplay"},{type:"button",name:"videoland",tap_action:{action:"source",source:"Videoland"},icon:"videoland"},{type:"button",name:"vlc",tap_action:{action:"source",source:"VLC"},icon:"mdi:vlc"},{type:"button",name:"vudu",tap_action:{action:"source",source:"Fandango at Home"},icon:"vudu"},{type:"button",name:"waiputv",tap_action:{action:"source",source:"waipu.tv"},icon:"waiputv"},{type:"button",name:"wow",tap_action:{action:"source",source:"WOW"},icon:"wow"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"YouTube TV"},icon:"mdi:youtube-tv"}],s=[{type:"button",name:"power",tap_action:{action:"key",key:"TvPower"},icon:"mdi:power"},{type:"button",name:"home",tap_action:{action:"key",key:"Home"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"Return"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"ActionMenu"},icon:"mdi:menu"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VolumeUp"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VolumeDown"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"Mute"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"Up"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"Down"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"Left"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"Right"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"Confirm"},icon:"mdi:checkbox-blank-circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"Confirm"},up:{tap_action:{action:"key",key:"Up"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"Down"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"Left"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"Right"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"Confirm"},drag_action:{action:"key",key:'{{ ("Right" if deltaX > 0 else "Left") if (deltaX | abs) > (deltaY | abs) else ("Down" if deltaY > 0 else "Up") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'{{ ("Right" if deltaX > 0 else "Left") if (deltaX | abs) > (deltaY | abs) else ("Down" if deltaY > 0 else "Up") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"media_player.media_play_pause"},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"key",key:"Play"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"Pause"},icon:"mdi:pause"},{type:"button",name:"rewind",tap_action:{action:"key",key:"Rewind"},icon:"mdi:rewind"},{type:"button",name:"fast_forward",tap_action:{action:"key",key:"Forward"},icon:"mdi:fast-forward"},{type:"button",name:"previous",tap_action:{action:"key",key:"Prev"},icon:"mdi:skip-previous"},{type:"button",name:"next",tap_action:{action:"key",key:"Next"},icon:"mdi:skip-next"},{type:"button",name:"stop",tap_action:{action:"key",key:"Stop"},icon:"mdi:stop"},{type:"button",name:"record",tap_action:{action:"key",key:"Rec"},icon:"mdi:record"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:google-assistant"},{type:"button",name:"delete",tap_action:{action:"key",key:"input keyevent 67"},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"enter",tap_action:{action:"perform-action",perform_action:"remote.send_command",data:{command:"input keyevent 66"}},icon:"mdi:magnify"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"ChannelUp"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"ChannelDown"},icon:"mdi:arrow-down-circle"},{type:"button",name:"red",tap_action:{action:"key",key:"Red"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"Green"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"Yellow"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"Blue"},icon:"mdi:alpha-b-box"},{type:"button",name:"n0",tap_action:{action:"key",key:"Num0"},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"key",key:"Num1"},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"key",key:"Num2"},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"key",key:"Num3"},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"key",key:"Num4"},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"key",key:"Num5"},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"key",key:"Num6"},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"key",key:"Num7"},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"key",key:"Num8"},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"key",key:"Num9"},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"captions",tap_action:{action:"key",key:"SubTitle"},icon:"mdi:closed-caption"},{type:"button",name:"explorer",tap_action:{action:"key",key:"ApplicationLauncher"},icon:"mdi:folder-multiple"},{type:"button",name:"teletext",tap_action:{action:"key",key:"Teletext"},icon:"mdi:card-text"},{type:"button",name:"tv",tap_action:{action:"key",key:"Tv"},icon:"mdi:television-box"},{type:"button",name:"audio_track",tap_action:{action:"key",key:"MediaAudioTrack"},icon:"mdi:waveform"}],c=[{type:"button",name:"appletv",tap_action:{action:"source",source:"Apple TV"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"Crunchyroll"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"DAZN"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"discovery+"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"Disney+"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"Emby"},icon:"mdi:emby"},{type:"button",name:"filmplus",tap_action:{action:"source",source:"Filmplus"},icon:"filmplus"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"FOX Sports"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"Hulu"},icon:"mdi:hulu"},{type:"button",name:"jellyfin",tap_action:{action:"source",source:"Jellyfin"},icon:"jellyfin"},{type:"button",name:"kijk",tap_action:{action:"source",source:"KIJK"},icon:"kijk"},{type:"button",name:"max",tap_action:{action:"source",source:"Max"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"MLB"},icon:"mlbtv"},{type:"button",name:"nba",tap_action:{action:"source",source:"NBA"},icon:"nba"},{type:"button",name:"netflix",tap_action:{action:"key",key:"Netflix"},icon:"mdi:netflix"},{type:"button",name:"npo_start",tap_action:{action:"source",source:"NPO Start"},icon:"npo"},{type:"button",name:"nrktv",tap_action:{action:"source",source:"NRK TV"},icon:"nrktv"},{type:"button",name:"paramount",tap_action:{action:"source",source:"Paramount+"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"Peacock"},icon:"peacock"},{type:"button",name:"pia",tap_action:{action:"source",source:"Private Internet Access VPN"},icon:"pia"},{type:"button",name:"plex",tap_action:{action:"source",source:"Plex"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"Amazon Prime Video"},icon:"primevideo"},{type:"button",name:"rakutentv",tap_action:{action:"source",source:"Rakuten"},icon:"rakutentv"},{type:"button",name:"rakutenviki",tap_action:{action:"source",source:"Viki"},icon:"rakutenviki"},{type:"button",name:"skyshowtime",tap_action:{action:"source",source:"SkyShowtime"},icon:"showtime"},{type:"button",name:"spotify",tap_action:{action:"source",source:"Spotify"},icon:"mdi:spotify"},{type:"button",name:"starplus",tap_action:{action:"source",source:"Star+"},icon:"starplus"},{type:"button",name:"stremio",tap_action:{action:"source",source:"Stremio"},icon:"stremio"},{type:"button",name:"surfshark",tap_action:{action:"source",source:"Surfshark"},icon:"surfshark"},{type:"button",name:"tv2play",tap_action:{action:"source",source:"TV2 Play"},icon:"tv2play"},{type:"button",name:"viaplay",tap_action:{action:"source",source:"Viaplay"},icon:"viaplay"},{type:"button",name:"videoland",tap_action:{action:"source",source:"Videoplay"},icon:"videoland"},{type:"button",name:"vudu",tap_action:{action:"source",source:"Vudu"},icon:"vudu"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"YouTube TV"},icon:"mdi:youtube-tv"}],l=[{name:"allente",path:"M12.8246 16.9889V9.1355H8.9057C8.9057 9.1355 8.8874 10.2821 8.8874 10.3738 8.1728 9.4052 6.9869 8.9602 5.2068 8.9522 3.3664 8.9706 1.8037 9.7768.9791 10.947.3325 11.8161 0 12.9234 0 14.2716 0 15.6774.3325 16.7663.9791 17.6171 1.8481 18.8187 3.2697 19.447 5.0629 19.447 7.0759 19.447 7.8717 19.0779 8.6282 18.4497 8.6282 18.8737 8.7382 19.3187 8.8141 19.3187H13.0444C12.8612 19.0779 12.8246 17.9313 12.8246 16.9889ZM8.2408 15.8239C7.8901 16.248 7.3351 16.5072 6.4293 16.5072 5.4686 16.5072 4.8769 16.1564 4.5628 15.693 4.3219 15.3423 4.1937 14.769 4.1937 14.2323 4.1937 13.6773 4.3403 13.0674 4.6361 12.6984 4.9869 12.2742 5.5785 11.9785 6.5026 11.9785 7.3351 11.9785 7.8874 12.2559 8.2199 12.6251 8.5523 12.9758 8.7382 13.6041 8.7382 14.2323 8.7408 14.8266 8.5549 15.4365 8.2408 15.8239ZM14.2801 19.3658C14.2068 19.3291 14.1361 19.0804 14.2068 18.3134 14.2068 16.7611 14.2068 8.4731 14.2068 6.1825 14.2068 5.4234 14.0733 4.8998 14.0366 4.7322H18.2487C18.2932 4.8605 18.4188 5.3422 18.4188 6.0149 18.4188 8.0647 18.3246 15.2544 18.4188 18.4416 18.4188 18.9783 18.4188 19.2741 18.5288 19.3657ZM19.7512 19.3175C19.678 19.2808 19.678 19.1709 19.678 18.2651 19.678 16.7128 19.678 8.4248 19.678 6.1342 19.678 5.3751 19.5445 4.8515 19.5078 4.6839H23.7199C23.7644 4.8123 23.89 5.2939 23.89 5.9667 23.89 8.0164 23.89 15.4012 23.89 18.3933 23.89 18.93 23.89 19.2258 24 19.3174Z"},{name:"appletv",path:"M 6.820312 8.246094 C 7.179688 7.824219 7.398438 7.273438 7.398438 6.675781 C 7.398438 6.613281 7.398438 6.550781 7.394531 6.492188 L 7.394531 6.5 C 6.746094 6.566406 6.183594 6.871094 5.785156 7.324219 L 5.78125 7.328125 C 5.417969 7.726562 5.195312 8.261719 5.195312 8.851562 C 5.195312 8.910156 5.199219 8.96875 5.203125 9.023438 L 5.203125 9.015625 C 5.207031 9.015625 5.214844 9.015625 5.222656 9.015625 C 5.867188 9.015625 6.445312 8.71875 6.820312 8.25 Z M 8.195312 12.304688 C 8.203125 13.292969 8.796875 14.140625 9.648438 14.511719 L 9.664062 14.519531 C 9.46875 15.109375 9.214844 15.625 8.894531 16.09375 L 8.90625 16.070312 C 8.449219 16.734375 7.980469 17.398438 7.230469 17.414062 C 6.5 17.429688 6.269531 16.980469 5.425781 16.980469 C 4.589844 16.980469 4.328125 17.398438 3.632812 17.429688 C 2.925781 17.453125 2.375 16.703125 1.914062 16.039062 C 1.226562 15.109375 0.8125 13.941406 0.8125 12.671875 C 0.8125 11.902344 0.964844 11.167969 1.242188 10.5 L 1.226562 10.535156 C 1.679688 9.734375 2.519531 9.195312 3.484375 9.171875 L 3.488281 9.171875 C 4.191406 9.15625 4.863281 9.648438 5.296875 9.648438 C 5.726562 9.648438 6.535156 9.0625 7.386719 9.148438 C 8.210938 9.179688 8.933594 9.59375 9.378906 10.21875 L 9.386719 10.226562 C 8.675781 10.664062 8.210938 11.429688 8.195312 12.304688 Z M 15.019531 17.304688 C 14.589844 17.429688 14.097656 17.5 13.585938 17.5 C 13.582031 17.5 13.574219 17.5 13.566406 17.5 C 12.417969 17.5 11.847656 16.851562 11.847656 15.546875 L 11.847656 9.796875 L 10.851562 9.796875 L 10.851562 8.753906 L 11.898438 8.753906 L 11.898438 7.398438 L 13.28125 6.832031 L 13.28125 8.761719 L 14.878906 8.761719 L 14.878906 9.804688 L 13.289062 9.804688 L 13.289062 15.238281 C 13.285156 15.277344 13.285156 15.320312 13.285156 15.367188 C 13.285156 15.640625 13.359375 15.898438 13.492188 16.117188 L 13.492188 16.109375 C 13.644531 16.265625 13.855469 16.363281 14.089844 16.363281 C 14.128906 16.363281 14.160156 16.359375 14.195312 16.355469 L 14.191406 16.355469 C 14.492188 16.34375 14.777344 16.304688 15.050781 16.242188 L 15.019531 16.25 Z M 20.019531 17.367188 L 18.324219 17.367188 L 15.195312 8.753906 L 16.726562 8.753906 L 18.617188 14.355469 C 18.6875 14.574219 18.871094 15.199219 19.164062 16.242188 L 19.441406 15.308594 L 19.75 14.367188 L 21.710938 8.746094 L 23.230469 8.746094 Z M 20.019531 17.367188 Z"},{name:"crunchyroll",path:"M 2.933594 13.46875 C 2.707031 10.601562 3.65625 7.769531 5.566406 5.621094 C 7.476562 3.476562 10.179688 2.199219 13.050781 2.089844 C 15.921875 1.984375 18.710938 3.050781 20.777344 5.046875 C 22.847656 7.042969 24.007812 9.792969 24 12.667969 L 24 12 C 24 5.371094 18.628906 0 12 0 C 5.371094 0 0 5.371094 0 12 C 0 18.628906 5.371094 24 12 24 L 12.800781 24 C 7.261719 23.609375 2.964844 19.015625 2.933594 13.46875 Z M 19.199219 14 C 14.886719 14.015625 13.8125 8.011719 17.867188 6.53125 C 16.679688 5.898438 15.347656 5.574219 14 5.601562 C 10.601562 5.601562 7.539062 7.648438 6.238281 10.785156 C 4.9375 13.925781 5.65625 17.539062 8.058594 19.941406 C 10.460938 22.34375 14.074219 23.0625 17.214844 21.761719 C 20.351562 20.460938 22.398438 17.398438 22.398438 14 C 22.421875 13.464844 22.378906 12.925781 22.265625 12.398438 C 21.609375 13.449219 20.4375 14.0625 19.199219 14 Z M 19.199219 14 Z"},{name:"dazn",path:"m14.774 8.291.772-2.596.79 2.596zm3.848 2.268-2.025-6.128c-.045-.135-.097-.224-.154-.266a.497.497 0 0 0-.28-.063h-1.12a.485.485 0 0 0-.284.068c-.06.045-.11.132-.149.261l-2.045 6.128c-.025.032-.038.096-.038.192 0 .149.09.223.27.223h.84c.076 0 .139-.003.187-.01a.207.207 0 0 0 .116-.048.326.326 0 0 0 .077-.116c.022-.051.046-.119.072-.202l.318-1.071h2.306l.327 1.051c.026.09.051.16.077.213a.395.395 0 0 0 .087.12c.031.028.07.047.114.053h.002c.045.006.103.01.173.01h.897c.18 0 .27-.074.27-.223a.59.59 0 0 0-.005-.09.878.878 0 0 0-.036-.108l.003.006zm-.994 2.467h-.646c-.168 0-.279.024-.333.072-.055.049-.082.147-.082.295v3.638l-1.91-3.647c-.076-.155-.152-.253-.226-.295-.074-.041-.204-.063-.39-.063h-.599c-.167 0-.278.025-.332.073-.055.048-.082.147-.082.294v6.138c0 .148.025.246.077.294.052.048.16.072.328.072h.656c.167 0 .278-.024.332-.072.055-.048.082-.146.082-.294v-3.648l1.91 3.657c.077.155.152.253.227.295.073.042.204.062.39.062h.598c.167 0 .278-.024.333-.072.054-.048.082-.146.082-.294v-6.138c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.333-.073zm3.203-.581 1.665 1.665v8.385H1.505V14.11l1.663-1.664a.63.63 0 0 0 0-.89L1.504 9.891V1.505h20.991v8.384l-1.665 1.666a.63.63 0 0 0 0 .89zM24 0H0v10.613L1.387 12 0 13.387V24h24V13.387L22.613 12 24 10.613zM10.67 18.469H7.96l2.855-4.014a.67.67 0 0 0 .087-.155.425.425 0 0 0 .019-.135v-.772c0-.148-.028-.246-.082-.294-.055-.048-.166-.073-.334-.073H6.382c-.149 0-.245.028-.29.082-.045.055-.068.169-.068.343v.58c0 .172.023.287.068.341.045.055.141.083.29.083h2.545L6.11 18.469a.438.438 0 0 0-.107.27v.792c0 .148.027.245.082.294.055.048.167.072.334.072h4.25c.148 0 .245-.027.29-.081.045-.055.068-.17.068-.344v-.579c0-.173-.023-.287-.068-.342-.045-.055-.142-.082-.29-.082zM9.408 8.233c0 .264-.017.484-.052.661a1.08 1.08 0 0 1-.174.43.648.648 0 0 1-.318.231 1.523 1.523 0 0 1-.487.068h-.79v-4.17h.79c.366 0 .63.11.79.324.16.215.241.571.241 1.067v1.389zm1.38-2.789c-.225-.457-.533-.795-.921-1.013-.39-.219-.88-.328-1.47-.328H6.418c-.167 0-.278.024-.333.072-.054.049-.082.147-.082.294v6.138c0 .148.028.246.082.295.055.048.166.072.333.072h2.218c1.048 0 1.765-.447 2.15-1.342.09-.205.153-.413.188-.622a4.91 4.91 0 0 0 .054-.796V6.911c0-.367-.018-.656-.054-.868a2.2 2.2 0 0 0-.193-.612l.006.013z"},{name:"discovery",path:"M 20.89,2.51 C 20.89,2.51 21.19,2.51 21.19,2.51 21.19,2.51 21.19,4.12 21.19,4.12 21.19,4.12 22.90,4.12 22.90,4.12 22.90,4.12 22.90,4.52 22.90,4.52 22.90,4.52 21.19,4.52 21.19,4.52 21.19,5.07 21.32,5.87 20.99,6.33 21.37,6.65 21.51,6.90 21.77,7.33 22.76,8.97 23.02,10.57 23.00,12.45 22.95,16.30 20.25,19.55 16.67,20.72 15.89,20.97 14.98,21.18 14.16,21.19 14.16,21.19 11.95,21.19 11.95,21.19 11.52,21.19 11.05,21.25 10.64,21.09 11.68,20.46 12.51,19.78 13.21,18.78 15.48,15.57 14.70,11.39 11.65,8.99 10.33,7.95 8.87,7.56 7.23,7.43 7.23,7.43 7.23,2.71 7.23,2.71 7.23,2.71 11.75,2.71 11.75,2.71 11.75,2.71 13.76,2.71 13.76,2.71 15.63,2.71 17.70,3.38 19.18,4.52 19.18,4.52 19.18,4.12 19.18,4.12 19.18,4.12 20.89,4.12 20.89,4.12 20.89,4.12 20.89,2.51 20.89,2.51 Z M 20.89,4.52 C 20.89,4.52 19.28,4.52 19.28,4.52 19.28,4.52 20.89,6.03 20.89,6.03 20.89,6.03 20.89,4.52 20.89,4.52 Z M 6.23,8.28 C 8.69,7.96 10.94,8.76 12.50,10.74 13.67,12.24 13.78,13.56 13.76,15.36 13.73,17.32 12.38,19.32 10.74,20.30 9.24,21.21 8.31,21.21 6.63,21.19 3.58,21.15 0.82,18.17 0.80,15.16 0.80,14.11 0.75,13.69 1.08,12.65 1.85,10.26 3.80,8.73 6.23,8.28 Z"},{name:"disney",path:"M2.056 6.834C1.572 6.834 1 6.77 1 6.483c0-2.023 3.562-2.11 5.08-2.11c1.978 0 4.506.614 6.66 1.384c3.277 1.188 9.917 5.145 9.917 9.674c0 4.001-4.31 5.914-8.311 5.914a22 22 0 0 1-3.21-.33c-.066.243-.11.418-.264.924a4.3 4.3 0 0 1-.77.087l-.505-.043c-.33-.396-.44-1.033-.572-1.715c-2-1.165-3.298-2.155-3.891-2.836c-.506-.528-1.078-1.232-1.078-1.913c0-.351.22-.66.726-1.01c1.034-.77 2.352-1.188 4.507-1.563l.044-.9c.022-.22.242-2.573.748-3.013c.813.66.901 1.341.967 2.353c.022.44.044.901.11 1.385h.308c1.539 0 6.244.395 6.244 2.616c0 .528-.77 1.517-1.518 1.517a1.9 1.9 0 0 1-.966-.285c.329-.375.813-.704.945-.99c-.44-.528-2.814-1.143-4.551-1.143a4 4 0 0 0-.572.022l.022 4.815c.703.44 1.561.483 2.11.483c2.42 0 7.431-.417 7.431-4.331c0-3.87-4.946-6.86-8.64-8.266a21.4 21.4 0 0 0-7.937-1.496a7.2 7.2 0 0 0-1.803.198c-.373.088-.505.176-.505.264c0 .153.747.242.836.286a.22.22 0 0 1 .11.175a.26.26 0 0 1-.088.176c-.089 0-.286.022-.528.022M9.2 14.551c-2.176.177-4.595.397-4.595 1.166c0 .594 1.012 1.32 1.627 1.781a7.05 7.05 0 0 0 2.77 1.319zm11.155-9.85c-.02.428-.042.942-.042 1.723c0 .3 0 .642.01 1.027c-.042.193-.32.214-.46.278a1.2 1.2 0 0 1-.256-.192V4.83c0-.29.01-.588.01-1.038c0-.225 0-.482-.01-.792c0-.192.032-.374.15-.802a.34.34 0 0 1 .3-.224c.245.064.491.17.577.374c-.257.76-.235 1.594-.279 2.353m-.384-.085c.428.021.941.042 1.722.042c.3 0 .643 0 1.027-.01c.193.041.215.32.279.459q-.078.141-.193.257H20.1c-.289 0-.589-.01-1.037-.01c-.225 0-.482 0-.792.01c-.193.002-.375-.03-.803-.149a.35.35 0 0 1-.225-.299c.064-.246.172-.492.374-.578c.76.257 1.595.235 2.355.278z"},{name:"f1tv",path:"M20.2174 15 20.3424 15 20.3424 14.4214 20.3445 14.4214 20.5524 15 20.6605 15 20.8684 14.4214 20.8705 14.4214 20.8705 15 20.9955 15 20.9955 14.2503 20.8127 14.2503 20.6111 14.8373 20.609 14.8373 20.4022 14.2503 20.2174 14.2503 20.2174 15ZM19.5255 14.3636 19.7627 14.3636 19.7627 15 19.894 15 19.894 14.3636 20.1324 14.3636 20.1324 14.2503 19.5255 14.2503 19.5255 14.3636ZM18 15 24 9 20.3887 9 14.3889 15 18 15ZM17.1397 11.613 9.8764 11.613C7.6627 11.613 7.2754 11.7304 6.3272 12.6785 5.4405 13.5653 4.0001 15 4.0001 15L7.1465 15 7.8971 14.2494C8.3906 13.7559 8.6451 13.7047 9.6814 13.7047L15.0481 13.7047 17.1397 11.613ZM6.2304 12.2506C5.5755 12.8685 4.1506 14.2526 3.3826 15L0 15C0 15 2.7105 12.2974 4.217 10.8145 5.7691 9.337 6.5429 9 9.3897 9L19.7529 9 17.509 11.2437 9.6002 11.2437C7.5999 11.2437 7.1504 11.3824 6.2304 12.2506Z"},{name:"filmplus",path:"M19.5906 0C19.2204.1246 18.8469.259 18.4817.3964 18.1169.5341 17.7562.6762 17.3905.8103 17.025.9447 16.6652 1.0866 16.3033 1.2284 15.9418 1.3706 15.5767 1.5033 15.2165 1.6468 14.8561 1.7901 14.4937 1.9267 14.1333 2.0689 13.7729 2.2113 13.4083 2.3479 13.0465 2.4872 12.6847 2.6266 12.336 2.7852 11.9722 2.9182 11.6087 3.0514 11.258 3.21 10.8957 3.3469 10.5336 3.484 10.1695 3.6231 9.8086 3.765 9.4476 3.9072 9.0824 4.0401 8.7215 4.1831 8.3605 4.3264 7.9875 4.4577 7.6238 4.5907 7.2603 4.7239 6.8848 4.863 6.5236 4.9957 6.1626 5.1286 5.8024 5.2859 5.4495 5.4269 5.0967 5.5679 4.7658 5.7433 4.4291 5.9116 4.0921 6.0797 3.7952 6.2539 3.5 6.4878 3.2048 6.722 2.9843 6.9433 2.7474 7.2404 2.5105 7.5376 2.3245 7.8004 2.1626 8.1608 2.0006 8.5213 1.8671 8.8716 1.7782 9.2817 1.689 9.6917 1.5898 10.1143 1.5557 10.5645 1.5217 11.0146 1.4955 11.5342 1.5 12.0139 1.5045 12.4937 1.4958 13.03 1.5 13.5192 1.5042 14.0084 1.4933 14.5338 1.5 15.0244 1.5067 15.515 1.5368 16.0098 1.5279 16.5017 1.519 16.9937 1.5429 17.5047 1.5 17.9791 1.4571 18.4538 1.5229 18.9854 1.5557 19.4286 1.5886 19.8718 1.6684 20.3111 1.779 20.7105 1.8897 21.11 2.019 21.4422 2.1991 21.7957 2.3789 22.1494 2.5433 22.4078 2.7892 22.7108 3.0348 23.0141 3.26 23.2075 3.5836 23.4216 3.9072 23.6354 4.2342 23.7815 4.6214 23.8891 5.0083 23.9969 5.5471 24.0466 5.9599 24 6.3728 23.9534 6.8037 23.859 7.1675 23.7023 7.5312 23.5459 7.8415 23.4116 8.1411 23.1707 8.441 22.9302 8.6677 22.7392 8.9216 22.446 9.1755 22.1525 9.3328 21.884 9.5209 21.5401 9.7088 21.1958 9.8245 20.8535 9.9466 20.4605 10.0689 20.0677 10.1319 19.617 10.1709 19.1797 10.2102 18.7426 10.2339 18.2102 10.2526 17.7561 10.2713 17.302 10.3078 16.7615 10.3103 16.3086 10.3128 15.8559 10.8603 15.859 11.1702 15.6633 11.4805 15.4679 11.8376 15.3123 12.1695 15.1574 12.5015 15.0024 12.8299 14.7724 13.1733 14.6559 13.5164 14.5391 13.8735 14.3334 13.9898 13.9671 14.106 13.6011 14.2351 13.2284 14.4082 12.8803 14.581 12.5318 14.6604 12.1477 14.8305 11.7974 15.0005 11.447 15.1488 11.0807 15.2422 10.7038 14.7689 10.8594 14.3223 11.1044 13.8677 11.3084 13.4133 11.5128 12.962 11.7196 12.5127 11.9325 12.0631 12.1452 11.5978 12.3334 11.151 12.55 10.7042 12.7666 10.2403 12.9561 9.798 13.1763 9.3559 13.3962 8.8472 13.5395 8.4193 13.7764 7.9914 14.0134 7.3004 14.0733 7.3537 14.6899 7.4069 15.3065 7.3779 16.0259 7.3815 16.6411 7.3852 17.2563 7.386 18.0429 7.3813 18.6199 7.3765 19.1972 7.2826 19.7809 6.9891 20.2068 6.6958 20.633 6.3326 21.0007 5.8392 20.9709 5.3459 20.941 4.9266 20.6071 4.7036 20.1274 4.4803 19.6477 4.4218 19.018 4.4268 18.4251 4.4318 17.8322 4.4238 17.067 4.4268 16.446 4.4299 15.8249 4.424 15.0905 4.4268 14.4669 4.4296 13.8433 4.4226 13.0896 4.4268 12.4878 4.431 11.886 4.4817 11.241 4.6409 10.7228 4.7998 10.2046 5.0139 9.8537 5.3955 9.4983 5.7774 9.1431 6.1417 8.9296 6.5946 8.7183 7.0476 8.507 7.5217 8.3306 7.9755 8.1201 8.4291 7.9094 8.8817 7.7293 9.3414 7.5348 9.8008 7.3399 10.2509 7.1281 10.7075 6.9218 11.1644 6.7158 11.6433 6.5422 12.101 6.3362 12.5584 6.1299 13.018 5.9337 13.4797 5.7357 13.9415 5.5378 14.3942 5.3282 14.8606 5.1376 15.3266 4.9466 15.7626 4.7089 16.2392 4.5371 16.7162 4.3654 17.1151 4.0764 17.6109 3.9298 18.1066 3.7829 18.3569 3.3218 18.5054 2.8452 18.6543 2.3688 18.8898 1.8879 19.0521 1.4127 19.214.9374 19.4498.4808 19.5906 0ZM17.1376 6.0767C13.8936 7.4135 10.6707 8.8111 7.4373 10.1742 7.4373 11.0197 7.4373 11.8654 7.4373 12.7108 8.1832 12.3663 8.9787 12.0555 9.7169 11.7012 10.455 11.3469 11.2394 11.0534 11.9616 10.6846 12.6836 10.3155 13.5413 10.085 14.2323 9.6939 14.9233 9.3029 15.8537 9.1788 16.2373 8.4374 16.6206 7.6962 16.8519 6.8538 17.1376 6.0767ZM19.3118 17.5331C19.2422 16.7922 19.413 16.0875 19.2932 15.3497 19.1733 14.6118 18.2033 14.8496 17.6394 14.8014 17.0755 14.7532 16.1511 14.7866 16.1899 15.554 16.2286 16.3214 16.2401 16.9385 16.2456 17.7003 15.7024 17.7274 14.9517 17.6574 14.4338 17.6725 13.9159 17.6875 13.2419 17.5412 13.066 18.1165 12.8898 18.6918 13.0473 19.2808 13.0582 19.8553 13.0691 20.4295 13.7091 20.4755 14.2387 20.4321 14.7683 20.3886 15.5022 20.4647 16.0505 20.4321 16.1314 19.59 15.8272 18.4524 16.5737 17.8612 17.3202 17.27 18.4151 17.6443 19.3118 17.5331ZM17.5 17.6446C17.1808 17.6309 16.853 17.7695 16.615 17.9861 16.3769 18.2024 16.2713 18.4758 16.2456 18.8153 16.2203 19.1548 16.2587 19.6507 16.2456 20.0139 16.2325 20.3771 16.2551 20.8496 16.2456 21.2125 16.2362 21.5755 16.2576 22.0728 16.2456 22.4111 16.2337 22.7495 16.2699 23.1323 16.6167 23.2387 16.9631 23.3452 17.4153 23.2728 17.7787 23.2753 18.1422 23.2778 18.5985 23.3427 18.93 23.2282 19.2617 23.1136 19.3138 22.7401 19.3118 22.4111 19.3099 22.0822 19.3157 21.5855 19.3397 21.2404 19.3637 20.8953 19.2121 20.2662 19.6742 20.3484 20.1364 20.4307 20.4293 20.3738 20.8449 20.3763 21.2606 20.3788 21.6703 20.4123 22.043 20.3757 22.4154 20.339 22.518 19.9925 22.5453 19.6794 22.5726 19.3664 22.4399 18.8917 22.5174 18.5645 22.5949 18.2372 22.4709 17.8707 22.1464 17.7369 21.8222 17.6028 21.4169 17.6485 21.0401 17.6446 20.6632 17.6407 20.2284 17.646 19.8415 17.6446 19.4546 17.6432 19.0596 17.6663 18.6707 17.6725 18.2819 17.6786 17.8685 17.6602 17.5 17.6446Z"},{name:"foxsports",path:"M 0.2305 15.125 L 0.2305 5 L 6.2148 5 L 6.3984 7.7695 L 3.0469 7.7695 L 3.0469 9.0898 L 5.7773 9.0898 L 5.7773 11.8516 L 3.0273 11.8516 L 3.0273 15.125 L 0.2305 15.125 M 23.2813 15.0938 L 20.2852 9.8398 L 23.0078 5 L 20.0117 5 L 18.7695 7.1797 L 17.5469 5 L 14.4453 5 L 17.2188 9.875 L 14.2813 15.1016 L 17.293 15.0977 L 18.7305 12.5391 L 20.1836 15.0938 L 23.2813 15.0938 M 11.9102 12.0977 L 11.9102 8.0508 C 11.9102 7.5898 11.5156 7.1758 11.0703 7.1758 C 10.6289 7.1758 10.2695 7.5898 10.2695 8.0508 L 10.2695 12.082 C 10.2695 12.5469 10.6289 12.918 11.0703 12.918 C 11.5156 12.918 11.9102 12.5586 11.9102 12.0977 Z M 6.3242 10.0742 C 6.3242 7.3594 8.4414 5.1523 11.0586 5.1523 C 13.6758 5.1523 15.7969 7.3594 15.7969 10.0742 C 15.7969 12.793 13.6758 14.9961 11.0586 14.9961 C 8.4414 14.9961 6.3242 12.793 6.3242 10.0742 Z M 0 19.5195 L 0 18.9961 L 0.2617 18.7344 L 2.3867 18.7344 L 2.4648 18.6563 L 2.4648 18.1016 L 2.4102 18.0391 L 0.4375 18.0391 L 0 17.5938 L 0 16.3203 L 0.5039 15.8086 L 3.3633 15.8086 L 3.3633 16.3711 L 3.1563 16.5859 L 1.082 16.5859 L 1.0039 16.668 L 1.0039 17.207 L 1.0625 17.2656 L 3.0273 17.2656 L 3.4648 17.7148 L 3.4648 19.0039 L 2.9609 19.5195 L 0 19.5195 M 6.4609 17.6055 L 6.6094 17.4531 L 6.6094 16.7422 L 6.4609 16.5938 L 5.0938 16.5938 L 5.0938 17.6055 Z M 4.0898 15.8086 L 7.0547 15.8086 L 7.6172 16.3789 L 7.6172 17.7539 L 7.0547 18.3281 L 5.0938 18.3281 L 5.0938 19.5195 L 4.0898 19.5195 Z M 10.5156 18.6484 L 10.7227 18.4414 L 10.7227 16.8203 L 10.5156 16.6133 L 9.3477 16.6133 L 9.1406 16.8203 L 9.1406 18.4414 L 9.3477 18.6484 Z M 8.1445 18.9492 L 8.1445 16.3789 L 8.6992 15.8086 L 11.1602 15.8086 L 11.7227 16.3789 L 11.7227 18.9492 L 11.1602 19.5195 L 8.6992 19.5195 Z M 14.7344 17.3984 L 14.875 17.2539 L 14.875 16.7109 L 14.7344 16.5664 L 13.3828 16.5664 L 13.3828 17.3984 Z M 12.3789 15.8086 L 15.375 15.8086 L 15.8789 16.3203 L 15.8789 17.5039 L 15.3984 17.9961 L 16.0313 19.5195 L 14.9141 19.5195 L 14.4453 18.1719 L 13.3828 18.1719 L 13.3828 19.5195 L 12.3789 19.5195 Z M 17.3789 16.668 L 16.2188 16.668 L 16.2188 15.8086 L 19.5391 15.8086 L 19.5391 16.668 L 18.3828 16.668 L 18.3828 19.5195 L 17.3789 19.5195 L 17.3789 16.668 M 20.082 19.6211 L 20.082 19.0977 L 20.3438 18.8359 L 22.4688 18.8359 L 22.5469 18.7578 L 22.5469 18.2031 L 22.4922 18.1406 L 20.5195 18.1406 L 20.082 17.6953 L 20.082 16.4219 L 20.5859 15.9102 L 23.4453 15.9102 L 23.4453 16.4727 L 23.2383 16.6875 L 21.168 16.6875 L 21.0859 16.7695 L 21.0859 17.3086 L 21.1445 17.3672 L 23.1133 17.3672 L 23.5469 17.8164 L 23.5469 19.1055 L 23.043 19.6211 L 20.082 19.6211 Z"},{name:"jellyfin",path:"M12 .002C8.826.002-1.398 18.537.16 21.666c1.56 3.129 22.14 3.094 23.682 0C25.384 18.573 15.177 0 12 0zm7.76 18.949c-1.008 2.028-14.493 2.05-15.514 0C3.224 16.9 9.92 4.755 12.003 4.755c2.081 0 8.77 12.166 7.759 14.196zM12 9.198c-1.054 0-4.446 6.15-3.93 7.189.518 1.04 7.348 1.027 7.86 0 .511-1.027-2.874-7.19-3.93-7.19z"},{name:"kijk",path:"M19.5051 14.5813C18.3413 15.5829 17.1659 16.3763 16.0112 16.94 14.6307 17.6141 13.2811 17.956 12 17.956 7.4971 17.956 3.4816 13.8181 1.9157 11.9739A23.7339 23.7339 90 014.4949 9.3696C5.6587 8.3683 6.8341 7.5749 7.9888 7.0109 9.3693 6.3368 10.7189 5.9952 12 5.9952 16.5029 5.9952 20.5184 10.1328 22.0843 11.9773A23.7288 23.7288 90 0119.5051 14.5813ZM12 4.5C5.3725 4.5 0 11.9755 0 11.9755S5.3725 19.4509 12 19.4509 24 11.9755 24 11.9755 18.6275 4.5 12 4.5ZM11.4315 9.9397C11.4955 9.9397 11.5469 9.9917 11.5469 10.0557V13.8779C11.5469 13.9419 11.4952 13.9939 11.4315 13.9939H10.1952A.1157.1157 90 0110.0797 13.8779V10.0557C10.0797 9.9917 10.1315 9.9397 10.1952 9.9397H11.4315ZM9.5221 10.072 8.4128 11.8576 8.4099 11.8624A.192.192 90 008.3819 11.9611.192.192 90 008.4085 12.0571L8.4099 12.0592 8.4125 12.064 9.5219 13.8499A.0893.0893 90 019.4469 13.988H8.1336A.1144.1144 90 018.0365 13.9347C7.7947 13.5517 7.1544 12.5165 7.1544 12.5165V13.872C7.1544 13.936 7.1027 13.988 7.0389 13.988H5.8437A.1157.1157 90 015.7285 13.872V10.0499C5.7285 9.9859 5.78 9.9339 5.8437 9.9339H7.0389C7.1029 9.9339 7.1544 9.9859 7.1544 10.0499V11.4053S7.7944 10.3699 8.0365 9.9872C8.0579 9.9536 8.0941 9.9339 8.1336 9.9339H9.4472A.0893.0893 90 019.5219 10.072ZM18.0776 9.9339C18.1413 9.9339 18.1928 9.9859 18.1928 10.0499V13.872C18.1928 13.936 18.1411 13.988 18.0776 13.988H16.8824A.1157.1157 90 0116.7669 13.872V12.5165S16.1269 13.5517 15.8848 13.9347A.1144.1144 90 0115.7877 13.988H14.4741A.0893.0893 90 0114.3992 13.8499L15.5085 12.064C15.5096 12.0624 15.5107 12.0611 15.5115 12.0592L15.5131 12.0568A.192.192 90 0015.5392 11.9608.192.192 90 0015.5131 11.8648L15.5115 11.8624 15.5088 11.8576 14.3992 10.072A.0896.0896 90 0114.4741 9.9339H15.7877C15.8272 9.9339 15.8635 9.9536 15.8848 9.9872 16.1267 10.3699 16.7669 11.4053 16.7669 11.4053V10.0499C16.7669 9.9859 16.8187 9.9339 16.8824 9.9339H18.0776ZM13.7085 9.9397C13.7723 9.9397 13.824 9.9917 13.824 10.0557V13.9731C13.824 14.2749 13.7493 14.564 13.5947 14.7981L12.8787 15.8741A.1149.1149 90 0112.6848 15.8709L11.9664 14.7144A.1165.1165 90 0111.9683 14.5885L12.2653 14.1413C12.3248 14.0525 12.3565 13.9477 12.3565 13.8405V10.0557C12.3565 9.9917 12.4083 9.9397 12.472 9.9397H13.7085Z"},{name:"max",path:"M 3.7443 8 C 3.0949 8 2.4381 8.2932 1.5957 8.9574 L 1.5957 8.167 L 0 8.167 L 0 14.4756 L 1.6959 14.4756 L 1.6959 10.5531 C 2.4381 9.9557 2.7758 9.7664 3.0541 9.7664 C 3.3844 9.7664 3.5996 9.9742 3.5996 10.5012 L 3.5996 14.4756 L 5.2955 14.4756 L 5.2955 10.542 C 6.0377 9.9557 6.368 9.7664 6.6537 9.7664 C 6.984 9.7664 7.1992 9.9742 7.1992 10.5012 L 7.1992 14.4756 L 8.8951 14.4756 L 8.8951 9.8926 C 8.8951 8.4713 8.1047 8 7.3439 8 C 6.6945 8 6.0377 8.2746 5.173 8.9463 C 4.8947 8.2412 4.2898 8 3.7443 8 Z M 12.3426 8 C 10.6578 8 9.2588 9.4807 9.2588 11.3213 C 9.2588 13.1619 10.6578 14.6426 12.3426 14.6426 C 13.1775 14.6426 13.8975 14.3271 14.4504 13.6443 L 14.4504 14.4756 L 16.0684 14.4756 L 16.0684 8.167 L 14.4504 8.167 L 14.4504 8.9982 C 13.8975 8.3154 13.1775 8 12.3426 8 Z M 16.3652 8.167 C 17.0629 9.284 17.857 10.2822 18.7811 11.2805 C 17.857 12.3195 17.0629 13.4031 16.3652 14.4756 L 18.41 14.4756 C 18.8961 13.674 19.4416 12.9504 20.0687 12.2676 C 20.6848 12.9504 21.2006 13.674 21.683 14.4756 L 23.75 14.4756 C 23.0412 13.3697 22.2693 12.3195 21.3416 11.2805 C 22.2582 10.2822 23.0412 9.2506 23.75 8.167 L 21.7238 8.167 C 21.2191 8.9686 20.6736 9.6402 20.0687 10.3008 C 19.449 9.6402 18.9072 8.9686 18.41 8.167 Z M 12.5986 9.4621 C 13.608 9.4621 14.4207 10.2896 14.4207 11.3213 C 14.4207 12.3529 13.608 13.1805 12.5986 13.1805 C 11.593 13.1805 10.7803 12.3529 10.7803 11.3213 C 10.7803 10.2896 11.593 9.4621 12.5986 9.4621 Z M 12.5986 9.8814 C 11.8268 9.8814 11.1996 10.5234 11.1996 11.3213 C 11.1996 12.1191 11.8268 12.7611 12.5986 12.7611 C 13.3705 12.7611 13.9977 12.1191 13.9977 11.3213 C 13.9977 10.5234 13.3705 9.8814 12.5986 9.8814 Z M 12.5986 9.8814 Z"},{name:"mlbtv",path:"M 23.2539 7.0039 C 23.2656 6.293 22.6953 5.7109 21.9883 5.7031 C 21.9805 5.7031 21.9727 5.7031 21.9648 5.7031 L 16.3828 5.7031 L 19.5859 11.0625 L 19.8789 11.1016 L 20.0664 11.3438 L 20.0664 11.5742 L 20.2695 11.6172 L 20.457 11.8711 L 20.457 12.0898 L 20.6641 12.1289 L 20.875 12.3594 L 20.875 12.8672 C 21.1289 13.0977 21.4102 13.2852 21.7188 13.4297 C 22 13.5391 22.0313 13.9922 22.2031 14.2344 C 22.4141 14.5859 22.707 14.7266 22.6445 14.9258 C 22.5039 15.4492 21.9648 16.3398 21.4648 16.3789 L 19.4805 16.3789 L 19.4805 17.2305 L 21.9648 17.2305 C 22.6836 17.2266 23.2617 16.6445 23.2578 15.9258 L 23.2578 7.0039 M 9.6016 16.3945 L 8.6445 16.3945 C 8.6445 13.9922 9.4531 12.6641 10.4258 12.3984 C 10.5586 12.375 10.4922 11.7188 10.3242 11.5195 L 9.7656 11.5195 C 9.6758 11.5195 9.7266 11.3477 9.7266 11.3477 L 10.1797 10.3789 L 10.1211 10.1094 L 8.4414 10.1094 L 9.8203 9.1445 C 9.8828 6.5938 12.4961 6.3945 14.0664 7.457 C 15.0039 8.0781 15.0742 9.3086 15.0039 10.1563 C 14.9922 10.2109 14.7578 10.1758 14.7578 10.1758 C 14.7578 10.1758 14.6016 11.1133 15.0156 11.1133 L 16.8516 11.1133 C 17.5977 11.082 18.3203 11.5898 18.3203 11.5898 L 18.4961 10.9453 L 14.4766 5.7031 L 1.9961 5.7031 C 1.6523 5.6992 1.3203 5.8359 1.0742 6.0781 C 0.832 6.3242 0.6953 6.6563 0.6992 7.0039 L 0.6992 15.9297 C 0.6953 16.2734 0.8281 16.6094 1.0742 16.8516 C 1.3203 17.0977 1.6523 17.2344 1.9961 17.2344 L 10.0977 17.2344 C 9.9023 16.8945 9.6758 16.5078 9.6055 16.3945 M 2.5 14.5 C 2.5 14.0078 2.8945 13.6094 3.3867 13.6094 C 3.875 13.6094 4.2734 14.0078 4.2734 14.5 C 4.2734 14.9883 3.875 15.3867 3.3867 15.3867 L 3.3789 15.3867 C 2.8945 15.3867 2.5 14.9961 2.5 14.5117 C 2.5 14.5078 2.5 14.5039 2.5 14.5 Z"},{name:"nba",path:"M 7.8555 21.1602 C 7.5547 20.8906 7.7539 20.7734 7.7383 20.6563 C 7.5391 19.8203 6.8672 19.3203 7.2188 19.0547 C 7.1484 18.8438 7.0664 18.6367 6.9688 18.4336 C 5.9336 17.8477 5.0625 16.8789 4.9141 16.7461 C 4.7617 16.6133 4.4297 16.3438 4.3633 16.1953 C 4.2969 16.043 2.9063 14.2383 2.625 13.6211 L 2.1406 13.5547 C 1.9219 12.6367 1.1719 11.8672 1.1523 10.9648 C 1.1758 10.543 1.25 10.1289 1.3711 9.7266 C 1.4688 9.5781 1.5859 9.4414 1.7227 9.3242 L 1.7227 9.0742 C 0.6523 9.1094 0.9531 8.9922 0.7695 8.5742 C 0.5859 8.1563 0.7344 8.2227 0.7852 8.0234 C 0.9375 7.4375 1.4023 6.5195 1.6055 6.1016 C 1.8047 5.6836 1.8711 5.3828 1.8711 5.3828 C 2.6758 3.7617 2.9766 3.8789 3.9258 3.7773 L 3.9766 3.7109 C 4.9297 3.6758 4.7813 3.5938 4.9141 2.6758 C 4.7813 2.7422 4.7305 2.3906 4.7305 2.3906 C 4.6445 1.8711 4.8789 1.9727 4.9805 1.957 C 4.9961 1.1016 5.0977 0.8203 5.7148 0.5859 L 2.4922 0.5859 C 1.4375 0.5859 0.5859 1.4375 0.5859 2.4883 L 0.5859 21.5078 C 0.5859 22.5625 1.4375 23.4141 2.4922 23.4141 L 8.1055 23.4141 C 7.4531 23.0625 7.8398 22.4141 7.8555 21.1602 M 21.5078 0.5859 L 6.2852 0.5859 C 6.5156 0.6484 6.7148 0.7969 6.8359 1.0039 C 7.0703 1.0195 7.3555 1.5547 6.918 2.3242 C 7.1211 2.457 6.9688 2.6406 6.8203 2.8594 C 6.668 3.0742 6.7344 3.0586 6.6172 3.043 C 6.4531 3.3945 6.25 3.7266 6.1016 3.7422 C 6.0352 3.8203 6.0273 3.9297 6.082 4.0117 C 6.3086 4.1016 6.5156 4.2266 6.7031 4.3789 L 6.7031 4.4609 C 6.8672 4.5625 6.9531 4.6445 7.1367 4.7461 C 7.5859 5.0313 8.1563 5.5469 8.0898 7.3203 C 8.2227 7.7031 8.2734 8.457 8.3906 8.707 C 8.5078 8.957 8.793 9.4922 8.8594 9.9258 C 8.8594 9.9258 8.9258 10.5781 9.0078 10.6641 L 9.0586 10.6641 C 9.4414 10.7461 9.375 10.7969 9.4102 10.8633 L 9.5078 10.9453 C 9.6094 10.9961 9.7773 11.0469 9.7773 11.2305 L 9.8594 11.3633 C 9.9102 11.4453 9.957 11.5273 9.9961 11.6172 C 10.1289 11.9922 10.1289 12.4063 9.9961 12.7852 L 9.9961 12.8359 C 9.8477 13.2031 9.5742 13.5039 9.2266 13.6875 L 9.1914 13.6875 L 9.1406 13.7227 C 8.918 13.8281 8.6719 13.8867 8.4219 13.8867 C 7.4883 13.7656 6.832 12.9063 6.957 11.9727 C 7.0391 11.3594 7.4453 10.8398 8.0234 10.6133 C 7.8203 10.1289 7.4219 9.3438 7.3047 9.0938 C 7.1875 8.8398 6.9023 7.2188 6.8516 6.9023 C 6.8008 6.5859 6.1172 7.3203 6.1172 7.3555 C 6.1172 7.3867 5.582 8.6914 5.5664 8.7578 C 5.5547 8.8281 5.5469 8.9023 5.5469 8.9766 C 5.5469 8.9766 5.8008 9.0078 5.9336 9.4258 C 6.0664 9.8438 6.5 11.3984 6.5 11.3984 L 6.3828 11.5156 C 6.918 13.3047 6.7344 14.0742 6.9688 14.6055 C 7.2031 15.1406 7.3555 15.2422 7.6055 15.8789 C 7.8555 16.5117 7.9883 18.1172 8.0742 18.1836 C 8.3555 18.5508 8.5234 18.8359 8.5234 19.0352 C 8.5234 19.2383 8.2734 19.8555 8.375 20.2227 C 8.4727 20.5898 8.457 20.9063 8.5586 20.9922 C 8.6563 21.0742 8.6406 21.1758 8.6055 21.2422 C 8.5898 21.2734 8.5781 21.3086 8.5742 21.3438 C 8.7227 21.9102 9.2422 22.8633 8.4219 23.3633 L 8.375 23.3984 L 21.543 23.3984 C 22.582 23.3906 23.4219 22.5508 23.4336 21.5117 L 23.4336 2.4922 C 23.4219 1.4336 22.5664 0.5859 21.5078 0.5859 Z M 21.5078 0.5859 M 15.793 5.1133 L 19.2383 5.1133 L 18.5352 16.6289 L 17.7813 5.1133 L 21.1406 5.1133 L 19.6563 18.9023 L 17.2461 18.9023 Z M 15.3438 6.8359 L 13.8867 6.8359 L 13.8867 18.8867 L 12.0352 18.8867 L 12.0352 6.8359 L 10.6133 6.8359 L 10.6133 5.0977 L 15.3438 5.0977 Z M 3.543 22.2266 L 3.543 18.7852 L 4.2109 18.7852 C 4.5977 18.7852 4.8281 18.9844 4.8281 19.4727 L 4.8281 19.9883 C 4.8281 20.3047 4.7305 20.457 4.5977 20.5391 C 4.7539 20.6563 4.8438 20.8438 4.8281 21.043 L 4.8281 21.543 C 4.8281 22.0117 4.5781 22.2266 4.2109 22.2266 Z M 4.0117 20.7227 L 4.0117 21.793 L 4.1953 21.793 C 4.3438 21.793 4.3945 21.7109 4.3945 21.543 L 4.3945 20.957 C 4.3945 20.793 4.3438 20.7227 4.1953 20.7227 Z M 4.0117 19.2188 L 4.0117 20.3555 L 4.1797 20.3555 C 4.3438 20.3555 4.3789 20.3047 4.3789 20.1055 L 4.3789 19.4375 C 4.3789 19.2695 4.3281 19.2031 4.1797 19.2031 L 4.0117 19.2031 Z M 5.9336 21.5273 L 5.5156 21.5273 L 5.4648 22.2266 L 4.9961 22.2266 L 5.4141 18.7852 L 6.0664 18.7852 L 6.4688 22.2266 L 5.9844 22.2266 Z M 5.7148 19.168 L 5.6992 19.168 C 5.6641 19.5859 5.6172 20.3047 5.5977 20.5391 L 5.5469 21.1406 L 5.8984 21.1406 L 5.8477 20.5391 C 5.832 20.3047 5.7656 19.5859 5.7148 19.168 M 2.1875 22.2266 L 1.7891 22.2266 L 1.7891 18.7852 L 2.4219 18.7852 L 2.9414 21.6094 C 2.8906 20.9414 2.8398 20.1211 2.8398 19.4219 L 2.8398 18.7852 L 3.2422 18.7852 L 3.2422 22.2266 L 2.6563 22.2266 L 2.1406 19.4727 C 2.1719 20.1055 2.1875 20.625 2.1875 21.1406 Z M 2.1875 22.2266 Z"},{name:"npo",path:"M23.4519 10.6902C24.1664 11.4046 24.1664 12.5775 23.4519 13.2964L13.2964 23.4519C12.582 24.1664 11.4092 24.1664 10.6902 23.4519L.5347 13.2964C-.1798 12.582-.1798 11.4092.5347 10.6902L10.6902.5347C11.4046-.1798 12.5775-.1798 13.2964.5347L23.4519 10.6902ZM10.9239 2.3771 9.9263 3.3747C9.3511 3.9498 9.3511 4.8935 9.9263 5.4731L10.9239 6.4707C11.499 7.0459 12.4427 7.0459 13.0224 6.4707L14.02 5.4731C14.5951 4.898 14.5951 3.9543 14.02 3.3747L13.0224 2.3771C12.4427 1.8019 11.499 1.8019 10.9239 2.3771ZM13.1616 4.0398C13.3728 4.2509 13.3728 4.5924 13.1616 4.8037L12.3528 5.6124C12.1416 5.8237 11.8001 5.8237 11.5889 5.6124L10.7801 4.8037C10.5688 4.5924 10.5688 4.2509 10.7801 4.0398L11.5889 3.2309C11.8001 3.0197 12.1416 3.0197 12.3528 3.2309L13.1616 4.0398ZM7.2167 6.0843 6.2191 7.0818C5.6439 7.657 5.6439 8.6006 6.2191 9.1803L7.0369 9.9981 7.2167 10.1779 8.749 11.7102C8.9602 11.9215 9.3016 11.9215 9.5084 11.7102 9.7196 11.499 9.7151 11.1576 9.5084 10.9508L8.9871 10.4206C9.1039 10.3532 9.2163 10.2723 9.3152 10.1734L10.3127 9.1758C10.8879 8.6006 10.8879 7.657 10.3127 7.0773L9.3152 6.0798C8.7354 5.5091 7.7919 5.5091 7.2167 6.0843ZM9.4545 7.7469C9.6656 7.9581 9.6656 8.2997 9.4545 8.5108L8.6456 9.3197C8.4344 9.5309 8.0929 9.5309 7.8817 9.3197L7.7964 9.2342 7.0728 8.5108C6.8617 8.2997 6.8617 7.9581 7.0728 7.7469L7.8817 6.938C8.0929 6.7269 8.4344 6.7269 8.6456 6.938L9.4545 7.7469ZM3.451 9.8499 2.4535 10.8475C1.8784 11.4227 1.8784 12.3663 2.4535 12.946L2.467 12.9594 2.9522 13.4448 4.179 14.667C4.3902 14.8782 4.7317 14.8782 4.9385 14.667 5.1496 14.4557 5.1451 14.1143 4.9385 13.9076L3.7116 12.6809 3.3073 12.2764C3.0961 12.0652 3.0961 11.7237 3.3073 11.5125L4.1161 10.7036C4.3273 10.4925 4.6688 10.4925 4.88 10.7036L5.2844 11.1081 6.5111 12.3348C6.7224 12.546 7.0639 12.546 7.2705 12.3348 7.4818 12.1237 7.4773 11.7821 7.2705 11.5754L6.0438 10.3487 5.5585 9.8634 5.545 9.8499C4.9699 9.2747 4.0262 9.2747 3.451 9.8499Z"},{name:"nrktv",path:"M21.6896 6.8901C21.5139 6.5927 21.5038 6.4097 21.6732 6.1225L24 2.3139H20.772C20.772 2.3139 18.8327 5.4829 18.5675 5.9232 18.3049 6.3628 18.3163 6.6368 18.5783 7.0885 18.8434 7.5399 20.772 10.6862 20.772 10.6862H24C24 10.6862 21.715 6.937 21.6896 6.8901M15.066 10.6862H18.0016V2.3139H15.066M13.2146 2.1535C12.2962 2.1535 11.5528 2.9039 11.5528 3.83 11.5528 4.7559 12.2962 5.5084 13.2146 5.5084 14.1345 5.5084 14.881 4.7559 14.881 3.83 14.881 2.9039 14.1345 2.1535 13.2146 2.1535M8.4165 10.6862H11.3505V2.3139H8.4165M0 10.6862H2.9285V2.3139H-.0414M6.6341 3.659C6.4838 2.8918 5.8128 2.3139 5.0084 2.3139H3.1222L5.0175 10.6862H8.2057ZM0 13.3139V14.2914H2.5989V21.6861H3.6779V14.2914H6.2793V13.3139M12.1731 13.3139 9.9187 20.4641 7.7101 13.3139H6.5931L9.2756 21.6861H10.5456L13.2595 13.3139 Z"},{name:"paramount",path:"M7.6519 3.4867 7.2368 3.0901 7.4931 2.5755 6.9777 2.8346 6.5777 2.4416 6.671 2.988 6.1597 3.2496 6.7367 3.3405 6.8285 3.9031 7.0833 3.3984ZM9.1307 2.3332 9.4803 1.8825 8.9266 2.0371 8.61 1.5778 8.595 2.1318 8.0415 2.2902 8.5896 2.4891 8.569 3.0602 8.9199 2.6118 9.461 2.8049ZM5.9611 4.3735 5.4774 4.0588 5.6269 3.5086 5.1745 3.8586 4.7045 3.548 4.9004 4.0688 4.4496 4.4163 5.0362 4.4015 5.2362 4.9358 5.3869 4.393ZM11.1977 2.0426 11.6265 1.6605 11.0523 1.7122 10.8345 1.2 10.707 1.7429 10.1357 1.7969 10.6344 2.0929 10.5029 2.6481 10.9344 2.2734 11.4278 2.5645ZM2.678 7.4355 3.2043 7.2059 2.633 7.0928 2.5602 6.5278 2.2739 7.0178 1.723 6.9012 2.1053 7.3114 1.819 7.8003 2.3561 7.5695 2.7426 7.9931ZM1.8391 9.3077 2.3132 8.9847 1.7283 8.9785 1.5474 8.4395 1.3624 8.975.7963 8.9615 1.2526 9.2931 1.0677 9.826 1.5474 9.5018 2.0145 9.8445ZM4.4963 5.6934 3.9591 5.4749 3.9975 4.9072 3.6206 5.336 3.1013 5.1173 3.3959 5.5914 3.0219 6.0164 3.5919 5.8924 3.892 6.3787 3.9344 5.821ZM1.2618 11.2663 1.6605 10.861 1.0891 10.9641.8042 10.4692.7288 11.0255.1697 11.1201.6809 11.362.6041 11.9199 1.0138 11.5095 1.5372 11.76ZM1.099 13.3023 1.4128 12.8294.87 13.0383.4961 12.6036.5263 13.1673 0 13.3637.5495 13.5036.5824 14.064.9043 13.586 1.4677 13.7362ZM1.1904 16.8054 1.4368 17.3153 1.0218 17.6924 1.5836 17.6222 1.8302 18.1283 1.9453 17.5683 2.5236 17.5006 2.018 17.2315 2.1261 16.6799 1.7054 17.0708ZM1.0876 15.0527.634 14.6951.7751 15.2441.2941 15.5353.8629 15.5711 1.0012 16.1148 1.2246 15.5856 1.8084 15.625 1.3629 15.27 1.5795 14.748ZM16.507 2.5754 17.0223 2.8346 17.4223 2.4416 17.3291 2.988 17.8404 3.2496 17.2633 3.3405 17.1715 3.9031 16.9167 3.3984 16.3481 3.4867 16.7632 3.0901ZM15.0734 2.0371 15.39 1.5778 15.4051 2.1318 15.9586 2.2902 15.4105 2.4891 15.4309 3.0602 15.0802 2.6118 14.5389 2.8049 14.8693 2.3332 14.5197 1.8825ZM18.3732 3.5086 18.8256 3.8586 19.2955 3.548 19.0996 4.0688 19.5505 4.4163 18.9638 4.4015 18.7638 4.9358 18.6131 4.393 18.0388 4.3735 18.5227 4.0588ZM12.9477 1.7121 13.1656 1.2 13.2931 1.7429 13.8645 1.7969 13.3658 2.0929 13.4972 2.6481 13.0657 2.2734 12.5724 2.5645 12.8024 2.0426 12.3737 1.6605ZM21.3671 7.0928 21.4398 6.5278 21.7261 7.0178 22.2768 6.9012 21.8948 7.3114 22.1811 7.8003 21.644 7.5695 21.2574 7.9931 21.3219 7.4355 20.7956 7.2059ZM22.2717 8.9785 22.4526 8.4395 22.6377 8.975 23.2037 8.9615 22.7474 9.2931 22.9323 9.826 22.4526 9.5018 21.9855 9.8445 22.1608 9.3077 21.6868 8.9847ZM20.0025 4.9073 20.3794 5.336 20.8987 5.1173 20.604 5.5914 20.9781 6.0164 20.4082 5.8924 20.108 6.3787 20.0655 5.821 19.5037 5.6934 20.0409 5.4749ZM22.9109 10.9641 23.1958 10.4692 23.2712 11.0255 23.8303 11.1201 23.3192 11.362 23.396 11.9199 22.9863 11.5095 22.4627 11.76 22.7382 11.2663 22.3395 10.861ZM23.1299 13.0383 23.5039 12.6036 23.4737 13.1673 24 13.3637 23.4506 13.5036 23.4176 14.064 23.0957 13.586 22.5324 13.7362 22.9011 13.3023 22.5873 12.8294ZM22.9782 17.6923 22.4164 17.6222 22.1698 18.1283 22.0547 17.5683 21.4765 17.5006 21.982 17.2315 21.8739 16.6799 22.2946 17.0708 22.8096 16.8054 22.5632 17.3153ZM23.2249 15.244 23.7059 15.5353 23.1371 15.5711 22.9988 16.1148 22.7753 15.5856 22.1916 15.625 22.637 15.27 22.4205 14.748 22.9125 15.0527 23.366 14.6952ZM5.0813 16.6138 5.0473 16.5614 6.0387 14.9258 6.6053 14.0437 7.248 13.368 6.5461 14.7817 6.1656 15.0785ZM8.138 15.2082 8.3748 14.8688 8.5947 14.8123 9.2655 13.5343 9.3444 12.703 9.711 11.8831 9.6828 11.7755 9.1133 12.4937 8.9723 12.5447 7.9407 14.1111 8.0872 14.2638 7.0217 16.6389 7.7377 15.8982ZM9.5418 15.4514 9.4347 15.2704 8.5213 16.9217 8.3071 17.8491H8.4846L9.0682 17.1535 9.305 16.0678ZM13.1276 8.2619 12.3946 7.5418V9.9132L11.7857 11.5757 12.6126 12.1036 11.2031 15.9 11.4737 16.1337 10.7407 17.7887 11.6579 18.7841H13.041L12.8042 18.1809 14.8941 18.95H17.2656L16.7658 18.0866 16.5064 17.4081 16.4049 16.8952 17.6377 18.426H19.1562L18.7089 17.5022 18.0249 16.8086 16.3035 13.0347 15.5368 12.8011 15.315 13.0498H15.1801L14.7953 12.0357 14.4106 11.3534 13.8792 10.4975ZM11.9381 3.5225C6.6995 3.5225 2.4529 7.7821 2.4529 13.0366 2.4529 14.4803 2.7734 15.8488 3.3472 17.0746L6.9689 12.907 7.2818 12.8053 8.6771 10.8374 9.2859 10.3115 10.1992 8.878 10.7489 8.3521 11.6368 7.1052 12.195 6.6811 13.2351 7.4275 13.7509 8.386 14.4106 10.3539 15.1802 11.7195 16.7952 12.4406 18.2582 15.4347 18.6134 16.6308 18.9601 16.8851 19.2645 17.2414 19.8297 18.3169C20.8363 16.8061 21.4233 14.9901 21.4233 13.0366 21.4233 7.7821 17.1767 3.5225 11.9381 3.5225ZM18.849 19.502H18.3886L18.2825 19.7472 18.1032 20.162H17.887L17.8228 20.3027H18.0444L17.7774 20.9087C17.5868 21.3348 17.2843 21.7549 17.1114 21.7549 17.0748 21.7549 17.052 21.7375 17.052 21.6986 17.052 21.6621 17.0619 21.6224 17.1069 21.5161 17.1616 21.3855 17.2498 21.2004 17.3155 21.0633 17.4108 20.8656 17.5645 20.5551 17.5645 20.4006 17.5645 20.2452 17.468 20.1269 17.2797 20.1269 17.067 20.1269 16.8762 20.2582 16.7 20.4453L16.8144 20.162H16.379L16.0247 20.9814C15.884 21.2726 15.594 21.7543 15.4146 21.7543 15.3773 21.7543 15.3616 21.7309 15.3616 21.6932 15.3616 21.6728 15.3715 21.6302 15.3874 21.5931 15.4034 21.5558 15.6151 21.0552 15.6151 21.0552L15.9985 20.1596H15.5321L15.1595 21.0307C15.0426 21.3004 14.7512 21.7562 14.5644 21.7562 14.5264 21.7562 14.5016 21.7366 14.5016 21.6886 14.5016 21.6407 14.5363 21.5553 14.5631 21.4913L14.7583 21.055 14.759 21.0552 15.1625 20.1597H14.696L14.605 20.3614H14.6046C14.5377 20.497 14.4195 20.6588 14.2372 20.6588 14.1485 20.6588 14.1082 20.623 14.0864 20.588 14.0592 20.2863 13.873 20.1254 13.5947 20.1254 13.2098 20.1254 12.9356 20.358 12.7555 20.638 12.6354 20.8252 12.5536 21.0283 12.4811 21.2622 12.316 21.5382 12.1416 21.7543 12.0064 21.7543 11.9718 21.7543 11.9504 21.7332 11.9504 21.6869 11.9504 21.6351 11.9952 21.5333 12.0125 21.4952L12.3145 20.8389C12.3986 20.6356 12.4572 20.5014 12.4572 20.3699 12.4572 20.2282 12.3603 20.127 12.2026 20.127 11.984 20.127 11.745 20.2544 11.5575 20.4678 11.5638 20.438 11.5669 20.4035 11.5669 20.3649 11.5669 20.2094 11.4919 20.1269 11.3304 20.1269 11.1301 20.1269 10.9245 20.2474 10.7362 20.4689L10.8611 20.162H10.4356L10.079 20.9814C9.9088 21.3675 9.6372 21.7543 9.4823 21.7543 9.4462 21.7543 9.4256 21.7354 9.4256 21.6883 9.4256 21.6125 9.5051 21.4312 9.5371 21.3565L10.0089 20.2633C10.0441 20.1817 9.8173 20.1312 9.5291 20.1312 9.2331 20.1312 8.9307 20.2814 8.7068 20.4698 8.5505 20.6013 8.4347 20.6684 8.3748 20.6684 8.3458 20.6684 8.3327 20.6521 8.3327 20.6331 8.3327 20.5657 8.4899 20.3779 8.4899 20.2354 8.4899 20.1705 8.4555 20.1269 8.3678 20.1269 8.1983 20.1269 7.9996 20.2928 7.8517 20.4641L7.9765 20.1618H7.5636L7.2078 20.9814C7.0375 21.3675 6.7583 21.771 6.6036 21.771 6.5676 21.771 6.5468 21.7519 6.5468 21.7049 6.5468 21.632 6.6231 21.4518 6.6662 21.3565L7.138 20.2633C7.1732 20.1817 6.9466 20.1312 6.6584 20.1312 6.233 20.1312 5.8184 20.4239 5.596 20.7236 5.3535 21.0497 5.1892 21.3945 5.1855 21.6758 5.1824 21.9013 5.2971 22.0435 5.5284 22.0435 5.7859 22.0435 5.9916 21.8349 6.1146 21.6791 6.1117 21.6954 6.1001 21.7528 6.1001 21.7724 6.1001 21.9297 6.1616 22.0435 6.3483 22.0435 6.5135 22.0435 6.7342 21.9024 6.9117 21.6777L6.7682 22.0106H7.2187L7.6601 20.99C7.8041 20.6578 7.9714 20.4855 8.0163 20.4855 8.0308 20.4855 8.0371 20.492 8.0371 20.5047 8.0371 20.5402 7.9696 20.6333 7.9696 20.7206 7.9696 20.8099 8.0172 20.8709 8.138 20.8709 8.2344 20.8709 8.3428 20.823 8.4382 20.7628 8.2116 21.0774 8.0597 21.406 8.0562 21.6759 8.0532 21.9012 8.1682 22.0436 8.3994 22.0436 8.6436 22.0436 8.8674 21.8102 8.9904 21.6543A.8034.8034 90 008.9815 21.7623C8.9815 21.9155 9.0664 22.0435 9.2398 22.0435 9.4301 22.0435 9.5873 21.9214 9.7785 21.6832L9.6372 22.0106H10.0986L10.5195 21.0351C10.7036 20.6105 10.9533 20.3868 11.0766 20.3868 11.1131 20.3868 11.1376 20.4068 11.1376 20.4503 11.1376 20.4765 11.1265 20.5247 11.0997 20.5885L10.4825 22.0106 10.9549 22.0094 11.386 21.0169C11.5714 20.5918 11.7765 20.3815 11.9288 20.3815 11.9749 20.3815 11.9946 20.4058 11.9946 20.4572 11.9946 20.4857 11.9858 20.5332 11.9501 20.613L11.5371 21.5121C11.5027 21.589 11.4691 21.6995 11.4691 21.7849 11.4691 21.9211 11.5432 22.0435 11.7491 22.0435 12.0169 22.0435 12.2229 21.8371 12.4527 21.5259L12.4538 21.5925C12.4709 21.8396 12.6074 22.053 12.9638 22.053 13.3861 22.053 13.7281 21.7543 13.9358 21.2823 14.029 21.0705 14.074 20.8898 14.0864 20.753 14.1258 20.7731 14.1751 20.7857 14.2372 20.7857 14.2955 20.7857 14.3644 20.7739 14.436 20.7363L14.3626 20.899C14.2781 21.0794 14.1839 21.2799 14.114 21.4471 14.0625 21.5704 14.0315 21.686 14.0315 21.7633 14.0315 21.9323 14.122 22.0514 14.3101 22.0514 14.4986 22.0514 14.7576 21.8708 14.9397 21.6177H14.9454C14.9349 21.6681 14.9246 21.7397 14.9246 21.7776 14.9246 21.9168 14.9664 22.0504 15.1589 22.0504 15.3819 22.0504 15.5539 21.8856 15.7233 21.68L15.5804 22.0106H16.0469L16.4186 21.1508C16.6291 20.6655 16.8415 20.3737 17.0382 20.3737 17.0802 20.3737 17.1019 20.4021 17.1019 20.4446 17.1019 20.5255 16.9887 20.7483 16.8816 20.974 16.7848 21.1774 16.713 21.3329 16.6626 21.4553 16.6182 21.5637 16.5817 21.6944 16.5817 21.7797 16.5817 21.9292 16.6632 22.0435 16.8424 22.0435 17.1108 22.0435 17.3857 21.7793 17.5296 21.5757 17.4966 21.6698 17.4758 21.7839 17.4758 21.8738 17.4758 22.1477 17.639 22.2853 17.8644 22.2853 18.0234 22.2853 18.1609 22.2289 18.2825 22.1428 18.4588 22.018 18.6007 21.8302 18.7211 21.6559L18.6418 21.578C18.5304 21.7383 18.4082 21.8922 18.2825 21.9869 18.2038 22.0465 18.1238 22.0828 18.0445 22.0828 17.9487 22.0828 17.8872 22.0325 17.8872 21.9048 17.8872 21.779 17.9439 21.6098 18.0322 21.3849 18.0369 21.3739 18.1623 21.0868 18.2825 20.8101 18.3844 20.5759 18.4826 20.3489 18.5015 20.3028H18.8041L18.8653 20.162H18.5642ZM5.7447 21.7561C5.6781 21.7561 5.6335 21.7334 5.6318 21.6452 5.6351 21.4124 5.8227 21.0031 6.0596 20.6754 6.2237 20.4484 6.4398 20.2808 6.67 20.2808L6.3768 20.9467C6.1596 21.4501 5.9204 21.7561 5.7448 21.7561ZM8.6157 21.7561C8.5491 21.7561 8.5042 21.7334 8.5027 21.6452 8.5059 21.4124 8.6935 21.0031 8.9304 20.6754 9.0944 20.4484 9.3105 20.2808 9.5407 20.2808L9.2475 20.9467H9.2482C9.0275 21.4574 8.7994 21.7561 8.6157 21.7561ZM13.2333 21.6984C13.1293 21.8473 13.0401 21.8903 12.9629 21.8903 12.8568 21.8903 12.8253 21.7998 12.8383 21.6673 12.8615 21.4348 13.0485 20.8979 13.3111 20.5263 13.4305 20.3571 13.513 20.2867 13.6021 20.2867 13.69 20.2867 13.7212 20.364 13.718 20.4608 13.7097 20.7129 13.4903 21.3297 13.2333 21.6984ZM4.5481 20.6415C4.7102 20.6225 4.9754 20.5695 5.0763 20.5329 5.6999 20.3591 6.4062 19.9418 6.4062 19.201 6.4062 18.3477 5.5018 17.9385 4.4239 17.9385 3.2736 17.9385 2.2186 18.4483 1.8272 19.236 1.7238 19.4445 1.6661 19.672 1.6661 19.9152 1.6661 20.1349 1.7196 20.3324 1.8272 20.4917 1.9932 20.7375 2.2891 20.8919 2.7261 20.8919 3.2589 20.8919 3.6835 20.5994 3.6835 20.0908 3.6835 20.0908 3.6913 19.9479 3.5254 19.9479 3.3892 19.9479 3.3542 20.0415 3.3574 20.0908 3.3768 20.4906 3.141 20.808 2.7176 20.808 2.2447 20.808 2.0459 20.4061 2.0459 19.9751 2.0459 19.0943 2.7106 18.5106 3.4021 18.2606 3.7566 18.1312 4.0418 18.0847 4.4137 18.0847 5.1959 18.0847 5.8357 18.3855 5.8357 19.1879 5.8357 19.8602 5.2714 20.4321 4.5929 20.4799L4.6197 20.3875C4.7588 19.8949 4.9265 19.3562 5.2033 18.9554 5.2196 18.9303 5.2485 18.8927 5.2801 18.8528L5.2422 18.8055C5.1928 18.834 5.1045 18.8984 5.0693 18.9259 3.7711 19.9368 3.7319 22.774 2.0033 22.774 1.9406 22.774 1.8821 22.7691 1.8272 22.7603 1.4665 22.7023 1.2778 22.4601 1.279 22.1235 1.2793 22.0574 1.3018 21.9662 1.3018 21.9144 1.3018 21.8271 1.2426 21.7366 1.1129 21.7366.9586 21.7366.8954 21.8565.8925 22.0333.8843 22.5389 1.2556 22.8313 1.8272 22.884 1.8896 22.8898 1.955 22.967 2.0217 22.8927 3.3701 22.8927 4.1989 21.8763 4.5481 20.6415M21.3734 19.2275 20.7897 20.4889H19.5284L19.1581 21.2891H20.4194L19.8357 22.5505H20.636L21.2197 21.2891H22.4811L22.8514 20.4888H21.59L22.1737 19.2275Z"},{name:"peacock",path:"M6 12.7V7c.699-3.725 5.849-3.806 6.5 0 .401 2.234-.975 3.582-2.511 4.094Zm0 9.6V14.25L7 15.3l5-1.95c1.763-.665 3.812-3.119 3.489-6.35C14.3-.5 4.299-.5 3 7V22.3M18 1.5a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Zm0 4.19a1 1 0 003 0 1 1 0 00-3 0Z"},{name:"primevideo",path:"M10.5404 24C8.6114 23.8847 6.7246 23.3486 4.9953 22.4245 4.0043 21.9206 3.1033 21.2346 2.3328 20.3973 1.7161 19.7304 1.4078 19.2945 1.3491 18.9899 1.3174 18.8334 1.3432 18.7144 1.4211 18.6499 1.5195 18.6415 1.6179 18.6332 1.7163 18.6249 1.8497 18.6796 2.0389 18.8139 2.3132 19.0424 3.9381 20.3973 6.1992 21.3794 8.7148 21.8153 11.8436 22.3549 15.0469 22.0922 18.0628 21.0485 18.6011 20.8542 18.9437 20.7019 19.4968 20.4131 19.859 20.2188 19.9715 20.1715 20.089 20.1663 20.2309 20.1505 20.2358 20.1558 20.3141 20.245 20.4267 20.3763 20.4218 20.5496 20.2994 20.7492 20.1869 20.933 19.9862 21.1483 19.6877 21.4057 18.1558 22.7291 15.6646 23.6797 12.9924 23.958 12.5127 24.0105 10.9613 24.0315 10.5404 24ZM20.5637 22.435C20.4071 22.2932 20.4365 22.1356 20.6861 21.6893 20.9996 21.1528 21.2309 20.5659 21.3713 19.9509 21.4251 19.5833 21.337 19.4625 20.9602 19.389 20.6078 19.326 19.7807 19.3733 19.257 19.4888 19.1591 19.5098 18.9878 19.5256 18.8752 19.5256 18.6795 19.5256 18.655 19.5256 18.606 19.4625 18.5678 19.4127 18.5425 19.3529 18.5326 19.2892 18.5228 19.1947 18.5326 19.1684 18.606 19.0792 19.2394 18.5242 20.0349 18.2266 20.8525 18.2389 21.6209 18.2389 22.2424 18.4385 22.448 18.7536 22.5214 18.8691 22.5263 18.8796 22.5361 19.263 22.541 19.5466 22.5361 19.7199 22.5018 19.8984 22.3886 20.516 22.146 21.0979 21.7922 21.6 21.5444 21.9179 21.258 22.1988 20.9406 22.435 20.7448 22.54 20.6714 22.54 20.5637 22.435ZM11.6139 7.4537C11.5755 7.4363 11.5447 7.4055 11.5274 7.3669 11.5101 7.3206 11.5043 6.3482 11.5043 4.7158 11.5043 2.5336 11.5043 2.1342 11.5389 2.0879 11.5735 2.0416 11.6139 2.0358 12.0692 2.0301 12.4035 2.0243 12.5879 2.0301 12.634 2.0532 12.709 2.0821 12.7205 2.1111 12.8069 2.5742L12.8703 2.8173C12.8819 2.8231 12.928 2.7536 12.9799 2.6552 13.1412 2.331 13.4064 2.0879 13.7291 1.9722 13.8502 1.9259 13.9424 1.9143 14.1787 1.9143 14.4957 1.9143 14.6225 1.9374 14.8876 2.0706 15.1187 2.2161 15.3123 2.4144 15.4525 2.6494 15.5101 2.7478 15.5562 2.8231 15.5678 2.8231 15.5735 2.8231 15.6196 2.771 15.6657 2.7073 15.8837 2.3676 16.2052 2.1077 16.5822 1.9664 16.884 1.8834 17.2025 1.8834 17.5044 1.9664 18.0346 2.1516 18.3459 2.5452 18.5418 3.2803 18.5879 3.4829 18.5937 3.5408 18.5994 5.422 18.611 7.1006 18.5994 7.3727 18.5706 7.419 18.536 7.4653 18.5015 7.4711 17.9482 7.4769 17.3833 7.4827 17.3545 7.4827 17.2911 7.4306L17.2219 7.3727 17.2104 5.6246C17.2046 3.8997 17.2046 3.8707 17.147 3.7029 17.0317 3.3556 16.8415 3.2051 16.5245 3.2051 16.2018 3.2051 15.9712 3.3787 15.8502 3.7203 15.7637 3.9634 15.7522 4.2759 15.7522 5.8446 15.7522 7.3438 15.7522 7.3785 15.6945 7.4306 15.6484 7.4769 15.6139 7.4827 15.0778 7.4827 14.5015 7.4827 14.4381 7.4711 14.3862 7.3785 14.3539 6.8196 14.3443 6.2596 14.3574 5.6999 14.3574 4.0791 14.3516 3.8823 14.2652 3.6161 14.1499 3.2456 13.6888 3.0835 13.3257 3.2861 13.0894 3.4135 12.9626 3.6797 12.9222 4.1486 12.9049 4.2817 12.8934 5.0632 12.8934 5.8851V7.3785L12.8358 7.4306C12.7781 7.4769 12.7493 7.4827 12.2248 7.4827 11.9193 7.4827 11.6484 7.4653 11.6139 7.4537ZM.3458 9.1671C.31 9.1565.2767 9.1388.2479 9.115.2018 9.0861.2018 8.8835.2018 5.613.2018 3.7087.2133 2.14.219 2.1227.2709 2.0474.3631 2.0301.8127 2.0301 1.0721 2.0301 1.2969 2.0416 1.3199 2.0474 1.3833 2.0706 1.4064 2.14 1.4755 2.4758 1.5101 2.6494 1.5505 2.7999 1.562 2.8115 1.5735 2.8231 1.6139 2.7652 1.6542 2.6841 1.7464 2.5105 2.0173 2.2211 2.196 2.1227 2.4922 1.9451 2.8403 1.8756 3.1816 1.9259 3.9655 2.0474 4.5072 2.7189 4.7493 3.8534 4.8069 4.1428 4.8242 5.1037 4.7724 5.4741 4.7135 6.0632 4.4852 6.6223 4.1153 7.0833 3.7868 7.4306 3.4813 7.5869 3.0605 7.6042 2.7551 7.6274 2.5533 7.5927 2.3228 7.4769 2.0818 7.3418 1.8778 7.1489 1.7291 6.9154 1.6984 6.8598 1.6596 6.809 1.6139 6.7649 1.6023 6.7649 1.5908 7.2685 1.5908 7.8879 1.5908 8.513 1.5793 9.0398 1.5678 9.0745 1.5274 9.1729 1.4237 9.1903.8876 9.1903.6167 9.1903.3689 9.1845.3458 9.1729ZM2.709 6.3771C2.8992 6.3192 3.0778 6.1224 3.1816 5.8793 3.2969 5.6015 3.343 5.3294 3.3603 4.8953 3.3891 4.1428 3.2162 3.5061 2.928 3.2572 2.8358 3.1761 2.5937 3.0835 2.4842 3.0835 1.9251 3.0835 1.562 3.726 1.562 4.7216 1.562 5.4336 1.7061 5.9372 1.977 6.215 2.1729 6.406 2.4438 6.4697 2.7147 6.3771ZM21.1528 7.5869C20.2331 7.3991 19.5127 6.6801 19.3199 5.7578 18.9914 4.4496 19.3487 3.072 20.196 2.3831 20.9772 1.733 22.1092 1.7354 22.8876 2.3889 23.2104 2.6783 23.4006 2.9446 23.5793 3.3845 23.7234 3.7434 23.781 4.056 23.7983 4.5538 23.8098 4.7853 23.8041 4.9995 23.7983 5.0342 23.7579 5.1905 23.8386 5.1789 22.196 5.1789 21.3718 5.1789 20.6917 5.1905 20.6801 5.2021 20.6513 5.2484 20.7493 5.7114 20.8242 5.914 20.928 6.1861 21.1239 6.3945 21.3257 6.4523 21.758 6.5739 22.1729 6.3771 22.3113 5.9777 22.4092 5.7056 22.4208 5.6883 22.5303 5.6767 22.611 5.6709 23.1989 5.7925 23.5562 5.8793 23.7061 5.9198 23.7234 5.9951 23.6254 6.2382 23.5216 6.516 23.3833 6.7418 23.1931 6.9444 22.7967 7.3835 22.2266 7.6232 21.6369 7.5984 21.4352 7.6042 21.2162 7.5984 21.147 7.5869ZM22.3631 4.1717C22.3631 3.9113 22.2018 3.4308 22.0461 3.2456 21.9213 3.114 21.7487 3.0388 21.5677 3.0372 21.2969 3.0372 21.0894 3.1646 20.9337 3.425 20.8415 3.5929 20.732 3.9171 20.7032 4.1197L20.6859 4.2528H22.3631ZM5.5505 7.4306 5.4813 7.3727V4.7448C5.4813 2.3253 5.4813 2.1053 5.5216 2.0764 5.5793 2.0301 6.4784 2.0069 6.5879 2.0532 6.6744 2.0879 6.7032 2.1516 6.7666 2.5047 6.7954 2.661 6.8242 2.7941 6.8415 2.8057 6.8473 2.8173 6.8992 2.7478 6.9453 2.6552 7.0605 2.441 7.3199 2.1632 7.4986 2.0764 7.8352 1.918 8.2159 1.8812 8.5764 1.9722 8.7896 2.0301 8.8761 2.1053 8.8761 2.2269 8.8761 2.3137 8.7032 3.0372 8.6283 3.2746 8.5706 3.4482 8.536 3.4656 8.2824 3.3672 8.0933 3.2813 7.8902 3.2303 7.683 3.2167 7.2969 3.2167 7.049 3.4193 6.9337 3.8534 6.8876 3.9865 6.8819 4.2007 6.8703 5.7057 6.8929 6.283 6.8775 6.8611 6.8242 7.4364 6.7954 7.4595 6.6398 7.4711 6.2017 7.4769 5.6369 7.4827 5.6138 7.4769 5.5504 7.4306ZM9.3545 7.4537C9.3233 7.4443 9.2966 7.4237 9.2796 7.3959 9.268 7.3669 9.2507 2.6552 9.2623 2.1748 9.2623 2.0416 9.343 2.0243 9.9885 2.0243 10.6283 2.0243 10.6398 2.0301 10.6513 2.1979V4.8258C10.6513 7.3438 10.6513 7.3785 10.5994 7.4306 10.5533 7.4769 10.5188 7.4827 9.977 7.4827 9.66 7.4827 9.3775 7.4711 9.3487 7.4537ZM9.7234 1.6191C9.4958 1.5469 9.3081 1.3835 9.2046 1.1676 9.1222.9415 9.1222.6933 9.2046.4672 9.2796.2993 9.4409.1373 9.6081.062 9.8353-.0202 10.084-.0202 10.3113.062 10.4957.1488 10.6801.3514 10.7435.5482 10.8012.745 10.7839 1.0229 10.6974 1.2139 10.6167 1.3875 10.4265 1.5496 10.2363 1.6075 10.098 1.648 9.8329 1.6538 9.7234 1.6191ZM9.7194 16.2724C9.0674 16.1565 8.5202 15.533 8.2989 14.6612 8.1484 13.9852 8.1405 13.2877 8.2757 12.6087 8.4561 11.8197 8.8578 11.2404 9.4109 10.9976 10.0703 10.6771 10.8789 10.8909 11.268 11.4887 11.3379 11.588 11.4077 11.6652 11.4194 11.6542 11.4369 11.6487 11.4485 11.2073 11.4485 10.5341 11.4485 9.4472 11.4485 9.4251 11.5009 9.3755 11.5533 9.3258 11.5766 9.3203 12.1587 9.3313 12.3731 9.3168 12.5885 9.3298 12.7991 9.3699 12.8574 9.4251 12.869 9.9327 12.8574 13.0115L12.8457 16.0682 12.7875 16.1234C12.7409 16.1786 12.7235 16.1786 12.2519 16.1786 12.0751 16.1836 11.8982 16.1781 11.7221 16.162 11.6523 16.1344 11.6057 16.0296 11.5475 15.7151 11.5317 15.612 11.5064 15.5105 11.4718 15.4116L11.3845 15.5551C11.268 15.7648 10.9595 16.0462 10.715 16.162 10.6102 16.2117 10.4588 16.2613 10.3831 16.2724 10.2143 16.3055 9.8941 16.3055 9.7194 16.2724ZM10.8605 15.1027C11.2855 14.9095 11.5067 14.2695 11.4601 13.3922 11.4194 12.6032 11.1691 12.1397 10.7324 12.0239 10.6333 11.9898 10.5254 11.986 10.4239 12.0128 9.9989 12.1011 9.766 12.4598 9.6787 13.1439 9.6257 13.5718 9.6533 14.0052 9.7602 14.424 9.8592 14.7771 10.0338 15.0089 10.2783 15.1192 10.4239 15.1854 10.7033 15.1744 10.8605 15.1027ZM20.6817 16.2613C19.9915 16.0852 19.4172 15.6316 19.1099 15.0199 18.9718 14.7334 18.8739 14.4311 18.8188 14.1205 18.6616 13.0722 18.976 12.057 19.6397 11.4556 19.932 11.1704 20.3102 10.9777 20.7225 10.9038 22.1896 10.6224 23.4587 11.759 23.5286 13.4308 23.5723 14.0903 23.3972 14.7463 23.0279 15.3068 22.7241 15.7386 22.2777 16.0627 21.7588 16.2282 21.405 16.3027 21.0398 16.3139 20.6817 16.2613ZM21.4677 15.1468C21.7064 15.0364 21.8868 14.7606 21.9858 14.3743 22.0324 14.1757 22.044 14.0709 22.044 13.5908 22.044 13.1439 22.0324 13.0005 21.9974 12.8515 21.8635 12.3163 21.6365 12.0349 21.2872 11.9632 20.8215 11.8749 20.4605 12.2004 20.3266 12.8184 20.1636 13.5633 20.2626 14.4902 20.5478 14.8985 20.6293 15.0144 20.8156 15.1578 20.9321 15.1965 21.0485 15.2296 21.3571 15.2075 21.4677 15.1468ZM15.5004 16.2613C15.2693 16.2249 15.0478 16.1462 14.8484 16.0296 14.1848 15.6345 13.7426 14.9786 13.6433 14.2419 13.5851 13.9164 13.5851 13.3095 13.6433 12.9894 13.7519 12.2614 14.1706 11.6073 14.8018 11.1797 15.154 10.9783 15.555 10.8662 15.9661 10.8542 16.1874 10.8542 16.5483 10.9204 16.7579 10.9976 17.3241 11.2351 17.7679 11.6755 17.9921 12.2225 18.1668 12.6142 18.2366 12.9784 18.2424 13.4915 18.2424 13.8391 18.2424 13.8833 18.1959 13.9329 18.1493 13.9881 18.1376 13.9881 16.6182 13.9881H15.0871V14.0709C15.0871 14.2198 15.1569 14.5178 15.2442 14.7054 15.3432 14.9316 15.4655 15.0751 15.6401 15.1578 15.8264 15.2516 16.1233 15.2516 16.3271 15.1689 16.4901 15.1026 16.6764 14.9151 16.7346 14.7661L16.8103 14.5619C16.8394 14.4737 16.8569 14.4626 16.9384 14.4571 17.0548 14.4461 17.9863 14.6392 18.0736 14.6888 18.1609 14.744 18.1376 14.8544 17.9921 15.1468 17.8477 15.4372 17.6345 15.6921 17.3692 15.8917 16.9617 16.1786 16.6356 16.2779 16.0593 16.2889 15.7973 16.2944 15.6168 16.2889 15.5004 16.2668ZM16.7754 13.0722C16.7987 13.0556 16.7987 13.017 16.7637 12.8349 16.6764 12.3991 16.4959 12.1066 16.2398 11.9963 15.8613 11.8308 15.4247 12.0515 15.2384 12.5039 15.1569 12.7246 15.0871 13.0391 15.122 13.0722 15.1569 13.1053 16.7171 13.1053 16.7754 13.0722ZM1.9707 16.1289C1.9183 16.0737 1.8951 16.0075 1.7379 15.4503 1.5252 14.7115 1.3078 13.974 1.0858 13.2377L.591 11.5494C.527 11.3342.4746 11.1411.4746 11.108.4746 10.9976.5444 10.9811 1.2023 10.9811 1.7553 10.9811 1.8252 10.9866 1.8776 11.0252 1.9242 11.0638 1.9649 11.2073 2.1396 11.9466L2.5005 13.4971C2.6344 14.0488 2.7916 14.733 2.7916 14.7661 2.7916 14.8488 2.8324 14.7661 2.8615 14.6281L3.2923 12.7798C3.6416 11.29 3.6882 11.0804 3.7347 11.0362 3.7697 11.0031 3.8628 10.9921 4.3926 10.9866 5.0563 10.9866 5.1319 10.9921 5.1494 11.0969 5.1552 11.1521 5.0679 11.4666 4.672 12.8074L4.1073 14.7275C4.02 15.042 3.9501 15.2682 3.7464 15.9413 3.7173 16.0351 3.6765 16.1234 3.6532 16.1455 3.6241 16.1786 3.5019 16.1841 2.8149 16.1841 2.0581 16.1841 2.0115 16.1841 1.9707 16.1344ZM6.0285 16.1289 5.9586 16.0737 5.9644 13.5743C5.9703 11.2183 5.9761 11.0749 6.0227 11.0362 6.0634 10.9976 6.1274 10.9921 6.6456 10.9811 7.1404 10.9811 7.2452 10.9811 7.3093 11.0142L7.3908 11.0528V13.5357C7.3908 15.3234 7.3791 16.0462 7.3617 16.0903 7.3432 16.1239 7.312 16.1495 7.2743 16.162 7.2452 16.1731 6.9658 16.1786 6.6572 16.1786 6.1333 16.1786 6.0925 16.1786 6.0285 16.1234ZM6.436 10.5838C6.2031 10.5286 5.9703 10.3245 5.9004 10.1093 5.8422 9.9603 5.8422 9.7231 5.9004 9.5575 5.9412 9.403 6.1275 9.1989 6.2846 9.1216 6.4418 9.0444 6.8435 9.0334 7.0124 9.0996 7.2045 9.1823 7.3267 9.2872 7.4199 9.4527 7.4839 9.5906 7.4956 9.6293 7.4956 9.8279 7.4956 10.0927 7.4432 10.2141 7.2918 10.3686 7.1346 10.5231 6.9716 10.5893 6.7271 10.6003 6.6107 10.6003 6.4826 10.6003 6.436 10.5838Z"},{name:"pia",path:"M 24 12 C 24 18.628906 18.628906 24 12 24 C 5.371094 24 0 18.628906 0 12 C 0 5.371094 5.371094 0 12 0 C 18.628906 0 24 5.371094 24 12 Z M 24 12 M 11.40625 8.695312 C 11.40625 8.332031 10.96875 8.152344 10.710938 8.40625 C 10.457031 8.664062 10.636719 9.101562 11 9.101562 C 11.222656 9.101562 11.40625 8.917969 11.402344 8.695312 M 13.003906 8.289062 C 12.640625 8.289062 12.457031 8.726562 12.714844 8.984375 C 12.972656 9.238281 13.40625 9.058594 13.40625 8.695312 C 13.40625 8.472656 13.226562 8.289062 13.003906 8.289062 M 12.566406 9.363281 C 12.242188 9.652344 11.757812 9.652344 11.4375 9.363281 C 11.332031 9.277344 11.199219 9.425781 11.292969 9.519531 C 11.691406 9.894531 12.3125 9.894531 12.707031 9.519531 C 12.75 9.480469 12.75 9.414062 12.710938 9.375 C 12.671875 9.332031 12.609375 9.328125 12.566406 9.363281 M 16.304688 10.933594 L 16.304688 10.929688 C 16.304688 10.550781 16.054688 10.21875 15.691406 10.117188 L 15.691406 9.390625 C 15.691406 7.414062 14.089844 5.8125 12.113281 5.8125 L 11.976562 5.8125 C 10 5.8125 8.394531 7.414062 8.394531 9.390625 L 8.394531 10.097656 C 7.996094 10.171875 7.707031 10.515625 7.703125 10.921875 C 7.59375 11.105469 7.535156 11.316406 7.535156 11.53125 L 7.535156 16.121094 C 7.535156 16.667969 7.902344 17.144531 8.429688 17.289062 C 8.570312 17.605469 8.886719 17.8125 9.234375 17.8125 L 10.238281 17.8125 C 10.570312 17.8125 10.875 17.625 11.027344 17.328125 L 12.871094 17.328125 C 13.019531 17.625 13.324219 17.8125 13.65625 17.8125 L 14.660156 17.8125 C 15 17.8125 15.308594 17.617188 15.457031 17.3125 C 16.039062 17.214844 16.464844 16.710938 16.464844 16.121094 L 16.464844 11.53125 C 16.464844 11.324219 16.410156 11.117188 16.304688 10.933594 Z M 13.113281 15.382812 C 13.136719 15.539062 13.089844 15.695312 12.988281 15.816406 C 12.886719 15.933594 12.738281 16.003906 12.578125 16.003906 L 11.421875 16.003906 C 11.265625 16.003906 11.113281 15.933594 11.011719 15.816406 C 10.910156 15.695312 10.863281 15.539062 10.886719 15.382812 L 11.109375 13.871094 C 10.691406 13.515625 10.527344 12.949219 10.6875 12.421875 C 10.847656 11.898438 11.300781 11.519531 11.84375 11.460938 C 12.445312 11.390625 13.019531 11.722656 13.261719 12.277344 C 13.5 12.832031 13.351562 13.480469 12.890625 13.871094 Z M 13.246094 10.324219 L 10.761719 10.324219 C 10.605469 10.167969 10.390625 10.082031 10.171875 10.082031 L 9.75 10.082031 L 9.75 9.332031 C 9.75 8.09375 10.753906 7.089844 11.992188 7.089844 L 12.101562 7.089844 C 13.339844 7.089844 14.339844 8.09375 14.339844 9.332031 L 14.339844 10.082031 L 13.835938 10.082031 C 13.613281 10.082031 13.402344 10.167969 13.246094 10.324219 Z M 12.730469 15.457031 C 12.742188 15.496094 12.734375 15.535156 12.707031 15.570312 C 12.683594 15.601562 12.644531 15.617188 12.605469 15.617188 L 11.402344 15.617188 C 11.363281 15.617188 11.324219 15.601562 11.300781 15.566406 C 11.273438 15.535156 11.265625 15.496094 11.277344 15.457031 L 11.507812 13.785156 C 11.507812 13.761719 11.503906 13.738281 11.496094 13.714844 C 11.476562 13.683594 11.453125 13.660156 11.421875 13.636719 C 11.417969 13.632812 11.417969 13.632812 11.414062 13.628906 C 11.070312 13.375 10.925781 12.933594 11.058594 12.527344 C 11.191406 12.121094 11.566406 11.84375 11.992188 11.839844 C 12.421875 11.839844 12.800781 12.109375 12.9375 12.515625 C 13.074219 12.917969 12.9375 13.367188 12.59375 13.621094 C 12.59375 13.625 12.59375 13.628906 12.582031 13.636719 C 12.550781 13.660156 12.527344 13.683594 12.507812 13.714844 C 12.503906 13.722656 12.5 13.734375 12.5 13.746094 Z M 12.730469 15.457031 Z"},{name:"rakutentv",path:"M6.886 1.2781V1.4302C6.6426 1.2781 6.4448 1.1868 6.1405 1.1868 5.2429 1.1868 4.5734 1.9931 4.5734 2.9973 4.5734 4.0015 5.258 4.8079 6.1405 4.8079 6.4296 4.8079 6.6426 4.7166 6.886 4.5644V4.7166H7.662V1.2781H6.886ZM6.1405 3.9863C5.6993 3.9863 5.3797 3.5603 5.3797 3.0125 5.3797 2.4648 5.6993 2.0388 6.1405 2.0388 6.5817 2.0388 6.886 2.4648 6.886 3.0125 6.9013 3.545 6.5817 3.9863 6.1405 3.9863ZM13.1545 1.2781V3.3016C13.1545 3.682 12.8958 4.0015 12.5155 4.0015 12.1351 4.0015 11.8764 3.682 11.8764 3.3016V1.2781H11.0853V3.3016C11.0853 4.1384 11.6483 4.8079 12.4851 4.8079 12.8654 4.8079 13.1545 4.5949 13.1545 4.5949V4.7166H13.9305V1.2781H13.1545ZM20.4576 4.7318V2.693C20.4576 2.3126 20.7163 1.9931 21.0966 1.9931 21.477 1.9931 21.7357 2.3126 21.7357 2.693V4.7166H22.5268V2.693C22.5268 1.8562 21.9638 1.1868 21.127 1.1868 20.7467 1.1868 20.4576 1.3998 20.4576 1.3998V1.2781H19.6816V4.7318H20.4576ZM2.3216 4.7318V3.3929H2.8998L3.9039 4.7318H4.9233L3.7061 3.119C4.0865 2.8452 4.3299 2.4039 4.3299 1.9018 4.3299 1.0803 3.6605.4108 2.8389.4108H1.5V4.7166H2.3216ZM2.3216 1.2324H2.8541C3.2192 1.2324 3.5235 1.5367 3.5235 1.9018 3.5235 2.267 3.2192 2.5713 2.8541 2.5713H2.3216V1.2324ZM16.0606 3.9102C15.9844 3.9559 15.9084 4.0015 15.8019 4.0015 15.6802 4.0015 15.4367 3.9102 15.4367 3.5755V2.0996H16.1061V1.2781H15.4367L15.4367.4108H14.6608L14.6608 1.2781H14.2499V2.0996H14.6608V3.5907C14.6608 4.3666 15.2389 4.8231 15.8323 4.8231 16.0453 4.8231 16.3496 4.747 16.593 4.61L16.0606 3.9102ZM9.6095 2.8908 10.9636 1.2781 9.8682 1.2781 8.9248 2.48 8.9248.137 8.1184.137 8.1184 4.7318 8.9248 4.7318 8.9248 3.3168 10.0812 4.7318 11.1766 4.7318M17.8711 1.1868C16.9582 1.1868 16.3191 1.9779 16.3191 2.9973 16.3191 4.0623 17.1408 4.8079 17.9472 4.8079 18.3579 4.8079 18.8905 4.6709 19.3317 4.0319L18.6471 3.6363C18.1145 4.4275 17.2168 4.0319 17.1104 3.2408L19.3622 3.2408C19.5599 2.0084 18.7535 1.1868 17.8711 1.1868ZM18.5558 2.5561H17.1408C17.3081 1.7497 18.4036 1.7041 18.5558 2.5561ZM5.8822 5.221 6.858 6.2007 18.1252 5.221 5.8822 5.221ZM10.0372 12.0377C9.9862 11.5775 9.9862 11.373 10.3439 11.1686 10.5996 11.0152 11.8776 10.2484 14.2803 9.5327 14.587 9.4305 14.8427 9.4816 14.9959 9.6861 15.1493 9.8905 15.2005 10.1973 15.0982 10.4529 14.8937 10.9641 14.8427 11.373 15.0471 11.5775 15.2516 11.7309 15.4561 11.782 16.0695 11.4753 16.8875 11.0664 17.8077 9.9928 17.7565 8.2547 17.7565 7.6412 17.5009 7.1812 17.092 6.8744 16.683 6.6188 16.1206 6.5165 15.5583 6.5165 14.0246 6.5165 13.2578 6.8744 11.2641 7.6412 8.4524 8.6637 4.9251 9.7883 2.9825 10.2995 2.1646 10.504 1.5 11.0664 1.5 11.8843 1.5 13.1623 3.0336 13.5202 4.1072 13.1623 4.3117 13.1112 6.5099 12.2932 7.2767 12.191 7.379 12.191 7.4301 12.2421 7.4301 12.2932 7.4301 12.3955 7.4812 13.5202 7.5322 13.9802 7.6346 16.0762 7.7879 20.1659 7.7879 20.4215 7.839 20.9839 7.839 22.6709 8.7592 22.6709 9.6283 22.6709 10.0372 21.7507 10.2417 20.4215M21.5906 8.6637C20.4149 8.6637 19.3413 10.8107 18.5233 12.7022 17.5009 15.1049 16.9386 17.252 16.6318 17.9677 16.3763 17.252 15.6605 15.2072 15.3027 14.4915 14.6893 13.2134 14.0758 12.2421 13.2578 12.2421 12.7978 12.2421 12.2866 12.4977 12.2866 13.3157 12.2866 13.878 12.5421 14.5937 12.7978 15.2583 12.9 15.4628 14.4336 19.2457 14.6382 19.9614 14.6382 19.9614 15.405 22.2619 15.4561 22.4664 15.9161 23.8466 16.3252 24 16.6318 24 17.092 24 17.7565 23.7955 18.0633 22.4152 18.2677 21.5462 18.5745 20.5237 18.8301 19.6547 19.2901 18.1722 20.4149 15.3094 21.1817 13.5713 21.7951 12.191 22.5108 10.5551 22.5108 9.5327 22.5108 9.1748 22.3063 8.6637 21.5906 8.6637Z"},{name:"rakutenviki",path:"M7.5496 3.24 7.5496 8.2824 8.47 8.2824 8.47 6.7261 9.7889 8.2824 11.0422 8.2824 9.2623 6.2699 10.7968 4.4964 9.5435 4.4964 8.47 5.8152 8.47 3.24 7.5496 3.24zM.0007 3.5526.0007 8.2824C0 8.2832.9349 8.2824.9349 8.2824L.9349 6.8167 1.5961 6.8167 2.7414 8.2824 3.9133 8.2824 2.529 6.5136C2.9602 6.216 3.2447 5.7319 3.2447 5.1839 3.2447 4.2838 2.4838 3.5526 1.5461 3.5526L.0007 3.5526zM14.9986 3.5526 14.9986 4.4948 14.5252 4.4948 14.5252 5.3933 14.9986 5.3933 14.9986 7.0278C14.9986 7.8734 15.6612 8.3778 16.3284 8.3778 16.5772 8.3778 16.9228 8.2987 17.2033 8.1385L16.6127 7.3872C16.5326 7.4393 16.4311 7.4795 16.3144 7.4795 16.168 7.4795 15.8924 7.3722 15.8924 7.0153L15.8924 5.395 16.658 5.395 16.658 4.4964 15.8924 4.4964 15.8924 3.5526 14.9986 3.5526zM18.6786 4.3994C17.6434 4.3994 16.902 5.2726 16.902 6.3886 16.902 7.5614 17.8339 8.3792 18.7675 8.3792 19.2396 8.3792 19.844 8.2238 20.3521 7.531L19.5614 7.0933C18.9509 7.9582 17.9335 7.5202 17.8158 6.6542L20.3911 6.6542C20.6105 5.2943 19.6972 4.3994 18.6786 4.3994zM5.3027 4.4026C4.2848 4.4026 3.5134 5.295 3.5134 6.3902 3.5134 7.4848 4.2857 8.3762 5.3027 8.3762 5.633 8.3762 5.8751 8.2793 6.1448 8.1138L6.1448 8.2824 7.0402 8.2824 7.0402 4.4948C7.0402 4.4964 6.1448 4.4964 6.1448 4.4964L6.1448 4.6651C5.8751 4.5004 5.6339 4.4026 5.3027 4.4026zM22.4006 4.4026C21.9607 4.4026 21.6413 4.6354 21.6413 4.6354L21.6413 4.4964 20.7458 4.4964 20.7458 8.2824C20.7458 8.2832 21.6413 8.2824 21.6413 8.2824L21.6413 6.0574C21.6413 5.6406 21.9396 5.2885 22.3741 5.2885 22.8078 5.2885 23.107 5.6406 23.107 6.0574L23.107 8.2824 24.0008 8.2824 24.0008 6.0574C24.0008 5.1445 23.3503 4.4026 22.4006 4.4026zM.9349 4.451 1.5444 4.451C1.9645 4.451 2.3086 4.7797 2.3086 5.1839 2.3086 5.5895 1.9645 5.9184 1.5444 5.9184L.9349 5.9184.9349 4.451zM10.9483 4.4964 10.9483 6.7214C10.9483 7.6345 11.5987 8.3778 12.5484 8.3778 12.9883 8.3778 13.3079 8.1433 13.3079 8.1433L13.3079 8.2841 14.2031 8.2841 14.2031 4.4964 13.3079 4.4964 13.3079 6.7214C13.3079 7.1384 13.0093 7.4921 12.575 7.4921 12.1414 7.4921 11.842 7.1384 11.842 6.7214L11.842 4.4964 10.9483 4.4964zM18.6596 5.2166C19.0172 5.2103 19.3727 5.4323 19.4599 5.9011L17.8488 5.9011C17.9428 5.458 18.3022 5.2231 18.6596 5.2166zM5.3027 5.3152C5.8042 5.3152 6.159 5.7901 6.159 6.3902 6.1582 6.9894 5.8042 7.4639 5.3027 7.4639 4.801 7.4639 4.4338 6.9901 4.4338 6.3902 4.4338 5.791 4.801 5.3152 5.3027 5.3152zM4.9933 9.3108 6.1559 10.478 19.5787 9.3108 4.9933 9.3108zM-.001 12.4141 3.2604 20.8412 5.262 20.8412 8.4857 12.4141 5.9543 12.4141 4.2604 17.9332 2.5432 12.4141-.001 12.4141zM9.2935 12.4141 9.2935 20.8412 11.703 20.8412 11.703 12.4141 9.2935 12.4141zM13.0687 12.4141 13.0687 20.8412 15.4783 20.8412 15.4783 18.4082 16.1441 17.7426 18.3176 20.8412 21.085 20.8412 17.677 16.1878 20.8631 12.4141 18.1458 12.4141 15.4783 15.619 15.4783 12.4141 13.0687 12.4141zM21.5912 12.4141 21.5912 20.8412 24.0008 20.8412 24.0008 12.4141 21.5912 12.4141z"},{name:"showtime",path:"M12 0C8.3317 0 5.0504 1.6476 2.8492 4.2412 3.1847 4.2547 3.4606 4.3319 3.4606 4.3319 6.2608 5.0435 6.2609 7.956 6.2609 8.8696L3.6522 8.8696C3.6522 8.8696 3.6522 6.7826 2.3478 6.7826 2.0551 6.7826 1.8376 6.892 1.6712 7.0282 1.5982 7.0882 1.4345 7.2822 1.3594 7.5754 1.2096 8.1639 1.2172 9.169 2.3478 10.1739 3.8337 11.4944 6.7826 12.7174 6.7826 15.8478 6.7826 18.277 5.0607 19.5718 3.5717 19.7894 3.5717 19.7894 3.3445 19.8327 2.9266 19.8536 5.1273 22.3934 8.376 24 12 24 15.6464 24 18.9094 22.3696 21.1101 19.8026 18.6485 19.558 16.6957 16.1635 16.6957 12 16.6957 7.8365 18.6485 4.442 21.1101 4.1974 18.9094 1.6304 15.6464 0 12 0zM7.8261 4.6957 10.4348 4.6957 10.4348 10.6957 13.0435 10.6957 13.0435 4.6957 15.6522 4.6957 15.6522 19.8261 13.0435 19.8261 13.0435 13.3043 10.4348 13.3043 10.4348 19.8261 7.8261 19.8261 7.8261 4.6957zM21.6522 6.7826A5.2174 2.3478 90 0019.3043 12 5.2174 2.3478 90 0021.6522 17.2174 5.2174 2.3478 90 0024 12 5.2174 2.3478 90 0021.6522 6.7826zM.0061 11.2174C.0061 11.2174-.0288 13.6831.373 14.8696.9693 16.6304 1.6394 17.2174 2.7575 17.2174 3.5771 17.2174 4.1739 16.6957 4.1739 15.587 4.1739 14.3463 2.6362 13.6105 1.5734 12.8071.5701 12.049.0061 11.2174.0061 11.2174z"},{name:"starplus",path:"m10.9 8.58l-.79 2.399H7.601l2.002 1.472s.989-.637 2.199-.879c-1.76 1.298-2.729 2.596-2.729 2.596l-.219.682l2.045-1.473l2.026 1.473l-.772-2.399l2.047-1.472h-2.53zm-8.14.748c-.902 0-1.563.593-1.563 1.385c0 .55.265.969.881 1.299l.703.351c.396.176.573.331.573.617c0 .309-.243.528-.573.528c-.352 0-.658-.199-.812-.639L1 13.156c.22.814.901 1.3 1.781 1.3c.946 0 1.674-.617 1.674-1.476c0-.682-.374-1.121-1.078-1.43l-.66-.33c-.33-.131-.442-.31-.442-.507c0-.242.2-.44.53-.44c.286 0 .506.156.66.53l.924-.418c-.264-.66-.793-1.057-1.63-1.057zm11.728.067v4.972h1.078v-1.98l1.342 1.98h1.233l-1.409-1.98c.682-.088 1.254-.705 1.254-1.453c0-.99-.66-1.54-1.76-1.54zm-9.75.007v.979h1.098v3.994h1.098v-3.994h1.08v-.979zm15.586.534v1.537H18.73v1.02h1.594v1.525h1.07v-1.526H23v-1.02h-1.605V9.937zm-4.758.404h.66c.419 0 .682.22.682.572c0 .396-.263.66-.681.66h-.66z"},{name:"stremio",path:"M12.6527.2686 12.6527.2686 23.7314 11.3473C23.9035 11.5209 24 11.7556 24 12 24 12.2445 23.9035 12.479 23.7314 12.6527L12.6527 23.7314C12.479 23.9035 12.2445 24 12 24 11.7556 24 11.5209 23.9035 11.3473 23.7314L.2686 12.6527C.0965 12.479 0 12.2445 0 12 0 11.7556.0965 11.5209.2686 11.3473L11.3473.2686C11.5209.0965 11.7556 0 12 0 12.2445 0 12.479.0965 12.6527.2686M16.1357 12.543C16.2199 12.4849 16.2888 12.4072 16.3363 12.3167 16.3838 12.2261 16.4087 12.1254 16.4087 12.0231 16.4087 11.9208 16.3838 11.8201 16.3363 11.7295 16.2888 11.6389 16.2199 11.5613 16.1357 11.5033L11.2549 8.0895C11.1597 8.0228 11.0482 7.9835 10.9322 7.9758 10.8163 7.9681 10.7005 7.9924 10.5974 8.046 10.4943 8.0997 10.4079 8.1806 10.3477 8.2799 10.2874 8.3792 10.2555 8.4932 10.2556 8.6094V15.4368C10.2555 15.553 10.2874 15.6669 10.3477 15.7663 10.4079 15.8657 10.4943 15.9465 10.5974 16.0001 10.7005 16.0538 10.8163 16.0781 10.9322 16.0704 11.0482 16.0627 11.1597 16.0234 11.2549 15.9567L16.1357 12.543Z"},{name:"surfshark",path:"M 24 12 C 24 18.628906 18.628906 24 12 24 C 5.371094 24 0 18.628906 0 12 C 0 5.371094 5.371094 0 12 0 C 18.628906 0 24 5.371094 24 12 Z M 24 12M 16.546875 8.351562 L 16.546875 8.34375 C 16.539062 8.242188 16.53125 8.125 16.527344 8 C 16.511719 7.765625 16.496094 7.515625 16.480469 7.320312 C 16.457031 7.1875 16.425781 7.070312 16.386719 6.960938 C 16.148438 6.429688 15.683594 6.175781 15.191406 6.054688 C 14.964844 6.015625 14.691406 6.007812 14.398438 6 L 11.570312 6 C 9.75 6.097656 8.984375 7.152344 8.78125 7.714844 C 7.984375 10.097656 7.484375 13.1875 7.128906 15.414062 C 7.121094 15.460938 7.113281 15.5 7.105469 15.542969 L 6.988281 16.601562 C 6.980469 16.769531 7 16.953125 7.042969 17.128906 C 7.265625 17.773438 7.941406 18.320312 9.425781 17.777344 C 10.832031 17.167969 12.488281 16.410156 14.199219 15.558594 C 15.175781 14.996094 16.605469 13.703125 16.679688 12.066406 C 16.667969 10.859375 16.628906 9.589844 16.546875 8.351562 Z M 14.289062 9.246094 C 14.289062 9.386719 14.175781 9.5 14.035156 9.5 C 13.183594 9.5 12.496094 10.191406 12.496094 11.039062 L 12.496094 11.980469 C 12.496094 13.5625 11.214844 14.84375 9.636719 14.84375 C 9.496094 14.84375 9.386719 14.730469 9.386719 14.59375 L 9.386719 13.8125 C 9.386719 13.671875 9.5 13.558594 9.640625 13.558594 C 10.492188 13.558594 11.179688 12.871094 11.179688 12.019531 L 11.179688 11.078125 C 11.179688 9.5 12.460938 8.21875 14.042969 8.21875 C 14.179688 8.21875 14.289062 8.328125 14.289062 8.464844 Z M 14.289062 9.246094 Z"},{name:"tv2play",path:"M 2.26,9.74 C 2.26,8.33 2.48,7.12 3.04,5.81 3.42,4.92 3.95,4.09 4.58,3.36 7.90,-0.52 13.66,-1.11 17.76,1.86 19.66,3.24 21.11,5.51 21.53,7.82 21.78,9.18 21.70,10.58 21.70,11.95 21.70,11.95 16.75,11.95 16.75,11.95 16.75,11.09 16.80,9.74 16.69,8.93 16.53,7.78 15.86,6.48 14.98,5.73 14.49,5.33 13.99,5.01 13.39,4.80 12.95,4.65 12.37,4.55 11.90,4.56 9.18,4.59 7.20,7.15 7.20,9.74 7.20,9.74 2.26,9.74 2.26,9.74 Z M 2.26,24.00 C 2.26,24.00 2.26,19.73 2.26,19.73 2.26,19.63 2.25,19.49 2.28,19.39 2.33,19.26 2.48,19.12 2.57,19.01 2.57,19.01 3.28,18.19 3.28,18.19 3.28,18.19 6.42,14.59 6.42,14.59 6.42,14.59 8.14,12.62 8.14,12.62 8.29,12.45 8.64,12.00 8.83,11.93 8.92,11.90 9.07,11.90 9.17,11.90 9.17,11.90 15.17,11.90 15.17,11.90 15.17,11.90 14.27,12.96 14.27,12.96 14.27,12.96 12.30,15.22 12.30,15.22 12.30,15.22 10.00,17.86 10.00,17.86 10.00,17.86 8.64,19.39 8.64,19.39 8.64,19.39 21.70,19.39 21.70,19.39 21.70,19.39 21.70,24.00 21.70,24.00 21.70,24.00 2.26,24.00 2.26,24.00 Z"},{name:"viaplay",path:"M1.2766 6.6383C.4742 8.2432 0 10.0669 0 11.9999 0 13.9331.4742 15.7568 1.2766 17.3617L11.9999 11.9999ZM11.9999 0C9.0456 0 6.3465 1.0577 4.231 2.845L16.7781 9.5927V14.4073L4.231 21.155C6.31 22.9422 9.0456 24 11.9999 24 18.6383 24 24 18.6383 24 11.9999 24 5.3617 18.6383 0 11.9999 0Z"},{name:"videoland",path:"M12 23.7692 24 3 17.0433 3 12 12.6586 6.9567 3 0 3ZM12 23.7692 Z"},{name:"vudu",path:"M 6.0971 6.9926 L 5.0469 6.9926 C 4.8725 6.9963 4.7129 7.1039 4.6535 7.2709 C 4.6535 7.282 4.6535 7.2895 4.6535 7.3006 C 4.2602 8.4324 3.915 9.4047 3.518 10.5365 C 3.4141 10.8371 3.3102 11.134 3.1914 11.4346 C 3.184 11.4605 3.1654 11.4828 3.1395 11.4939 C 3.0949 11.4939 3.0949 11.4605 3.0838 11.4309 C 2.8389 10.7221 2.5939 10.017 2.3416 9.3119 L 1.6217 7.2561 C 1.6254 7.2486 1.6254 7.2412 1.6217 7.2338 C 1.5475 7.0854 1.399 6.9926 1.2357 6.9926 L 0.1707 6.9926 C 0.0854 6.9852 0.0111 7.0482 0 7.1336 C -0.0037 7.1633 0.0037 7.193 0.0148 7.2189 C 0.6271 8.9297 1.2357 10.6404 1.8443 12.3475 L 1.9705 12.7 C 2.1486 13.2195 2.6348 13.5646 3.1803 13.5609 L 3.3213 13.5609 C 3.5551 13.5498 3.7889 13.5201 4.0227 13.4682 L 4.4531 12.2287 L 6.2566 7.2301 C 6.2641 7.2078 6.2678 7.1893 6.2752 7.1707 C 6.2863 7.0854 6.227 7.0037 6.1416 6.9926 C 6.1268 6.9926 6.1156 6.9926 6.1008 6.9926 M 11.9418 7.4416 C 11.9418 7.2152 11.7674 7.0297 11.5447 7.0111 L 10.4574 7.0111 L 10.4574 7.6123 C 10.4574 8.7441 10.4574 9.7498 10.4574 10.8854 C 10.4611 11.0004 10.45 11.1154 10.424 11.2268 C 10.3424 11.635 10.0455 11.9578 9.6484 12.0729 C 9.0436 12.2695 8.3904 11.9393 8.1937 11.3307 C 8.1566 11.2119 8.1381 11.0895 8.1381 10.967 C 8.1381 10.184 8.1381 8.5104 8.1381 7.6049 L 8.1381 7 C 8.1381 7 7.0545 7 7.0471 7 C 6.8244 7.0148 6.65 7.2041 6.65 7.4268 L 6.65 7.6457 C 6.65 8.8221 6.65 9.8314 6.65 11.0301 C 6.6574 12.4773 7.8301 13.6426 9.2699 13.6314 C 9.4406 13.6314 9.6076 13.6129 9.7746 13.5795 C 10.4203 13.4719 11.0029 13.1193 11.4037 12.5998 C 11.7451 12.1693 11.9344 11.6387 11.9418 11.0857 C 11.9418 10.4586 11.9418 9.8314 11.9418 9.2006 Z M 11.9418 7.4416 M 23.75 7.4416 C 23.75 7.2189 23.5793 7.0297 23.3566 7.0111 L 22.2656 7.0111 L 22.2656 7.6123 C 22.2656 8.7441 22.2656 9.7498 22.2656 10.8854 C 22.2656 11.0004 22.2545 11.1154 22.2285 11.2268 C 22.1506 11.6312 21.85 11.9578 21.4529 12.0729 C 20.8518 12.2732 20.2023 11.943 20.002 11.3381 C 19.9611 11.2193 19.9426 11.0932 19.9426 10.967 C 19.9426 10.184 19.9426 8.5104 19.9426 7.6049 L 19.9426 7 C 19.9426 7 18.8627 7 18.8479 7 C 18.6289 7.0186 18.4582 7.2041 18.4545 7.4268 L 18.4545 7.6457 C 18.4545 8.8221 18.4545 9.8314 18.4545 11.0301 C 18.4656 12.4773 19.6383 13.6426 21.0744 13.6314 C 21.2451 13.6314 21.4158 13.6129 21.5828 13.5795 C 22.2285 13.4719 22.8074 13.1193 23.2082 12.5998 C 23.5533 12.1693 23.7426 11.6387 23.7463 11.0857 C 23.7463 10.4586 23.7463 9.8314 23.7463 9.2006 L 23.7463 7.4416 Z M 23.75 7.4416 M 16.1352 11.5385 C 15.8457 11.8873 15.4338 12.1062 14.9885 12.1471 C 14.8994 12.1508 14.8104 12.1508 14.7213 12.1471 L 13.9531 12.1471 C 13.8604 12.1471 13.8566 12.1471 13.8566 12.0506 L 13.8566 8.4584 C 13.8566 8.373 13.8566 8.373 13.942 8.373 C 14.2686 8.373 14.5691 8.373 14.8809 8.373 C 15.4375 8.3916 15.9496 8.6811 16.2539 9.1486 C 16.4506 9.4381 16.5656 9.7795 16.5805 10.132 C 16.6213 10.6404 16.4617 11.1451 16.1352 11.5385 M 16.5693 7.4898 C 16.1018 7.1893 15.56 7.0223 15.0033 7.0074 C 14.7436 7.0074 14.4875 7.0074 14.224 7.0074 L 12.8473 7.0074 C 12.6098 7.0074 12.4205 7.2004 12.4205 7.4379 L 12.4205 13.1156 C 12.4205 13.3531 12.6098 13.5461 12.8473 13.5461 L 14.9143 13.5461 C 15.0701 13.5461 15.226 13.5313 15.3818 13.5016 C 16.0053 13.4088 16.5842 13.1305 17.0443 12.7037 C 17.9016 11.9541 18.2912 10.8 18.0686 9.6793 C 17.9127 8.7701 17.3672 7.976 16.5805 7.5047 M 19.0334 14.4293 C 18.4656 14.4553 18.024 14.9451 18.0463 15.5166 C 18.0686 16.0881 18.5473 16.5297 19.115 16.5074 C 19.6717 16.4852 20.1096 16.025 20.1021 15.4646 C 20.1133 14.9117 19.6791 14.4479 19.1262 14.4293 L 19.0334 14.4293 M 19.616 15.5092 C 19.6049 15.6354 19.5492 15.7578 19.4639 15.8506 L 19.4342 15.8803 C 19.1967 16.1029 18.8256 16.0918 18.6029 15.8543 C 18.3803 15.6205 18.3914 15.2457 18.6289 15.023 C 18.8627 14.8004 19.2338 14.8115 19.4564 15.049 C 19.4564 15.049 19.4564 15.049 19.4602 15.049 C 19.5529 15.1492 19.6086 15.2791 19.616 15.4164 Z M 19.616 15.5092 M 16.818 15.3199 L 16.818 15.7727 L 17.2633 15.7727 L 17.2633 15.9285 C 17.1557 16.0102 17.0295 16.051 16.8959 16.051 C 16.6027 16.0621 16.3541 15.832 16.343 15.5352 C 16.3393 15.5129 16.3393 15.4906 16.343 15.4721 C 16.3207 15.1752 16.5396 14.9154 16.8365 14.8932 L 16.8959 14.8932 C 17.0703 14.8969 17.2299 14.9934 17.3152 15.1455 L 17.7457 14.9229 C 17.575 14.6111 17.2484 14.4256 16.8959 14.4367 C 16.3281 14.4219 15.8568 14.8746 15.842 15.4424 C 15.8271 15.9953 16.2428 16.4629 16.792 16.5037 L 16.8959 16.5037 C 17.1965 16.5037 17.4859 16.3887 17.7012 16.1734 C 17.7346 16.14 17.7568 16.0881 17.7605 16.0361 L 17.7605 15.3199 Z M 16.818 15.3199 M 15.3187 14.485 L 15.2779 14.485 C 15.1666 14.4924 15.0812 14.5852 15.0775 14.6965 L 15.0775 15.5797 L 14.276 14.485 L 13.7416 14.485 L 13.7416 16.4777 L 14.2537 16.4777 L 14.2537 15.3311 L 15.0924 16.4777 L 15.5822 16.4777 L 15.5822 14.485 Z M 15.3187 14.485 M 12.8139 14.485 L 12.1607 14.485 L 11.4111 16.4814 L 11.9937 16.4814 L 12.0939 16.192 L 12.8732 16.192 L 12.9252 16.3404 C 12.9586 16.4221 13.0328 16.474 13.1182 16.4777 L 13.5561 16.4777 Z M 12.2387 15.743 L 12.491 14.9896 L 12.7396 15.743 Z M 12.2387 15.743 M 10.3943 14.485 L 9.5557 14.485 L 9.5557 16.2699 C 9.5631 16.385 9.6559 16.4777 9.7709 16.4814 L 10.3943 16.4814 C 10.9398 16.5111 11.4111 16.0918 11.4408 15.5389 C 11.4742 14.9896 11.0549 14.5184 10.5057 14.485 C 10.4686 14.485 10.4314 14.485 10.3943 14.485 M 10.3943 16.0361 L 10.0678 16.0361 L 10.0678 14.9229 L 10.3943 14.9229 C 10.6764 14.908 10.9139 15.1232 10.9324 15.4053 L 10.9324 15.4646 C 10.9324 15.7615 10.6912 16.0361 10.398 16.0361 C 10.3943 16.0361 10.398 16.0324 10.398 16.0324 L 10.4018 16.0287 M 8.9063 14.485 C 8.7949 14.4887 8.7021 14.5777 8.6984 14.6891 L 8.6984 15.5797 L 7.8783 14.485 L 7.3439 14.485 L 7.3439 16.4777 L 7.8523 16.4777 L 7.8523 15.3311 L 8.6947 16.4852 L 9.1883 16.4852 L 9.1883 14.485 Z M 8.9063 14.485 M 6.4311 14.485 L 5.7779 14.485 L 5.032 16.4777 L 5.6258 16.4777 L 5.726 16.1883 L 6.5127 16.1883 L 6.5646 16.3404 C 6.598 16.4184 6.6723 16.4703 6.7576 16.4777 L 7.1918 16.4777 Z M 5.8559 15.743 L 6.1119 14.9896 L 6.3605 15.743 Z M 5.8559 15.743 M 5.2213 14.908 L 5.2213 14.459 L 3.6961 14.459 L 3.6961 16.448 L 4.2342 16.448 L 4.2342 15.7578 L 4.7686 15.7578 C 4.865 15.7467 4.9355 15.6687 4.943 15.5723 L 4.943 15.3051 L 4.2416 15.3051 L 4.2416 14.908 Z M 5.2213 14.908 M 0.3971 15.3941 L 3.2471 15.3941 L 3.2471 15.55 L 0.3971 15.55 Z M 0.3971 15.3941 M 20.5549 15.3941 L 23.4049 15.3941 L 23.4049 15.55 L 20.5549 15.55 Z M 20.5549 15.3941 Z"},{name:"waiputv",path:"M 10.087,7.672 10.009,7.801 V 7.863 A 3.161,3.161 0 0 0 9.786,9.016 v 4.67 a 3.064,3.064 0 0 0 0.375,1.46 c 0.034,0.061 0.07,0.119 0.107,0.177 a 2.8,2.8 0 0 0 1.33,1.093 l 0.175,0.069 a 2.766,2.766 0 0 0 2.323,-0.247 l 3.841,-2.3 a 2.952,2.952 0 0 0 0.347,-0.242 2.827,2.827 0 0 0 0.772,-0.977 l 0.065,-0.136 v -0.017 a 3.126,3.126 0 0 0 0.236,-1.177 V 6.716 A 3.074,3.074 0 0 0 18.983,5.257 2.833,2.833 0 0 0 17.545,3.976 L 17.372,3.908 a 2.917,2.917 0 0 0 -0.888,-0.149 0.485,0.485 0 0 0 -0.093,0.006 2.865,2.865 0 0 0 -1.344,0.39 l -0.948,0.567 v 0 l -2.891,1.73 a 2.842,2.842 0 0 0 -1.121,1.22 z m 5.3,-2.953 a 2.2,2.2 0 0 1 1.1,-0.3 2.235,2.235 0 0 1 0.683,0.116 0.04,0.04 0 0 0 0.027,0.014 2.193,2.193 0 0 1 1.21,1.026 2.407,2.407 0 0 1 0.293,1.141 v 4.671 a 2.435,2.435 0 0 1 -0.223,1.012 0.054,0.054 0 0 0 -0.014,0.043 2.2,2.2 0 0 1 -0.863,0.939 l -3.842,2.3 a 2.115,2.115 0 0 1 -1.782,0.187 0.042,0.042 0 0 0 -0.027,-0.014 2.182,2.182 0 0 1 -1.21,-1.026 2.4,2.4 0 0 1 -0.293,-1.143 V 9.016 A 2.442,2.442 0 0 1 10.667,8 c 0,-0.015 0.014,-0.015 0.014,-0.043 A 2.2,2.2 0 0 1 11.544,7.018 Z M 9.565,14.933 A 3.05,3.05 0 0 1 9.19,13.473 V 8.8 A 3.119,3.119 0 0 1 9.413,7.652 V 7.593 L 9.491,7.464 A 2.846,2.846 0 0 1 10.61,6.245 L 13.5,4.516 A 2.5,2.5 0 0 0 12.434,3.659 C 12.364,3.629 12.292,3.602 12.219,3.578 A 0.038,0.038 0 0 1 12.188,3.562 H 12.17 A 2.573,2.573 0 0 0 11.392,3.433 2.653,2.653 0 0 0 10.11,3.77 L 5.635,6.322 A 2.486,2.486 0 0 0 4.629,7.365 v 0.016 c 0,0.015 -0.015,0.015 -0.015,0.031 A 2.609,2.609 0 0 0 4.353,8.536 v 5.189 a 2.547,2.547 0 0 0 0.347,1.269 2.518,2.518 0 0 0 1.411,1.14 0.047,0.047 0 0 1 0.031,0.016 h 0.016 a 2.535,2.535 0 0 0 0.777,0.128 2.641,2.641 0 0 0 1.282,-0.336 L 9.677,15.11 A 1.924,1.924 0 0 1 9.565,14.933 Z m 7.5,2.467 -0.047,-0.018 A 0.8,0.8 0 0 0 16.776,17.341 H 16.75 a 0.773,0.773 0 0 0 -0.366,0.106 l -0.258,0.155 v 0 l -0.788,0.471 a 0.785,0.785 0 0 0 -0.3,0.333 l -0.021,0.035 v 0.017 a 0.863,0.863 0 0 0 -0.061,0.313 v 1.272 a 0.833,0.833 0 0 0 0.1,0.4 c 0.01,0.017 0.019,0.033 0.03,0.049 a 0.757,0.757 0 0 0 0.361,0.3 l 0.047,0.019 a 0.8,0.8 0 0 0 0.242,0.04 0.783,0.783 0 0 0 0.392,-0.108 l 1.047,-0.626 a 0.664,0.664 0 0 0 0.094,-0.066 0.781,0.781 0 0 0 0.211,-0.266 l 0.017,-0.038 v -0.006 a 0.855,0.855 0 0 0 0.065,-0.32 v -1.274 a 0.847,0.847 0 0 0 -0.1,-0.4 0.779,0.779 0 0 0 -0.396,-0.347 z m 0.314,2.02 a 0.668,0.668 0 0 1 -0.061,0.275 v 0.012 a 0.6,0.6 0 0 1 -0.235,0.256 l -1.047,0.626 A 0.573,0.573 0 0 1 15.55,20.64 h -0.007 a 0.6,0.6 0 0 1 -0.33,-0.28 0.652,0.652 0 0 1 -0.08,-0.312 V 18.772 A 0.656,0.656 0 0 1 15.2,18.5 v -0.012 a 0.6,0.6 0 0 1 0.235,-0.256 l 1.047,-0.626 a 0.607,0.607 0 0 1 0.3,-0.083 0.621,0.621 0 0 1 0.186,0.032 h 0.007 a 0.6,0.6 0 0 1 0.33,0.279 0.667,0.667 0 0 1 0.08,0.312 z m -2.591,0.569 v -1.273 a 0.841,0.841 0 0 1 0.06,-0.313 v -0.017 l 0.022,-0.035 a 0.77,0.77 0 0 1 0.3,-0.332 l 0.788,-0.472 A 0.694,0.694 0 0 0 15.667,17.313 L 15.609,17.291 H 15.6 a 0.73,0.73 0 0 0 -0.212,-0.035 0.722,0.722 0 0 0 -0.349,0.092 l -1.221,0.7 a 0.67,0.67 0 0 0 -0.274,0.284 v 0 l -0.005,0.009 a 0.722,0.722 0 0 0 -0.071,0.306 v 1.414 a 0.691,0.691 0 0 0 0.478,0.657 h 0.009 a 0.664,0.664 0 0 0 0.212,0.035 0.724,0.724 0 0 0 0.349,-0.091 l 0.4,-0.227 c -0.01,-0.016 -0.02,-0.032 -0.029,-0.048 a 0.837,0.837 0 0 1 -0.098,-0.398 z m 4.768,-0.361 H 19.52 a 0.253,0.253 0 0 1 -0.173,-0.045 0.182,0.182 0 0 1 -0.05,-0.147 V 18.4 h 0.243 a 0.22,0.22 0 0 0 0,-0.44 H 19.3 v -0.284 a 0.24,0.24 0 0 0 -0.48,0 v 0 0.287 h -0.242 a 0.22,0.22 0 0 0 0,0.44 h 0.242 v 1.035 a 0.616,0.616 0 0 0 0.176,0.494 0.76,0.76 0 0 0 0.5,0.149 h 0.063 a 0.226,0.226 0 0 0 0,-0.451 z M 21.979,18.3 A 0.24911945,0.24911945 0 0 0 21.518,18.111 L 21.036,19.37 20.555,18.114 V 18.107 A 0.25,0.25 0 0 0 20.094,18.3 l 0.675,1.591 a 0.3,0.3 0 0 0 0.159,0.16 0.294,0.294 0 0 0 0.382,-0.159 l 0.673,-1.6 z M 18.1,19.58 a 0.25,0.25 0 0 0 0,0.5 v 0 a 0.25,0.25 0 0 0 0,-0.5 z M 6.9,17.959 A 0.238,0.238 0 0 0 6.662,18.196 V 18.31 A 0.744,0.744 0 0 0 5.99,17.957 v 0 a 1.06,1.06 0 0 0 0,2.118 0.744,0.744 0 0 0 0.672,-0.349 v 0.113 A 0.237,0.237 0 0 0 6.88,20.075 H 6.92 A 0.237,0.237 0 0 0 7.137,19.839 V 18.185 A 0.238,0.238 0 0 0 6.9,17.959 Z m -0.311,1.357 a 0.565,0.565 0 0 1 -0.531,0.32 0.6,0.6 0 0 1 -0.607,-0.593 v -0.014 0 a 0.6,0.6 0 0 1 0.577,-0.621 h 0.023 a 0.588,0.588 0 0 1 0.556,0.353 0.628,0.628 0 0 1 0.054,0.28 0.7,0.7 0 0 1 -0.074,0.275 z m -2.016,-1.36 a 0.254,0.254 0 0 0 -0.244,0.185 v 0 L 4,19.316 3.653,18.2 v 0 A 0.25,0.25 0 0 0 3.436,18.025 H 3.4 a 0.251,0.251 0 0 0 -0.225,0.188 v 0 L 2.833,19.313 2.5,18.134 v 0 a 0.25110356,0.25110356 0 1 0 -0.484,0.134 l 0.011,0.035 v 0.009 l 0.5,1.569 v 0 a 0.289,0.289 0 0 0 0.248,0.194 H 2.818 A 0.29,0.29 0 0 0 3.08,19.868 v 0 l 0.33,-1.052 0.333,1.045 v 0 a 0.29,0.29 0 0 0 0.253,0.21 h 0.042 a 0.29,0.29 0 0 0 0.26,-0.194 v 0 l 0.518,-1.6 v 0 A 0.3,0.3 0 0 0 4.826,18.21 0.254,0.254 0 0 0 4.571,17.956 Z m -2.321,0 z m 5.606,0.007 H 7.813 A 0.238,0.238 0 0 0 7.59,18.2 v 1.656 0 a 0.237,0.237 0 0 0 0.473,0 v 0 -1.66 A 0.237,0.237 0 0 0 7.856,17.961 Z M 7.828,17.1 a 0.248,0.248 0 1 0 0.247,0.249 v 0 A 0.248,0.248 0 0 0 7.828,17.1 Z m 1.863,0.855 v 0 a 0.83,0.83 0 0 0 -0.7,0.353 v -0.129 a 0.22305605,0.22305605 0 0 0 -0.446,-0.01 v 0 2.395 a 0.237,0.237 0 0 0 0.218,0.228 H 8.8 a 0.237,0.237 0 0 0 0.216,-0.236 v -0.809 a 0.772,0.772 0 0 0 0.679,0.328 1.062,1.062 0 0 0 0,-2.12 z m 0.518,1.061 A 0.6,0.6 0 0 1 9.624,19.631 H 9.6 A 0.6,0.6 0 0 1 9,19.031 V 19.016 A 0.636,0.636 0 0 1 9.17,18.576 0.6,0.6 0 0 1 9.6,18.4 v 0 a 0.6,0.6 0 0 1 0.611,0.589 v 0.026 z m 2.489,-1 v 0 a 0.232,0.232 0 0 0 -0.136,-0.058 h -0.044 a 0.238,0.238 0 0 0 -0.217,0.235 v 0.923 c 0,0.284 -0.116,0.509 -0.458,0.509 -0.342,0 -0.436,-0.229 -0.436,-0.523 V 18.185 A 0.239,0.239 0 0 0 11.19,17.955 H 11.147 A 0.238,0.238 0 0 0 10.93,18.19 v 1.031 a 0.746,0.746 0 0 0 0.636,0.844 0.673,0.673 0 0 0 0.142,0.006 0.641,0.641 0 0 0 0.621,-0.327 v 0.107 a 0.224,0.224 0 1 0 0.448,0 V 18.2 A 0.236,0.236 0 0 0 12.7,18.026 Z"},{name:"wow",path:"M2.0563 15.263C2.7042 15.263 3.0046 14.8968 3.2582 14.3896L4.4037 12.0985 4.9859 14.1925C5.2112 15 5.5117 15.263 6.0845 15.263S7.0234 15.0752 7.3427 14.2957L8.2065 12.1738C8.2535 14.1549 9.6807 15.4413 11.6244 15.4413S14.892 14.1738 15.1643 12.5587L15.4647 14.2489C15.5962 14.9531 15.9248 15.263 16.4882 15.263S17.3802 15.0375 17.6619 14.5212L18.9765 12.0985 19.4929 14.2676C19.6525 14.9248 19.9436 15.263 20.5258 15.263S21.3896 15.0282 21.6431 14.5305L23.8591 10.2112A1.2019 1.2019 90 0023.9999 9.6385C23.9999 9.1315 23.6056 8.737 23.0234 8.737S22.1596 9.0188 21.9342 9.5165L20.8826 11.7699 20.3192 9.554C20.1971 9.0564 19.9154 8.737 19.3615 8.737 19.0046 8.737 18.6478 8.8404 18.3192 9.4601L17.1173 11.7794 16.7042 9.5727C16.6103 8.9907 16.1971 8.737 15.7089 8.737A.9671.9671 90 0014.7042 9.7324 1.784 1.784 90 0014.7323 10.061L14.7699 10.2489C14.2723 9.3099 13.2488 8.5587 11.8497 8.5587 10.892 8.5587 9.8028 8.9248 9.1267 9.8169A1.8122 1.8122 90 009.1361 9.5915C9.1267 9.1032 8.8075 8.737 8.2253 8.737S7.3802 8.9907 7.1737 9.5165L6.2535 11.9296 5.6431 9.5727C5.5117 9.0846 5.2582 8.737 4.7042 8.737S3.8779 8.9154 3.5962 9.5352L2.5446 11.9483 2.0187 9.5727C1.8873 8.9907 1.4741 8.737.9765 8.737S-.0282 9.1409-.0001 9.7324A.9014.9014 90 00.0375 9.986L.9671 14.1174C1.1079 14.7184 1.3333 15.263 2.0563 15.263ZM10.1784 12.061C10.1784 11.1596 10.8544 10.446 11.6995 10.446S13.2206 11.0846 13.2206 12.0141 12.5915 13.554 11.6995 13.554 10.1784 12.8968 10.1784 12.061Z"}],u=[{type:"button",name:"power",tap_action:{action:"key",key:"POWER"},icon:"mdi:power"},{type:"button",name:"sleep",tap_action:{action:"key",key:"SLEEP"},icon:"mdi:power-sleep"},{type:"button",name:"resume",tap_action:{action:"key",key:"RESUME"},icon:"mdi:power-on"},{type:"button",name:"wakeup",tap_action:{action:"key",key:"RESUME"},icon:"mdi:power-on"},{type:"button",name:"suspend",tap_action:{action:"key",key:"SUSPEND"},icon:"mdi:power-off"},{type:"button",name:"home",tap_action:{action:"key",key:"HOME"},icon:"mdi:home"},{type:"button",name:"move_home",tap_action:{action:"key",key:"MOVE_HOME"},icon:"mdi:home-import-outline"},{type:"button",name:"back",tap_action:{action:"key",key:"BACK"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"MENU"},icon:"mdi:menu"},{type:"button",name:"settings",tap_action:{action:"key",key:"SETTINGS"},icon:"mdi:cog"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VOLUME_UP"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VOLUME_DOWN"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"MUTE"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"UP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"DOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"LEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"RIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"CENTER"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"CENTER"},up:{tap_action:{action:"key",key:"UP"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"DOWN"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"LEFT"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"RIGHT"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"CENTER"},drag_action:{action:"key",key:'{{ ("RIGHT" if deltaX > 0 else "LEFT") if (deltaX | abs) > (deltaY | abs) else ("DOWN" if deltaY > 0 else "UP") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'{{ ("RIGHT" if deltaX > 0 else "LEFT") if (deltaX | abs) > (deltaY | abs) else ("DOWN" if deltaY > 0 else "UP") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"media_player.media_play_pause"},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"perform-action",perform_action:"media_player.media_play"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"perform-action",perform_action:"media_player.media_pause"},icon:"mdi:pause"},{type:"button",name:"fast_forward",tap_action:{action:"key",key:"FAST_FORWARD"},icon:"mdi:fast-forward"},{type:"button",name:"rewind",tap_action:{action:"key",key:"REWIND"},icon:"mdi:rewind"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:search-web"},{type:"button",name:"delete",tap_action:{action:"key",key:"input keyevent 67"},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"enter",tap_action:{action:"key",key:"ENTER"},icon:"mdi:magnify"},{type:"button",name:"red",tap_action:{action:"key",key:"RED"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"GREEN"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"YELLOW"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"BLUE"},icon:"mdi:alpha-b-box"},{type:"button",name:"component_1",tap_action:{action:"key",key:"COMPONENT1"},icon:"mdi:video-input-component"},{type:"button",name:"component_2",tap_action:{action:"key",key:"COMPONENT2"},icon:"mdi:video-input-component"},{type:"button",name:"composite_1",tap_action:{action:"key",key:"COMPOSITE1"},icon:"mdi:video-input-component"},{type:"button",name:"composite_2",tap_action:{action:"key",key:"COMPOSITE2"},icon:"mdi:video-input-component"},{type:"button",name:"hdmi_1",tap_action:{action:"key",key:"HDMI1"},icon:"mdi:video-input-hdmi"},{type:"button",name:"hdmi_2",tap_action:{action:"key",key:"HDMI2"},icon:"mdi:video-input-hdmi"},{type:"button",name:"hdmi_3",tap_action:{action:"key",key:"HDMI3"},icon:"mdi:video-input-hdmi"},{type:"button",name:"hdmi_4",tap_action:{action:"key",key:"HDMI4"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input",tap_action:{action:"key",key:"INPUT"},icon:"mdi:import"},{type:"button",name:"vga",tap_action:{action:"key",key:"VGA"},icon:"mdi:serial-port"},{type:"button",name:"end",tap_action:{action:"key",key:"END"},icon:"mdi:arrow-collapse-right"},{type:"button",name:"escape",tap_action:{action:"key",key:"ESCAPE"},icon:"mdi:exit-to-app"},{type:"button",name:"pairing",tap_action:{action:"key",key:"PAIRING"},icon:"mdi:bluetooth-audio"},{type:"button",name:"home",tap_action:{action:"key",key:"HOME"},icon:"mdi:home"},{type:"button",name:"sys_up",tap_action:{action:"key",key:"SYSUP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up-circle"},{type:"button",name:"sys_down",tap_action:{action:"key",key:"SYSDOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down-circle"},{type:"button",name:"sys_left",tap_action:{action:"key",key:"SYSLEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left-circle"},{type:"button",name:"sys_right",tap_action:{action:"key",key:"SYSRIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right-circle"},{type:"button",name:"text",tap_action:{action:"key",key:"TEXT"},icon:"mdi:text"},{type:"button",name:"top",tap_action:{action:"key",key:"TOP"},icon:"mdi:arrow-collapse-up"}],p=[{type:"button",name:"appletv",tap_action:{action:"source",source:"com.apple.atve.amazon.appletv"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"com.crunchyroll.crunchyroid"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"com.dazn"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"com.discovery.discoveryplus.firetv"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"com.disney.disneyplus"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"tv.emby.embyatv"},icon:"mdi:emby"},{type:"button",name:"f1tv",tap_action:{action:"source",source:"com.formulaone.production"},icon:"f1tv"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"com.foxsports.videogo"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"com.hulu.plus"},icon:"mdi:hulu"},{type:"button",name:"jellyfin",tap_action:{action:"source",source:"org.jellyfin.androidtv"},icon:"jellyfin"},{type:"button",name:"kodi",tap_action:{action:"source",source:"org.xbmc.kodi"},icon:"mdi:kodi"},{type:"button",name:"max",tap_action:{action:"source",source:"com.hbo.hbonow"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"com.bamnetworks.mobile.android.gameday.atbat"},icon:"mlbtv"},{type:"button",name:"netflix",tap_action:{action:"source",source:"com.netflix.ninja"},icon:"mdi:netflix"},{type:"button",name:"nrktv",tap_action:{action:"source",source:"no.nrk.tv"},icon:"nrktv"},{type:"button",name:"pandora",tap_action:{action:"source",source:"com.pandora.android.gtv"},icon:"mdi:pandora"},{type:"button",name:"paramount",tap_action:{action:"source",source:"com.cbs.ott"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"com.peacocktv.peacockfiretv"},icon:"peacock"},{type:"button",name:"pia",tap_action:{action:"source",source:"com.privateinternetaccess.android"},icon:"pia"},{type:"button",name:"plex",tap_action:{action:"source",source:"com.plexapp.android"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"com.amazon.firebat"},icon:"primevideo"},{type:"button",name:"skyshowtime",tap_action:{action:"source",source:"com.skyshowtime.skyshowtime.google"},icon:"showtime"},{type:"button",name:"spotify",tap_action:{action:"source",source:"com.spotify.tv.android"},icon:"mdi:spotify"},{type:"button",name:"steam",tap_action:{action:"source",source:"com.valvesoftware.steamlink"},icon:"mdi:steam"},{type:"button",name:"stremio",tap_action:{action:"source",source:"com.stremio.tv"},icon:"stremio"},{type:"button",name:"surfshark",tap_action:{action:"source",source:"com.surfshark.vpnclient.android"},icon:"surfshark"},{type:"button",name:"viaplay",tap_action:{action:"source",source:"com.viaplay.android"},icon:"viaplay"},{type:"button",name:"videoland",tap_action:{action:"source",source:"nl.rtl.videoland.v2.firetv"},icon:"videoland"},{type:"button",name:"vlc",tap_action:{action:"source",source:"org.videolan.vlc"},icon:"mdi:vlc"},{type:"button",name:"vudu",tap_action:{action:"source",source:"com.fandango.vudu.firetv"},icon:"vudu"},{type:"button",name:"waiputv",tap_action:{action:"source",source:"de.exaring.waipu.firetv.live"},icon:"waiputv"},{type:"button",name:"wow",tap_action:{action:"source",source:"de.sky.online"},icon:"wow"},{type:"button",name:"youtube",tap_action:{action:"source",source:"com.amazon.firetv.youtube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"com.amazon.firetv.tv"},icon:"mdi:youtube-tv"}],d=[{type:"button",name:"home",tap_action:{action:"key",key:"GoHome"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"Back"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"ToggleContextMenu"},icon:"mdi:menu"},{type:"button",name:"settings",tap_action:{action:"key",key:"GoToSettings"},icon:"mdi:cog"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VolumeUp"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VolumeDown"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"ToggleMute"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"MoveUp"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"MoveDown"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"MoveLeft"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"MoveRight"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"Select"},icon:"mdi:checkbox-blank-circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"Select"},up:{tap_action:{action:"key",key:"MoveUp"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"MoveDown"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"MoveLeft"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"MoveRight"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"Select"},drag_action:{action:"key",key:'{{ ("MoveRight" if deltaX > 0 else "MoveLeft") if (deltaX | abs) > (deltaY | abs) else ("MoveDown" if deltaY > 0 else "MoveUp") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'{{ ("MoveRight" if deltaX > 0 else "MoveLeft") if (deltaX | abs) > (deltaY | abs) else ("MoveDown" if deltaY > 0 else "MoveUp") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"media_player.media_play_pause"},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"perform-action",perform_action:"media_player.media_play"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"perform-action",perform_action:"media_player.media_pause"},icon:"mdi:pause"},{type:"button",name:"next",tap_action:{action:"key",key:"PlayNext"},icon:"mdi:skip-next"},{type:"button",name:"page_up",tap_action:{action:"key",key:"PageUp"},hold_action:{action:"repeat"},icon:"mdi:arrow-up"},{type:"button",name:"page_down",tap_action:{action:"key",key:"PageDown"},hold_action:{action:"repeat"},icon:"mdi:arrow-down"},{type:"button",name:"search",tap_action:{action:"key",key:"GoToSearch"},icon:"mdi:search-web"},{type:"button",name:"previous_letter",tap_action:{action:"key",key:"PreviousLetter"},icon:"mdi:page-previous"},{type:"button",name:"next_letter",tap_action:{action:"key",key:"NextLetter"},icon:"mdi:page-next"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"ChannelUp"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"ChannelDown"},icon:"mdi:arrow-down-circle"},{type:"button",name:"guide",tap_action:{action:"key",key:"Guide"},icon:"mdi:television-box"},{type:"button",name:"osd",tap_action:{action:"key",key:"ToggleOsd"},icon:"mdi:television-guide"},{type:"button",name:"osd_menu",tap_action:{action:"key",key:"ToggleOsdMenu"},icon:"mdi:television-guide"},{type:"button",name:"screenshot",tap_action:{action:"key",key:"TakeScreenshot"},icon:"mdi:monitor-screenshot"},{type:"button",name:"fullscreen",tap_action:{action:"key",key:"ToggleFullscreen"},icon:"mdi:fullscreen"},{type:"button",name:"display_content",tap_action:{action:"key",key:"DisplayContent"},icon:"mdi:content-duplicate"},{type:"button",name:"display_message",tap_action:{action:"key",key:"DisplayMessage"},icon:"mdi:message"},{type:"button",name:"stats",tap_action:{action:"key",key:"ToggleStats"},icon:"mdi:list-status"},{type:"button",name:"source",tap_action:{action:"key",key:"PlayMediaSource"},icon:"mdi:import"},{type:"button",name:"trailers",tap_action:{action:"key",key:"PlayTrailers"},icon:"mdi:truck-trailer"},{type:"button",name:"state",tap_action:{action:"key",key:"PlayState"},icon:"mdi:play-box-multiple"}],h=[],m=[{type:"button",name:"home",tap_action:{action:"key",key:"Input.Home"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"Input.Back"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"Input.ContextMenu"},icon:"mdi:menu"},{type:"button",name:"volume_up",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Application.SetVolume",volume:"increment"}},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Application.SetVolume",volume:"decrement"}},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Application.SetMute",mute:"toggle"}},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"Input.Up"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"Input.Down"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"Input.Left"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"Input.Right"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"Input.Select"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"Input.Select"},up:{tap_action:{action:"key",key:"Input.Up"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"Input.Down"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"Input.Left"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"Input.Right"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"Input.Select"},drag_action:{action:"key",key:'Input.{{ ("Right" if deltaX > 0 else "Left") if (deltaX | abs) > (deltaY | abs) else ("Down" if deltaY > 0 else "Up") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'Input.{{ ("Right" if deltaX > 0 else "Left") if (deltaX | abs) > (deltaY | abs) else ("Down" if deltaY > 0 else "Up") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:1}},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:1,play:!0}},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:1,play:!1}},icon:"mdi:pause"},{type:"button",name:"music_play_pause",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:0}},icon:"mdi:music"},{type:"button",name:"picture_play_pause",tap_action:{action:"perform-action",perform_action:"kodi.call_method",data:{method:"Player.PlayPause",playerid:2}},icon:"mdi:image"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:kodi"},{type:"button",name:"info",tap_action:{action:"key",key:"Input.Info"},icon:"mdi:information"},{type:"button",name:"codec",tap_action:{action:"key",key:"Input.ShowCodec"},icon:"mdi:information-box"},{type:"button",name:"osd",tap_action:{action:"key",key:"Input.ShowOSD"},icon:"mdi:television-guide"},{type:"button",name:"process_info",tap_action:{action:"key",key:"Input.ShowPlayerProcessInfo"},icon:"mdi:information-variant-circle"}],f=[],y=[{type:"button",name:"power",tap_action:{action:"key",key:"power"},icon:"mdi:power"},{type:"button",name:"home",tap_action:{action:"key",key:"home"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"back"},icon:"mdi:keyboard-backspace"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"volume_up"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"volume_down"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"volume_mute"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"up"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"down"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"left"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"right"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"select"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"select"},up:{tap_action:{action:"key",key:"up"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"down"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"left"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"right"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"select"},drag_action:{action:"key",key:'{{ ("right" if deltaX > 0 else "left") if (deltaX | abs) > (deltaY | abs) else ("down" if deltaY > 0 else "up") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'{{ ("right" if deltaX > 0 else "left") if (deltaX | abs) > (deltaY | abs) else ("down" if deltaY > 0 else "up") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"key",key:"play"},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"key",key:"play"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"play"},icon:"mdi:pause"},{type:"button",name:"forward",tap_action:{action:"key",key:"forward"},icon:"mdi:fast-forward"},{type:"button",name:"reverse",tap_action:{action:"key",key:"reverse"},icon:"mdi:rewind"},{type:"button",name:"replay",tap_action:{action:"key",key:"replay"},icon:"mdi:replay"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"search",tap_action:{action:"search"},icon:"mdi:search-web"},{type:"button",name:"delete",tap_action:{action:"key",key:"backspace"},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"enter",tap_action:{action:"key",key:"enter"},icon:"mdi:magnify"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"channel_up"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"channel_down"},icon:"mdi:arrow-down-circle"},{type:"button",name:"find_remote",tap_action:{action:"key",key:"find_remote"},icon:"mdi:remote-tv"},{type:"button",name:"info",tap_action:{action:"key",key:"info"},icon:"mdi:asterisk"},{type:"button",name:"input_av1",tap_action:{action:"key",key:"input_av1"},icon:"mdi:import"},{type:"button",name:"input_hdmi1",tap_action:{action:"key",key:"input_hdmi1"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input_hdmi2",tap_action:{action:"key",key:"input_hdmi2"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input_hdmi3",tap_action:{action:"key",key:"input_hdmi3"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input_hdmi4",tap_action:{action:"key",key:"input_hdmi4"},icon:"mdi:video-input-hdmi"},{type:"button",name:"input_tuner",tap_action:{action:"key",key:"input_tuner"},icon:"mdi:video-input-antenna"},{type:"button",name:"literal",tap_action:{action:"key",key:"literal"},icon:"mdi:alphabetical"}],_=[{type:"button",name:"appletv",tap_action:{action:"source",source:"Apple TV"},icon:"appletv"},{type:"button",name:"crunchyroll",tap_action:{action:"source",source:"Crunchyroll"},icon:"crunchyroll"},{type:"button",name:"dazn",tap_action:{action:"source",source:"DAZN Live Sports Streaming"},icon:"dazn"},{type:"button",name:"discoveryplus",tap_action:{action:"source",source:"discovery+ | Stream TV Shows"},icon:"discovery"},{type:"button",name:"disney",tap_action:{action:"source",source:"Disney Plus"},icon:"disney"},{type:"button",name:"emby",tap_action:{action:"source",source:"Emby"},icon:"mdi:emby"},{type:"button",name:"f1tv",tap_action:{action:"source",source:"F1 TV"},icon:"f1tv"},{type:"button",name:"foxsports",tap_action:{action:"source",source:"FOX Sports"},icon:"foxsports"},{type:"button",name:"hulu",tap_action:{action:"source",source:"Hulu"},icon:"mdi:hulu"},{type:"button",name:"jellyfin",tap_action:{action:"source",source:"Jellyfin"},icon:"jellyfin"},{type:"button",name:"max",tap_action:{action:"source",source:"Max"},icon:"max"},{type:"button",name:"mlbtv",tap_action:{action:"source",source:"MLB"},icon:"mlbtv"},{type:"button",name:"nba",tap_action:{action:"source",source:"NBA"},icon:"nba"},{type:"button",name:"netflix",tap_action:{action:"source",source:"Netflix"},icon:"mdi:netflix"},{type:"button",name:"pandora",tap_action:{action:"source",source:"Pandora"},icon:"mdi:pandora"},{type:"button",name:"paramount",tap_action:{action:"source",source:"Paramount Plus"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"Peacock TV"},icon:"peacock"},{type:"button",name:"plex",tap_action:{action:"source",source:"Plex - Free Movies & TV"},icon:"mdi:plex"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"Prime Video"},icon:"primevideo"},{type:"button",name:"spotify",tap_action:{action:"source",source:"Spotify"},icon:"mdi:spotify"},{type:"button",name:"vudu",tap_action:{action:"source",source:"Fandango at Home"},icon:"vudu"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"YouTube TV"},icon:"mdi:youtube-tv"}],b=[{type:"button",name:"power",tap_action:{action:"key",key:"KEY_POWER"},icon:"mdi:power"},{type:"button",name:"power_on",tap_action:{action:"key",key:"KEY_POWERON"},icon:"mdi:power-on"},{type:"button",name:"power_off",tap_action:{action:"key",key:"KEY_POWEROFF"},icon:"mdi:power-off"},{type:"button",name:"home",tap_action:{action:"key",key:"KEY_HOME"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"KEY_RETURN"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"KEY_MENU"},icon:"mdi:menu"},{type:"button",name:"top_menu",tap_action:{action:"key",key:"KEY_TOPMENU"},icon:"mdi:backburger"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"KEY_VOLUP"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"KEY_VOLDOWN"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"KEY_MUTE"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"KEY_UP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"KEY_DOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"KEY_LEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"KEY_RIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"KEY_ENTER"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"KEY_ENTER"},up:{tap_action:{action:"key",key:"KEY_UP"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"KEY_DOWN"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"KEY_LEFT"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"KEY_RIGHT"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"KEY_ENTER"},drag_action:{action:"key",key:'KEY_{{ ("RIGHT" if deltaX > 0 else "LEFT") if (deltaX | abs) > (deltaY | abs) else ("DOWN" if deltaY > 0 else "UP") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'KEY_{{ ("RIGHT" if deltaX > 0 else "LEFT") if (deltaX | abs) > (deltaY | abs) else ("DOWN" if deltaY > 0 else "UP") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"media_player.media_play_pause"},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"key",key:"KEY_PLAY"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"KEY_PAUSE"},icon:"mdi:pause"},{type:"button",name:"rewind",tap_action:{action:"key",key:"KEY_REWIND"},icon:"mdi:rewind"},{type:"button",name:"fast_forward",tap_action:{action:"key",key:"KEY_FF"},icon:"mdi:fast-forward"},{type:"button",name:"stop",tap_action:{action:"key",key:"KEY_STOP"},icon:"mdi:stop"},{type:"button",name:"record",tap_action:{action:"key",key:"KEY_REC"},icon:"mdi:record"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"KEY_CHUP"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"KEY_CHDOWN"},icon:"mdi:arrow-down-circle"},{type:"button",name:"channel_previous",tap_action:{action:"key",key:"KEY_PRECH"},icon:"mdi:arrow-left-circle"},{type:"button",name:"channel_favorites",tap_action:{action:"key",key:"KEY_FAVCH"},icon:"mdi:star-circle"},{type:"button",name:"channel_list",tap_action:{action:"key",key:"KEY_CH_LIST"},icon:"mdi:list-box"},{type:"button",name:"red",tap_action:{action:"key",key:"KEY_RED"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"KEY_GREEN"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"KEY_YELLOW"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"KEY_CYAN"},icon:"mdi:alpha-b-box"},{type:"button",name:"n0",tap_action:{action:"key",key:"KEY_0"},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"key",key:"KEY_1"},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"key",key:"KEY_2"},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"key",key:"KEY_3"},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"key",key:"KEY_4"},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"key",key:"KEY_5"},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"key",key:"KEY_6"},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"key",key:"KEY_7"},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"key",key:"KEY_8"},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"key",key:"KEY_9"},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"info",tap_action:{action:"key",key:"KEY_INFO"},icon:"mdi:information"},{type:"button",name:"guide",tap_action:{action:"key",key:"KEY_GUIDE"},icon:"mdi:television-box"},{type:"button",name:"captions",tap_action:{action:"key",key:"KEY_CAPTION"},icon:"mdi:closed-caption"},{type:"button",name:"tools",tap_action:{action:"key",key:"KEY_TOOLS"},icon:"mdi:hammer-screwdriver"},{type:"button",name:"contents",tap_action:{action:"key",key:"KEY_CONTENTS"},icon:"mdi:table-of-contents"},{type:"button",name:"disc_menu",tap_action:{action:"key",key:"KEY_DISC_MENU"},icon:"mdi:dots-horizontal-circle"},{type:"button",name:"dvr_menu",tap_action:{action:"key",key:"KEY_DVR_MENU"},icon:"mdi:dots-vertical-circle"},{type:"button",name:"help",tap_action:{action:"key",key:"KEY_HELP"},icon:"mdi:help"},{type:"button",name:"live",tap_action:{action:"key",key:"KEY_LIVE"},icon:"mdi:debug-step-over"},{type:"button",name:"quick_replay",tap_action:{action:"key",key:"KEY_QUICK_REPLAY"},icon:"mdi:replay"},{type:"button",name:"still_picture",tap_action:{action:"key",key:"KEY_STILL_PICTURE"},icon:"mdi:image"},{type:"button",name:"instant_replay",tap_action:{action:"key",key:"KEY_INSTANT_REPLAY"},icon:"mdi:replay"},{type:"button",name:"source",tap_action:{action:"key",key:"KEY_SOURCE"},icon:"mdi:import"},{type:"button",name:"auto_program",tap_action:{action:"key",key:"KEY_AUTO_PROGRAM"},icon:"mdi:refresh-auto"},{type:"button",name:"channel_magic",tap_action:{action:"key",key:"KEY_MAGIC_CHANNEL"},icon:"mdi:auto-fix"},{type:"button",name:"component_1",tap_action:{action:"key",key:"KEY_COMPONENT1"},icon:"mdi:video-input-component"},{type:"button",name:"component_2",tap_action:{action:"key",key:"KEY_COMPONENT2"},icon:"mdi:video-input-component"},{type:"button",name:"av_1",tap_action:{action:"key",key:"KEY_AV1"},icon:"mdi:video-input-component"},{type:"button",name:"av_2",tap_action:{action:"key",key:"KEY_AV2"},icon:"mdi:video-input-component"},{type:"button",name:"av_2",tap_action:{action:"key",key:"KEY_AV2"},icon:"mdi:video-input-component"},{type:"button",name:"svideo_1",tap_action:{action:"key",key:"KEY_SVIDEO1"},icon:"mdi:video-input-svideo"},{type:"button",name:"svideo_2",tap_action:{action:"key",key:"KEY_SVIDEO2"},icon:"mdi:video-input-svideo"},{type:"button",name:"svideo_3",tap_action:{action:"key",key:"KEY_SVIDEO3"},icon:"mdi:video-input-svideo"},{type:"button",name:"hdmi",tap_action:{action:"key",key:"KEY_HDMI"},icon:"mdi:video-input-hdmi"},{type:"button",name:"fm_radio",tap_action:{action:"key",key:"KEY_FM_RADIO"},icon:"mdi:radio-fm"},{type:"button",name:"dvi",tap_action:{action:"key",key:"KEY_DVI"},icon:"mdi:serial-port"},{type:"button",name:"dvr",tap_action:{action:"key",key:"KEY_DVR"},icon:"mdi:record-rec"},{type:"button",name:"tv",tap_action:{action:"key",key:"KEY_TV"},icon:"mdi:television"},{type:"button",name:"antenna",tap_action:{action:"key",key:"KEY_ANTENA"},icon:"mdi:video-input-antenna"},{type:"button",name:"dtv",tap_action:{action:"key",key:"KEY_DTV"},icon:"mdi:alpha-d-box"},{type:"button",name:"ambient",tap_action:{action:"key",key:"KEY_AMBIENT"},icon:"mdi:television-ambient-light"},{type:"button",name:"3d",tap_action:{action:"key",key:"KEY_PANNEL_CHDOWN"},icon:"mdi:video-3d"},{type:"button",name:"anynet",tap_action:{action:"key",key:"KEY_ANYNET"},icon:"mdi:hdmi-port"},{type:"button",name:"energy_saving",tap_action:{action:"key",key:"KEY_ESAVING"},icon:"mdi:leaf"},{type:"button",name:"sleep_timer",tap_action:{action:"key",key:"KEY_SLEEP"},icon:"mdi:power-sleep"},{type:"button",name:"dtv_signal",tap_action:{action:"key",key:"KEY_DTV_SIGNAL"},icon:"mdi:alpha-d-circle"},{type:"button",name:"pip_toggle",tap_action:{action:"key",key:"KEY_PIP_ONOFF"},icon:"mdi:picture-in-picture-top-right"},{type:"button",name:"pip_swap",tap_action:{action:"key",key:"KEY_PIP_SWAP"},icon:"mdi:picture-in-picture-bottom-right-outline"},{type:"button",name:"pip_size",tap_action:{action:"key",key:"KEY_PIP_SIZE"},icon:"mdi:picture-in-picture-top-right-outline"},{type:"button",name:"pip_channel_up",tap_action:{action:"key",key:"KEY_PIP_CHUP"},icon:"mdi:arrow-up-circle-outline"},{type:"button",name:"pip_channel_down",tap_action:{action:"key",key:"KEY_PIP_CHDOWN"},icon:"mdi:arrow-down-circle-outline"},{type:"button",name:"pip_small",tap_action:{action:"key",key:"KEY_AUTO_ARC_PIP_SMALL"},icon:"mdi:image"},{type:"button",name:"pip_wide",tap_action:{action:"key",key:"KEY_AUTO_ARC_PIP_WIDE"},icon:"mdi:panorama"},{type:"button",name:"pip_bottom_right",tap_action:{action:"key",key:"KEY_AUTO_ARC_PIP_RIGHT_BOTTOM"},icon:"mdi:picture-in-picture-bottom-right"},{type:"button",name:"pip_scan",tap_action:{action:"key",key:"KEY_PIP_SCAN"},icon:"mdi:picture-in-picture-bottom-right-outline"},{type:"button",name:"vcr",tap_action:{action:"key",key:"KEY_VCR_MODE"},icon:"mdi:vhs"},{type:"button",name:"catv",tap_action:{action:"key",key:"KEY_CATV_MODE"},icon:"mdi:video-input-antenna"},{type:"button",name:"dss",tap_action:{action:"key",key:"KEY_DSS_MODE"},icon:"mdi:alpha-d-box"},{type:"button",name:"tv",tap_action:{action:"key",key:"KEY_TV_MODE"},icon:"mdi:television"},{type:"button",name:"dvd",tap_action:{action:"key",key:"KEY_DVD_MODE"},icon:"mdi:disc"},{type:"button",name:"stb",tap_action:{action:"key",key:"KEY_STB_MODE"},icon:"mdi:audio-video"},{type:"button",name:"pc",tap_action:{action:"key",key:"KEY_PCMODE"},icon:"mdi:desktop-tower"},{type:"button",name:"teletext_mix",tap_action:{action:"key",key:"KEY_TTX_MIX"},icon:"mdi:text"},{type:"button",name:"teletext_subface",tap_action:{action:"key",key:"KEY_"},icon:"mdi:text-box-outline"},{type:"button",name:"aspect_ratio",tap_action:{action:"key",key:"KEY_ASPECT"},icon:"mdi:aspect-ratio"},{type:"button",name:"picture_size",tap_action:{action:"key",key:"KEY_PICTURE_SIZE"},icon:"mdi:image-size-select-large"},{type:"button",name:"aspect_ratio_4_3",tap_action:{action:"key",key:"KEY_4_3"},icon:"mdi:image"},{type:"button",name:"aspect_ratio_16_9",tap_action:{action:"key",key:"KEY_16_9"},icon:"mdi:image-area"},{type:"button",name:"picture_mode",tap_action:{action:"key",key:"KEY_PMODE"},icon:"mdi:image-text"},{type:"button",name:"picture_mode_panorama",tap_action:{action:"key",key:"KEY_PANORAMA"},icon:"mdi:panorama-variant"},{type:"button",name:"picture_mode_dynamic",tap_action:{action:"key",key:"KEY_DYNAMIC"},icon:"mdi:image-auto-adjust"},{type:"button",name:"picture_mode_standard",tap_action:{action:"key",key:"KEY_STANDARD"},icon:"mdi:image"},{type:"button",name:"picture_mode_movie",tap_action:{action:"key",key:"KEY_MOVIE1"},icon:"mdi:movie"},{type:"button",name:"picture_mode_game",tap_action:{action:"key",key:"KEY_GAME"},icon:"mdi:controller"},{type:"button",name:"picture_mode_custom",tap_action:{action:"key",key:"KEY_CUSTOM"},icon:"mdi:image-plus"},{type:"button",name:"clock",tap_action:{action:"key",key:"KEY_CLOCK_DISPLAY"},icon:"mdi:clock"},{type:"button",name:"clock_timer_setup",tap_action:{action:"key",key:"KEY_SETUP_CLOCK_TIMER"},icon:"mdi:clock-alert"},{type:"button",name:"subtitle",tap_action:{action:"key",key:"KEY_SUB_TITLE"},icon:"mdi:subtitles"},{type:"button",name:"zoom_move",tap_action:{action:"key",key:"KEY_ZOOM_MOVE"},icon:"mdi:magnify-plus-cursor"},{type:"button",name:"zoom_in",tap_action:{action:"key",key:"KEY_ZOOM_IN"},icon:"mdi:magnify-plus"},{type:"button",name:"zoom_out",tap_action:{action:"key",key:"KEY_ZOOM_OUT"},icon:"mdi:magnify-minus"},{type:"button",name:"zoom_1",tap_action:{action:"key",key:"KEY_ZOOM1"},icon:"mdi:magnify-plus-outline"},{type:"button",name:"zoom_2",tap_action:{action:"key",key:"KEY_ZOOM2"},icon:"mdi:magnify-minus-outline"}],v=[{type:"button",name:"appletv",tap_action:{action:"source",source:"Apple TV"},icon:"appletv"},{type:"button",name:"dazn",tap_action:{action:"source",source:"DAZN"},icon:"dazn"},{type:"button",name:"disney",tap_action:{action:"source",source:"Disney+"},icon:"disney"},{type:"button",name:"hulu",tap_action:{action:"source",source:"Hulu"},icon:"mdi:hulu"},{type:"button",name:"netflix",tap_action:{action:"source",source:"Netflix"},icon:"mdi:netflix"},{type:"button",name:"max",tap_action:{action:"source",source:"Max"},icon:"max"},{type:"button",name:"paramount",tap_action:{action:"source",source:"Paramount+"},icon:"paramount"},{type:"button",name:"peacock",tap_action:{action:"source",source:"Peacock TV"},icon:"peacock"},{type:"button",name:"primevideo",tap_action:{action:"source",source:"Prime Video"},icon:"primevideo"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"},{type:"button",name:"youtubetv",tap_action:{action:"source",source:"YouTube TV"},icon:"mdi:youtube-tv"}],g=[{type:"button",name:"monitor_off",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Monitor",action:"turn_off"}},icon:"mdi:monitor-off"},{type:"button",name:"monitor_on",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Monitor",action:"turn_on"}},icon:"mdi:monitor"},{type:"button",name:"windows",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"lwin"}]}}},icon:"mdi:microsoft"},{type:"button",name:"window_switcher",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Stroke",extras:{Values:[{Value:"lwin"},{Value:"tab"}]}}},icon:"mdi:apps"},{type:"button",name:"back",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"back"}]}}},icon:"mdi:keyboard-backspace"},{type:"button",name:"close",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Stroke",extras:{Values:[{Value:"alt"},{Value:"f4"}]}}},icon:"mdi:window-close"},{type:"button",name:"volume_up",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Media",action:"volume_up"}},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Media",action:"volume_down"}},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Media",action:"volume_mute"}},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"touchpad",name:"mousepad",drag_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Relmtech.Basic Input",action:"delta",extras:{Values:[{Value:0},{Value:"{{ 3 * deltaX }}"},{Value:"{{ 3 * deltaY }}"}]}}},multi_drag_action:{action:"perform-action",perform_action:"unified_remote.call",repeat_delay:50,data:{remote_id:"Core.Input",action:'{{ "Horz" if (deltaX | abs) > (deltaY | abs) else "Vert" }}',extras:{Values:[{Value:"{{ -1 * (deltaX if (deltaX | abs) > (deltaY | abs) else deltaY) }}"}]}}},tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Relmtech.Basic Input",action:"tap"}},hold_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Relmtech.Basic Input",action:"hold"}},multi_tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Relmtech.Basic Input",action:"right"}},up:{},down:{},left:{},right:{},icon:"mdi:mouse"},{type:"button",name:"up",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"up"}]}}},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"down"}]}}},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"left"}]}}},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"right"}]}}},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"enter"}]}}},icon:"mdi:checkbox-blank-circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"enter"}]}}},up:{tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"up"}]}}},hold_action:{action:"repeat"}},down:{tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"down"}]}}},hold_action:{action:"repeat"}},left:{tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"left"}]}}},hold_action:{action:"repeat"}},right:{tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"right"}]}}},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"enter"}]}}},drag_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:'{{ ("right" if deltaX > 0 else "left") if (deltaX | abs) > (deltaY | abs) else ("down" if deltaY > 0 else "up") }}'}]}},repeat_delay:100},multi_drag_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:'{{ ("right" if deltaX > 0 else "left") if (deltaX | abs) > (deltaY | abs) else ("down" if deltaY > 0 else "up") }}'}]}},repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Media",action:"play_pause"}},icon:"mdi:play-pause"},{type:"button",name:"stop",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Media",action:"stop"}},icon:"mdi:stop"},{type:"button",name:"previous",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Media",action:"previous"}},icon:"mdi:skip-previous"},{type:"button",name:"next",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Unified.Media",action:"next"}},icon:"mdi:skip-next"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"delete",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"back"}]}}},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"forward_delete",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"delete"}]}}},hold_action:{action:"repeat"},icon:"mdi:backspace-reverse"},{type:"button",name:"enter",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"enter"}]}}},icon:"mdi:magnify"},{type:"button",name:"n0",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"0"}]}}},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"1"}]}}},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"2"}]}}},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"3"}]}}},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"4"}]}}},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"5"}]}}},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"6"}]}}},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"7"}]}}},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"8"}]}}},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"9"}]}}},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"f1",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f1"}]}}},icon:"mdi:keyboard-f1"},{type:"button",name:"f2",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f2"}]}}},icon:"mdi:keyboard-f2"},{type:"button",name:"f3",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f3"}]}}},icon:"mdi:keyboard-f3"},{type:"button",name:"f4",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f4"}]}}},icon:"mdi:keyboard-f4"},{type:"button",name:"f5",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f5"}]}}},icon:"mdi:keyboard-f5"},{type:"button",name:"f6",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f6"}]}}},icon:"mdi:keyboard-f6"},{type:"button",name:"f7",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f7"}]}}},icon:"mdi:keyboard-f7"},{type:"button",name:"f8",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f8"}]}}},icon:"mdi:keyboard-f8"},{type:"button",name:"f9",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f9"}]}}},icon:"mdi:keyboard-f9"},{type:"button",name:"f10",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f10"}]}}},icon:"mdi:keyboard-f10"},{type:"button",name:"f11",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f11"}]}}},icon:"mdi:keyboard-f11"},{type:"button",name:"f12",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"f12"}]}}},icon:"mdi:keyboard-f12"},{type:"button",name:"dock-top",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Stroke",extras:{Values:[{Value:"lwin"},{Value:"up"}]}}},icon:"mdi:dock-top"},{type:"button",name:"dock-bottom",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Stroke",extras:{Values:[{Value:"lwin"},{Value:"down"}]}}},icon:"mdi:dock-bottom"},{type:"button",name:"dock-left",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Stroke",extras:{Values:[{Value:"lwin"},{Value:"left"}]}}},icon:"mdi:dock-left"},{type:"button",name:"dock-right",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"Stroke",extras:{Values:[{Value:"lwin"},{Value:"right"}]}}},icon:"mdi:dock-right"},{type:"button",name:"zoom_in",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"ZoomIn"}},icon:"mdi:magnify-plus"},{type:"button",name:"zoom_out",tap_action:{action:"perform-action",perform_action:"unified_remote.call",data:{remote_id:"Core.Input",action:"ZoomOut"}},icon:"mdi:magnify-minus"}],k=[],w=[{type:"button",name:"home",tap_action:{action:"key",key:"HOME"},icon:"mdi:home"},{type:"button",name:"back",tap_action:{action:"key",key:"BACK"},icon:"mdi:keyboard-backspace"},{type:"button",name:"menu",tap_action:{action:"key",key:"MENU"},icon:"mdi:menu"},{type:"button",name:"dash",tap_action:{action:"key",key:"DASH"},icon:"mdi:view-dashboard-variant"},{type:"button",name:"exit",tap_action:{action:"key",key:"EXIT"},icon:"mdi:exit-to-app"},{type:"button",name:"volume_up",tap_action:{action:"key",key:"VOLUMEUP"},hold_action:{action:"repeat"},icon:"mdi:volume-high"},{type:"button",name:"volume_down",tap_action:{action:"key",key:"VOLUMEDOWN"},hold_action:{action:"repeat"},icon:"mdi:volume-medium"},{type:"button",name:"volume_mute",tap_action:{action:"key",key:"MUTE"},icon:"mdi:volume-low"},{type:"button",name:"volume_buttons",icon:"mdi:volume-plus"},{type:"slider",name:"slider",range:[0,1],step:.01,value_attribute:"volume_level",tap_action:{action:"perform-action",perform_action:"media_player.volume_set",data:{volume_level:"{{ value | float }}"}}},{type:"button",name:"up",tap_action:{action:"key",key:"UP"},hold_action:{action:"repeat"},icon:"mdi:chevron-up"},{type:"button",name:"down",tap_action:{action:"key",key:"DOWN"},hold_action:{action:"repeat"},icon:"mdi:chevron-down"},{type:"button",name:"left",tap_action:{action:"key",key:"LEFT"},hold_action:{action:"repeat"},icon:"mdi:chevron-left"},{type:"button",name:"right",tap_action:{action:"key",key:"RIGHT"},hold_action:{action:"repeat"},icon:"mdi:chevron-right"},{type:"button",name:"center",tap_action:{action:"key",key:"ENTER"},icon:"mdi:circle"},{type:"button",name:"navigation_buttons",icon:"mdi:gamepad"},{type:"button",name:"dpad",icon:"mdi:gamepad"},{type:"touchpad",name:"touchpad",tap_action:{action:"key",key:"ENTER"},up:{tap_action:{action:"key",key:"UP"},hold_action:{action:"repeat"}},down:{tap_action:{action:"key",key:"DOWN"},hold_action:{action:"repeat"}},left:{tap_action:{action:"key",key:"LEFT"},hold_action:{action:"repeat"}},right:{tap_action:{action:"key",key:"RIGHT"},hold_action:{action:"repeat"}}},{type:"touchpad",name:"dragpad",tap_action:{action:"key",key:"ENTER"},drag_action:{action:"key",key:'{{ ("RIGHT" if deltaX > 0 else "LEFT") if (deltaX | abs) > (deltaY | abs) else ("DOWN" if deltaY > 0 else "UP") }}',repeat_delay:100},multi_drag_action:{action:"key",key:'{{ ("RIGHT" if deltaX > 0 else "LEFT") if (deltaX | abs) > (deltaY | abs) else ("DOWN" if deltaY > 0 else "UP") }}',repeat_delay:50},up:{},down:{},left:{},right:{},icon:"mdi:drag-variant"},{type:"button",name:"play_pause",tap_action:{action:"perform-action",perform_action:"media_player.media_play_pause"},icon:"mdi:play-pause"},{type:"button",name:"play",tap_action:{action:"key",key:"PLAY"},icon:"mdi:play"},{type:"button",name:"pause",tap_action:{action:"key",key:"PAUSE"},icon:"mdi:pause"},{type:"button",name:"stop",tap_action:{action:"perform-action",perform_action:"webostv.command",data:{command:"media.controls/stop"}},icon:"mdi:stop"},{type:"button",name:"rewind",tap_action:{action:"perform-action",perform_action:"webostv.command",data:{command:"media.controls/rewind"}},icon:"mdi:rewind"},{type:"button",name:"fast_forward",tap_action:{action:"perform-action",perform_action:"webostv.command",data:{command:"media.controls/fastForward"}},icon:"mdi:fast-forward"},{type:"button",name:"keyboard",tap_action:{action:"keyboard"},icon:"mdi:keyboard"},{type:"button",name:"textbox",tap_action:{action:"textbox"},icon:"mdi:text-box"},{type:"button",name:"delete",tap_action:{action:"perform-action",perform_action:"webostv.command",data:{command:"com.webos.service.ime/deleteCharacters"}},hold_action:{action:"repeat"},icon:"mdi:backspace"},{type:"button",name:"enter",tap_action:{action:"perform-action",perform_action:"webostv.command",data:{command:"com.webos.service.ime/sendEnterKey"}},icon:"mdi:magnify"},{type:"button",name:"channel_up",tap_action:{action:"key",key:"CHANNELUP"},icon:"mdi:arrow-up-circle"},{type:"button",name:"channel_down",tap_action:{action:"key",key:"CHANNELDOWN"},icon:"mdi:arrow-down-circle"},{type:"button",name:"red",tap_action:{action:"key",key:"RED"},icon:"mdi:alpha-r-box"},{type:"button",name:"green",tap_action:{action:"key",key:"GREEN"},icon:"mdi:alpha-g-box"},{type:"button",name:"yellow",tap_action:{action:"key",key:"YELLOW"},icon:"mdi:alpha-y-box"},{type:"button",name:"blue",tap_action:{action:"key",key:"BLUE"},icon:"mdi:alpha-b-box"},{type:"button",name:"n0",tap_action:{action:"key",key:"0"},icon:"mdi:numeric-0"},{type:"button",name:"n1",tap_action:{action:"key",key:"1"},icon:"mdi:numeric-1"},{type:"button",name:"n2",tap_action:{action:"key",key:"2"},icon:"mdi:numeric-2"},{type:"button",name:"n3",tap_action:{action:"key",key:"3"},icon:"mdi:numeric-3"},{type:"button",name:"n4",tap_action:{action:"key",key:"4"},icon:"mdi:numeric-4"},{type:"button",name:"n5",tap_action:{action:"key",key:"5"},icon:"mdi:numeric-5"},{type:"button",name:"n6",tap_action:{action:"key",key:"6"},icon:"mdi:numeric-6"},{type:"button",name:"n7",tap_action:{action:"key",key:"7"},icon:"mdi:numeric-7"},{type:"button",name:"n8",tap_action:{action:"key",key:"8"},icon:"mdi:numeric-8"},{type:"button",name:"n9",tap_action:{action:"key",key:"9"},icon:"mdi:numeric-9"},{type:"button",name:"numpad",icon:"mdi:dialpad"},{type:"button",name:"asterisk",tap_action:{action:"key",key:"ASTERISK"},icon:"mdi:asterisk"},{type:"button",name:"info",tap_action:{action:"key",key:"INFO"},icon:"mdi:information"},{type:"button",name:"guide",tap_action:{action:"key",key:"GUIDE"},icon:"mdi:television-box"},{type:"button",name:"captions",tap_action:{action:"key",key:"CC"},icon:"mdi:closed-caption"}],E=[{type:"button",name:"disney",tap_action:{action:"source",source:"Disney+"},icon:"disney"},{type:"button",name:"netflix",tap_action:{action:"key",key:"NETFLIX"},icon:"mdi:netflix"},{type:"button",name:"primevideo",tap_action:{action:"key",key:"AMAZON"},icon:"primevideo"},{type:"button",name:"rakutentv",tap_action:{action:"source",source:"Rakuten TV"},icon:"rakutentv"},{type:"button",name:"waiputv",tap_action:{action:"source",source:"waipu.tv"},icon:"waiputv"},{type:"button",name:"wow",tap_action:{action:"source",source:"WOW"},icon:"wow"},{type:"button",name:"youtube",tap_action:{action:"source",source:"YouTube"},icon:"mdi:youtube"}]},626:(t,e,n)=>{"use strict";function i(t){let e=[];for(const n in t)if("object"==typeof t[n]){const o=i(t[n]);e=e.concat(o.map((t=>n+"."+t)))}else e.push(n);return e}function o(t,e){const n=e.split(".");if(null!=t)return 1==n.length?t[n[0]]:o(t[n[0]],n.splice(1).join("."))}function a(t,e,n){const i=e.split(".");return 1==i.length?t[i[0]]=n:(i[0]in t&&"object"==typeof t[i[0]]||(/^-?\d+$/.test(i[1])?t[i[0]]=new Array(parseInt(i[1])):t[i[0]]={}),a(t[i[0]],i.splice(1).join("."),n)),t}function r(t,...e){function n(t){return t&&"object"==typeof t&&!Array.isArray(t)}if(!e.length)return t;const i=e.shift();if(n(t)&&n(i))for(const e in i)n(i[e])?(t[e]||Object.assign(t,{[e]:{}}),r(t[e],i[e])):Object.assign(t,{[e]:i[e]});return r(t,...e)}n.d(e,{vz:()=>o,HD:()=>a,b$:()=>i,XO:()=>c,D9:()=>r});var s=n(63);function c(t){let e,n;switch(t){case"Unified Remote":e=s.i4,n=s.oA;break;case"LG webOS":e=s.CI,n=s.Mo;break;case"Samsung TV":e=s.ks,n=s.Qz;break;case"Jellyfin":e=s.nK,n=s.zT;break;case"Kodi":e=s.np,n=s.rl;break;case"Roku":e=s.j0,n=s.$S;break;case"Apple TV":e=s.qz,n=s._6;break;case"Fire TV":e=s.iu,n=s.ci;break;case"Sony BRAVIA":e=s.J7,n=s.hd;break;default:e=s.$i,n=s.tz}return[structuredClone(e),structuredClone(n)]}},1:(t,e,n)=>{"use strict";n.d(e,{mN:()=>x,AH:()=>c,W3:()=>w,Ec:()=>E});const i=globalThis,o=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),r=new WeakMap;class s{constructor(t,e,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(o&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&r.set(e,t))}return t}toString(){return this.cssText}}const c=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[i+1]),t[0]);return new s(n,t,a)},l=(t,e)=>{if(o)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),o=i.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=n.cssText,t.appendChild(e)}},u=o?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new s("string"==typeof t?t:t+"",void 0,a))(e)})(t):t,{is:p,defineProperty:d,getOwnPropertyDescriptor:h,getOwnPropertyNames:m,getOwnPropertySymbols:f,getPrototypeOf:y}=Object,_=globalThis,b=_.trustedTypes,v=b?b.emptyScript:"",g=_.reactiveElementPolyfillSupport,k=(t,e)=>t,w={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},E=(t,e)=>!p(t,e),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:E};Symbol.metadata??=Symbol("metadata"),_.litPropertyMetadata??=new WeakMap;class x extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=C){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(t,n,e);void 0!==i&&d(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){const{get:i,set:o}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return i?.call(this)},set(e){const a=i?.call(this);o.call(this,e),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??C}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;const t=y(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){const t=this.properties,e=[...m(t),...f(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$ES(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$E_??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$E_?.delete(t)}_$ES(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return l(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$E_?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$E_?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$EO(t,e){const n=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,n);if(void 0!==i&&!0===n.reflect){const o=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(e,n.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const n=this.constructor,i=n._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=n.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:w;this._$Em=i,this[i]=o.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){if(n??=this.constructor.getPropertyOptions(t),!(n.hasChanged??E)(this[t],e))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,e,n){this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Em!==t&&(this._$ET??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t)!0!==n.wrapped||this._$AL.has(e)||void 0===this[e]||this.C(e,this[e],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$E_?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$Ej()}catch(e){throw t=!1,this._$Ej(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$E_?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ej(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$ET&&=this._$ET.forEach((t=>this._$EO(t,this[t]))),this._$Ej()}updated(t){}firstUpdated(t){}}x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[k("elementProperties")]=new Map,x[k("finalized")]=new Map,g?.({ReactiveElement:x}),(_.reactiveElementVersions??=[]).push("2.0.3")},703:(t,e,n)=>{"use strict";n.d(e,{o:()=>In,X:()=>Dn});var i=n(894);function o(t,e){try{if(e){if(t.entities[e]){if(t.entities[e].area_id)return t.entities[e].area_id;e=t.entities[e].device_id??e}if(t.devices[e])return t.devices[e].area_id;for(const n in t.areas)if(t.areas[n].name==e)return n}return}catch{return}}function a(t,e){try{if(e){let n=e;if(t.entities[e]&&(n=t.entities[e].area_id??n,e=t.entities[e].device_id??e),t.devices[e]&&(n=t.devices[e].area_id??n),t.areas[n])return t.areas[n].name}return}catch{return}}function r(t,e){try{const n=[];if(e){const i=s(t,e);for(const e of i)for(const i in t.entities)t.entities[i].device_id==e&&n.push(i);n.sort()}return n}catch{return[]}}function s(t,e){try{const n=[];if(e){if(!(e in t.areas))for(const n in t.areas)if(t.areas[n].name==e){e=n;break}for(const i in t.devices)t.devices[i].area_id==e&&n.push(i);n.sort()}return n}catch{return[]}}function c(t,e){return!!Array.isArray(t)&&t?.includes(e)}function l(t,e,n,i){"object"!=typeof n||Array.isArray(n)||(i=n.with_unit??i,n=n.rounded??void 0);try{const o=t.states[e];let a=o?.state;if(i&&null==n&&(n=!0),n&&!isNaN(o?.state)){const n=t.entities[e]?.display_precision??0;a=Number(a).toPrecision(n)}return i&&o?.attributes?.unit_of_measurement&&(a=`${a} ${o?.attributes?.unit_of_measurement}`),a}catch{return}}function u(t,e,n){try{return t.states[e].attributes[n]}catch{return}}function p(t,e){try{const n=l(t,e);return!![!1,0,-0,""].includes(n)||Boolean(n)}catch{return!1}}function d(t){const e={};for(const n in t.states){const[i,o]=n.split(".");e[i]=e[i]??{},e[i][o]=t.states[n]}return e}function h(t,e){try{const n=[];if(e)for(const i in t.entities)t.entities[i].device_id==e&&n.push(i);return n}catch{return[]}}function m(t,e,n){try{return t.devices[e]?.[n]??u(t,e,n)}catch{return}}function f(t,e){try{if(e){if(t.entities[e])return t.entities[e].device_id;for(const n in t.devices){const i=t.devices[n];if(i.name==e||i.name_by_user==e)return n}}return}catch{return}}function y(t,e,n=!1){if(t[0]==e[0]&&t[1]==e[1])return 0;const i=1/298.257223563,o=6356752.314245,a=Math.atan((1-i)*Math.tan(t[0]*Math.PI/180)),r=Math.atan((1-i)*Math.tan(e[0]*Math.PI/180));let s=(e[1]-t[1])*Math.PI/180,c=s;const l=Math.sin(a),u=Math.cos(a),p=Math.sin(r),d=Math.cos(r);let h=0,m=0,f=0,y=0,_=0;for(let t=0;t<200;t++){const e=Math.sin(c),n=Math.cos(c);if(m=Math.sqrt((d*e)**2+(u*p-l*d*n)**2),0==m)return 0;y=l*p+u*d*n,_=Math.atan2(m,y);const o=u*d*e/m;h=1-o**2,f=0!=h?y-2*l*p/h:0;const a=i/16*h*(4+i*(4-3*h)),r=c;if(c=s+(1-a)*i*o*(_+a*m*(f+a*y*(2*f**2-1))),Math.abs(c-r)<1e-12)break;if(199==t)return null}const b=272331606109.84375*h/o**2,v=b/1024*(256+b*(b*(74-47*b)-128));let g=o*(1+b/16384*(4096+b*(b*(320-175*b)-768)))*(_-v*m*(f+v/4*(y*(2*f**2-1)-v/6*f*(4*m**2-3)*(4*f**2-3))))/1e3;return n&&(g*=.621371),g}function _(t,...e){function n(e){if(e.startsWith("zone."))return t.states[e].attributes.persons??[];let n=Object.keys(t.states).filter((t=>t==e||t.split(".")[0]==e));if("zone"==e){let e=[];for(const i of n)e.push(...t.states[i].attributes.persons??[]);n=Array.from(new Set(e))}return n}let i,o;if(1==e.length)i=[t.states["zone.home"].attributes.latitude,t.states["zone.home"].attributes.longitude],o=0;else if("number"==typeof e[0]){if("number"!=typeof e[1]||2==e.length)return null;i=[e[0],e[1]],o=2}else if("object"==typeof e[0]){if(Array.isArray(e[0])||!e[0].attributes)return null;i=[e[0].attributes.latitude,e[0].attributes.longitude],o=1}else{if("string"!=typeof e[0])return null;i=[t.states[e[0]].attributes.latitude,t.states[e[0]].attributes.longitude],o=1}let a=[];for(let t=o;te[t][n].entity_id));else for(const o of n)i.push(...Object.keys(e[t][o]).map((n=>e[t][o][n].entity_id)))}for(const t of i)a.push(...n(t))}else"string"==typeof e[t]&&a.push(...n(e[t]));a=Array.from(new Set(a));let r=null,s=1/0;for(const e of a){let n;n="string"==typeof e?t.states[e]:e;const o=n.attributes.latitude,a=n.attributes.longitude;if(null!=o&&null!=a){const t=y(i,[o,a])??1/0;t<=s&&(r=n,s=t)}}return r}function b(t,e){try{let n=e;if(t.entities[e]&&(n=t.entities[e].area_id??n,e=t.entities[e].device_id??e),e){if(t.devices[e]&&(n=t.devices[e].area_id??n),t.areas[n])return t.areas[n].floor_id;for(const n in t.areas)if(t.areas[n].name==e)return t.areas[n].floor_id}return}catch{return}}function v(t,e){if(t.floors[e])return t.floors[e].name;const n=b(t,e);return n?t.floors[n].name:void 0}function g(t,e){try{const n=[];if(e){let i;if(t.floors[e])i=e;else for(const n in t.floors)if(t.floors[n].name==e){i=n;break}if(!i)return[];for(const e in t.areas)t.areas[e].floor_id==i&&n.push(e)}return n}catch{return[]}}function k(t,...e){const n=[];for(let i of e.flat(1/0))if("string"==typeof i&&(i=t.states[i]),i)if(Array.isArray(i.attributes?.entity_id))n.push(...k(t,...i.attributes?.entity_id));else if(i?.attributes?.persons)n.push(...k(t,...i.attributes.persons));else if(i.entity_id)n.push(i);else{const e=Object.values(i);if(e[0]?.entity_id)n.push(...e);else for(const i of e){const e=Object.values(i);for(const i of e)i?.attributes?.persons?n.push(...k(t,...i.attributes.persons)):n.push(i)}}return n.filter(((t,e,n)=>e==n.findIndex((e=>e.entity_id==t.entity_id)))).sort(((t,e)=>t.entity_id.localeCompare(e.entity_id)))}function w(t,e,n,i,o){if("object"!=typeof n||Array.isArray(n)||(o=n.if_none??o,i=n.if_false??i,n=n.if_true??void 0),o){const n=Dn(t,e);if([void 0,null,"undefined","null","None"].includes(n))return o}return Dn(t,`\n\t\t{% if ${e} %}\n\t\t${n??!0}\n\t\t{% else %}\n\t\t${i??!1}\n\t\t{% endif %}\n\t`)}const E={};function C(t,e){try{return e?t.entities[e]?.labels??t.devices[e]?.labels??t.areas[e]?.labels??[]:Object.keys(E)}catch{return[]}}function x(t){for(const e in E)if(E[e].name==t)return e}function T(t){return E[t]?.name}function L(t,e){try{const n=[];let i;if(e){if(i=E[e]?e:x(e),!i)return[];for(const e in t.areas)(t.areas[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function A(t,e){try{const n=[];if(e){let i;if(i=E[e]?e:x(e),!i)return[];for(const e in t.devices)(t.devices[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function S(t,e){try{const n=[];if(e){let i;if(i=E[e]?e:x(e),!i)return[];for(const e in t.entities)(t.entities[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function O(t){return t.toString()}function M(t){if(t.toString().includes("NaN"))throw Error("Result returned NaN.")}function I(t){return t!=1/0&&!isNaN(t)}function $(t,e){if("number"==typeof t)return 0!=t;if("boolean"==typeof t)return t;if(t=t.toLowerCase(),["true","yes","on","enable","1"].includes(t))return!0;if(["false","no","off","disable","0"].includes(t))return!1;if(e)return e;throw Error("Invalid input")}function D(t,e=Math.E,n){try{const n=Math.log(t)/Math.log(e);return M(n.toString()),n}catch(t){if(n)return n;throw t}}function P(t,e){try{const e=Math.sin(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function N(t,e){try{const e=Math.cos(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function R(t,e){try{const e=Math.tan(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function V(t,e){try{const e=Math.asin(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function F(t,e){try{const e=Math.acos(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function U(t,e){try{const e=Math.atan(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function j(t,e,n){try{const n=Math.atan2(t,e);return M(n.toString()),n}catch(t){if(n)return n;throw t}}function K(t,e){try{const e=Math.sqrt(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function B(...t){return Math.max(...t.flat(1/0))}function H(...t){return Math.min(...t.flat(1/0))}function Y(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");return t.reduce(((t,e)=>t+e))/t.length}catch(t){if(e)return e;throw t}}function Z(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");if(!t.length)throw Error("Empty array provided");t=t.sort(((t,e)=>t-e));const e=Math.floor(t.length/2);return t.length%2?t[e]:(t[e-1]+t[e])/2}catch(t){if(e)return e;throw t}}function z(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");if(!t.length)throw Error("Empty array provided");const e={};for(const n of t)e[n]||(e[n]=0),e[n]++;let n=t[0],i=0;for(const t in e)e[t]>i&&(n=Number(t),i=e[t]);return n}catch(t){if(e)return e;throw t}}const q=Math.E,W=Math.PI,X=2*Math.PI;function G(t,e,n){try{return t.formatEntityState(t.states[e],n)}catch{return n??t.states[e]?.state??void 0}}function J(t,e,n){try{return t.formatEntityAttributeName(t.states[e],n)}catch{return n??t.states[e]?.attributes?.[n]??void 0}}function Q(t,e,n,i){try{return t.formatEntityAttributeValue(t.states[e],n,i)}catch{return i??t.states[e]?.attributes?.[n]??void 0}}const tt=new Date,et=new Date;function nt(t,e,n,i){function o(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return o.floor=e=>(t(e=new Date(+e)),e),o.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),o.round=t=>{const e=o(t),n=o.ceil(t);return t-e(e(t=new Date(+t),null==n?1:Math.floor(n)),t),o.range=(n,i,a)=>{const r=[];if(n=o.ceil(n),a=null==a?1:Math.floor(a),!(n0))return r;let s;do{r.push(s=new Date(+n)),e(n,a),t(n)}while(snt((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,i)=>{if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););})),n&&(o.count=(e,i)=>(tt.setTime(+e),et.setTime(+i),t(tt),t(et),Math.floor(n(tt,et))),o.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?o.filter(i?e=>i(e)%t==0:e=>o.count(0,e)%t==0):o:null)),o}const it=864e5,ot=6048e5;function at(t){return nt((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ot))}const rt=at(0),st=at(1),ct=at(2),lt=at(3),ut=at(4),pt=at(5),dt=at(6);function ht(t){return nt((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/ot))}rt.range,st.range,ct.range,lt.range,ut.range,pt.range,dt.range;const mt=ht(0),ft=ht(1),yt=ht(2),_t=ht(3),bt=ht(4),vt=ht(5),gt=ht(6),kt=(mt.range,ft.range,yt.range,_t.range,bt.range,vt.range,gt.range,nt((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/it),(t=>t.getDate()-1))),wt=(kt.range,nt((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/it),(t=>t.getUTCDate()-1))),Et=(wt.range,nt((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/it),(t=>Math.floor(t/it)))),Ct=(Et.range,nt((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear())));Ct.every=t=>isFinite(t=Math.floor(t))&&t>0?nt((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,Ct.range;const xt=nt((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Tt(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Lt(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function At(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}xt.every=t=>isFinite(t=Math.floor(t))&&t>0?nt((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,xt.range;var St,Ot,Mt,It,$t,Dt={"-":"",_:" ",0:"0"},Pt=/^\s*\d+/,Nt=/^%/,Rt=/[\\^$*+?|[\]().{}]/g;function Vt(t,e,n){var i=t<0?"-":"",o=(i?-t:t)+"",a=o.length;return i+(a[t.toLowerCase(),e])))}function Kt(t,e,n){var i=Pt.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function Bt(t,e,n){var i=Pt.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function Ht(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function Yt(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function Zt(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function zt(t,e,n){var i=Pt.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function qt(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Wt(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function Xt(t,e,n){var i=Pt.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function Gt(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Jt(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function Qt(t,e,n){var i=Pt.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function te(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function ee(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function ne(t,e,n){var i=Pt.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function ie(t,e,n){var i=Pt.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function oe(t,e,n){var i=Pt.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function ae(t,e,n){var i=Nt.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function re(t,e,n){var i=Pt.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function se(t,e,n){var i=Pt.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function ce(t,e){return Vt(t.getDate(),e,2)}function le(t,e){return Vt(t.getHours(),e,2)}function ue(t,e){return Vt(t.getHours()%12||12,e,2)}function pe(t,e){return Vt(1+kt.count(Ct(t),t),e,3)}function de(t,e){return Vt(t.getMilliseconds(),e,3)}function he(t,e){return de(t,e)+"000"}function me(t,e){return Vt(t.getMonth()+1,e,2)}function fe(t,e){return Vt(t.getMinutes(),e,2)}function ye(t,e){return Vt(t.getSeconds(),e,2)}function _e(t){var e=t.getDay();return 0===e?7:e}function be(t,e){return Vt(rt.count(Ct(t)-1,t),e,2)}function ve(t){var e=t.getDay();return e>=4||0===e?ut(t):ut.ceil(t)}function ge(t,e){return t=ve(t),Vt(ut.count(Ct(t),t)+(4===Ct(t).getDay()),e,2)}function ke(t){return t.getDay()}function we(t,e){return Vt(st.count(Ct(t)-1,t),e,2)}function Ee(t,e){return Vt(t.getFullYear()%100,e,2)}function Ce(t,e){return Vt((t=ve(t)).getFullYear()%100,e,2)}function xe(t,e){return Vt(t.getFullYear()%1e4,e,4)}function Te(t,e){var n=t.getDay();return Vt((t=n>=4||0===n?ut(t):ut.ceil(t)).getFullYear()%1e4,e,4)}function Le(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Vt(e/60|0,"0",2)+Vt(e%60,"0",2)}function Ae(t,e){return Vt(t.getUTCDate(),e,2)}function Se(t,e){return Vt(t.getUTCHours(),e,2)}function Oe(t,e){return Vt(t.getUTCHours()%12||12,e,2)}function Me(t,e){return Vt(1+wt.count(xt(t),t),e,3)}function Ie(t,e){return Vt(t.getUTCMilliseconds(),e,3)}function $e(t,e){return Ie(t,e)+"000"}function De(t,e){return Vt(t.getUTCMonth()+1,e,2)}function Pe(t,e){return Vt(t.getUTCMinutes(),e,2)}function Ne(t,e){return Vt(t.getUTCSeconds(),e,2)}function Re(t){var e=t.getUTCDay();return 0===e?7:e}function Ve(t,e){return Vt(mt.count(xt(t)-1,t),e,2)}function Fe(t){var e=t.getUTCDay();return e>=4||0===e?bt(t):bt.ceil(t)}function Ue(t,e){return t=Fe(t),Vt(bt.count(xt(t),t)+(4===xt(t).getUTCDay()),e,2)}function je(t){return t.getUTCDay()}function Ke(t,e){return Vt(ft.count(xt(t)-1,t),e,2)}function Be(t,e){return Vt(t.getUTCFullYear()%100,e,2)}function He(t,e){return Vt((t=Fe(t)).getUTCFullYear()%100,e,2)}function Ye(t,e){return Vt(t.getUTCFullYear()%1e4,e,4)}function Ze(t,e){var n=t.getUTCDay();return Vt((t=n>=4||0===n?bt(t):bt.ceil(t)).getUTCFullYear()%1e4,e,4)}function ze(){return"+0000"}function qe(){return"%"}function We(t){return+t}function Xe(t){return Math.floor(+t/1e3)}St=function(t){var e=t.dateTime,n=t.date,i=t.time,o=t.periods,a=t.days,r=t.shortDays,s=t.months,c=t.shortMonths,l=Ut(o),u=jt(o),p=Ut(a),d=jt(a),h=Ut(r),m=jt(r),f=Ut(s),y=jt(s),_=Ut(c),b=jt(c),v={a:function(t){return r[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:ce,e:ce,f:he,g:Ce,G:Te,H:le,I:ue,j:pe,L:de,m:me,M:fe,p:function(t){return o[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:We,s:Xe,S:ye,u:_e,U:be,V:ge,w:ke,W:we,x:null,X:null,y:Ee,Y:xe,Z:Le,"%":qe},g={a:function(t){return r[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Ae,e:Ae,f:$e,g:He,G:Ze,H:Se,I:Oe,j:Me,L:Ie,m:De,M:Pe,p:function(t){return o[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:We,s:Xe,S:Ne,u:Re,U:Ve,V:Ue,w:je,W:Ke,x:null,X:null,y:Be,Y:Ye,Z:ze,"%":qe},k={a:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.w=m.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=p.exec(e.slice(n));return i?(t.w=d.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=_.exec(e.slice(n));return i?(t.m=b.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=f.exec(e.slice(n));return i?(t.m=y.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return C(t,e,n,i)},d:Jt,e:Jt,f:oe,g:qt,G:zt,H:te,I:te,j:Qt,L:ie,m:Gt,M:ee,p:function(t,e,n){var i=l.exec(e.slice(n));return i?(t.p=u.get(i[0].toLowerCase()),n+i[0].length):-1},q:Xt,Q:re,s:se,S:ne,u:Bt,U:Ht,V:Yt,w:Kt,W:Zt,x:function(t,e,i){return C(t,n,e,i)},X:function(t,e,n){return C(t,i,e,n)},y:qt,Y:zt,Z:Wt,"%":ae};function w(t,e){return function(n){var i,o,a,r=[],s=-1,c=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s53)return null;"w"in a||(a.w=1),"Z"in a?(o=(i=Lt(At(a.y,0,1))).getUTCDay(),i=o>4||0===o?ft.ceil(i):ft(i),i=wt.offset(i,7*(a.V-1)),a.y=i.getUTCFullYear(),a.m=i.getUTCMonth(),a.d=i.getUTCDate()+(a.w+6)%7):(o=(i=Tt(At(a.y,0,1))).getDay(),i=o>4||0===o?st.ceil(i):st(i),i=kt.offset(i,7*(a.V-1)),a.y=i.getFullYear(),a.m=i.getMonth(),a.d=i.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),o="Z"in a?Lt(At(a.y,0,1)).getUTCDay():Tt(At(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(o+5)%7:a.w+7*a.U-(o+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,Lt(a)):Tt(a)}}function C(t,e,n,i){for(var o,a,r=0,s=e.length,c=n.length;r=c)return-1;if(37===(o=e.charCodeAt(r++))){if(o=e.charAt(r++),!(a=k[o in Dt?e.charAt(r++):o])||(i=a(t,n,i))<0)return-1}else if(o!=n.charCodeAt(i++))return-1}return i}return v.x=w(n,v),v.X=w(i,v),v.c=w(e,v),g.x=w(n,g),g.X=w(i,g),g.c=w(e,g),{format:function(t){var e=w(t+="",v);return e.toString=function(){return t},e},parse:function(t){var e=E(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",g);return e.toString=function(){return t},e},utcParse:function(t){var e=E(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Ot=St.format,Mt=St.parse,It=St.utcFormat,$t=St.utcParse;var Ge="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||It(Ge);var Je=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:$t(Ge);const Qe=Je,tn=["weeks","days","hours","minutes","seconds","milliseconds"],en={weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001};function nn(t){return"object"==typeof t&&!Array.isArray(t)}class on{constructor(t=0,e=0,n=0,i=0,o=0,a=0){this.days=0,this.seconds=0,this.milliseconds=0;let r={days:t,seconds:e,milliseconds:n,minutes:i,hours:o,weeks:a};nn(t)&&(delete r.days,Object.assign(r,t));let s=0;if(tn.forEach((t=>{s+=(r[t]??0)*en[t]})),sthis.maxSeconds)throw RangeError("value out of range, must have magnitude less than 999999999 days");if(s.toString().includes(".")){const t=s.toString();this.milliseconds=Math.trunc(parseFloat(`0.${t.split(".")[1]}`)/en.milliseconds),t.startsWith("-")&&(this.milliseconds*=-1),s=Math.trunc(s)}this.days=Math.trunc(s/en.days),this.days=this.days||0,this.seconds=s-this.days*en.days,this.seconds=this.seconds||0}total_seconds(){return this.days*en.days+this.seconds+this.milliseconds*en.milliseconds}valueOf(){return this.total_seconds()}toString(){return`${0!=this.days?`${this.days} day${Math.abs(this.days)>1?"s,":","}`:""} ${It("%-H:%M:%S"+(this.milliseconds?".%f":""))(new Date(1e3*this.valueOf()))}`.trim()}static get min(){return new on(-1e8)}get minSeconds(){return-864e10}static get max(){return new on(1e8)}get maxSeconds(){return 864e10}static get resolution(){return new on({milliseconds:1})}}class an{constructor(t=0,e=0,n=0,i=0){this.hour=0,this.minute=0,this.second=0,this.millisecond=0;let o={hour:t,minute:e,second:n,millisecond:i};nn(t)&&(delete o.hour,Object.assign(o,t));for(const t in o)if(!Number.isInteger(o[t]))throw TypeError("'float' object cannot be interpreted as an integer");if((o.hour??0)<0||(o.hour??0)>23)throw RangeError("hour must be in 0..23");if((o.minute??0)<0||(o.minute??0)>59)throw RangeError("minute must be in 0..59");if((o.second??0)<0||(o.second??0)>59)throw RangeError("second must be in 0..59");if((o.millisecond??0)<0||(o.millisecond??0)>999)throw RangeError("millisecond must be in 0..999");Object.assign(this,o)}replace(t=this.hour,e=this.minute,n=this.second,i=this.millisecond){let o={hour:t,minute:e,second:n,millisecond:i};return nn(t)&&(delete o.hour,Object.assign(o,t)),new an(o.hour??this.hour,o.minute??this.minute,o.second??this.second,o.millisecond??this.millisecond)}isoformat(t="auto"){let e;switch(t){case"hours":e="%H";break;case"minutes":e="%H:%M";break;case"seconds":e="%H:%M:%S";break;case"milliseconds":e="%H:%M:%S.%f";break;default:e="%H:%M:%S"+(this.millisecond?".%f":"")}return this.strftime(e)}valueOf(){return this.hour*en.hours+this.minute*en.minutes+this.second*en.seconds+this.millisecond*en.milliseconds}toString(){return this.isoformat()}strftime(t){return It(t)(this.jsDate)}get jsDate(){return new Date(1e3*this.valueOf())}static get min(){return new an(0,0,0,0)}static get max(){return new an(23,59,59,999)}static get resolution(){return on.resolution}static fromisoformat(t){const e=Qe(`1970-01-01T${t}`);if(e)return new an(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());throw SyntaxError("Unable to parse date string")}}const rn=100,sn=9999,cn=36160,ln=3652059,un=["year","month","day","hour","minute","second","millisecond"];class pn{constructor(t,e,n,i=0,o=0,a=0,r=0,s=!1){this.year=1970,this.month=1,this.day=1,this.hour=0,this.minute=0,this.second=0,this.millisecond=0,this.utc=!1;const c={year:t,month:e,day:n,hour:i,minute:o,second:a,millisecond:r,utc:s};if(nn(t)&&(delete c.year,Object.assign(c,t)),!c.year||!c.month||!c.day)throw SyntaxError("Missing required argument year, month, or day");for(const t in c)if(un.includes(t)&&!Number.isInteger(c[t]))throw TypeError(`Argument ${t} value ${c[t]} is not an integer`);if(c.yearsn)throw RangeError(`year ${c.year} is out of range`);if(c.month<1||c.month>12)throw RangeError(`month ${c.month} is out of range`);if(c.day<1||c.day>new Date(c.year,c.month,0).getDate())throw RangeError(`day ${n} is out of range for month`);if((c.hour??0)<0||(c.hour??0)>23)throw RangeError("hour must be in 0..23");if((c.minute??0)<0||(c.minute??0)>59)throw RangeError("minute must be in 0..59");if((c.second??0)<0||(c.second??0)>59)throw RangeError("second must be in 0..59");if((c.millisecond??0)<0||(c.millisecond??0)>999)throw RangeError("millisecond must be in 0..999");Object.assign(this,c)}date(){return new dn(this.year,this.month,this.day)}time(){return new an(this.hour,this.minute,this.second,this.millisecond)}replace(t=this.year,e=this.month,n=this.day,i=this.hour,o=this.minute,a=this.second,r=this.millisecond){const s={year:t,month:e,day:n,hour:i,minute:o,second:a,millisecond:r};return nn(t)&&(delete s.year,Object.assign(s,t)),new pn({year:s.year??this.year,month:s.month??this.month,day:s.day??this.day,hour:s.hour??this.hour,minute:s.minute??this.minute,second:s.second??this.second,millisecond:s.millisecond??this.millisecond})}toordinal(){return this.date().toordinal()}timestamp(){let t;return t=this.utc?Date.UTC(this.year,this.month-1,this.day||1,this.hour||0,this.minute||0,this.second||0,this.millisecond||0):this.jsDate.getTime(),t/1e3}weekday(){return this.date().weekday()}isoweekday(){return this.weekday()+1}isocalendar(){const[t,e,n]=It("%G-%V-%u")(this.jsDate).split("-");return[Number(t),Number(e),Number(n)]}isoformat(t="T",e="auto"){const n={sep:t,timespec:e};let i;switch(nn(t)&&(delete n.sep,Object.assign(n,t),n.sep=n.sep??"T"),n.timespec){case"hours":i=`%Y-%m-%d${n.sep}%H`;break;case"minutes":i=`%Y-%m-%d${n.sep}%H:%M`;break;case"seconds":i=`%Y-%m-%d${n.sep}%H:%M:%S`;break;case"milliseconds":i=`%Y-%m-%d${n.sep}%H:%M:%S.%f`;break;default:i=`%Y-%m-%d${n.sep}%H:%M:%S${this.millisecond?".%f":""}`}return this.strftime(i)}valueOf(){return this.timestamp()}toString(){return this.isoformat(" ")}ctime(){return Ot("%a %b %-e %H:%M:%S %Y")(this.jsDate)}strftime(t){return this.utc?It(t)(this.jsDate):Ot(t)(this.jsDate)}get jsDate(){return this.utc?new Date(1e3*this.valueOf()):new Date(this.year,this.month-1,this.day||1,this.hour||0,this.minute||0,this.second||0,this.millisecond||0)}static get min(){return new pn(rn,1,1)}static get max(){return new pn(sn,12,31,23,59,59,999)}static get resolution(){return on.resolution}static today(){return pn.now()}static now(){return pn.fromjsdate(new Date)}static utcnow(){return pn.utcfromjsdate(new Date)}static fromtimestamp(t){const e=new Date(1e3*t);return pn.fromjsdate(e)}static utcfromtimestamp(t){const e=new Date(1e3*t);return pn.utcfromjsdate(e)}static fromjsdate(t){return new pn({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()})}static utcfromjsdate(t){return new pn({year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),utc:!0})}static fromordinal(t){if(tln)throw RangeError(`ordinal ${t} is out of range`);return pn.fromtimestamp(dn.min.valueOf()+new on({days:t-cn}).valueOf())}static combine(t,e){return new pn({year:t.year,month:t.month,day:t.day,hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})}static fromisoformat(t){const e=Qe(t);if(e)return pn.fromjsdate(e);throw SyntaxError("Unable to parse date string")}static fromisocalendar(t,e,n){return pn.strptime(`${t}-${e}-${n}`,"%G-%V-%u")}static strptime(t,e,n=!1){const i=(n?$t:Mt)(e)(t);if(!i)throw Error(`'${t}' does not match format '${e}'`);return n?pn.utcfromjsdate(i):pn.fromjsdate(i)}}class dn{constructor(t,e,n){if(this.year=1970,this.month=1,this.day=1,!Number.isInteger(t)||tsn)throw RangeError(`year ${t} is out of range`);if(!Number.isInteger(e)||e<1||e>12)throw RangeError(`month ${e} is out of range`);if(!Number.isInteger(n)||n<1||n>new Date(t,e,0).getDate())throw RangeError(`day ${n} is out of range for month`);Object.assign(this,{year:t,month:e,day:n})}replace(t=this.year,e=this.month,n=this.day){const i={year:t,month:e,day:n};return nn(t)&&(delete i.year,Object.assign(i,t)),new dn(i.year??this.year,i.month??this.month,i.day??this.day)}toordinal(){return Math.trunc((this.valueOf()+new on({days:719163}).total_seconds())/en.days)}weekday(){return(this.jsDate.getDay()+6)%7}isoweekday(){return this.weekday()+1}isocalendar(){const[t,e,n]=It("%G-%V-%u")(this.jsDate).split("-");return[Number(t),Number(e),Number(n)]}isoformat(){return It("%Y-%m-%d")(this.jsDate)}valueOf(){return this.jsDate.getTime()/1e3}toString(){return this.isoformat()}ctime(){return Ot("%a %b %-e 00:00:00 %Y")(this.jsDate)}strftime(t){return Ot(t)(this.jsDate)}get jsDate(){return new Date(this.year,this.month-1,this.day)}static get min(){return new dn(rn,1,1)}static get max(){return new dn(sn,12,31)}static get resolution(){return new on({days:1})}static today(){const t=pn.now();return new dn(t.year,t.month,t.day)}static fromtimestamp(t){const e=pn.fromtimestamp(t);return new dn(e.year,e.month,e.day)}static fromordinal(t){if(tln)throw RangeError(`ordinal ${t} is out of range`);return dn.fromtimestamp(dn.min.valueOf()+new on({days:t-cn}).valueOf())}static fromisoformat(t){const e=Qe(t);if(e)return new dn(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate());throw SyntaxError("Unable to parse date string")}static fromisocalendar(t,e,n){const i=pn.strptime(`${t}-${e}-${n}`,"%G-%V-%u");return new dn(Number(i.year),Number(i.month),Number(i.day))}}const hn=(...t)=>new on(...t);hn.min=on.min,hn.max=on.max,hn.resolution=on.resolution;const mn=(...t)=>new dn(...t);mn.min=dn.min,mn.max=dn.max,mn.resolution=dn.resolution,mn.today=dn.today,mn.fromtimestamp=dn.fromtimestamp,mn.fromordinal=dn.fromordinal,mn.fromisoformat=dn.fromisoformat,mn.fromisocalendar=dn.fromisocalendar;const fn=(...t)=>new pn(...t);fn.min=pn.min,fn.max=pn.max,fn.resolution=pn.resolution,fn.today=pn.today,fn.now=pn.now,fn.utcnow=pn.utcnow,fn.fromtimestamp=pn.fromtimestamp,fn.utcfromtimestamp=pn.utcfromtimestamp,fn.fromjsdate=pn.fromjsdate,fn.utcfromjsdate=pn.utcfromjsdate,fn.fromordinal=pn.fromordinal,fn.combine=pn.combine,fn.fromisoformat=pn.fromisoformat,fn.fromisocalendar=pn.fromisocalendar,fn.strptime=pn.strptime;const yn=(...t)=>new an(...t);yn.min=an.min,yn.max=an.max,yn.resolution=an.resolution,yn.fromisoformat=an.fromisoformat;const _n={MINYEAR:rn,MAXYEAR:sn,MINYEAR_ORDINAL:cn,MAXYEAR_ORDINAL:ln,timedelta:hn,date:mn,datetime:fn,time:yn};function bn(){return _n.datetime.now()}function vn(t="00:00"){const[e,n,i,o]=t.split(":"),a=_n.datetime.now(),r=_n.datetime(a.year,a.month,a.day,Number(e??0),Number(n??0),Number(i??0),Number(o??0));return M(r.toString()),r}function gn(t,e=void 0,n=!0){"object"!=typeof e||Array.isArray(e)||(n=e.utc??n,e=e.fallback??void 0);try{let e;if("string"==typeof t)if(/[^\d]/g.test(t)){t=t.replace(/T/g," ");const i=["%Y-%m-%d %H:%M:%S.%f%Z","%Y-%m-%d %H:%M:%S.%f","%Y-%m-%d %H:%M:%S%Z","%Y-%m-%d %H:%M:%S"];for(const o of i)try{e=_n.datetime.strptime(t,o,n);break}catch{}e||(t=parseFloat(t))}else t=parseFloat(t);else e="number"==typeof t?n?_n.datetime.utcfromtimestamp(t):_n.datetime.fromtimestamp(t):t instanceof dn?_n.datetime(t.year,t.month,t.day):t;return M((e??"NaN").toString()),e}catch(t){if(e)return e;throw t}}function kn(t,e){try{let e;return"string"==typeof t?(t.includes(" ")||t.includes("T")||(t+=" 00:00:00"),e=Date.parse(t)/1e3):e="number"==typeof t?_n.datetime.utcfromtimestamp(t).jsDate.getTime()/1e3:t.jsDate.getTime()/1e3,M(e.toString()),e}catch(t){if(e)return e;throw t}}function wn(t){return _n.datetime.fromjsdate(_n.datetime(t).jsDate)}function En(t,e=1,n=!1){if(!(t instanceof pn))return t;let i=bn().valueOf()-wn(t).valueOf();if(n&&(i*=-1),i<=0)return t;(0==e||e>6)&&(e=6);const o={year:31536e3,month:2592e3,day:86400,hour:3600,minute:60,second:1},a=Object.keys(o);let r="",s=!1;for(let t=0;t0)&&(s=!0,r+=` ${n} ${a[t]}${1!=n?"s":""}`,i-=n*o[a[t]])}return r.trim()}function Cn(t,e=1){return En(t,e)}function xn(t,e=1){return En(t,e,!0)}const Tn={states:l,state_attr:u,has_value:p,state_translated:G,attr_name_translated:J,attr_value_translated:Q,expand:k,device_entities:h,device_attr:m,device_id:f,floor_id:b,floor_name:v,floor_areas:g,area_id:o,area_name:a,area_entities:r,area_devices:s,labels:C,label_areas:L,label_devices:A,label_entities:S,iif:w,closest:_},Ln={label_id:x,label_name:T,today_at:vn,as_datetime:gn,as_timestamp:kn,as_local:wn,time_since:Cn,time_until:xn,timestamp_local:function(t,e){try{const e=_n.datetime.fromtimestamp(t).strftime("%Y-%m-%dT%H:%M:%S%Z");return M(e),e}catch(t){if(e)return e;throw t}},timestamp_utc:function(t,e){try{const e=_n.datetime.utcfromtimestamp(t).strftime("%Y-%m-%dT%H:%M:%S%Z");return M(e),e}catch(t){if(e)return e;throw t}},timestamp_custom:function(t,e,n=!0,i=void 0){"object"!=typeof n||Array.isArray(n)||(i=n.fallback??i,n=n.local??!0);try{const i=(n?_n.datetime.fromtimestamp(t):_n.datetime.utcfromtimestamp(t)).strftime(e);return M(i),i}catch(t){if(i)return i;throw t}},to_json:function(t,e=!1,n=!1,i=!1){"object"!=typeof e||Array.isArray(e)||(i=e.sort_keys??i,n=e.pretty_print??n,e=e.ensure_ascii??!1),i&&(t=Object.keys(t).sort().reduce(((e,n)=>(e[n]=t[n],e)),{}));let o=JSON.stringify(t,void 0,n?2:void 0);return e&&(o=o.replace(/[\u007F-\uFFFF]/g,(t=>`\\u'${("0000"+t.charCodeAt(0).toString(16)).substring(-4)}`))),o},from_json:function(t){return JSON.parse(t)},closest:_,contains:c,is_number:I,bool:$,log:D,sin:P,cos:N,tan:R,asin:V,acos:F,atan:U,atan2:j,sqrt:K,max:B,min:H,average:Y,median:Z,statistical_mode:z,bitwise_and:function(t,e){return t&e},bitwise_or:function(t,e){return t|e},bitwise_xor:function(t,e){return t^e},bitwise_not:function(t){return~t},ord:function(t){if(1==t.length)return t.codePointAt(0);throw Error("Expected a character, but received a string")},multiply:function(t,e){return Number(t)*Number(e)},add:function(t,e){return Number(t)+Number(e)},regex_replace:function(t,e="",n=""){return t.replace(new RegExp(e,"g"),n)},regex_findall:function(t,e=""){return t.match(new RegExp(e,"g"))??[]},regex_findall_index:function(t,e="",n=0){return(t.match(new RegExp(e,"g"))??[])[n]},str:O},An={states:l,is_state:function(t,e,n){try{const i=l(t,e);return Array.isArray(n)?n.includes(i):i==n}catch{return!1}},state_attr:u,is_state_attr:function(t,e,n,i){try{return u(t,e,n)==i}catch{return!1}},has_value:p,state_translated:G,attr_name_translated:J,attr_value_translated:Q,expand:k,is_hidden_entity:function(t,e){try{return t.entities[e].hidden??!1}catch{return!1}},device_entities:h,device_attr:m,is_device_attr:function(t,e,n,i){try{return null!=i&&m(t,e,n)==i}catch{return!1}},device_id:f,floors:function(t){return Object.keys(t.floors)},floor_id:b,floor_name:v,floor_areas:g,areas:function(t){try{return Object.keys(t.areas)}catch{return[]}},area_id:o,area_name:a,area_entities:r,area_devices:s,integration_entities:function(t,e){try{const n=[];if(e){for(const i in t.entities)t.entities[i].platform==e&&n.push(i);n.sort()}return n}catch{return[]}},labels:C,label_areas:L,label_devices:A,label_entities:S,iif:w,distance:function(t,...e){try{let n,i,o,a,r=0;if("string"==typeof e[0])n=t.states[e[0]].attributes.latitude,o=t.states[e[0]].attributes.longitude,r=1;else if("object"!=typeof e[0]||Array.isArray(e[0])){if("number"!=typeof e[0])return null;if("number"!=typeof e[1])throw Error("Latitude provided but not longitude 1");n=e[0],o=e[1],r=2}else n=e[0].attributes.latitude,o=e[0].attributes.longitude,r=1;if("string"==typeof e[r])i=t.states[e[r]].attributes.latitude,a=t.states[e[r]].attributes.longitude;else if("object"!=typeof e[r]||Array.isArray(e[r]))if("number"==typeof e[r]){if("number"!=typeof e[r+1])throw Error("Latitude provided but not longitude 2");i=e[r],a=e[r+1]}else i=t.states["zone.home"].attributes.latitude,a=t.states["zone.home"].attributes.longitude;else i=e[r].attributes.latitude,a=e[r].attributes.longitude;return y([n,o],[i,a],"mi"==t.config.unit_system.length)}catch{return null}},closest:_},Sn={label_id:x,label_name:T,now:bn,utcnow:function(){return _n.datetime.utcnow()},today_at:vn,as_datetime:gn,as_timestamp:kn,as_local:wn,strptime:function(t,e,n=void 0,i=!1){"object"!=typeof n||Array.isArray(n)||n instanceof pn||n instanceof dn||(i=n.utc??i,n=n.fallback??void 0);try{e=e.replace(/%z/g,"%Z");const n=_n.datetime.strptime(t,e,i);return M(n.toString()),n}catch(t){if(n)return n;throw t}},time_since:Cn,time_until:xn,as_timedelta:function(t){try{let e;if(t.includes(":")||t.includes(" ")||/^\d*\.?\d*$/.test(t)){let n,i;t.includes(" ")?t.includes("days")?[n,i]=t.split(" days "):[n,i]=t.split(" "):(n=0,i=t);const[o,a,r]=i.split(":").reverse();e=_n.timedelta(Number(n),Number(o.replace(",",".")??0),0,Number(a??0),Number(r??0))}else{if(!t.startsWith("P"))return null;{const n=t.replace(/P|T/g,"").match(/(\d*?)[A-Z]/g);if(!n)return null;const i={};for(const t of n){const e=t.match(/^(\d*)/),n=t.match(/[A-Z]$/);e&&n&&(i[n[0]]=parseFloat(e[0]))}e=_n.timedelta(i.D,i.S,0,i.M,i.H,i.W)}}return M(e.toString()),e}catch{return null}},float:function(t,e){try{const e=parseFloat(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}},is_number:I,int:function(t,e){try{const e=parseInt(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}},bool:$,log:D,sin:P,cos:N,tan:R,asin:V,acos:F,atan:U,atan2:j,sqrt:K,max:B,min:H,average:Y,median:Z,statistical_mode:z,set:function(...t){return new Set(t.flat(1/0))},list:function(...t){return t.map((t=>Array.from(t))).flat(1/0)},zip:function(...t){if(t.length>1)return t[0].map(((e,n)=>{const i=[e];for(let e=1;et.name.localeCompare(e.name)));for(const t of e)E[t.label_id]=t}}(t),In=t,"string"==typeof e&&(e.includes("{{")&&e.includes("}}")||e.includes("{%")&&e.includes("%}"))?(e=$n.renderString(structuredClone(e),{hass:t,_states:d(t),...n}).trim(),[void 0,null,"undefined","null","None"].includes(e)?"":"true"==e.toLowerCase()||"false"!=e.toLowerCase()&&e):e}},740:(t,e,n)=>{"use strict";n.d(e,{XX:()=>U,c0:()=>C,qy:()=>E});const i=globalThis,o=i.trustedTypes,a=o?o.createPolicy("lit-html",{createHTML:t=>t}):void 0,r="$lit$",s=`lit$${(Math.random()+"").slice(9)}$`,c="?"+s,l=`<${c}>`,u=document,p=()=>u.createComment(""),d=t=>null===t||"object"!=typeof t&&"function"!=typeof t,h=Array.isArray,m="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,y=/-->/g,_=/>/g,b=RegExp(`>|${m}(?:([^\\s"'>=/]+)(${m}*=${m}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),v=/'/g,g=/"/g,k=/^(?:script|style|textarea|title)$/i,w=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),E=w(1),C=(w(2),Symbol.for("lit-noChange")),x=Symbol.for("lit-nothing"),T=new WeakMap,L=u.createTreeWalker(u,129);function A(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==a?a.createHTML(e):e}const S=(t,e)=>{const n=t.length-1,i=[];let o,a=2===e?"":"",c=f;for(let e=0;e"===p[0]?(c=o??f,d=-1):void 0===p[1]?d=-2:(d=c.lastIndex-p[2].length,u=p[1],c=void 0===p[3]?b:'"'===p[3]?g:v):c===g||c===v?c=b:c===y||c===_?c=f:(c=b,o=void 0);const m=c===b&&t[e+1].startsWith("/>")?" ":"";a+=c===f?n+l:d>=0?(i.push(u),n.slice(0,d)+r+n.slice(d)+s+m):n+s+(-2===d?e:m)}return[A(t,a+(t[n]||"")+(2===e?"":"")),i]};class O{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let a=0,l=0;const u=t.length-1,d=this.parts,[h,m]=S(t,e);if(this.el=O.createElement(h,n),L.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=L.nextNode())&&d.length0){i.textContent=o?o.emptyScript:"";for(let n=0;nh(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==x&&d(this._$AH)?this._$AA.nextSibling.data=t:this.$(u.createTextNode(t)),this._$AH=t}g(t){const{values:e,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=O.createElement(A(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new I(i,this),n=t.u(this.options);t.p(e),this.$(n),this._$AH=t}}_$AC(t){let e=T.get(t.strings);return void 0===e&&T.set(t.strings,e=new O(t)),e}T(t){h(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const o of t)i===e.length?e.push(n=new $(this.k(p()),this.k(p()),this,this.options)):n=e[i],n._$AI(o),i++;i2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=x}_$AI(t,e=this,n,i){const o=this.strings;let a=!1;if(void 0===o)t=M(this,t,e,0),a=!d(t)||t!==this._$AH&&t!==C,a&&(this._$AH=t);else{const i=t;let r,s;for(t=o[0],r=0;r{const i=n?.renderBefore??e;let o=i._$litPart$;if(void 0===o){const t=n?.renderBefore??null;i._$litPart$=o=new $(e.insertBefore(p(),t),t,void 0,n??{})}return o._$AI(t),o}},385:(t,e,n)=>{"use strict";n.d(e,{EM:()=>i,Ls:()=>l,MZ:()=>s,wk:()=>c});const i=t=>(e,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)};var o=n(1);const a={attribute:!0,type:String,converter:o.W3,reflect:!1,hasChanged:o.Ec},r=(t=a,e,n)=>{const{kind:i,metadata:o}=n;let r=globalThis.litPropertyMetadata.get(o);if(void 0===r&&globalThis.litPropertyMetadata.set(o,r=new Map),r.set(n.name,t),"accessor"===i){const{name:i}=n;return{set(n){const o=e.get.call(this);e.set.call(this,n),this.requestUpdate(i,o,t)},init(e){return void 0!==e&&this.C(i,void 0,t),e}}}if("setter"===i){const{name:i}=n;return function(n){const o=this[i];e.call(this,n),this.requestUpdate(i,o,t)}}throw Error("Unsupported decorator location: "+i)};function s(t){return(e,n)=>"object"==typeof n?r(t,e,n):((t,e,n)=>{const i=e.hasOwnProperty(n);return e.constructor.createProperty(n,i?{...t,wrapped:!0}:t),i?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}function c(t){return s({...t,state:!0,attribute:!1})}function l(t){return(e,n)=>{const i="function"==typeof e?e:e[n];Object.assign(i,t)}}},670:(t,e,n)=>{"use strict";n.d(e,{WF:()=>a,AH:()=>i.AH,qy:()=>o.qy});var i=n(1),o=n(740);class a extends i.mN{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,o.XX)(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return o.c0}}a._$litElement$=!0,a.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:a});const r=globalThis.litElementPolyfillSupport;r?.({LitElement:a}),(globalThis.litElementVersions??=[]).push("4.0.3")}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(t,e)=>{for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var __webpack_exports__={};(()=>{"use strict";var t=__webpack_require__(670),e=__webpack_require__(385),n=__webpack_require__(703);function i(t){return null==t}var o={isNothing:i,isObject:function(t){return"object"==typeof t&&null!==t},toArray:function(t){return Array.isArray(t)?t:i(t)?[]:[t]},repeat:function(t,e){var n,i="";for(n=0;ns&&(e=i-s+(a=" ... ").length),n-i>s&&(n=i+s-(r=" ...").length),{str:a+t.slice(e,n).replace(/\t/g,"→")+r,pos:i-e+a.length}}function l(t,e){return o.repeat(" ",e-t.length)+t}var u=function(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),"number"!=typeof e.indent&&(e.indent=1),"number"!=typeof e.linesBefore&&(e.linesBefore=3),"number"!=typeof e.linesAfter&&(e.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,a=[0],r=[],s=-1;n=i.exec(t.buffer);)r.push(n.index),a.push(n.index+n[0].length),t.position<=n.index&&s<0&&(s=a.length-2);s<0&&(s=a.length-1);var u,p,d="",h=Math.min(t.line+e.linesAfter,r.length).toString().length,m=e.maxLength-(e.indent+h+3);for(u=1;u<=e.linesBefore&&!(s-u<0);u++)p=c(t.buffer,a[s-u],r[s-u],t.position-(a[s]-a[s-u]),m),d=o.repeat(" ",e.indent)+l((t.line-u+1).toString(),h)+" | "+p.str+"\n"+d;for(p=c(t.buffer,a[s],r[s],t.position,m),d+=o.repeat(" ",e.indent)+l((t.line+1).toString(),h)+" | "+p.str+"\n",d+=o.repeat("-",e.indent+h+3+p.pos)+"^\n",u=1;u<=e.linesAfter&&!(s+u>=r.length);u++)p=c(t.buffer,a[s+u],r[s+u],t.position-(a[s]-a[s+u]),m),d+=o.repeat(" ",e.indent)+l((t.line+u+1).toString(),h)+" | "+p.str+"\n";return d.replace(/\n$/,"")},p=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],d=["scalar","sequence","mapping"],h=function(t,e){if(e=e||{},Object.keys(e).forEach((function(e){if(-1===p.indexOf(e))throw new s('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=function(t){var e={};return null!==t&&Object.keys(t).forEach((function(n){t[n].forEach((function(t){e[String(t)]=n}))})),e}(e.styleAliases||null),-1===d.indexOf(this.kind))throw new s('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function m(t,e){var n=[];return t[e].forEach((function(t){var e=n.length;n.forEach((function(n,i){n.tag===t.tag&&n.kind===t.kind&&n.multi===t.multi&&(e=i)})),n[e]=t})),n}function f(t){return this.extend(t)}f.prototype.extend=function(t){var e=[],n=[];if(t instanceof h)n.push(t);else if(Array.isArray(t))n=n.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new s("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(e=e.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit))}e.forEach((function(t){if(!(t instanceof h))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new s("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new s("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(t){if(!(t instanceof h))throw new s("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(f.prototype);return i.implicit=(this.implicit||[]).concat(e),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=m(i,"implicit"),i.compiledExplicit=m(i,"explicit"),i.compiledTypeMap=function(){var t,e,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(t){t.multi?(n.multi[t.kind].push(t),n.multi.fallback.push(t)):n[t.kind][t.tag]=n.fallback[t.tag]=t}for(t=0,e=arguments.length;t=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),w=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),E=/^[-+]?[0-9]+e/,C=new h("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!w.test(t)||"_"===t[t.length-1])},construct:function(t){var e,n;return n="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:n*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||o.isNegativeZero(t))},represent:function(t,e){var n;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(o.isNegativeZero(t))return"-0.0";return n=t.toString(10),E.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),x=y.extend({implicit:[_,b,k,C]}),T=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),L=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),A=new h("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==T.exec(t)||null!==L.exec(t))},construct:function(t){var e,n,i,o,a,r,s,c,l=0,u=null;if(null===(e=T.exec(t))&&(e=L.exec(t)),null===e)throw new Error("Date resolve error");if(n=+e[1],i=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(n,i,o));if(a=+e[4],r=+e[5],s=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(u=-u)),c=new Date(Date.UTC(n,i,o,a,r,s,l)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(t){return t.toISOString()}}),S=new h("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",M=new h("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,i=0,o=t.length,a=O;for(n=0;n64)){if(e<0)return!1;i+=6}return i%8==0},construct:function(t){var e,n,i=t.replace(/[\r\n=]/g,""),o=i.length,a=O,r=0,s=[];for(e=0;e>16&255),s.push(r>>8&255),s.push(255&r)),r=r<<6|a.indexOf(i.charAt(e));return 0==(n=o%4*6)?(s.push(r>>16&255),s.push(r>>8&255),s.push(255&r)):18===n?(s.push(r>>10&255),s.push(r>>2&255)):12===n&&s.push(r>>4&255),new Uint8Array(s)},predicate:function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function(t){var e,n,i="",o=0,a=t.length,r=O;for(e=0;e>18&63],i+=r[o>>12&63],i+=r[o>>6&63],i+=r[63&o]),o=(o<<8)+t[e];return 0==(n=a%3)?(i+=r[o>>18&63],i+=r[o>>12&63],i+=r[o>>6&63],i+=r[63&o]):2===n?(i+=r[o>>10&63],i+=r[o>>4&63],i+=r[o<<2&63],i+=r[64]):1===n&&(i+=r[o>>2&63],i+=r[o<<4&63],i+=r[64],i+=r[64]),i}}),I=Object.prototype.hasOwnProperty,$=Object.prototype.toString,D=new h("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,i,o,a,r=[],s=t;for(e=0,n=s.length;e>10),56320+(t-65536&1023))}for(var st=new Array(256),ct=new Array(256),lt=0;lt<256;lt++)st[lt]=at(lt)?1:0,ct[lt]=at(lt);function ut(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||F,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function pt(t,e){var n={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return n.snippet=u(n),new s(e,n)}function dt(t,e){throw pt(t,e)}function ht(t,e){t.onWarning&&t.onWarning.call(null,pt(t,e))}var mt={YAML:function(t,e,n){var i,o,a;null!==t.version&&dt(t,"duplication of %YAML directive"),1!==n.length&&dt(t,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&dt(t,"ill-formed argument of the YAML directive"),o=parseInt(i[1],10),a=parseInt(i[2],10),1!==o&&dt(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=a<2,1!==a&&2!==a&&ht(t,"unsupported YAML version of the document")},TAG:function(t,e,n){var i,o;2!==n.length&&dt(t,"TAG directive accepts exactly two arguments"),i=n[0],o=n[1],G.test(i)||dt(t,"ill-formed tag handle (first argument) of the TAG directive"),U.call(t.tagMap,i)&&dt(t,'there is a previously declared suffix for "'+i+'" tag handle'),J.test(o)||dt(t,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch(e){dt(t,"tag prefix is malformed: "+o)}t.tagMap[i]=o}};function ft(t,e,n,i){var o,a,r,s;if(e1&&(t.result+=o.repeat("\n",e-1))}function wt(t,e){var n,i,o=t.tag,a=t.anchor,r=[],s=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=r),i=t.input.charCodeAt(t.position);0!==i&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,dt(t,"tab characters must not be used in indentation")),45===i)&&nt(t.input.charCodeAt(t.position+1));)if(s=!0,t.position++,vt(t,!0,-1)&&t.lineIndent<=e)r.push(null),i=t.input.charCodeAt(t.position);else if(n=t.line,xt(t,e,B,!1,!0),r.push(t.result),vt(t,!0,-1),i=t.input.charCodeAt(t.position),(t.line===n||t.lineIndent>e)&&0!==i)dt(t,"bad indentation of a sequence entry");else if(t.lineIndente?f=1:t.lineIndent===e?f=0:t.lineIndente?f=1:t.lineIndent===e?f=0:t.lineIndente)&&(_&&(r=t.line,s=t.lineStart,c=t.position),xt(t,e,H,!0,o)&&(_?f=t.result:y=t.result),_||(_t(t,d,h,m,f,y,r,s,c),m=f=y=null),vt(t,!0,-1),l=t.input.charCodeAt(t.position)),(t.line===a||t.lineIndent>e)&&0!==l)dt(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===a?dt(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?dt(t,"repeat of an indentation width identifier"):(p=e+a-1,u=!0)}if(et(r)){do{r=t.input.charCodeAt(++t.position)}while(et(r));if(35===r)do{r=t.input.charCodeAt(++t.position)}while(!tt(r)&&0!==r)}for(;0!==r;){for(bt(t),t.lineIndent=0,r=t.input.charCodeAt(t.position);(!u||t.lineIndentp&&(p=t.lineIndent),tt(r))d++;else{if(t.lineIndent0){for(o=r,a=0;o>0;o--)(r=ot(s=t.input.charCodeAt(++t.position)))>=0?a=(a<<4)+r:dt(t,"expected hexadecimal character");t.result+=rt(a),t.position++}else dt(t,"unknown escape sequence");n=i=t.position}else tt(s)?(ft(t,n,i,!0),kt(t,vt(t,!1,e)),n=i=t.position):t.position===t.lineStart&>(t)?dt(t,"unexpected end of the document within a double quoted scalar"):(t.position++,i=t.position)}dt(t,"unexpected end of the stream within a double quoted scalar")}(t,h)?_=!0:function(t){var e,n,i;if(42!==(i=t.input.charCodeAt(t.position)))return!1;for(i=t.input.charCodeAt(++t.position),e=t.position;0!==i&&!nt(i)&&!it(i);)i=t.input.charCodeAt(++t.position);return t.position===e&&dt(t,"name of an alias node must contain at least one character"),n=t.input.slice(e,t.position),U.call(t.anchorMap,n)||dt(t,'unidentified alias "'+n+'"'),t.result=t.anchorMap[n],vt(t,!0,-1),!0}(t)?(_=!0,null===t.tag&&null===t.anchor||dt(t,"alias node should not have any properties")):function(t,e,n){var i,o,a,r,s,c,l,u,p=t.kind,d=t.result;if(nt(u=t.input.charCodeAt(t.position))||it(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(nt(i=t.input.charCodeAt(t.position+1))||n&&it(i)))return!1;for(t.kind="scalar",t.result="",o=a=t.position,r=!1;0!==u;){if(58===u){if(nt(i=t.input.charCodeAt(t.position+1))||n&&it(i))break}else if(35===u){if(nt(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&>(t)||n&&it(u))break;if(tt(u)){if(s=t.line,c=t.lineStart,l=t.lineIndent,vt(t,!1,-1),t.lineIndent>=e){r=!0,u=t.input.charCodeAt(t.position);continue}t.position=a,t.line=s,t.lineStart=c,t.lineIndent=l;break}}r&&(ft(t,o,a,!1),kt(t,t.line-s),o=a=t.position,r=!1),et(u)||(a=t.position+1),u=t.input.charCodeAt(++t.position)}return ft(t,o,a,!1),!!t.result||(t.kind=p,t.result=d,!1)}(t,h,j===n)&&(_=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===f&&(_=c&&wt(t,m))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&dt(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),l=0,u=t.implicitTypes.length;l"),null!==t.result&&d.kind!==t.kind&&dt(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+d.kind+'", not "'+t.kind+'"'),d.resolve(t.result,t.tag)?(t.result=d.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):dt(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||_}function Tt(t){var e,n,i,o,a=t.position,r=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(o=t.input.charCodeAt(t.position))&&(vt(t,!0,-1),o=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==o));){for(r=!0,o=t.input.charCodeAt(++t.position),e=t.position;0!==o&&!nt(o);)o=t.input.charCodeAt(++t.position);for(i=[],(n=t.input.slice(e,t.position)).length<1&&dt(t,"directive name must not be less than one character in length");0!==o;){for(;et(o);)o=t.input.charCodeAt(++t.position);if(35===o){do{o=t.input.charCodeAt(++t.position)}while(0!==o&&!tt(o));break}if(tt(o))break;for(e=t.position;0!==o&&!nt(o);)o=t.input.charCodeAt(++t.position);i.push(t.input.slice(e,t.position))}0!==o&&bt(t),U.call(mt,n)?mt[n](t,n,i):ht(t,'unknown document directive "'+n+'"')}vt(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,vt(t,!0,-1)):r&&dt(t,"directives end mark is expected"),xt(t,t.lineIndent-1,H,!1,!0),vt(t,!0,-1),t.checkLineBreaks&&W.test(t.input.slice(a,t.position))&&ht(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&>(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,vt(t,!0,-1)):t.position=55296&&i<=56319&&e+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function fe(t){return/^\n* /.test(t)}var ye=1,_e=2,be=3,ve=4,ge=5;function ke(t,e,n,i,o){t.dump=function(){if(0===e.length)return t.quotingType===re?'""':"''";if(!t.noCompatMode&&(-1!==ie.indexOf(e)||oe.test(e)))return t.quotingType===re?'"'+e+'"':"'"+e+"'";var a=t.indent*Math.max(1,n),r=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-a),c=i||t.flowLevel>-1&&n>=t.flowLevel;switch(function(t,e,n,i,o,a,r,s){var c,l,u=0,p=null,d=!1,h=!1,m=-1!==i,f=-1,y=pe(l=me(t,0))&&l!==Mt&&!ue(l)&&l!==Ht&&l!==qt&&l!==Yt&&l!==Bt&&l!==Xt&&l!==Gt&&l!==Qt&&l!==ee&&l!==Vt&&l!==Ut&&l!==Kt&&l!==Nt&&l!==te&&l!==Zt&&l!==zt&&l!==jt&&l!==Rt&&l!==Ft&&l!==Wt&&l!==Jt&&function(t){return!ue(t)&&t!==Yt}(me(t,t.length-1));if(e||r)for(c=0;c=65536?c+=2:c++){if(!pe(u=me(t,c)))return ge;y=y&&he(u,p,s),p=u}else{for(c=0;c=65536?c+=2:c++){if((u=me(t,c))===$t)d=!0,m&&(h=h||c-f-1>i&&" "!==t[f+1],f=c);else if(!pe(u))return ge;y=y&&he(u,p,s),p=u}h=h||m&&c-f-1>i&&" "!==t[f+1]}return d||h?n>9&&fe(t)?ge:r?a===re?ge:_e:h?ve:be:!y||r||o(t)?a===re?ge:_e:ye}(e,c,t.indent,r,(function(e){return function(t,e){var n,i;for(n=0,i=t.implicitTypes.length;n"+we(e,t.indent)+Ee(ce(function(t,e){for(var n,i,o,a=/(\n+)([^\n]*)/g,r=(o=-1!==(o=t.indexOf("\n"))?o:t.length,a.lastIndex=o,Ce(t.slice(0,o),e)),s="\n"===t[0]||" "===t[0];i=a.exec(t);){var c=i[1],l=i[2];n=" "===l[0],r+=c+(s||n||""===l?"":"\n")+Ce(l,e),s=n}return r}(e,r),a));case ge:return'"'+function(t){for(var e,n="",i=0,o=0;o=65536?o+=2:o++)i=me(t,o),!(e=ne[i])&&pe(i)?(n+=t[o],i>=65536&&(n+=t[o+1])):n+=e||ae(i);return n}(e)+'"';default:throw new s("impossible error: invalid scalar style")}}()}function we(t,e){var n=fe(t)?String(e):"",i="\n"===t[t.length-1];return n+(!i||"\n"!==t[t.length-2]&&"\n"!==t?i?"":"-":"+")+"\n"}function Ee(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function Ce(t,e){if(""===t||" "===t[0])return t;for(var n,i,o=/ [^ ]/g,a=0,r=0,s=0,c="";n=o.exec(t);)(s=n.index)-a>e&&(i=r>a?r:s,c+="\n"+t.slice(a,i),a=i+1),r=s;return c+="\n",t.length-a>e&&r>a?c+=t.slice(a,r)+"\n"+t.slice(r+1):c+=t.slice(a),c.slice(1)}function xe(t,e,n,i){var o,a,r,s="",c=t.tag;for(o=0,a=n.length;o tag resolver accepts not "'+l+'" style');i=c.represent[l](e,l)}t.dump=i}return!0}return!1}function Le(t,e,n,i,o,a,r){t.tag=null,t.dump=n,Te(t,n,!1)||Te(t,n,!0);var c,l=St.call(t.dump),u=i;i&&(i=t.flowLevel<0||t.flowLevel>e);var p,d,h="[object Object]"===l||"[object Array]"===l;if(h&&(d=-1!==(p=t.duplicates.indexOf(n))),(null!==t.tag&&"?"!==t.tag||d||2!==t.indent&&e>0)&&(o=!1),d&&t.usedDuplicates[p])t.dump="*ref_"+p;else{if(h&&d&&!t.usedDuplicates[p]&&(t.usedDuplicates[p]=!0),"[object Object]"===l)i&&0!==Object.keys(t.dump).length?(function(t,e,n,i){var o,a,r,c,l,u,p="",d=t.tag,h=Object.keys(n);if(!0===t.sortKeys)h.sort();else if("function"==typeof t.sortKeys)h.sort(t.sortKeys);else if(t.sortKeys)throw new s("sortKeys must be a boolean or a function");for(o=0,a=h.length;o1024)&&(t.dump&&$t===t.dump.charCodeAt(0)?u+="?":u+="? "),u+=t.dump,l&&(u+=le(t,e)),Le(t,e+1,c,!0,l)&&(t.dump&&$t===t.dump.charCodeAt(0)?u+=":":u+=": ",p+=u+=t.dump));t.tag=d,t.dump=p||"{}"}(t,e,t.dump,o),d&&(t.dump="&ref_"+p+t.dump)):(function(t,e,n){var i,o,a,r,s,c="",l=t.tag,u=Object.keys(n);for(i=0,o=u.length;i1024&&(s+="? "),s+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Le(t,e,r,!1,!1)&&(c+=s+=t.dump));t.tag=l,t.dump="{"+c+"}"}(t,e,t.dump),d&&(t.dump="&ref_"+p+" "+t.dump));else if("[object Array]"===l)i&&0!==t.dump.length?(t.noArrayIndent&&!r&&e>0?xe(t,e-1,t.dump,o):xe(t,e,t.dump,o),d&&(t.dump="&ref_"+p+t.dump)):(function(t,e,n){var i,o,a,r="",s=t.tag;for(i=0,o=n.length;i",t.dump=c+" "+t.dump)}return!0}function Ae(t,e){var n,i,o=[],a=[];for(Se(t,o,a),n=0,i=a.length;n=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};class Be extends t.WF{constructor(){super(...arguments),this.baseTabIndex=0,this.entryIndex=-1,this.actionsTabIndex=0,this.touchpadTabIndex=2,this.guiMode=!0,this.yamlStringsCache={},this.people=[],this.BASE_TABS=["general","layout","actions","icons"],this.TOUCHPAD_TABS=["up","down","center","left","right"],this.DEFAULT_KEYS=[],this.DEFAULT_SOURCES=[],this.DEFAULT_ACTIONS=[]}static get properties(){return{hass:{},config:{}}}setConfig(t){this.config=t}configChanged(t){t=this.autofillDefaultFields(t);const e=new Event("config-changed",{bubbles:!0,composed:!0});e.detail={config:t},this.dispatchEvent(e),this.requestUpdate()}entriesChanged(t){let e;e=3===this.baseTabIndex?"custom_icons":"custom_actions",this.configChanged({...this.config,[e]:t})}entryChanged(t){let e,n,i;if(3===this.baseTabIndex)e=structuredClone(this.config.custom_icons??[]),n=e[this.entryIndex],i={...n,...t};else switch(e=structuredClone(this.config.custom_actions??[]),n=e[this.entryIndex],this.renderTemplate(n?.type,this.getEntryContext(n))){case"touchpad":if(2!=this.touchpadTabIndex){i={...n,[this.TOUCHPAD_TABS[this.touchpadTabIndex]]:{...n[this.TOUCHPAD_TABS[this.touchpadTabIndex]],...t}};break}default:i={...n,...t}}e[this.entryIndex]=i,this.entriesChanged(e)}toggleGuiMode(t){this.yamlString=void 0,this.configChanged(this.config),this.guiMode=!this.guiMode}get activeEntry(){if(this.entryIndex<0)return;let t;return 3===this.baseTabIndex?(this.config.custom_icons??[])[this.entryIndex]:(t=(this.config.custom_actions??[])[this.entryIndex],"touchpad"===this.renderTemplate(t?.type,this.getEntryContext(t))&&2!=this.touchpadTabIndex?t[this.TOUCHPAD_TABS[this.touchpadTabIndex]]??{}:t)}get yaml(){if(null==this.yamlString){let t="";switch(this.baseTabIndex){case 3:case 2:t=Ie(this.activeEntry);break;case 1:t=Ie(this.config.rows)}this.yamlString=["{}","[]"].includes(t.trim())?"":t}return this.yamlString??""}set yaml(t){this.yamlString=t;try{const t=Me(this.yaml);switch(this.baseTabIndex){case 3:{const e=structuredClone(this.config.custom_icons??[]);e[this.entryIndex]=t,this.entriesChanged(e);break}case 2:{const e=structuredClone(this.config.custom_actions??[]);switch(this.renderTemplate(e[this.entryIndex].type,this.getEntryContext(t))){case"touchpad":if(2!=this.touchpadTabIndex){e[this.entryIndex]={...e[this.entryIndex],[this.TOUCHPAD_TABS[this.touchpadTabIndex]]:t};break}default:e[this.entryIndex]=t}this.entriesChanged(e);break}case 1:this.configChanged({...this.config,rows:t})}this.errors=void 0}catch(t){this.errors=[t.message]}}handleYamlCodeChanged(t){t.stopPropagation();const e=t.detail.value;e!=this.yaml&&(this.yaml=e)}handleStyleCodeChanged(t){t.stopPropagation();const e=t.detail.value;this.entryIndex>-1&&this.activeEntry?e!=this.activeEntry?.styles&&this.entryChanged({styles:e}):e!=this.config.styles&&this.configChanged({...this.config,styles:e})}handleActionCodeChanged(t){t.stopPropagation();const e=t.target.id,n=t.detail.value;if(this.yamlStringsCache[e]=n,this.activeEntry)try{const t=Me(n);if(JSON.stringify(t??{}).includes("null"))return;this.entryChanged({[e]:t}),this.errors=void 0}catch(t){this.errors=[t.message]}}handleEvalCodeChanged(t){t.stopPropagation();const e=t.target.id,n=t.detail.value;this.activeEntry&&this.entryChanged({type:this.activeEntry.type,name:this.activeEntry.name,[e]:{...this.activeEntry[e],eval:n}})}handleBaseTabSelected(t){this.yamlStringsCache={},this.yamlString=void 0,this.entryIndex=-1,this.guiMode=!0;const e=t.detail.index;this.baseTabIndex!=e&&(this.baseTabIndex=e)}handleActionsTabSelected(t){this.yamlStringsCache={};const e=t.detail.index;this.actionsTabIndex!=e&&(this.actionsTabIndex=e)}handleTouchpadTabSelected(t){this.yamlString=void 0,this.yamlStringsCache={};const e=t.detail.index;this.touchpadTabIndex!=e&&(this.touchpadTabIndex=e,this.setActionsTab(this.entryIndex))}handleSelectorChange(t){this.yamlStringsCache={};const e=t.target.id;let n=t.detail.value;switch(e.endsWith(".confirmation.exemptions")&&(n=(n??[]).map((t=>({user:t})))),this.baseTabIndex){case 3:case 2:this.entryChanged((0,je.HD)(structuredClone(this.activeEntry),e,n));break;default:this.configChanged({...this.config,[e]:n})}null==n&&setTimeout((()=>{this.configChanged(this.config)}),100)}handleLayoutActionListItemDragStart(t){t.stopPropagation(),t.isTrusted&&t.dataTransfer&&t.dataTransfer.setData("text/plain","- "+t.currentTarget.innerText)}addEntry(t){const e=t.detail.index;let n;3===this.baseTabIndex?(n=structuredClone(this.config.custom_icons)??[],n.push({name:"",path:""})):(n=structuredClone(this.config.custom_actions)??[],n.push({type:Re[e],name:""})),this.entriesChanged(n);const i=this.shadowRoot?.querySelector(".features");i&&setTimeout((()=>i.scrollTop=i.scrollHeight),100)}removeEntry(t){const e=t.currentTarget.index;let n;n=3===this.baseTabIndex?this.config.custom_icons??[]:this.config.custom_actions??[],n=structuredClone(n),n.splice(e,1),this.entriesChanged(n)}moveEntry(t){let e;t.stopPropagation(),e=3===this.baseTabIndex?this.config.custom_icons??[]:this.config.custom_actions??[],e=structuredClone(e);const{oldIndex:n,newIndex:i}=t.detail;e.splice(i,0,e.splice(n,1)[0]),this.entriesChanged(e)}copyEntry(t){let e;e=3===this.baseTabIndex?this.config.custom_icons??[]:this.config.custom_actions??[],e=structuredClone(e);const n=t.currentTarget.index,i=structuredClone(e[n]);i.name=`${i.name}_copy`,e.splice(n,1,e[n],i),this.entriesChanged(e)}editEntry(t){this.yamlStringsCache={},this.yamlString=void 0;const e=t.currentTarget.index;3===this.baseTabIndex||(this.setActionsTab(e),this.touchpadTabIndex=2),this.entryIndex=e}exitEditEntry(t){this.yamlStringsCache={},this.yamlString=void 0,this.entryIndex=-1}setActionsTab(t){let e=this.config.custom_actions?.[t]??{type:"button",name:""};const n=e.type;"touchpad"==n&&2!=this.touchpadTabIndex&&(e=e[this.TOUCHPAD_TABS[this.touchpadTabIndex]]??{});const i=this.getEntryContext(e);"none"!=this.renderTemplate(e?.drag_action?.action??"none",i)||"none"!=this.renderTemplate(e?.multi_drag_action?.action??"none",i)?"touchpad"==n&&2==this.touchpadTabIndex?this.actionsTabIndex=3:this.actionsTabIndex=0:"none"!=this.renderTemplate(e?.momentary_start_action?.action??"none",i)||"none"!=this.renderTemplate(e?.momentary_end_action?.action??"none",i)?"touchpad"==n&&2==this.touchpadTabIndex?this.actionsTabIndex=2:this.actionsTabIndex=1:"touchpad"!=n||"none"==this.renderTemplate(e?.multi_tap_action?.action??"none",i)&&"none"==this.renderTemplate(e?.multi_double_tap_action?.action??"none",i)&&"none"==this.renderTemplate(e?.multi_hold_action?.action??"none",i)?this.actionsTabIndex=0:this.actionsTabIndex=1}buildIconElement(e,n){let i=t.qy``,o=this.renderTemplate(e.icon??e.path??"",n);if(!o.includes(":")){const t=(this.config.custom_icons??[]).filter((t=>t.name==o))[0]??Ue.o$.filter((t=>t.name==o))[0];o=t?.path??o}if(!o.length)switch(this.renderTemplate(e?.type,n)){case"touchpad":o="mdi:gesture-tap-button";break;case"slider":o=this.renderTemplate(e?.vertical??!1,n)?"mdi:tune-vertical-variant":"mdi:tune-variant";break;default:o="mdi:circle-small"}return i=o.includes(":")?t.qy``:t.qy``,i}buildEntryList(){let e,n;return 3===this.baseTabIndex?(e=this.config.custom_icons??[],n="Custom Icons"):(e=this.config.custom_actions??[],n="Custom Actions"),t.qy`
${n}
${e.map(((e,n)=>{const i=this.getEntryContext(e),o=this.buildIconElement(e,i),a=this.renderTemplate(e.label,i),r=this.renderTemplate(e.type,i),s=this.renderTemplate(e.name,i);return t.qy`
${o}
${r} ⸱ ${s} ${a?` ⸱ ${a}`:""} ${i.config.entity?t.qy`${i.config.entity}${i.config.attribute?` ⸱ ${i.config.attribute}`:""}`:""}
`}))}
`}buildAddEntryButton(){return 3===this.baseTabIndex?t.qy``:t.qy`${Re.map((e=>t.qy`${e}`))}`}buildEntryHeader(){let e;return e=3===this.baseTabIndex?"SVG Icon":this.renderTemplate(this.config.custom_actions?.[this.entryIndex]?.type??"button",this.getEntryContext(this.activeEntry??{type:"button",name:""})),t.qy`
${e}
`}buildSelector(e,n,i,o){const a={...this.hass,localize:(t,e)=>({"ui.panel.lovelace.editor.action-editor.actions.repeat":"Repeat","ui.panel.lovelace.editor.action-editor.actions.fire-dom-event":"Fire DOM event","ui.panel.lovelace.editor.action-editor.actions.eval":"Evaluate JS","ui.panel.lovelace.editor.action-editor.actions.key":"Key","ui.panel.lovelace.editor.action-editor.actions.source":"Source","ui.panel.lovelace.editor.action-editor.actions.keyboard":"Keyboard","ui.panel.lovelace.editor.action-editor.actions.textbox":"Textbox","ui.panel.lovelace.editor.action-editor.actions.search":"Search"}[t]??this.hass.localize(t,e))};let r;switch(this.baseTabIndex){case 3:case 2:r=(0,je.vz)(this.activeEntry,n);break;case 1:break;default:r=this.config[n]}return n.endsWith(".confirmation.exemptions")&&(r=(r??[]).map((t=>t.user))),t.qy``}buildMainFeatureOptions(e=t.qy``){const n=this.renderTemplate(this.activeEntry.autofill_entity_id??this.config.autofill_entity_id??Fe.$6,this.getEntryContext(this.activeEntry)),i=(Array.isArray(this.activeEntry?.tap_action?.target?.entity_id)?this.activeEntry?.tap_action?.target?.entity_id?.[0]:this.activeEntry?.tap_action?.target?.entity_id)??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id;return t.qy`${this.buildSelector("Name","name",{text:{}})} ${this.buildSelector("Entity","entity_id",{entity:{}},n?i:void 0)} ${this.hass.states[this.activeEntry?.entity_id??(n?i:"")??""]?this.buildSelector("Attribute","value_attribute",{attribute:{entity_id:this.activeEntry?.entity_id??i}},n?"state":void 0):""}
${e} ${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},this.config.autofill_entity_id??Fe.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},n?this.config.haptics??Fe.Xy:Fe.Xy)}
`}buildAppearancePanel(e=t.qy``){return t.qy`
Appearance
${this.buildAlertBox("Change the feature appearance based on its value using a template like '{{ value | float }}'.")} ${e}${this.buildCodeEditor("css")}
`}buildCommonAppearanceOptions(){const e=this.getEntryContext(this.activeEntry??{type:"button",name:""});let n,i=this.renderTemplate(this.activeEntry?.icon??"",e);if(i&&!i.includes(":")){const e=(this.config.custom_icons??[]).filter((t=>t.name==i))[0]??Ue.o$.filter((t=>t.name==i))[0];i=e?.path??i,n=t.qy``}return t.qy`${this.buildSelector("Label","label",{text:{multiline:!0}})}
${this.buildSelector("Icon","icon",{icon:{}})}${n??""}${this.buildSelector("Units","unit_of_measurement",{text:{}})}
`}buildInteractionsPanel(e){return t.qy`
Interactions
${e}
`}buildActionOption(e,n,i,o=!1){const a=this.getEntryContext(this.activeEntry??{}),r=this.renderTemplate(this.activeEntry.autofill_entity_id??this.config.autofill_entity_id??Fe.$6,a),s=this.renderTemplate(this.activeEntry?.[n]?.action??"none",a),c=this.renderTemplate(this.activeEntry?.[n]?.platform??this.config.platform??"Android TV",a);return t.qy`
${this.buildSelector(e,n,i)} ${"none"!=s&&n.includes("double_tap_action")?this.buildSelector("Double tap window",`${n}.double_tap_window`,{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.double_tap_window:void 0)??Fe.jc):n.includes("hold_action")&&this.activeEntry[n]?t.qy`
${this.buildSelector("Hold time",`${n}.hold_time`,{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.hold_time:void 0)??Fe.At)} ${"repeat"==this.renderTemplate(this.activeEntry?.[n]?.action,a)?this.buildSelector("Repeat delay",`${n}.repeat_delay`,{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},(r?this.config.repeat_delay:void 0)??Fe.a3):""}
`:"none"!=s&&n.includes("drag_action")?this.buildSelector("Sampling delay",`${n}.repeat_delay`,{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},0):""} ${"key"==s?t.qy`
${["Kodi","LG webOS"].includes(c)?this.buildSelector("Media Player ID",`${n}.media_player_id`,{entity:{filter:{domain:"media_player"}}},r?this.config.media_player_id:void 0):this.buildSelector("Remote ID",`${n}.remote_id`,{entity:{filter:{domain:"remote"}}},r?this.config.remote_id:void 0)} ${this.buildSelector("Platform",`${n}.platform`,{select:{mode:"dropdown",options:De,reorder:!1}},r?this.config.platform??"Android TV":"Android TV")}
${this.buildSelector("Key",`${n}.key`,{text:{}})}`:""} ${"source"==s?t.qy`
${["Android TV"].includes(c)?this.buildSelector("Remote ID",`${n}.remote_id`,{entity:{filter:{domain:"remote"}}},r?this.config.remote_id:void 0):this.buildSelector("Media Player ID",`${n}.media_player_id`,{entity:{filter:{domain:"media_player"}}},r?this.config.media_player_id:void 0)} ${this.buildSelector("Platform",`${n}.platform`,{select:{mode:"dropdown",options:De,reorder:!1}},r?this.config.platform??"Android TV":"Android TV")}
${this.buildSelector("Source",`${n}.source`,{text:{}})}`:""} ${["keyboard","textbox","search"].includes(s)?t.qy`
${this.buildSelector("Keyboard ID",`${n}.keyboard_id`,{entity:{filter:{domain:["remote","media_player"]}}},r?this.config.keyboard_id:void 0)} ${this.buildSelector("Platform",`${n}.platform`,{select:{mode:"dropdown",options:$e,reorder:!1}},r&&$e.includes(this.config.platform)?this.config.platform:"Android TV")}
${["Android TV","Roku"].includes(c)?t.qy`
${this.buildSelector("Remote ID",`${n}.remote_id`,{entity:{filter:{domain:"remote"}}},r?this.config.remote_id:void 0)} ${"Roku"==c?this.buildSelector("Media Player ID",`${n}.media_player_id`,{entity:{filter:{domain:"media_player"}}},r?this.config.media_player_id:void 0):""}
`:""} ${this.buildSelector("Prompt",`${n}.keyboard_prompt`,{text:{}})}`:""} ${"more-info"==s?this.buildSelector("Entity",`${n}.target.entity_id`,{entity:{}},r?this.activeEntry?.entity_id??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id:void 0):""} ${"toggle"==s?this.buildSelector("Target",`${n}.target`,{target:{}}):""} ${o||"fire-dom-event"==s?this.buildCodeEditor("action",n):""} ${"eval"==s?t.qy`${this.buildAlertBox("Evaluating raw JavaScript strings in browser is considered extremely unsafe. Do not use unless you know what you're doing!","warning")} ${this.buildCodeEditor("eval",n)}`:""} ${"none"!=s?t.qy`${this.buildSelector("Confirmation",`${n}.confirmation`,{boolean:{}},!1)} ${this.activeEntry?.[n]?.confirmation?t.qy`${this.buildSelector("Text",`${n}.confirmation.text`,{text:{}})} ${this.buildSelector("Exemptions",`${n}.confirmation.exemptions`,{select:{multiple:!0,mode:"list",options:this.people,reorder:!1}})}`:""}`:""}
`}buildTabBar(e,n,i){return t.qy`${i.map((e=>t.qy``))}`}buildButtonGuiEditor(){const e=this.buildTabBar(this.actionsTabIndex,this.handleActionsTabSelected,["default","momentary"]);let n;const i=Pe.concat();i.splice(Pe.indexOf("repeat"),1);const o={ui_action:{actions:i}};return n=1===this.actionsTabIndex?t.qy`${e} ${this.buildAlertBox("Enabling momentary actions disables tap, double tap, and hold actions.","warning")} ${this.buildActionOption("Start behavior (optional)","momentary_start_action",o)} ${this.buildAlertBox("Set the action below, and then use the code editor to set a data field to the seconds the feature was held down using a template like '{{ hold_secs | float }}'.")} ${this.buildActionOption("End behavior (optional)","momentary_end_action",o,!0)}`:t.qy`${e} ${this.buildActionOption("Tap behavior (optional)","tap_action",o)} ${this.buildActionOption("Double tap behavior (optional)","double_tap_action",o)} ${this.buildActionOption("Hold behavior (optional)","hold_action",{ui_action:{actions:Pe}})}`,t.qy`${this.buildMainFeatureOptions()} ${this.buildAppearancePanel(this.buildCommonAppearanceOptions())} ${this.buildInteractionsPanel(n)}`}buildSliderGuiEditor(){const e=Pe.concat();e.splice(Pe.indexOf("repeat"),1);const n=this.getEntryContext(this.activeEntry??{}),i=Number(this.renderTemplate(this.activeEntry?.range?.[0],n)),o=Number(this.renderTemplate(this.activeEntry?.range?.[0],n)),a=Number(this.renderTemplate(this.activeEntry?.step,n)),r=this.renderTemplate(this.activeEntry?.unit_of_measurement,n);return t.qy`${this.buildMainFeatureOptions(t.qy`${this.buildSelector("Min","range.0",{number:{max:o??void 0,step:a,mode:"box",unit_of_measurement:r},RANGE_MIN:Fe.HB})} ${this.buildSelector("Max","range.1",{number:{min:i??void 0,step:a,mode:"box",unit_of_measurement:r},RANGE_MAX:Fe.bQ})} ${this.buildSelector("Step","step",{number:{min:0,step:a??Math.min(1,((o??Fe.bQ)-(i??Fe.HB))/Fe.zM),mode:"box",unit_of_measurement:r},STEP:Fe.RZ})} ${this.buildSelector("Update after action delay","value_from_hass_delay",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},Fe.s$)}`)} ${this.buildAppearancePanel(t.qy`${this.buildCommonAppearanceOptions()}${this.buildSelector("Vertical","vertical",{boolean:{}},!1)}`)} ${this.buildInteractionsPanel(t.qy`${this.buildAlertBox()} ${this.buildActionOption("Behavior","tap_action",{ui_action:{actions:e}},!0)}`)}`}buildTouchpadGuiEditor(){const e=["default","multi-touch"];2==this.touchpadTabIndex&&e.push("momentary","drag");const n=this.buildTabBar(this.actionsTabIndex,this.handleActionsTabSelected,e);let i;const o=Pe.concat();o.splice(Pe.indexOf("repeat"),1);const a={ui_action:{actions:o}};switch(this.actionsTabIndex){case 3:i=t.qy`${n} ${this.buildAlertBox("Enabling drag actions disables directional swipe actions.","warning")} ${this.buildActionOption("Drag behavior (optional)","drag_action",a)} ${this.buildActionOption("Multi-touch drag behavior (optional)","multi_drag_action",a)}`;break;case 2:i=t.qy`${n} ${this.buildAlertBox("Enabling momentary actions disables tap, double tap, and hold actions.","warning")} ${this.buildActionOption("Start behavior (optional)","momentary_start_action",a)} ${this.buildAlertBox("Set the action below, and then use the code editor to set a data field to the seconds the feature was held down using a template like '{{ hold_secs | float }}'.")} ${this.buildActionOption("End behavior (optional)","momentary_end_action",a,!0)}`;break;case 1:i=t.qy`${n} ${this.buildActionOption(`Multi-touch ${2==this.touchpadTabIndex?"tap":"swipe"} behavior (optional)`,"multi_tap_action",a)} ${2==this.touchpadTabIndex?this.buildActionOption("Multi-touch double tap behavior (optional)","multi_double_tap_action",a):""} ${this.buildActionOption("Multi-touch hold behavior (optional)","multi_hold_action",{ui_action:{actions:Pe}})}`;break;default:i=t.qy`${n} ${this.buildActionOption((2==this.touchpadTabIndex?"Tap":"Swipe")+" behavior (optional)","tap_action",a)} ${2==this.touchpadTabIndex?this.buildActionOption("Double tap behavior (optional)","double_tap_action",a):""} ${this.buildActionOption("Hold behavior (optional)","hold_action",{ui_action:{actions:Pe}})}`}const r=this.buildTabBar(this.touchpadTabIndex,this.handleTouchpadTabSelected,this.TOUCHPAD_TABS);return t.qy`${r} ${2==this.touchpadTabIndex?this.buildMainFeatureOptions():""} ${this.buildAppearancePanel(this.buildCommonAppearanceOptions())} ${this.buildInteractionsPanel(i)}`}buildIconGuiEditor(){return t.qy`
${this.buildAlertBox("Icons must be resized to 24x24px to display correctly. Use a tool like https://yqnn.github.io/svg-path-editor/ to edit your SVG paths. If correctly sized the icon will perfectly fit in the preview ouline below.","info")} ${this.buildSelector("Name","name",{text:{}})} ${this.buildSelector("SVG Path","path",{text:{multiline:!0}})}
`}buildEntryGuiEditor(){let e;if(3===this.baseTabIndex)e=this.buildIconGuiEditor();else switch(this.config.custom_actions?.[this.entryIndex]?.type){case"slider":e=this.buildSliderGuiEditor();break;case"touchpad":e=this.buildTouchpadGuiEditor();break;default:e=this.buildButtonGuiEditor()}return t.qy`
${e}
`}buildCodeEditor(e,n){let i,o,a,r,s,c;switch(e){case"css":c="jinja2",o=(this.entryIndex>-1?this.activeEntry?.styles:this.config.styles)??"",a=this.handleStyleCodeChanged,i="CSS Styles",r=!0,s=!1;break;case"action":c="yaml",a=this.handleActionCodeChanged,n=n??"tap_action",o=this.yamlStringsCache[n]??Ie(this.activeEntry?.[n]??{}),o="{}"==o.trim()?"":o,r=!0,s=!1;break;case"layout":c="yaml",o=this.yaml,a=this.handleYamlCodeChanged,o="[]"==o.trim()?"":o,r=!1,s=!1;break;case"eval":c="jinja2",o=this.yamlStringsCache[`${n}.eval`]??(this.activeEntry?.[n]).eval??"",a=this.handleEvalCodeChanged,r=!1,s=!1;break;default:c="yaml",o=this.yaml,a=this.handleYamlCodeChanged,r=!0,s=!0}return t.qy`
${i?t.qy`
${i}
`:""}
`}buildEntryEditor(){let e;return e=this.guiMode?this.buildEntryGuiEditor():this.buildCodeEditor("yaml"),t.qy`${this.buildEntryHeader()}
${e}
`}buildLayoutEditor(){const e=Array.from(new Set([...this.config.custom_actions?.map((t=>t.name))??[],...this.customActionsFromFile?.map((t=>t.name))??[]])),n=e.map((t=>this.config.custom_actions?.filter((e=>e.name==t))[0]??this.customActionsFromFile?.filter((e=>e.name==t))[0]??{type:"button",name:""})),i=this.DEFAULT_KEYS.filter((t=>!e.includes(t.name))),o=this.DEFAULT_SOURCES.filter((t=>!e.includes(t.name)));return t.qy`
${this.buildCodeEditor("layout")}
${n?.length?t.qy`
Custom Actions
    ${n.map((e=>{const n=this.getEntryContext(e),i=this.buildIconElement(e,n);return t.qy`
  • ${i} ${e.name}
  • `}))}

`:""}
${i.length?t.qy`
Default Keys
    ${i.map((e=>{const n=this.getEntryContext(e),i=this.buildIconElement(e,n);return t.qy`
  • ${i} ${e.name}
  • `}))}
`:""} ${o.length?t.qy`
Default Sources
    ${o.map((e=>{const n=this.getEntryContext(e),i=this.buildIconElement(e,n);return t.qy`
  • ${i} ${e.name}
  • `}))}
`:""}
`}buildGeneralEditor(){return t.qy`
Media Platform and Entity IDs
${this.buildSelector("Platform","platform",{select:{mode:"dropdown",options:De,reorder:!1}},"Android TV")} ${this.buildSelector("Remote ID","remote_id",{entity:{filter:{domain:"remote"}}})} ${this.buildSelector("Keyboard ID","keyboard_id",{entity:{filter:{domain:["remote","media_player"]}}})} ${this.buildSelector("Media Player ID","media_player_id",{entity:{filter:{domain:"media_player"}}})}
Action Timings
${this.buildSelector("Hold time","hold_time",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},Fe.At)} ${this.buildSelector("Repeat delay","repeat_delay",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},Fe.a3)} ${this.buildSelector("Double tap window","double_tap_window",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},Fe.jc)}
Miscellaneous
${this.buildCodeEditor("css")}
${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},Fe.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},Fe.Xy)}
${this.buildSelector("Title","title",{text:{}})}
${this.buildSelector("Custom Actions File","custom_actions_file",{text:{}})}
`}buildErrorPanel(){return t.qy`${this.errors&&this.errors.length>0?t.qy`
${this.hass.localize("ui.errors.config.error_detected")}:
    ${this.errors.map((e=>t.qy`
  • ${e}
  • `))}
`:""}`}buildAlertBox(e="Set the action below, and then use the code editor to set a data field to the feature's new value using a template like '{{ value | float }}'.",n="info"){return t.qy``}buildPeopleList(){this.people=[];const t=Object.keys(this.hass.states).filter((t=>t.startsWith("person.")));for(const e of t)this.people.push({value:this.hass.states[e].attributes.user_id,label:this.hass.states[e].attributes.friendly_name??this.hass.states[e].attributes.id??e})}fetchCustomActionsFromFile(t){if(!this.customActionsFromFile&&t){t=`${t.startsWith("/")?"":"/"}${t}`;try{const e=t.split(".").pop()?.toLowerCase();this.hass.fetchWithAuth(t).then((t=>"json"==e?t.json():t.text())).then((t=>{const n="json"==e?t:Me(t);if(!Array.isArray(n))throw TypeError(n);this.customActionsFromFile=n,this.requestUpdate()}))}catch(e){console.error(`File ${t} is not a valid JSON or YAML array\n${e}`),this.customActionsFromFile=[]}}}render(){if(!this.hass||!this.config)return t.qy``;const e={config:{...this.config,entity:(0,n.X)(this.hass,this.config.remote_id??this.config.media_player_id??this.config.keyboard_id??""),attribute:"state"}};this.buildPeopleList(),this.fetchCustomActionsFromFile((0,n.X)(this.hass,this.config.custom_actions_file??""));const i=(0,n.X)(this.hass,this.config.platform??"Android TV",e),[o,a]=(0,je.XO)(i);this.DEFAULT_KEYS=o,this.DEFAULT_SOURCES=a,this.DEFAULT_ACTIONS=[...o,...a];const r=this.buildTabBar(this.baseTabIndex,this.handleBaseTabSelected,this.BASE_TABS);let s;switch(this.baseTabIndex){case 3:case 2:s=this.entryIndex>-1&&this.activeEntry?t.qy`${this.buildEntryEditor()}`:t.qy`${this.buildEntryList()}${this.buildAddEntryButton()}`;break;case 1:s=this.buildLayoutEditor();break;default:s=this.buildGeneralEditor()}return t.qy`${r}${s}${this.buildErrorPanel()}`}renderTemplate(t,e){e={render:t=>this.renderTemplate(t,e),...e};const i=(0,n.X)(this.hass,t,e);if(i!=t)return i;if("string"==typeof t)for(const n of["VALUE","HOLD_SECS","UNIT"]){if(t==n)return e[n];t.includes(n)&&(t=t.replace(new RegExp(n,"g"),e[n]??""))}return t}getEntryContext(t){const e={VALUE:0,HOLD_SECS:0,UNIT:"",value:0,hold_secs:0,unit:"",config:{...t,entity:"",attribute:""}};e.config.attribute=this.renderTemplate(t?.value_attribute??"state",e),e.config.entity=this.renderTemplate(t?.entity_id??(Array.isArray(t?.tap_action?.target?.entity_id)?t?.tap_action?.target?.entity_id?.[0]:t?.tap_action?.target?.entity_id)??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id,e);const n=this.renderTemplate(t?.unit_of_measurement,e);e.UNIT=n,e.unit=n;const i=this.getFeatureValue(e.config.entity,e.config.attribute);return e.VALUE=i,e.value=i,e}getFeatureValue(t,e){if(this.hass.states[t]){if("state"!=e&&e){let n;const i=e.match(/\[\d+\]$/);if(i){const o=parseInt(i[0].replace(/\[|\]/g,""));return e=e.replace(i[0],""),n=this.hass.states[t].attributes[e],n&&Array.isArray(n)&&n.length?n[o]:void 0}if(n=this.hass.states[t].attributes[e],null!=n||"elapsed"==e)switch(e){case"brightness":return Math.round(100*parseInt(n??0)/255);case"elapsed":if(t.startsWith("timer.")){const e=this.hass.states[t].attributes.duration.split(":"),n=3600*parseInt(e[0])+60*parseInt(e[1])+parseInt(e[2]);if("idle"==this.hass.states[t].state)return 0;if("active"==this.hass.states[t].state){const e=(Date.parse(this.hass.states[t].attributes.finishes_at)-Date.now())/1e3,i=Math.floor(n-e);return Math.min(i,n)}{const e=this.hass.states[t].attributes.remaining.split(":"),i=3600*parseInt(e[0])+60*parseInt(e[1])+parseInt(e[2]);return Math.floor(n-i)}}default:return n}return n}return this.hass.states[t].state}return""}updatePlatform(t){switch(t){case"KODI":case"Kodi":return"Kodi";case"ROKU":case"Roku":return"Roku";case"FIRE":case"FIRETV":case"FIRE_TV":case"FIRE TV":case"Fire TV":return"Fire TV";case"BRAVIA":case"Sony BRAVIA":return"Sony BRAVIA";case"APPLE TV":case"Apple TV":return"Apple TV";case"SAMSUNG TV":case"Samsung TV":return"Samsung TV";case"WEBOS":case"LG webOS":return"LG webOS";case"ANDROID":case"ANDROIDTV":case"ANDROID_TV":case"ANDROID TV":case"Android TV":return"Android TV";default:return}}autofillDefaultFields(t){const e=structuredClone(t),n=[];for(const t of e.custom_actions??[])n.push(this.autofillDefaultEntryFields(e,t));return e.custom_actions=n,e}autofillDefaultEntryFields(t,e,n,i){const o=this.getEntryContext(e);if(this.renderTemplate(e.autofill_entity_id??t.autofill_entity_id??Fe.$6,o)){if(n&&i){const t=structuredClone([...this.customActionsFromFile??[],...this.DEFAULT_ACTIONS].filter((t=>t.name==n))[0])??{},o=t[i];e={...o,...e}}else{const t=structuredClone([...this.customActionsFromFile??[],...this.DEFAULT_ACTIONS].filter((t=>t.name==this.renderTemplate(e.name,o)))[0])??{};e={...t,...e,value_attribute:e.value_attribute??t.value_attribute}}for(const t of Ne)if(e[t]){const n=e[t]??{};switch(this.renderTemplate(n.action,o)){case"keyboard":case"textbox":case"search":case"key":case"source":break;case"toggle":case"more-info":case"service":case"perform-action":for(const t of["entity_id","device_id","area_id","label_id"])n.data?.[t]&&(n.target=n.target??{},n.target[t]=n.data?.[t],delete n.data?.[t]);default:delete n.keyboard_id,delete n.keyboard_prompt,delete n.remote_id,delete n.media_player_id,delete n.platform}e[t]=n}if("touchpad"==this.renderTemplate(e.type,o))for(const n of Ve)e[n]&&(e[n]=this.autofillDefaultEntryFields(t,e[n]??{},this.renderTemplate(e.name,o),n))}return e}handleUpdateDeprecatedConfig(){const t=this.updateDeprecatedFields(this.config);this.configChanged(t)}updateDeprecatedFields(t=this.config){const e=structuredClone(t);if("adb_id"in e&&(e.keyboard_id=e.adb_id,delete e.adb_id),"keyboard_mode"in e&&(e.platform=e.keyboard_mode,delete e.keyboard_mode),e.platform=this.updatePlatform(e.platform),"enable_button_feedback"in e&&(e.haptics=e.enable_button_feedback),"button_haptics"in e&&(e.haptics=e.button_haptics),!e.rows){const n=[],i=Object.keys(e).filter((t=>t.includes("_row")));for(const o of i){let i=t[o];"string"==typeof i&&(i=[i]),"volume_row"==o?i=["volume_"+i[0]]:"navigation_row"==o&&(i=["navigation_"+i[0]]),n.push(i),delete e[o]}e.rows=n}const n=JSON.stringify(e.rows??[]).replace(/vol_buttons/g,"volume_buttons").replace(/nav_buttons/g,"navigation_buttons").replace(/d_pad/g,"dpad").replace(/direction_pad/g,"dpad").replace(/num_pad/g,"numpad").replace(/number_pad/g,"numpad").replace(/x_pad/g,"xpad").replace(/gamepad/g,"xpad").replace(/xgamepad/g,"xpad").replace(/x_gamepad/g,"xpad").replace(/n_pad/g,"npad").replace(/ngamepad/g,"npad").replace(/n_gamepad/g,"npad").replace(/volume_slider/g,"slider").replace(/nav_touchpad/g,"touchpad").replace(/navigation_touchpad/g,"touchpad");if(e.rows=JSON.parse(n),!Array.isArray(e.custom_icons)&&"object"==typeof e.custom_icons&&null!=e.custom_icons){const t=[];for(const n of Object.keys(e.custom_icons))t.push({name:n,path:e?.custom_icons?.[n]});e.custom_icons=t}let i=[];if(Array.isArray(e.custom_actions)||"object"!=typeof e.custom_actions||null==e.custom_actions)i=e.custom_actions??[];else for(const t of Object.keys(e.custom_actions))i.push({...e.custom_actions?.[t],name:t});for(const t of["custom_keys","custom_sources"])if(t in e){for(const n of Object.keys(e[t]))i.push({...e[t]?.[n],name:n});delete e[t]}const o=i.findIndex((t=>"slider"==t.name)),a=i[o]??{type:"slider",name:"slider"};let r=!1;if("slider_style"in e){let t=a.styles??"";t+="\n:host {";const n=e.slider_style;for(const e in n)t+=`\n ${e}: ${n[e]};`;t+="\n}",a.styles=t.trim(),delete e.slider_style,r=!0}if("tooltip"in a){let t=a.styles??"";t+=`\n.tooltip {\n display: {{ "initial" if render(${a.tooltip}) else "none" }};\n}`,a.styles=t.trim(),r=!0}if("slider_range"in e&&(a.range=e.slider_range,delete e.slider_range,r=!0),"slider_step"in e&&(a.step=e.slider_step,delete e.slider_step,r=!0),"slider_attribute"in e&&(a.value_attribute=e.slider_attribute,delete e.slider_attribute,r=!0),"enable_slider_feedback"in e&&(a.haptics=e.enable_slider_feedback,delete e.enable_slider_feedback,r=!0),"slider_haptics"in e&&(a.haptics=e.slider_haptics,delete e.slider_haptics,r=!0),"slider_id"in e){e.media_player_id||(e.media_player_id=e.slider_id),a.entity_id=a.entity_id??e.slider_id??t.media_player_id??"";const n=a.tap_action??this.DEFAULT_KEYS.filter((t=>"slider"==t.name))[0].tap_action;if(n){const t=n.data??{},i=n.target??{};"entity_id"in i||(i.entity_id=t.entity_id??e.slider_id,delete t.entity_id),n.data=t,n.target=i}a.tap_action=n,delete e.slider_id,r=!0}if(r){const t=this.DEFAULT_KEYS.filter((t=>"slider"==t.name))[0];o>-1?i[o]={...structuredClone(t),...a}:i.push({...structuredClone(t),...a})}const s=i.findIndex((t=>"touchpad"==t.name)),c=i[s]??{type:"touchpad",name:"touchpad"};let l=!1;if("touchpad_style"in e){let t=c.styles??"";t+="\ntoucharea {";const n=e.touchpad_style;for(const e in n)t+=`\n ${e}: ${n[e]};`;t+="\n}",c.styles=t.trim(),delete e.touchpad_style,l=!0}if("touchpad_height"in e){let t=c.styles??"";t+=`\ntoucharea {\n height: ${e.touchpad_height};\n}`,c.styles=t.trim(),delete e.touchpad_height,l=!0}"enable_touchpad_feedback"in e&&(c.haptics=e.enable_touchpad_feedback,delete e.enable_touchpad_feedback,l=!0),"touchpad_haptics"in e&&(c.haptics=e.touchpad_haptics,delete e.touchpad_haptics,l=!0),"enable_double_click"in e&&(c.double_tap_action={action:"key",key:e.double_click_keycode??"BACK"},delete e.enable_double_click,delete e.double_click_keycode,l=!0),"long_click_keycode"in e&&(c.hold_action={action:"key",key:e.long_click_keycode??"DPAD_CENTER"},l=!0);const u=this.DEFAULT_KEYS.filter((t=>"touchpad"==t.name))[0];if(e.rows.toString().includes("touchpad")){const t=i.filter((t=>"center"==t.name))[0];if(t){for(const e of Ne)t[e]?c[e]=t[e]:u[e]&&!c[e]&&(c[e]=u[e]);l=!0}for(const t of Ve){const n=i.filter((e=>e.name==t))[0];!c[t]&&n&&e.rows.toString().includes("touchpad")&&(c[t]=n,delete c[t]?.icon,l=!0)}}if(l){for(const t of Ve)c[t]||(c[t]=structuredClone(u[t]??{}),delete c[t]?.type,delete c[t]?.icon);s>-1?i[s]={...structuredClone(u),...c}:i.push({...structuredClone(u),...c})}for(const[t,e]of i.entries()){const n=this.updateDeprecatedActionFields(e,i);for(const t of Ve)n[t]&&(n[t]=this.updateDeprecatedActionFields(n[t],i));i[t]=n}if(e.style){let t=e.styles??"";t+="\n:host {";const n=e.style;for(const e in n)t+=`\n ${e}: ${n[e]};`;t+="\n}",e.styles=t.trim(),delete e.style}if(e.button_style){let t=e.styles??"";t+="\nremote-button {";const n=e.button_style;for(const e in n)t+=`\n ${e}: ${n[e]};`;t+="\n}",e.styles=t.trim(),delete e.button_style}if(e.row_styles){let t=e.styles??"";const n=e.row_styles;for(const e in n){if(e.includes("-"))t+=`\n#${e} {`;else if("rows"==e)t+="\n.row {";else{if("columns"!=e)continue;t+="\n.column {"}for(const i in n[e])t+=`\n ${i}: ${n[e][i]};`;t+="\n}"}e.styles=t.trim(),delete e.row_styles}return e.custom_actions=i,e}updateDeprecatedActionFields(t,e){let n=structuredClone(t);"svg_path"in n&&(n.icon=n.svg_path);const i=["key","source","service","service_data","data","target","navigation_path","navigation_replace","url_path","confirmation","pipeline_id","start_listening"],o=n.tap_action??{};let a=!1;for(const t of i)t in n&&(a=!0,o[t]=n[t],delete n[t]);a&&(n.tap_action=o);for(const t of Ne)if(t in n){const e=n[t];e&&(e.action?"call-service"==e.action&&(e.action="perform-action",e.perform_action=e.service??"",delete e.service):e.key?e.action="key":e.source?e.action="source":e.perform_action?e.action="perform-action":e.service?(e.action="perform-action",e.perform_action=e.service,delete e.service):e.navigation_path?e.action="navigate":e.url_path?e.action="url":e.browser_mod?e.action="fire-dom-event":e.pipeline_id||e.start_listening?e.action="assist":e.action="none",e.service_data&&(e.data={...e.service_data,...e.data},delete e.service_data),n[t]=e)}if(n.type=(n.type??"button").toLowerCase(),n.style){let t=n.styles??"";t+="\n:host {";const e=n.style;for(const n in e)t+=`\n ${n}: ${e[n]};`;t+="\n}",n.styles=t.trim(),delete n.style}if("template"in t){const i=e?.filter((e=>t.template==e.name))[0]??this.DEFAULT_ACTIONS.filter((e=>t.template==e.name))[0]??{};n=(0,je.D9)(structuredClone(i),t),delete n.template}return n}static get styles(){return t.AH`:host{display:flex;flex-direction:column;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}.content{padding:12px;display:inline-flex;flex-direction:column;gap:24px;box-sizing:border-box;width:100%}.action-options{display:inline-flex;flex-direction:column;gap:8px;box-sizing:border-box;width:100%}ha-expansion-panel{display:block;border-radius:6px;border:solid 1px var(--outline-color);--ha-card-border-radius:6px;--expansion-panel-content-padding:0}ha-icon{display:flex;color:var(--secondary-text-color)}.add-list-item{margin:0 18px 12px}ha-button{width:fit-content;--mdc-icon-size:100%}ha-list-item{text-transform:capitalize}.features{max-height:480px;overflow:auto;overflow-y:scroll}.feature-list-item{display:flex;align-items:center;pointer-events:none}.handle{display:flex;align-items:center;cursor:move;cursor:grab;padding-right:8px;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction);pointer-events:all}.feature-list-item-content{height:60px;font-size:16px;display:flex;align-items:center;justify-content:flex-start;flex-grow:1;gap:8px;overflow:hidden}.primary:first-letter{text-transform:capitalize}.feature-list-item-label{display:flex;flex-direction:column}.secondary{font-size:12px;color:var(--secondary-text-color)}.copy-icon,.edit-icon,.remove-icon{color:var(--secondary-text-color);pointer-events:all;--mdc-icon-button-size:36px}.header{display:inline-flex;justify-content:space-between;align-items:center}.text-icon{color:var(--mdc-dialog-content-ink-color,rgba(0,0,0,.6))}.back-title{display:flex;align-items:center;font-size:18px}.wrapper{width:100%}.gui-editor{display:inline-flex;flex-direction:column;gap:24px;padding:8px 0;width:100%}.yaml-editor{display:inline-flex;flex-direction:column;padding:8px 0;width:100%}ha-code-editor{--code-mirror-max-height:calc(100vh - 245px)}.layout-editor{display:flex;flex-direction:column;font-weight:500}.actions-list-container{background:var(--code-editor-background-color,var(--mdc-text-field-fill-color,#f5f5f5));padding:4px;border-radius:4px}.default-action-lists-container{display:flex;flex-direction:row}.action-list-container{max-height:285px;overflow:scroll}.custom-action-list-container{max-height:190px}.action-list{columns:1;-webkit-columns:1;-moz-columns:1;margin-top:4px;padding-left:4px}.two-column-action-list{columns:2;-webkit-columns:2;-moz-columns:2}.action-list-item::marker{content:''}.action-list-item{display:flex;flex-direction:row;align-items:center;gap:4px;padding:2px 0}.action-list-item-label{width:100%;background:0 0;border:none;outline:0;font-family:monospace;font-size:14px}.error,.info{word-break:break-word;margin-top:8px}.error{color:var(--error-color)}.error ul{margin:4px 0}.error li,.warning li{white-space:pre-wrap}.title-header{font-size:20px;font-weight:500;padding:12px 4px}.panel-header{display:inline-flex;gap:4px}.style-header{font-size:var(--mdc-typography-body1-font-size,1rem);font-weight:500;padding:8px}.form{display:grid;grid-template-columns:repeat(var(--form-grid-column-count,auto-fit),minmax(var(--form-grid-min-width,200px),1fr));gap:24px 8px}.actions-form{display:grid;grid-template-columns:repeat(var(--form-grid-column-count,auto-fit),minmax(var(--form-grid-min-width,200px),1fr));gap:8px}.selector-margin{margin:8px 0}.custom-icon-picked{position:absolute;padding:16px;pointer-events:none}.custom-icon-preview{align-self:center;outline:1px dashed var(--primary-color);--mdc-icon-size:50%}mwc-tab-bar{--mdc-tab-horizontal-padding:16px}`}}Ke([(0,e.MZ)()],Be.prototype,"hass",void 0),Ke([(0,e.MZ)()],Be.prototype,"config",void 0),Ke([(0,e.wk)()],Be.prototype,"baseTabIndex",void 0),Ke([(0,e.wk)()],Be.prototype,"entryIndex",void 0),Ke([(0,e.wk)()],Be.prototype,"actionsTabIndex",void 0),Ke([(0,e.wk)()],Be.prototype,"touchpadTabIndex",void 0),Ke([(0,e.wk)()],Be.prototype,"guiMode",void 0),Ke([(0,e.wk)()],Be.prototype,"errors",void 0);var He=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};let Ye=class extends t.WF{constructor(){super(...arguments),this.onKeyDownFired=!1}getRokuId(t){return(this.config?.keyboard_id??"").split(".")[0]!=t?"media_player"===t?this.config?.media_player_id:this.config?.remote_id:this.config?.keyboard_id}forceCursorToEnd(){this.textarea.selectionStart=this.textarea.value.length,this.textarea.selectionEnd=this.textarea.value.length}forceCursorToEndEvent(t){t.preventDefault(),this.forceCursorToEnd()}kodiOnKeyDown(t){if(t.stopImmediatePropagation(),["Backspace","Enter"].includes(t.key)){const t=this.textarea?.value??"";this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:t,done:!1})}}kodiOnInput(t){t.stopImmediatePropagation();const e=this.textarea?.value??"";this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:e,done:!1})}webosOnKeyDown(t){if(t.stopImmediatePropagation(),["Backspace","Enter"].includes(t.key)){const t=this.textarea?.value??"";this.hass.callService("webostv","command",{entity_id:this.config?.keyboard_id,command:"com.webos.service.ime/insertText",payload:{text:t,replace:!0}})}}webosOnInput(t){t.stopImmediatePropagation();const e=this.textarea?.value??"";this.hass.callService("webostv","command",{entity_id:this.config?.keyboard_id,command:"com.webos.service.ime/insertText",payload:{text:e,replace:!0}})}unifiedRemoteOnKeyDown(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e={Backspace:"back",Enter:"enter"}[t.key??""];e&&(this.onKeyDownFired=!0,this.hass.callService("unified_remote","call",{target:this.config?.keyboard_id,remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:e}]}}))}unifiedRemoteOnInput(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.inputType??"",n=t.data??"";if(n&&"insertText"==e)this.hass.callService("unified_remote","call",{target:this.config?.keyboard_id,remote_id:"Core.Input",action:"Text",extras:{Values:[{Value:n}]}});else if(!this.onKeyDownFired){const t={deleteContentBackward:"back",insertLineBreak:"enter"}[e??""];t&&this.hass.callService("unified_remote","call",{target:this.config?.keyboard_id,remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:t}]}})}this.onKeyDownFired=!1}rokuOnKeyDown(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.key,n={Backspace:"backspace",Enter:"enter"}[e??""];n&&(this.onKeyDownFired=!0,this.hass.callService("remote","send_command",{entity_id:this.getRokuId("remote"),command:n}),"Enter"==e&&this.closeDialog())}rokuOnInput(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.inputType??"",n=t.data??"";if(n&&"insertText"==e)this.hass.callService("remote","send_command",{entity_id:this.config?.keyboard_id,command:`Lit_${n}`});else if(!this.onKeyDownFired){const t={deleteContentBackward:"backspace",insertLineBreak:"enter"}[e??""];t&&this.hass.callService("remote","send_command",{entity_id:this.getRokuId("remote"),command:t})}this.onKeyDownFired=!1}adbOnKeyDown(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.key,n={Backspace:"67",Enter:"66"}[e??""];n&&(this.onKeyDownFired=!0,this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input keyevent ${n}`}),"Enter"==e&&this.closeDialog())}adbOnInput(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.inputType??"",n=t.data??"";if(n&&"insertText"==e)this.adbSendText(n);else if(!this.onKeyDownFired){const t={deleteContentBackward:"67",insertLineBreak:"66"}[e??""];t&&this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input keyevent ${t}`})}this.onKeyDownFired=!1}adbSendText(t){this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input text "${t}"`})}androidTvOnKeyDown(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.key,n={Backspace:"DEL",Enter:"ENTER"}[e??""];n&&(this.onKeyDownFired=!0,this.hass.callService("remote","send_command",{entity_id:this.config?.remote_id,command:n}),"Enter"==e&&this.closeDialog())}androidTvOnInput(t){t.stopImmediatePropagation(),this.forceCursorToEnd();const e=t.inputType??"",n=t.data??"";if(n&&"insertText"==e)this.adbSendText(n);else if(!this.onKeyDownFired){const t={deleteContentBackward:"DEL",insertLineBreak:"ENTER"}[e??""];t&&(this.hass.callService("remote","send_command",{entity_id:this.config?.remote_id,command:t}),"insertLineBreak"==e&&this.closeDialog())}this.onKeyDownFired=!1}keyboardOnPaste(t){t.stopImmediatePropagation(),"Kodi"!=this.config?.platform&&this.forceCursorToEnd();const e=t.clipboardData?.getData("Text");if(e)switch(this.config?.platform){case"Unified Remote":this.hass.callService("unified_remote","call",{target:this.config?.keyboard_id,remote_id:"Core.Input",action:"Text",extras:{Values:[{Value:e}]}});break;case"Kodi":this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:this.textarea?.value??"",done:!1});break;case"LG webOS":this.hass.callService("webostv","command",{entity_id:this.config?.keyboard_id,command:"com.webos.service.ime/insertText",text:this.textarea?.value??"",replace:!0});break;case"Roku":this.hass.callService("remote","send_command",{entity_id:this.config?.keyboard_id,command:`Lit_${e}`});break;default:this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input text "${e}"`})}}search(t){const e=this.textarea?.value;if(e)switch(this.config?.platform){case"Kodi":this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:e,done:!0});break;case"LG webOS":break;case"Roku":this.hass.callService("roku","search",{entity_id:this.getRokuId("media_player"),keyword:e});break;default:this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`am start -a "android.search.action.GLOBAL_SEARCH" --es query "${e}"`})}this.closeDialog()}textBox(t){const e=this.textarea?.value;if(e)switch(this.config?.platform){case"Unified Remote":this.hass.callService("unified_remote","call",{target:this.config?.keyboard_id,remote_id:"Core.Input",action:"Text",extras:{Values:[{Value:e}]}});break;case"Kodi":this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:e,done:!1});break;case"LG webOS":this.hass.callService("webostv","command",{entity_id:this.config?.keyboard_id,command:"com.webos.service.ime/insertText",payload:{text:e,replace:!0}});break;case"Roku":this.hass.callService("remote","send_command",{entity_id:this.getRokuId("remote"),command:`Lit_${e}`});break;default:this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:`input text "${e}"`})}this.closeDialog()}enterDialog(){switch(this.config?.platform){case"Unified Remote":this.hass.callService("unified_remote","call",{target:this.config?.keyboard_id,remote_id:"Core.Input",action:"Press",extras:{Values:[{Value:"enter"}]}});break;case"Kodi":this.hass.callService("kodi","call_method",{entity_id:this.config?.keyboard_id,method:"Input.SendText",text:this.textarea?.value??"",done:!0});break;case"LG webOS":this.hass.callService("webostv","command",{entity_id:this.config?.keyboard_id,command:"com.webos.service.ime/sendEnterKey"});break;case"Roku":this.hass.callService("remote","send_command",{entity_id:this.getRokuId("remote"),command:"enter"});break;case"Fire TV":case"Sony BRAVIA":this.hass.callService(this.domain??"remote",this.service??"send_command",{entity_id:this.config?.keyboard_id,command:"input keyevent 66"});break;default:this.hass.callService("remote","send_command",{entity_id:this.config?.remote_id,command:"ENTER"})}this.closeDialog()}showDialog(t){this.config=t.detail,"media_player"===(this.config?.keyboard_id??"").split(".")[0]?(this.domain="androidtv",this.service="adb_command"):(this.domain="remote",this.service="send_command");const e=this.shadowRoot?.querySelector("dialog");if(e){try{e.showModal()}catch{e.close(),e.showModal()}window.addEventListener("popstate",(()=>this.closeDialog()))}this.textarea=this.shadowRoot?.querySelector("textarea");const n=this.textarea;"Kodi"==this.config?.platform&&"search"==this.config?.action&&this.hass.callService("kodi","call_method",{entity_id:this.config.keyboard_id,method:"Addons.ExecuteAddon",addonid:"script.globalsearch"}),setTimeout((()=>{n&&n.focus()}),.4)}cancelDialog(t){t.preventDefault(),this.closeDialog()}closeDialog(t){const e=this.shadowRoot?.querySelector("dialog");if(e){try{e.close()}catch{e.showModal(),e.close()}window.removeEventListener("popstate",(()=>this.closeDialog()))}this.textarea&&(this.textarea.value="",this.textarea.blur()),this.config=void 0,this.domain=void 0,this.service=void 0,this.textarea=void 0}buildDialogButton(e,n){return t.qy`
${e}
`}render(){let e,n,i,o,a,r=t.qy``;switch(this.config?.action){case"search":e="Search for something...",r=t.qy`${this.buildDialogButton("Close",this.closeDialog)}${this.buildDialogButton("Search",this.search)}`;break;case"textbox":e="Type something...",r=t.qy`${this.buildDialogButton("Close",this.closeDialog)}${this.buildDialogButton("Send",this.textBox)}`;break;default:switch(a=this.forceCursorToEndEvent,this.config?.platform){case"Unified Remote":n=this.unifiedRemoteOnInput,i=this.unifiedRemoteOnKeyDown;break;case"Kodi":n=this.kodiOnInput,i=this.kodiOnKeyDown,a=void 0;break;case"LG webOS":n=this.webosOnInput,i=this.webosOnKeyDown,a=void 0;break;case"Roku":n=this.rokuOnInput,i=this.rokuOnKeyDown;break;case"Fire TV":case"Sony BRAVIA":n=this.adbOnInput,i=this.adbOnKeyDown;break;default:n=this.androidTvOnInput,i=this.androidTvOnKeyDown}e="Type something...",o=this.keyboardOnPaste,r=t.qy`${this.buildDialogButton("Close",this.closeDialog)}${this.buildDialogButton("Enter",this.enterDialog)}`}e=this.config?.keyboard_prompt??e;const s=t.qy``;return t.qy`${s}
${r}
`}static get styles(){return t.AH`:host{-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}dialog{height:0;width:0;display:inline-flex;flex-direction:column;position:fixed;border:none;background:var(--ha-card-background,var(--card-background-color,#fff));border-radius:var(--ha-card-border-radius,12px);opacity:0;transition:all .1s ease-in-out;pointer-events:none}dialog[open]{height:fit-content;width:85%;opacity:1;transition:all .1s ease-in-out;pointer-events:all}textarea{position:relative;height:180px;padding:8px;outline:0;background:0 0;border:none;resize:none;font-family:inherit;font-weight:500;font-size:30px}.buttons{height:36px;display:inline-flex;flex-direction:row;justify-content:space-between;margin:0 12px}.button{height:100%;width:min-content;align-content:center;cursor:pointer;border-radius:var(--mdc-shape-small,4px);overflow:hidden}button{height:100%;width:100%;background:0 0;opacity:1;border:none;overflow:hidden;cursor:pointer;padding:0}@media (hover:hover){button:hover{background:var(--ha-ripple-color);opacity:var(--md-ripple-hover-opacity)}}button:active{background:var(--ha-ripple-color);opacity:var(--md-ripple-pressed-opacity)}.button span{font-family:inherit;font-size:var(--paper-font-body1_-_font-size);font-weight:600;text-transform:uppercase;color:var(--mdc-theme-primary,#6200ee);user-select:none;-webkit-user-select:none;-moz-user-select:none;position:relative;top:-32px;padding:0 8px;pointer-events:none}dialog::backdrop{background:#000;opacity:.7}`}};He([(0,e.MZ)()],Ye.prototype,"hass",void 0),He([(0,e.wk)()],Ye.prototype,"config",void 0),Ye=He([(0,e.EM)("keyboard-dialog")],Ye);var Ze=__webpack_require__(44),ze=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};let qe=class extends Ze.W{constructor(){super(...arguments),this.clickCount=0,this.hold=!1}onClick(t){if(t.stopImmediatePropagation(),this.clickCount++,"none"!=this.renderTemplate(this.config.double_tap_action?.action??"none")){if(this.clickCount>1)this.fireHapticEvent("success"),this.sendAction("double_tap_action"),this.endAction();else if(!this.clickTimer){const t=this.renderTemplate(this.config.double_tap_action?.double_tap_window)??Fe.jc;this.clickTimer=setTimeout((()=>{this.fireHapticEvent("light"),this.sendAction("tap_action"),this.endAction()}),t)}}else this.fireHapticEvent("light"),this.sendAction("tap_action"),this.endAction()}onStart(t){if(super.onStart(t),this.cancelRippleToggle(),this.swiping=!1,"none"!=this.renderTemplate(this.config.momentary_start_action?.action??"none"))this.fireHapticEvent("light"),this.momentaryStart=performance.now(),this.sendAction("momentary_start_action");else if("none"!=this.renderTemplate(this.config.momentary_end_action?.action??"none"))this.fireHapticEvent("light"),this.momentaryStart=performance.now();else if(!this.holdTimer){const t=this.renderTemplate(this.config.hold_action?.hold_time??Fe.At);this.holdTimer=setTimeout((()=>{if(!this.swiping)if(this.hold=!0,"repeat"==this.renderTemplate(this.config.hold_action?.action)){const t=this.renderTemplate(this.config.hold_action?.repeat_delay??Fe.a3);this.holdInterval||(this.holdInterval=setInterval((()=>{this.fireHapticEvent("selection"),this.sendAction("tap_action")}),t))}else this.fireHapticEvent("medium"),this.sendAction("hold_action")}),t)}}onEnd(t){this.swiping||("none"!=this.renderTemplate(this.config.momentary_end_action?.action??"none")?(this.fireHapticEvent("selection"),this.momentaryEnd=performance.now(),this.sendAction("momentary_end_action"),this.endAction()):"none"!=this.renderTemplate(this.config.momentary_start_action?.action??"none")?this.endAction():this.hold?(t.stopImmediatePropagation(),t.preventDefault(),this.endAction()):this.onClick(t)),this.toggleRipple()}onMove(t){let e,n;"targetTouches"in t?(e=t.targetTouches[0].clientX,n=t.targetTouches[0].clientY):(e=t.clientX,n=t.clientY),this.deltaX=e-(this.currentX??e),this.deltaY=n-(this.currentY??n),this.currentX=e,this.currentY=n;const i=this.currentX-(this.initialX??0),o=this.currentY-(this.initialY??0);Math.abs(Math.abs(i)-Math.abs(o))>24&&(this.endAction(),this.swiping=!0)}onMouseLeave(t){this.endAction(),this.swiping=!0,this.toggleRipple()}onTouchCancel(t){this.endAction(),this.toggleRipple()}endAction(){clearTimeout(this.clickTimer),this.clickTimer=void 0,this.clickCount=0,clearTimeout(this.holdTimer),clearInterval(this.holdInterval),this.holdTimer=void 0,this.holdInterval=void 0,this.hold=!1,super.endAction()}render(){return this.setValue(),t.qy` ${this.buildStyles(this.config.styles)}`}static get styles(){return[super.styles,t.AH`:host{align-content:center;text-align:center}button{display:flex;height:100%;width:100%;border-radius:var(--size,48px);overflow:visible;cursor:pointer;pointer-events:all;position:relative;opacity:1;padding:0;background:rgb(0,0,0,0);border:none;flex-direction:column;align-content:center;text-align:center;justify-content:center;align-items:center;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}`]}};ze([(0,e.MZ)()],qe.prototype,"config",void 0),qe=ze([(0,e.EM)("remote-button")],qe);var We=__webpack_require__(740);class Xe{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const Ge="important",Je=" !"+Ge,Qe=(tn=class extends Xe{constructor(t){if(super(t),1!==t.type||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,n)=>{const i=t[n];return null==i?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`}),"")}update(t,[e]){const{style:n}=t.element;if(void 0===this.ut)return this.ut=new Set(Object.keys(e)),this.render(e);for(const t of this.ut)null==e[t]&&(this.ut.delete(t),t.includes("-")?n.removeProperty(t):n[t]=null);for(const t in e){const i=e[t];if(null!=i){this.ut.add(t);const e="string"==typeof i&&i.endsWith(Je);t.includes("-")||e?n.setProperty(t,e?i.slice(0,-11):i,e?Ge:""):n[t]=i}}return We.c0}},(...t)=>({_$litDirective$:tn,values:t}));var tn,en=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};let nn=class extends Ze.W{constructor(){super(...arguments),this.showTooltip=!1,this.thumbOffset=0,this.sliderOn=!0,this.currentValue=this.value,this.speed=.02,this.range=[Fe.HB,Fe.bQ],this.step=Fe.RZ,this.sliderWidth=0,this.sliderHeight=0,this.vertical=!1,this.thumbWidth=50,this.resizeObserver=new ResizeObserver((t=>{for(const e of t)this.sliderWidth=this.vertical?e.contentRect.height:e.contentRect.width,this.sliderHeight=this.vertical?e.contentRect.width:e.contentRect.height,this.setThumbOffset()})),this.rtl=!1}onInput(t){const e=t.currentTarget;if(this.swiping)null==this.value&&(this.getValueFromHass=!0),this.setValue(),this.currentValue=this.value??0,this.setThumbOffset(),this.showTooltip=!1;else{clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,this.value=e.value,this.fireHapticEvent("selection");const t=parseFloat(this.oldValue??this.value??"0"),n=parseFloat(e.value??t);this.newValue=n,this.currentValue=t,this.setThumbOffset(),this.showTooltip=!0,n>this.range[0]&&(this.sliderOn=!0),clearInterval(this.intervalId),this.intervalId=void 0;let i=t;t>n?this.intervalId=setInterval((()=>{i-=this.speed,this.currentValue=i,this.setThumbOffset(),n>=i&&(clearInterval(this.intervalId),this.intervalId=void 0,this.currentValue=n,this.setThumbOffset())}),Fe.hI):t{i+=this.speed,this.currentValue=i,this.setThumbOffset(),n<=i&&(clearInterval(this.intervalId),this.intervalId=void 0,this.currentValue=n,this.setThumbOffset())}),Fe.hI)):this.currentValue=n,this.oldValue=n}}onStart(t){super.onStart(t);const e=t.currentTarget;this.swiping||(clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,this.currentValue=e.value,this.value=e.value,this.setThumbOffset(),this.showTooltip=!0,this.sliderOn=!0)}onEnd(t){this.setThumbOffset(),this.showTooltip=!1,this.setValue(),this.swiping?(this.getValueFromHass=!0,this.setValue(),this.currentValue=this.value??0,this.setThumbOffset(),this.setSliderState(this.currentValue)):(this.newValue||0==this.newValue||(this.newValue=Number(this.value)),this.precision||(this.newValue=Math.trunc(this.newValue)),this.value=this.newValue,this.fireHapticEvent("light"),this.sendAction("tap_action")),this.endAction(),this.resetGetValueFromHass()}onMove(t){if(!this.vertical&&null!=this.initialX&&null!=this.initialY){super.onMove(t);const e=50;Math.abs((this.currentX??0)-(this.initialX??0))this.range[0]}endAction(){clearInterval(this.valueUpdateInterval),this.valueUpdateInterval=void 0,super.endAction()}buildBackground(){const e={};return this.vertical&&(e.transform=`rotateZ(${this.rtl?"90":"270"}deg)`,e.width=`${this.sliderWidth}px`,e.height=`var(--background-height, ${this.sliderHeight}px)`),t.qy`
`}buildTooltip(){return t.qy`
`}buildSliderStyles(e){let n,i;const o=this.shadowRoot?.querySelector(".container");if(o){const t=getComputedStyle(o);n=t.getPropertyValue("height"),i=t.getPropertyValue("width")}const a=`'${this.renderTemplate("{{ value }}{{ unit }}",e)}'`;let r,s;this.vertical?(r=`translate(calc(-0.3 * ${i??"var(--height)"} - 0.8em - 18px), calc(-1 * var(--thumb-offset)))`,s="translateY(calc(-1 * var(--thumb-offset)))"):(r=`translate(var(--thumb-offset), calc(-0.5 * ${n??"var(--height)"} - 0.4em - 10px))`,s="translateX(var(--thumb-offset))");const c=`\n\t\t:host {\n\t\t\t--tooltip-label: ${a};\n\t\t\t--tooltip-transform: ${r};\n\t\t\t--icon-transform: ${s};\n\t\t}\n\t\t${this.rtl?"\n\t\t.slider::-webkit-slider-thumb {\n\t\t\tscale: -1;\n\t\t}\n\t\t.slider::-moz-range-thumb {\n\t\t\tscale: -1;\n\t\t}\n\t\t":""}\n\t\t`;return t.qy``}buildSlider(e=this.config,n){const i=n.value;this.setSliderState(i);const o={};return"none"==this.renderTemplate(e.tap_action?.action,n)&&(o["pointer-events"]="none"),this.vertical&&(o.transform=`rotateZ(${this.rtl?"90":"270"}deg)`,o.height=`${this.sliderHeight}px`,o.width=`${this.sliderWidth}px`,o["touch-action"]="none"),t.qy``}render(){this.setValue(),this.getValueFromHass&&(this.currentValue=this.value);const e={VALUE:this.getValueFromHass?this.value:this.currentValue,value:this.getValueFromHass?this.value:this.currentValue};this.config.range&&(this.range[0]=parseFloat(this.renderTemplate(this.config.range[0],e)??Fe.HB),this.range[1]=parseFloat(this.renderTemplate(this.config.range[1],e)??Fe.bQ)),this.speed=(this.range[1]-this.range[0])/50,this.config.step?this.step=Number(this.renderTemplate(this.config.step,e)):this.step=(this.range[1]-this.range[0])/Fe.zM;const n=this.step.toString().split(".");n.length>1?this.precision=n[1].length:this.precision=0,this.vertical=1==this.renderTemplate(this.config.vertical??!1,e),this.resizeObserver.observe(this);const i={},o=this.shadowRoot?.querySelector("input");if(o){const t=getComputedStyle(o),e=t.getPropertyValue("--thumb-width"),n=t.getPropertyValue("--height");this.thumbWidth=e?parseInt(e.replace(/[^0-9]+/g,"")):parseInt(n.replace(/[^0-9]+/g,"")),this.vertical&&(this.style.setProperty("width","fit-content"),this.style.setProperty("align-self","stretch"),i.height=`${this.sliderWidth}px`,i.width="var(--height)")}return this.rtl="rtl"==getComputedStyle(this).direction,this.setThumbOffset(),this.style.setProperty("--thumb-offset",`calc(${this.rtl&&!this.vertical?"-1 * ":""}${this.thumbOffset}px)`),t.qy`
${this.buildBackground()}${this.buildSlider(void 0,e)} ${this.buildIcon(this.config.icon,e)} ${this.buildLabel(this.config.label,e)}
${this.buildTooltip()}${this.buildSliderStyles(e)} ${this.buildStyles(this.config.styles,e)}`}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver.disconnect()}static get styles(){return[super.styles,t.AH`:host{display:flex;flex-flow:column;flex-grow:0;place-content:center space-evenly;align-items:center;position:relative;height:unset;width:100%;border:none;border-radius:25px;padding:0;box-sizing:border-box;line-height:0;outline:0;overflow:visible;font-size:inherit;color:inherit;pointer-events:none;--color:var(--primary-text-color);--height:48px}.container{all:inherit;overflow:hidden;height:var(--height);align-self:center;color:var( --background, - var(--primary-background-color) - )}.off,.slider{position:absolute;appearance:none;-webkit-appearance:none;-moz-appearance:none;pointer-events:all;height:100%;width:inherit;background:0 0;overflow:hidden}.slider::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;height:var(--height);width:var(--thumb-width,var(--height));cursor:pointer;background:var(--color);border-color:rgb(0,0,0,0);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,var(--height))/ 2)) 0 0 100vw var(--color));border-radius:var(--thumb-border-radius,var(--height))}.slider::-moz-range-thumb{appearance:none;-webkit-appearance:none;height:var(--height);width:var(--thumb-width,var(--height));cursor:pointer;background:var(--color);border-color:rgb(0,0,0,0);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,var(--height))/ 2)) 0 0 100vw var(--color));border-radius:var(--thumb-border-radius,var(--height))}.off::-webkit-slider-thumb{visibility:hidden}.off::-moz-range-thumb{visibility:hidden}.tooltip{background:var(--clear-background-color);color:var(--primary-text-color);position:absolute;border-radius:.8em;padding:.2em .4em;height:20px;width:fit-content;line-height:20px;transform:var(--tooltip-transform);display:var(--tooltip-display)}.faded-out{opacity:0;transition:opacity 180ms ease-in-out 0s,left 180ms ease-in-out 0s,bottom 180ms ease-in-out 0s}.faded-in{opacity:1;transition:opacity 540ms ease-in-out 0s}.tooltip::after{content:var(--tooltip-label,0)}.icon{color:var(--icon-color,var(--background,var(--primary-background-color)));--mdc-icon-size:var(--size, 32px)}`]}};en([(0,e.MZ)()],nn.prototype,"config",void 0),en([(0,e.wk)()],nn.prototype,"showTooltip",void 0),en([(0,e.wk)()],nn.prototype,"thumbOffset",void 0),en([(0,e.wk)()],nn.prototype,"sliderOn",void 0),en([(0,e.wk)()],nn.prototype,"currentValue",void 0),en([(0,e.wk)()],nn.prototype,"sliderWidth",void 0),en([(0,e.wk)()],nn.prototype,"sliderHeight",void 0),nn=en([(0,e.EM)("remote-slider")],nn);var on=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};let an=class extends Ze.W{constructor(){super(...arguments),this.clickCount=0,this.hold=!1,this.holdStart=!1,this.holdMove=!1}onClick(t){t.stopImmediatePropagation(),this.clickCount++;const e=this.targetTouches?.length||1;if("none"!=this.renderTemplate(this.config.double_tap_action?.action??"none")||"none"!=this.renderTemplate(this.config.multi_double_tap_action?.action??"none")){const t=`${this.getMultiPrefix()}double_tap_action`;if(this.clickCount>e)this.fireHapticEvent("success"),this.sendAction(t),this.endAction();else if(!this.clickTimer){const e=this.getMultiPrefix();let n="double_tap_window"in(this.config[t]??{})?this.renderTemplate(this.config[t]?.double_tap_window):je.jc;"multi_"==e&&this.config.multi_double_tap_action&&(n=this.renderTemplate(this.config.multi_double_tap_action?.double_tap_window??je.a3)),this.clickTimer=setTimeout((()=>{this.fireHapticEvent("light"),this.sendAction(`${e}tap_action`),this.endAction()}),n)}}else this.fireHapticEvent("light"),this.sendAction(`${this.getMultiPrefix()}tap_action`),this.endAction()}onStart(t){if(this.cancelRippleToggle(),this.holdStart=!0,this.direction||"none"==this.renderTemplate(this.config.momentary_start_action?.action??"none")?this.direction||"none"==this.renderTemplate(this.config.momentary_end_action?.action??"none")?this.holdTimer||this.setHoldTimer():(this.fireHapticEvent("light"),this.momentaryStart=performance.now()):(this.fireHapticEvent("light"),this.momentaryStart=performance.now(),this.sendAction("momentary_start_action")),"targetTouches"in t){let e=0,n=0;this.targetTouches=t.targetTouches;for(const t of this.targetTouches)e+=t.clientX,n+=t.clientY;this.initialX=e/this.targetTouches.length,this.initialY=n/this.targetTouches.length}else this.initialX=t.clientX,this.initialY=t.clientY}onEnd(t){this.direction||"none"==this.renderTemplate(this.config.momentary_end_action?.action??"none")?this.direction||"none"==this.renderTemplate(this.config.momentary_start_action?.action??"none")?this.hold||this.holdMove?(t.stopImmediatePropagation(),t.preventDefault(),this.endAction(),"targetTouches"in t&&t.targetTouches?.length&&(this.hold=!0)):"targetTouches"in t&&t.targetTouches.length||this.onClick(t):this.endAction():(this.momentaryEnd=performance.now(),this.fireHapticEvent("selection"),this.sendAction("momentary_end_action"),this.endAction()),this.toggleRipple()}onMove(t){if(!this.initialX||!this.initialY||!this.holdStart)return;let e=0,n=0;if("targetTouches"in t){this.targetTouches=t.targetTouches;for(const t of this.targetTouches)e+=t.clientX,n+=t.clientY;e/=this.targetTouches.length,n/=this.targetTouches.length}else e=t.clientX??0,n=t.clientY??0;const i=this.initialX-e,o=this.initialY-n;Math.abs(Math.abs(i)-Math.abs(o))>2&&(Math.abs(i)>Math.abs(o)?this.direction=i>0?"left":"right":this.direction=o>0?"up":"down",this.holdMove||(this.fireHapticEvent("light"),this.sendAction(`${this.getMultiPrefix()}tap_action`,this.getActions()),this.holdMove=!0,this.holdTimer&&(clearTimeout(this.holdTimer),this.holdTimer=void 0,this.setHoldTimer())))}onMouseLeave(t){this.endAction(),this.toggleRipple()}onTouchCancel(t){this.endAction(),this.toggleRipple()}endAction(){clearTimeout(this.holdTimer),clearInterval(this.holdInterval),clearTimeout(this.clickTimer),this.holdTimer=void 0,this.holdInterval=void 0,this.clickTimer=void 0,this.hold=!1,this.holdStart=!1,this.holdMove=!1,this.direction=void 0,this.clickCount=0,this.initialX=void 0,this.initialY=void 0,this.targetTouches=void 0,super.endAction()}getActions(){return this.direction?this.config[this.direction]:this.config}getMultiPrefix(){return this.targetTouches&&this.targetTouches.length>1?"multi_":""}setHoldTimer(){const t=`${this.getMultiPrefix()}hold_action`,e=this.getActions(),n=this.renderTemplate(e[t]?.hold_time??je.At);this.holdTimer=setTimeout((()=>{this.hold=!0;const t=this.getActions(),e=this.getMultiPrefix();let n="repeat"==this.renderTemplate(t.hold_action?.action),i=this.renderTemplate(t.hold_action?.repeat_delay??je.a3);"multi_"==e&&t.multi_hold_action&&(n="repeat"==this.renderTemplate(t.multi_hold_action?.action),i=this.renderTemplate(t.multi_hold_action?.repeat_delay??je.a3)),n?this.holdInterval||(this.holdInterval=setInterval((()=>{this.fireHapticEvent("selection"),this.sendAction(`${this.getMultiPrefix()}tap_action`,this.getActions())}),i)):(this.fireHapticEvent("medium"),this.sendAction(`${this.getMultiPrefix()}hold_action`,t))}),n)}render(){return this.setValue(),t.qy`
${this.buildRipple()}
${this.buildStyles(this.config.styles)}`}static get styles(){return[super.styles,t.AH`:host{display:contents;--mdc-ripple-press-opacity:0.04}toucharea{border-radius:32px;flex-grow:1;height:250px;width:-moz-available;width:-webkit-fill-available;width:fill-available;background:var(--primary-background-color,#6f767d);touch-action:none;text-align:center;position:relative;overflow:hidden;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:space-between}.toucharea-row{min-height:var(--size,48px);display:flex;flex-direction:row;flex-wrap:nowrap;width:-moz-available;width:-webkit-fill-available;width:fill-available;justify-content:space-around;align-items:center}`]}};on([(0,e.MZ)()],an.prototype,"config",void 0),an=on([(0,e.EM)("remote-touchpad")],an);let rn=class extends Ze.W{render(){return this.setValue(),t.qy`${this.buildIcon(this.config.icon)}${this.buildLabel(this.config.label)}${this.buildStyles(this.config.styles)}`}};rn=on([(0,e.EM)("remote-icon-label")],rn);var sn=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};console.info("%c UNIVERSAL-REMOTE-CARD v4.2.1","color: white; font-weight: bold; background: green");class cn extends t.WF{constructor(){super(...arguments),this.DEFAULT_ACTIONS=[],this.nRows=0,this.nColumns=0,this.nPads=0,this.editMode=!1,this.rtl=!1}static get properties(){return{hass:{},config:{}}}static getConfigElement(){return document.createElement("universal-remote-card-editor")}static getStubConfig(){return{type:"custom:android-tv-card",rows:[]}}getCardSize(){let t=this.config.rows?.length??0;return this.config.title&&(t+=1),t}async setConfig(t){if(!t)throw new Error("Invalid configuration");this.config=t}updateElementConfig(t){if(!Object.keys(t).length)return t;const e=structuredClone(t),i={config:{...this.config,entity:(0,n.X)(this.hass,e.entity_id??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id??""),attribute:(0,n.X)(this.hass,e.value_attribute??"state")}};for(const t of Pe)if(e[t]){const o=e[t]??{};switch((0,n.X)(this.hass,o.action,i)){case"keyboard":case"textbox":case"search":o.keyboard_id=o.keyboard_id??this.config.keyboard_id;case"key":case"source":o.remote_id=o.remote_id??this.config.remote_id,o.media_player_id=o.media_player_id??this.config.media_player_id,o.platform=o.platform??this.config.platform;break;case"perform-action":{const[t,a]=(0,n.X)(this.hass,o.perform_action??"",i).split("."),r=o.target??{};if(!(r.entity_id||r.device_id||r.area_id||r.label_id)){const o=(0,n.X)(this.hass,e.entity_id??"",i);switch(t){case"remote":r.entity_id=o.startsWith("remote")?e.entity_id:this.config.remote_id;break;case"media_player":case"androidtv":case"kodi":case"denonavr":case"webostv":r.entity_id=o.startsWith("media_player")?e.entity_id:this.config.media_player_id;break;default:r.entity_id=e.entity_id}}o.target=r;break}}e[t]=o}e.haptics=e.haptics??this.config.haptics??!0,this.config.double_tap_window&&(e.double_tap_action&&(e.double_tap_action.double_tap_window=e.double_tap_action?.double_tap_window??this.config.double_tap_window??je.jc),e.multi_double_tap_action&&(e.multi_double_tap_action.double_tap_window=e.multi_double_tap_action.double_tap_window??this.config.double_tap_window??je.jc)),(this.config.hold_time||e.double_tap_action||e.multi_double_tap_action)&&(e.hold_action=e.hold_action??{},e.hold_action.hold_time=e.hold_action?.hold_time??this.config.hold_time??je.At,e.multi_hold_action=e.multi_hold_action??{},e.multi_hold_action.hold_time=e.multi_hold_action?.hold_time??this.config.hold_time??je.At),this.config.repeat_delay&&("repeat"==e.hold_action?.action&&(e.hold_action.repeat_delay=e.hold_action.repeat_delay??this.config.repeat_delay??je.a3),e.multi_hold_action&&"repeat"==e.multi_hold_action?.action&&(e.multi_hold_action.repeat_delay=e.multi_hold_action.repeat_delay??this.config.repeat_delay??je.a3));const o=(0,n.X)(this.hass,e.type,i);if("slider"==o&&"slider"==(0,n.X)(this.hass,e.name,i)?e.entity_id=e.entity_id??this.config.media_player_id:e.entity_id=e.entity_id??(Array.isArray(e.tap_action?.target?.entity_id)?e.tap_action?.target?.entity_id?.[0]:e.tap_action?.target?.entity_id)??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id,"touchpad"==o)for(const t of Fe)e[t].entity_id=e.entity_id,e[t].value_attribute=e.value_attribute,e[t]=this.updateElementConfig(e[t]??{});return e.card=this.config,e}getElementConfig(t){const e=[...this.config.custom_actions??[],...this.customActionsFromFile??[]].filter((e=>e.name==t))[0];return e?e.autofill_entity_id??this.config.autofill_entity_id??je.$6?this.updateElementConfig(e):e:this.updateElementConfig(this.DEFAULT_ACTIONS.filter((e=>e.name==t))[0]??{})}buildRow(e){this.nRows++;const n=`row-${this.nRows}`;return t.qy`
${e}
`}buildColumn(e){this.nColumns++;const n=`column-${this.nColumns}`;return t.qy`
${e}
`}buildPad(e){this.nPads++;const n=`pad-${this.nPads}`;return t.qy`
${e.map((t=>this.buildButton(t,this.getElementConfig(t))))}
`}buildButton(e,n){return Object.keys(n).length?t.qy``:t.qy`
`}buildSlider(e,n){return t.qy``}buildTouchpad(e,n){return t.qy``}buildVolumeButtons(){return[this.buildButton("volume_down",this.getElementConfig("volume_down")),this.buildButton("volume_mute",this.getElementConfig("volume_mute")),this.buildButton("volume_up",this.getElementConfig("volume_up"))]}buildNavButtons(){const t=[this.buildButton("left",this.getElementConfig("left")),this.buildButton("center",this.getElementConfig("center")),this.buildButton("right",this.getElementConfig("right"))];return this.rtl&&t.reverse(),this.buildColumn([this.buildRow([this.buildButton("up",this.getElementConfig("up"))]),this.buildRow(t),this.buildRow([this.buildButton("down",this.getElementConfig("down"))])])}buildElements(t,e=!1,i={}){"string"==typeof t&&(t=[t]);const o=[];for(let a of t)if(a=(0,n.X)(this.hass,a,i),"string"==typeof a&&a.includes("- ")&&(a=Me(a)),"object"==typeof a&&null!=a)o.push(this.buildElements(a,!e,i));else switch(a){case"volume_buttons":{const t=this.buildVolumeButtons();e&&t.reverse(),o.push(...t);break}case"navigation_buttons":o.push(this.buildNavButtons());break;case"dpad":o.push(this.buildPad(["","up","","left","center","right","","down",""]));break;case"numpad":o.push(this.buildPad(["n7","n8","n9","n4","n5","n6","n1","n2","n3"]));break;case"xpad":o.push(this.buildPad(["","y","","x","","b","","a",""]));break;case"npad":o.push(this.buildPad(["","x","","y","","a","","b",""]));break;default:{const t=this.getElementConfig(a);switch(t.type){case"slider":o.push(this.buildSlider(a,t));break;case"touchpad":o.push(this.buildTouchpad(a,t));break;default:o.push(this.buildButton(a,t))}break}}return e?this.buildColumn(o):this.buildRow(o)}buildDialog(){return t.qy``}fetchCustomActionsFromFile(t){if(!this.customActionsFromFile&&t){t=`${t.startsWith("/")?"":"/"}${t}`;try{const e=t.split(".").pop()?.toLowerCase();this.hass.fetchWithAuth(t).then((t=>"json"==e?t.json():t.text())).then((t=>{const n="json"==e?t:Me(t);if(!Array.isArray(n))throw TypeError(n);this.customActionsFromFile=n,this.requestUpdate()}))}catch(e){console.error(`File ${t} is not a valid JSON or YAML array\n${e}`),this.customActionsFromFile=[]}}}render(){if(!this.config||!this.hass)return t.qy``;const e={config:{...this.config,entity:(0,n.X)(this.hass,this.config.remote_id??this.config.media_player_id??this.config.keyboard_id??""),attribute:"state"}};this.fetchCustomActionsFromFile((0,n.X)(this.hass,this.config.custom_actions_file??"")),this.editMode=Boolean(document.querySelector("home-assistant")?.shadowRoot?.querySelector("hui-dialog-edit-card")?.shadowRoot?.querySelector("ha-dialog")),this.rtl="rtl"==getComputedStyle(this).direction;const i=(0,n.X)(this.hass,this.config.platform??"Android TV",e),[o,a]=(0,Ke.XO)(i);this.DEFAULT_ACTIONS=[...o,...a];const r=[];this.nRows=0,this.nColumns=0,this.nPads=0;for(const t of this.config.rows??[]){const n=this.buildElements(t,!1,e);r.push(n)}const s=this.config.styles?t.qy``:"";return t.qy`${r}${this.buildDialog()}${s}`}static get styles(){return t.AH`ha-card{padding:12px;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent;--md-ripple-hover-opacity:var(--ha-ripple-hover-opacity, 0.08);--md-ripple-pressed-opacity:var( + var( + --lovelace-background, + var(--primary-background-color) + ) + )}.background{position:absolute;width:inherit;height:var(--background-height,100%);background:var( + --background, + var( + --lovelace-background, + var(--primary-background-color) + ) + )}.off,.slider{position:absolute;appearance:none;-webkit-appearance:none;-moz-appearance:none;pointer-events:all;height:100%;width:inherit;background:0 0;overflow:hidden}.slider::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;height:var(--height);width:var(--thumb-width,var(--height));cursor:pointer;background:var(--color);border-color:rgb(0,0,0,0);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,var(--height))/ 2)) 0 0 100vw var(--color));border-radius:var(--thumb-border-radius,var(--height))}.slider::-moz-range-thumb{appearance:none;-webkit-appearance:none;height:var(--height);width:var(--thumb-width,var(--height));cursor:pointer;background:var(--color);border-color:rgb(0,0,0,0);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,var(--height))/ 2)) 0 0 100vw var(--color));border-radius:var(--thumb-border-radius,var(--height))}.off::-webkit-slider-thumb{visibility:hidden}.off::-moz-range-thumb{visibility:hidden}.tooltip{background:var(--clear-background-color);color:var(--primary-text-color);position:absolute;border-radius:.8em;padding:.2em .4em;height:20px;width:fit-content;line-height:20px;transform:var(--tooltip-transform);display:var(--tooltip-display)}.faded-out{opacity:0;transition:opacity 180ms ease-in-out 0s,left 180ms ease-in-out 0s,bottom 180ms ease-in-out 0s}.faded-in{opacity:1;transition:opacity 540ms ease-in-out 0s}.tooltip::after{content:var(--tooltip-label,0)}.icon{color:var( + --icon-color, + var( + --background, + var( + --lovelace-background, + var(--primary-background-color) + ) + ) + );--mdc-icon-size:var(--size, 32px)}`]}};en([(0,e.MZ)()],nn.prototype,"config",void 0),en([(0,e.wk)()],nn.prototype,"showTooltip",void 0),en([(0,e.wk)()],nn.prototype,"thumbOffset",void 0),en([(0,e.wk)()],nn.prototype,"sliderOn",void 0),en([(0,e.wk)()],nn.prototype,"currentValue",void 0),en([(0,e.wk)()],nn.prototype,"sliderWidth",void 0),en([(0,e.wk)()],nn.prototype,"sliderHeight",void 0),nn=en([(0,e.EM)("remote-slider")],nn);var on=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};let an=class extends Ze.W{constructor(){super(...arguments),this.clickCount=0,this.hold=!1,this.holdStart=!1,this.holdMove=!1,this.fireDragAction=!0}onClick(t){t.stopImmediatePropagation(),this.clickCount++;const e=this.getMultiPrefix();if("none"!=this.renderTemplate(this.config.double_tap_action?.action??"none")||"none"!=this.renderTemplate(this.config.multi_double_tap_action?.action??"none")){const t=`${e}double_tap_action`;if(this.clickCount>1)this.fireHapticEvent("success"),this.sendAction(t),this.endAction();else if(!this.clickTimer){const n=this.renderTemplate(this.config[t]?.double_tap_window??this.config.double_tap_action?.double_tap_window)??Fe.jc;this.clickTimer=setTimeout((()=>{this.fireHapticEvent("light"),this.sendAction(`${e}tap_action`),this.endAction()}),n)}}else this.fireHapticEvent("light"),this.sendAction(`${e}tap_action`),this.endAction()}onStart(t){super.onStart(t),this.cancelRippleToggle(),this.holdStart=!0,this.direction||"none"==this.renderTemplate(this.config.momentary_start_action?.action??"none")?this.direction||"none"==this.renderTemplate(this.config.momentary_end_action?.action??"none")?this.holdTimer||this.setHoldTimer():(this.fireHapticEvent("light"),this.momentaryStart=performance.now()):(this.fireHapticEvent("light"),this.momentaryStart=performance.now(),this.sendAction("momentary_start_action"))}onEnd(t){if(this.direction||"none"==this.renderTemplate(this.config.momentary_end_action?.action??"none"))if(this.direction||"none"==this.renderTemplate(this.config.momentary_start_action?.action??"none"))if(this.hold||this.holdMove){t.stopImmediatePropagation(),t.cancelable&&t.preventDefault();let e=!1;(this.targetTouches?.length??0)>1&&(e=!0),this.endAction(),e&&(this.holdMove=!0)}else this.holdMove||"targetTouches"in t&&t.targetTouches.length||this.onClick(t);else this.endAction();else this.momentaryEnd=performance.now(),this.fireHapticEvent("selection"),this.sendAction("momentary_end_action"),this.endAction();this.toggleRipple()}onMove(t){if(!this.initialX||!this.initialY||!this.holdStart)return;super.onMove(t);const e=this.getMultiPrefix(),n=(this.currentX??0)-this.initialX,i=(this.currentY??0)-this.initialY;if("none"!=this.renderTemplate(this.config[`${e}drag_action`]?.action??"none")){if((this.holdMove||Math.abs(Math.abs(n)-Math.abs(i))>1)&&this.fireDragAction){clearTimeout(this.holdTimer),this.holdTimer=void 0,this.holdMove=!0;const t=this.renderTemplate(this.config[`${e}drag_action`]?.repeat_delay??0);t&&(this.fireDragAction=!1,setTimeout((()=>{this.fireDragAction=!0}),t)),this.sendAction(`${e}drag_action`)}}else Math.abs(Math.abs(n)-Math.abs(i))>2&&(Math.abs(n)>Math.abs(i)?this.direction=n<0?"left":"right":this.direction=i<0?"up":"down",this.holdMove||(this.fireHapticEvent("light"),this.sendAction(`${e}tap_action`,this.getActions()),this.holdMove=!0,this.holdTimer&&(clearTimeout(this.holdTimer),this.holdTimer=void 0,this.setHoldTimer())))}onMouseLeave(t){this.endAction(),this.toggleRipple()}onTouchCancel(t){this.endAction(),this.toggleRipple()}endAction(){clearTimeout(this.clickTimer),this.clickTimer=void 0,this.clickCount=0,clearTimeout(this.holdTimer),clearInterval(this.holdInterval),this.holdTimer=void 0,this.holdInterval=void 0,this.hold=!1,this.holdStart=!1,this.holdMove=!1,this.direction=void 0,super.endAction()}getActions(){return this.direction?this.config[this.direction]:this.config}getMultiPrefix(){return this.targetTouches&&this.targetTouches.length>1?"multi_":""}setHoldTimer(){const t=`${this.getMultiPrefix()}hold_action`,e=this.getActions(),n=this.renderTemplate(e[t]?.hold_time??Fe.At);this.holdTimer=setTimeout((()=>{this.hold=!0;const t=this.getActions(),e=this.getMultiPrefix();let n="repeat"==this.renderTemplate(t.hold_action?.action),i=this.renderTemplate(t.hold_action?.repeat_delay??Fe.a3);"multi_"==e&&t.multi_hold_action&&(n="repeat"==this.renderTemplate(t.multi_hold_action?.action),i=this.renderTemplate(t.multi_hold_action?.repeat_delay??Fe.a3)),n?this.holdInterval||(this.holdInterval=setInterval((()=>{this.fireHapticEvent("selection"),this.sendAction(`${this.getMultiPrefix()}tap_action`,this.getActions())}),i)):(this.fireHapticEvent("medium"),this.sendAction(`${e}hold_action`,t))}),n)}render(){return this.setValue(),t.qy`
${this.buildRipple()}
${this.buildStyles(this.config.styles)}`}static get styles(){return[super.styles,t.AH`:host{display:contents;--mdc-ripple-press-opacity:0.04}toucharea{border-radius:32px;flex-grow:1;height:250px;width:-moz-available;width:-webkit-fill-available;width:fill-available;background:var(--lovelace-background,var(--primary-background-color,#6f767d));touch-action:none;text-align:center;position:relative;overflow:hidden;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:space-between}.toucharea-row{min-height:var(--size,48px);display:flex;flex-direction:row;flex-wrap:nowrap;width:-moz-available;width:-webkit-fill-available;width:fill-available;justify-content:space-around;align-items:center}`]}};on([(0,e.MZ)()],an.prototype,"config",void 0),an=on([(0,e.EM)("remote-touchpad")],an);let rn=class extends Ze.W{render(){return this.setValue(),t.qy`${this.buildIcon(this.config.icon)}${this.buildLabel(this.config.label)}${this.buildStyles(this.config.styles)}`}};rn=on([(0,e.EM)("remote-icon-label")],rn);var sn=function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r};console.info("%c UNIVERSAL-REMOTE-CARD v4.3.3","color: white; font-weight: bold; background: green");class cn extends t.WF{constructor(){super(...arguments),this.DEFAULT_ACTIONS=[],this.nRows=0,this.nColumns=0,this.nPads=0,this.editMode=!1,this.rtl=!1}static get properties(){return{hass:{},config:{}}}static getConfigElement(){return document.createElement("universal-remote-card-editor")}static getStubConfig(){return{type:"custom:android-tv-card",rows:[]}}getCardSize(){let t=this.config.rows?.length??0;return this.config.title&&(t+=1),t}async setConfig(t){if(!t)throw new Error("Invalid configuration");this.config=t}updateElementConfig(t){if(!Object.keys(t).length)return t;const e=structuredClone(t),i={config:{...this.config,entity:(0,n.X)(this.hass,e.entity_id??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id??""),attribute:(0,n.X)(this.hass,e.value_attribute??"state")}};for(const t of Ne)if(e[t]){const o=e[t]??{};switch((0,n.X)(this.hass,o.action,i)){case"keyboard":case"textbox":case"search":o.keyboard_id=o.keyboard_id??this.config.keyboard_id;case"key":case"source":o.remote_id=o.remote_id??this.config.remote_id,o.media_player_id=o.media_player_id??this.config.media_player_id,o.platform=o.platform??this.config.platform;break;case"perform-action":{const[t,a]=(0,n.X)(this.hass,o.perform_action??"",i).split("."),r=o.target??{};if(!(r.entity_id||r.device_id||r.area_id||r.label_id)){const a=(0,n.X)(this.hass,e.entity_id??"",i);switch(t){case"remote":r.entity_id=a.startsWith("remote")?e.entity_id:this.config.remote_id;break;case"media_player":case"androidtv":case"kodi":case"denonavr":case"webostv":r.entity_id=a.startsWith("media_player")?e.entity_id:this.config.media_player_id;break;case"unified_remote":o.data=o.data??{},o.data.target=o.data.target??e.entity_id??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id;break;default:r.entity_id=e.entity_id}}o.target=r;break}}e[t]=o}e.haptics=e.haptics??this.config.haptics??!0,this.config.double_tap_window&&(e.double_tap_action&&(e.double_tap_action.double_tap_window=e.double_tap_action?.double_tap_window??this.config.double_tap_window??Fe.jc),e.multi_double_tap_action&&(e.multi_double_tap_action.double_tap_window=e.multi_double_tap_action.double_tap_window??this.config.double_tap_window??Fe.jc)),this.config.hold_time&&(e.hold_action&&(e.hold_action.hold_time=e.hold_action?.hold_time??this.config.hold_time??Fe.At),e.multi_hold_action&&(e.multi_hold_action.hold_time=e.multi_hold_action?.hold_time??this.config.hold_time??Fe.At)),this.config.repeat_delay&&("repeat"==e.hold_action?.action&&(e.hold_action.repeat_delay=e.hold_action.repeat_delay??this.config.repeat_delay??Fe.a3),e.multi_hold_action&&"repeat"==e.multi_hold_action?.action&&(e.multi_hold_action.repeat_delay=e.multi_hold_action.repeat_delay??this.config.repeat_delay??Fe.a3));const o=(0,n.X)(this.hass,e.type,i);if("slider"==o&&"slider"==(0,n.X)(this.hass,e.name,i)?e.entity_id=e.entity_id??this.config.media_player_id:e.entity_id=e.entity_id??(Array.isArray(e.tap_action?.target?.entity_id)?e.tap_action?.target?.entity_id?.[0]:e.tap_action?.target?.entity_id)??this.config.remote_id??this.config.media_player_id??this.config.keyboard_id,"touchpad"==o)for(const t of Ve)e[t].entity_id=e.entity_id,e[t].value_attribute=e.value_attribute,e[t]=this.updateElementConfig(e[t]??{});return e.card=this.config,e}getElementConfig(t){const e=[...this.config.custom_actions??[],...this.customActionsFromFile??[]].filter((e=>e.name==t))[0];return e?e.autofill_entity_id??this.config.autofill_entity_id??Fe.$6?this.updateElementConfig(e):e:this.updateElementConfig(this.DEFAULT_ACTIONS.filter((e=>e.name==t))[0]??{})}buildRow(e){this.nRows++;const n=`row-${this.nRows}`;return t.qy`
${e}
`}buildColumn(e){this.nColumns++;const n=`column-${this.nColumns}`;return t.qy`
${e}
`}buildPad(e){this.nPads++;const n=`pad-${this.nPads}`;return t.qy`
${e.map((t=>this.buildButton(t,this.getElementConfig(t))))}
`}buildButton(e,n){return Object.keys(n).length?t.qy``:t.qy`
`}buildSlider(e,n){return t.qy``}buildTouchpad(e,n){return t.qy``}buildVolumeButtons(){return[this.buildButton("volume_down",this.getElementConfig("volume_down")),this.buildButton("volume_mute",this.getElementConfig("volume_mute")),this.buildButton("volume_up",this.getElementConfig("volume_up"))]}buildNavButtons(){const t=[this.buildButton("left",this.getElementConfig("left")),this.buildButton("center",this.getElementConfig("center")),this.buildButton("right",this.getElementConfig("right"))];return this.rtl&&t.reverse(),this.buildColumn([this.buildRow([this.buildButton("up",this.getElementConfig("up"))]),this.buildRow(t),this.buildRow([this.buildButton("down",this.getElementConfig("down"))])])}buildElements(t,e=!1,i={}){"string"==typeof t&&(t=[t]);const o=[];for(let a of t)if(a=(0,n.X)(this.hass,a,i),"string"==typeof a&&a.includes("- ")&&(a=Me(a)),"object"==typeof a&&null!=a)o.push(this.buildElements(a,!e,i));else switch(a){case"volume_buttons":{const t=this.buildVolumeButtons();e&&t.reverse(),o.push(...t);break}case"navigation_buttons":o.push(this.buildNavButtons());break;case"dpad":o.push(this.buildPad(["","up","","left","center","right","","down",""]));break;case"numpad":o.push(this.buildPad(["n7","n8","n9","n4","n5","n6","n1","n2","n3"]));break;case"xpad":o.push(this.buildPad(["","y","","x","","b","","a",""]));break;case"npad":o.push(this.buildPad(["","x","","y","","a","","b",""]));break;default:{const t=this.getElementConfig(a);switch(t.type){case"slider":o.push(this.buildSlider(a,t));break;case"touchpad":o.push(this.buildTouchpad(a,t));break;default:o.push(this.buildButton(a,t))}break}}return e?this.buildColumn(o):this.buildRow(o)}buildDialog(){return t.qy``}fetchCustomActionsFromFile(t){if(!this.customActionsFromFile&&t){t=`${t.startsWith("/")?"":"/"}${t}`;try{const e=t.split(".").pop()?.toLowerCase();this.hass.fetchWithAuth(t).then((t=>"json"==e?t.json():t.text())).then((t=>{const n="json"==e?t:Me(t);if(!Array.isArray(n))throw TypeError(n);this.customActionsFromFile=n,this.requestUpdate()}))}catch(e){console.error(`File ${t} is not a valid JSON or YAML array\n${e}`),this.customActionsFromFile=[]}}}render(){if(!this.config||!this.hass)return t.qy``;const e={config:{...this.config,entity:(0,n.X)(this.hass,this.config.remote_id??this.config.media_player_id??this.config.keyboard_id??""),attribute:"state"}};this.fetchCustomActionsFromFile((0,n.X)(this.hass,this.config.custom_actions_file??"")),this.editMode=Boolean(document.querySelector("home-assistant")?.shadowRoot?.querySelector("hui-dialog-edit-card")?.shadowRoot?.querySelector("ha-dialog")),this.rtl="rtl"==getComputedStyle(this).direction;const i=(0,n.X)(this.hass,this.config.platform??"Android TV",e),[o,a]=(0,je.XO)(i);this.DEFAULT_ACTIONS=[...o,...a];const r=[];this.nRows=0,this.nColumns=0,this.nPads=0;for(const t of this.config.rows??[]){const n=this.buildElements(t,!1,e);r.push(n)}const s=this.config.styles?t.qy``:"";return t.qy`${r}${this.buildDialog()}${s}`}static get styles(){return t.AH`ha-card{display:flex;flex-direction:column;align-items:center;padding:12px;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent;--md-ripple-hover-opacity:var(--ha-ripple-hover-opacity, 0.08);--md-ripple-pressed-opacity:var( --ha-ripple-pressed-opacity, 0.12 );--ha-ripple-color:var(--secondary-text-color);--mdc-ripple-hover-color:var( diff --git a/www/community/android-tv-card/universal-remote-card.min.js.gz b/www/community/android-tv-card/universal-remote-card.min.js.gz index 1ec7fce1..fc1e51f0 100644 Binary files a/www/community/android-tv-card/universal-remote-card.min.js.gz and b/www/community/android-tv-card/universal-remote-card.min.js.gz differ diff --git a/www/community/custom-sidebar/custom-sidebar-json.js b/www/community/custom-sidebar/custom-sidebar-json.js index 2702fb2f..03e3f9aa 100644 --- a/www/community/custom-sidebar/custom-sidebar-json.js +++ b/www/community/custom-sidebar/custom-sidebar-json.js @@ -1 +1 @@ -!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1] ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.PROFILE=".profile",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.HA_SCROLLBAR=".ha-scrollbar",e.DATA_INFO="[data-info]"}(Pe||(Pe={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(He||(He={})),function(e){e.PRIMARY_BACKGROUND_COLOR="--primary-background-color",e.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",e.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",e.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",e.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",e.SIDEBAR_ICON_COLOR="--sidebar-icon-color",e.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",e.SIDEBAR_TEXT_COLOR="--sidebar-text-color",e.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",e.ACCENT_COLOR="--accent-color",e.TEXT_ACCENT_COLOR="--text-accent-color",e.TEXT_PRIMARY_COLOR="--text-primary-color",e.PRIMARY_TEXT_COLOR="--primary-text-color",e.DIVIDER_COLOR="--divider-color",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(Me||(Me={})),function(e){e.BACKGROUND="--custom-sidebar-background",e.BORDER_COLOR="--custom-sidebar-border-color",e.MENU_BACKGROUND="--custom-sidebar-menu-background",e.TITLE_COLOR="--custom-sidebar-title-color",e.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",e.BUTTON_COLOR="--custom-sidebar-button-color",e.DIVIDER_COLOR="--custom-sidebar-divider-color",e.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",e.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",e.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",e.ITEM_BACKGROUND="--custom-sidebar-item-background",e.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",e.ICON_COLOR="--custom-sidebar-icon-color",e.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",e.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",e.TEXT_COLOR="--custom-sidebar-text-color",e.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",e.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",e.SELECTION_BACKGROUND="--custom-sidebar-selection-background",e.SELECTION_OPACITY="--custom-sidebar-selection-opacity",e.INFO_COLOR="--custom-sidebar-info-color",e.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",e.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",e.NOTIFICATION_COLOR="--custom-sidebar-notification-color",e.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",e.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",e.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",e.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",e.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(Be||(Be={}));var Ge,Ue,We,Xe,Ve,ke=["item_background","item_background_hover","icon_color","icon_color_selected","icon_color_hover","text_color","text_color_selected","text_color_hover","selection_background","info_color","info_color_selected","info_color_hover","notification_color","notification_color_selected","notification_color_hover","notification_text_color","notification_text_color_selected","notification_text_color_hover"],je=["selection_opacity"],Ke=[["item_background",Be.ITEM_BACKGROUND],["item_background_hover",Be.ITEM_BACKGROUND_HOVER],["icon_color",Be.ICON_COLOR],["icon_color_selected",Be.ICON_COLOR_SELECTED],["icon_color_hover",Be.ICON_COLOR_HOVER],["text_color",Be.TEXT_COLOR],["text_color_selected",Be.TEXT_COLOR_SELECTED],["text_color_hover",Be.TEXT_COLOR_HOVER],["selection_background",Be.SELECTION_BACKGROUND],["selection_opacity",Be.SELECTION_OPACITY],["info_color",Be.INFO_COLOR],["info_color_selected",Be.INFO_COLOR_SELECTED],["info_color_hover",Be.INFO_COLOR_HOVER],["notification_color",Be.NOTIFICATION_COLOR],["notification_color_selected",Be.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",Be.NOTIFICATION_COLOR_HOVER],["notification_text_color",Be.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",Be.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",Be.NOTIFICATION_TEXT_COLOR_HOVER]],qe=o([["title_color",Be.TITLE_COLOR],["subtitle_color",Be.SUBTITLE_COLOR],["sidebar_button_color",Be.BUTTON_COLOR],["sidebar_background",Be.BACKGROUND],["menu_background",Be.MENU_BACKGROUND],["scrollbar_thumb_color",Be.SCROLLBAR_THUMB_COLOR],["divider_color",Be.DIVIDER_COLOR],["divider_top_color",Be.DIVIDER_TOP_COLOR],["divider_bottom_color",Be.DIVIDER_BOTTOM_COLOR]],Ke,!0);!function(e){e.NOTIFICATIONS_BADGE="notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED="notification-badge-collapsed",e.IRON_SELECTED="iron-selected"}(Ge||(Ge={})),function(e){e.PANEL="data-panel",e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.ARIA_SELECTED="aria-selected",e.ARIA_DISABLED="aria-disabled",e.DISABLED="disabled",e.HREF="href",e.STYLE="style"}(Ue||(Ue={})),function(e){e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.HASS_EDIT_SIDEBAR="hass-edit-sidebar",e.RENDER_TEMPLATE="render_template"}(We||(We={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Xe||(Xe={})),function(e){e.PAPER_ICON_ITEM="PAPER-ICON-ITEM",e.A="A"}(Ve||(Ve={}));var Ye,$e,ze,Je,Qe,Ze,et,tt,nt,ot,rt,it,ct,at,st,_t,ut,lt,Et,dt,Ot,ht,ft,pt,It=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],Tt=((Ie={})[he.HIDDEN]=fe.ALWAYS_HIDDEN,Ie[he.NARROW]=fe.AUTO,Ie[he.EXTENDED]=fe.DOCKED,Ie),At="/profile",Rt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,Nt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,vt=/@partial\s+([\w-]+)/g,bt=o(o([],ke,!0),je,!0),mt=o(["title","subtitle","hide_all","sidebar_editable","sidebar_mode","sidebar_background","title_color","subtitle_color","sidebar_button_color","sidebar_border_color","menu_background","divider_color","divider_top_color","divider_bottom_color","scrollbar_thumb_color","styles"],bt,!0),Lt=["js_variables","jinja_variables","partials"],St=function(e){return Array.isArray(e)?e.map((function(e){return e.toLocaleLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},Ct=function(e,t){var n=new Map;return e.forEach((function(e){n.set(e.item,e)})),n.forEach((function(e){bt.forEach((function(n){void 0===e[n]&&void 0!==t[n]&&("selection_opacity"===n?e.selection_opacity=t.selection_opacity:e[n]=t[n])})),e.new_item||void 0!==e.hide||void 0===t.hide_all||(e.hide=t.hide_all)})),Array.from(n.values()).sort((function(e,t){return!!e.bottom!=!!t.bottom?e.bottom?1:-1:typeof e.order===Ce.UNDEFINED||typeof t.order===Ce.UNDEFINED?e.order===t.order?0:typeof e.order===Ce.UNDEFINED?1:-1:e.order-t.order}))},yt=function(t,n,r){if(r.exceptions){var i=t.name.toLocaleLowerCase(),c=r.exceptions.filter((function(e){return e.user&&St(e.user).includes(i)||e.not_user&&!St(e.not_user).includes(i)||e.device&&St(e.device).some((function(e){return n.includes(e)}))||e.not_device&&!St(e.not_device).some((function(e){return n.includes(e)}))||void 0!==e.is_admin&&e.is_admin===t.is_admin})),a=c.length?c[c.length-1]:null,s=c.flatMap((function(e){return e.order||[]})),_=!c.some((function(e){return!e.extend_from_base})),u=function(e,t,n){var o={};return mt.forEach((function(r){var i=null==t?void 0:t[r],c=n?null!=i?i:e[r]:i;typeof c!==Ce.UNDEFINED&&(o[r]=c)})),Lt.forEach((function(t){o[t]=e[t]})),o}(r,a,_);return e(e({},u),_?{order:Ct(o(o([],r.order||[],!0),s,!0),u)}:{order:Ct(s,u)})}return e(e({},r),{order:Ct(r.order||[],r)})},Dt=function(){return new Promise((function(e){setTimeout(e,1)}))},gt=function(e,t,n){return void 0===n&&(n=[]),e.replace(vt,(function(e,r){if(null==t?void 0:t[r]){if(n.includes(r))throw new SyntaxError("".concat(ye,": circular partials dependency ").concat(n.join(" > ")," > ").concat(r));return gt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(ye,": partial ").concat(r," doesn't exist")),""}))},wt=function(){for(var e=[],t=0;t ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={maxWidth:"calc(100% - 100px)"},Ye["".concat(Pe.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},Ye["".concat(Pe.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(He.AFTER)]={content:"attr(data-info)",display:"none",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Ye["{ SELECTOR.HOST_EXPANDED } ".concat(we.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED)]={opacity:"0"},Ye["".concat(Pe.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Pe.ITEM).concat(Pe.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={zIndex:"1"},Ye["".concat(Pe.HOST," ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATION_BADGE,":not(").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED,")")]=e({left:"calc(var(--app-drawer-width, 248px) - 22px)",maxWidth:"80px",transform:"translateX(-100%)"},Pt),Ye["".concat(Pe.HOST," ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED)]=e({bottom:"14px",left:"26px",maxWidth:"20px"},Pt),Ye["".concat(Pe.HOST," ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.CONFIGURATION_BADGE)]=e({},Pt),Ye),Mt=(($e={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Pe.TITLE)]={color:wt(Be.TITLE_COLOR,Me.SIDEBAR_TITLE_COLOR,Me.PRIMARY_TEXT_COLOR)},$e),Bt=((ze={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Pe.TITLE).concat(He.AFTER)]={content:"attr(data-subtitle)",color:wt(Be.SUBTITLE_COLOR,Be.TITLE_COLOR,Me.SIDEBAR_TITLE_COLOR,Me.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},ze),Ft=((Je={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(we.HA_ICON_BUTTON)]={color:wt(Be.BUTTON_COLOR,Me.SIDEBAR_ICON_COLOR)},Je),xt=((Qe={})[Pe.HOST]={background:wt(Be.BACKGROUND,Me.SIDEBAR_BACKGROUND_COLOR)+" !important"},Qe),Gt=((Ze={})["".concat(Pe.HOST," ").concat(Pe.MENU)]={background:wt(Be.MENU_BACKGROUND,Be.BACKGROUND,Me.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,Me.PRIMARY_BACKGROUND_COLOR),borderBottomColor:wt(Be.DIVIDER_TOP_COLOR,Be.DIVIDER_COLOR,Me.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},Ze),Ut=((et={})["".concat(Pe.HOST," ").concat(Pe.DIVIDER).concat(He.BEFORE)]={backgroundColor:wt(Be.DIVIDER_BOTTOM_COLOR,Be.DIVIDER_COLOR,Me.DIVIDER_COLOR)},et),Wt=((tt={})["".concat(Pe.HOST," > ").concat(Pe.MC_DRAWER)]={borderColor:wt(Be.BORDER_COLOR,Me.DIVIDER_COLOR,"rgba(0,0,0,.12)")},tt),Xt=((nt={})["".concat(Pe.HOST," ").concat(we.PAPER_LISTBOX).concat(Pe.HA_SCROLLBAR)]={scrollbarColor:wt(Be.SCROLLBAR_THUMB_COLOR,Me.SCROLLBAR_THUMB_COLOR)+" transparent"},nt["".concat(Pe.HOST," ").concat(we.PAPER_LISTBOX).concat(Pe.HA_SCROLLBAR).concat(He.WEBKIT_SCROLLBAR_THUMB)]={background:wt(Be.SCROLLBAR_THUMB_COLOR,Me.SCROLLBAR_THUMB_COLOR)},nt),Vt=((ot={})["".concat(Pe.MENU,"[").concat(xe,"]")]={pointerEvents:"none"},ot["".concat(Pe.MENU,"[").concat(xe,"] > ").concat(we.HA_ICON_BUTTON)]={pointerEvents:"all"},ot),kt=((rt={})["".concat(Pe.HOST," ").concat(Pe.ITEM,":not(").concat(Pe.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM)]={background:wt(Be.ITEM_BACKGROUND,"none")},rt),jt=((it={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM)]={background:wt(Be.ITEM_BACKGROUND_HOVER,Be.ITEM_BACKGROUND,"none")},it),Kt=((ct={})["".concat(Pe.HOST," ").concat(we.PAPER_ICON_ITEM," > :is(").concat(we.HA_SVG_ICON,", ").concat(we.HA_ICON,")")]={color:wt(Be.ICON_COLOR,Me.SIDEBAR_ICON_COLOR)},ct),qt=((at={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > :is(").concat(we.HA_SVG_ICON,", ").concat(we.HA_ICON,")")]={color:wt(Be.ICON_COLOR_SELECTED,Me.SIDEBAR_SELECTED_ICON_COLOR)},at),Yt=((st={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM," > :is(").concat(we.HA_SVG_ICON,", ").concat(we.HA_ICON,")")]={color:wt(Be.ICON_COLOR_HOVER,Be.ICON_COLOR,Me.SIDEBAR_ICON_COLOR)},st),$t=((_t={})["".concat(Pe.HOST," ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:wt(Be.TEXT_COLOR,Me.SIDEBAR_TEXT_COLOR)},_t),zt=((ut={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:wt(Be.TEXT_COLOR_SELECTED,Me.SIDEBAR_SELECTED_TEXT_COLOR)},ut),Jt=((lt={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:wt(Be.TEXT_COLOR_HOVER,Be.TEXT_COLOR,Me.SIDEBAR_TEXT_COLOR)},lt),Qt=((Et={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER,") > ").concat(we.PAPER_ICON_ITEM).concat(He.BEFORE)]={background:wt(Be.SELECTION_BACKGROUND,Be.ICON_COLOR_SELECTED,Me.SIDEBAR_SELECTED_ICON_COLOR),opacity:wt(Be.SELECTION_OPACITY,"0.12")},Et),Zt=((dt={})["".concat(Pe.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:wt(Be.INFO_COLOR,Me.SIDEBAR_TEXT_COLOR),display:"block"},dt),en=((Ot={})["".concat(Pe.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Pe.ITEM).concat(Pe.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:wt(Be.INFO_COLOR_SELECTED,Me.SIDEBAR_SELECTED_TEXT_COLOR)},Ot),tn=((ht={})["".concat(Pe.HOST_EXPANDED," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:wt(Be.INFO_COLOR_HOVER,Be.INFO_COLOR,Me.SIDEBAR_TEXT_COLOR)},ht),nn=((ft={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > :is(").concat(Pe.NOTIFICATION_BADGE,", ").concat(Pe.CONFIGURATION_BADGE,")")]={backgroundColor:wt(Be.NOTIFICATION_COLOR_SELECTED,Be.NOTIFICATION_COLOR,Me.ACCENT_COLOR),color:wt(Be.NOTIFICATION_TEXT_COLOR_SELECTED,Be.NOTIFICATION_TEXT_COLOR,Me.TEXT_ACCENT_COLOR,Me.TEXT_PRIMARY_COLOR)},ft),on=((pt={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM," > :is(").concat(Pe.NOTIFICATION_BADGE,", ").concat(Pe.CONFIGURATION_BADGE,")")]={backgroundColor:wt(Be.NOTIFICATION_COLOR_HOVER,Be.NOTIFICATION_COLOR,Me.ACCENT_COLOR),color:wt(Be.NOTIFICATION_TEXT_COLOR_HOVER,Be.NOTIFICATION_TEXT_COLOR,Me.TEXT_ACCENT_COLOR,Me.TEXT_PRIMARY_COLOR)},pt),rn="Invalid configuration",cn=o(["title","subtitle","sidebar_background","title_color","subtitle_color","sidebar_button_color","sidebar_border_color","menu_background","divider_color","divider_top_color","divider_bottom_color","scrollbar_thumb_color","styles"],ke,!0),an=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.STRING)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a string'))}))},sn=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.STRING&&typeof e[t]!==Ce.NUMBER)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a number or a string'))}))},_n=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.BOOLEAN)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean'))}))},un=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.BOOLEAN&&typeof e[t]!==Ce.STRING)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean or a string'))}))},ln=function(e){return typeof e===Ce.UNDEFINED||(typeof e===Ce.STRING||Array.isArray(e)&&e.some((function(e){return typeof e===Ce.STRING})))},En=function(e,t){if(typeof t!==Ce.UNDEFINED){if(Object.prototype.toString.call(t)!==Fe)throw new SyntaxError("".concat(rn,', "').concat(e,'" property should be an object'));Object.entries(t).forEach((function(t){var n=t[0],o=t[1];if(typeof o!==Ce.STRING&&typeof o!==Ce.NUMBER&&typeof o!==Ce.BOOLEAN)throw new SyntaxError("".concat(rn,', "').concat(e,'" property should contain only strings, numbers or booleans. Property ').concat(n," has the wrong type"));"string"==typeof o&&(Rt.test(o)||Nt.test(o))&&console.warn('"'.concat(e,'" property should not have templates. Property ').concat(n," seems to be a template"))}))}},dn=function(e){var t,n,r;if(an(e,o([],cn,!0),"".concat(rn,", exceptions")),sn(e,o([],je,!0),"".concat(rn,", exceptions")),n=[["user",e.user],["not_user",e.not_user],["device",e.device],["not_device",e.not_device]],r="".concat(rn,", exceptions"),n.forEach((function(e){var t=e[0],n=e[1];if(!ln(n))throw new SyntaxError("".concat(r,' "').concat(t,'" property should be a string or an array of strings'))})),typeof e.order!==Ce.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(rn,', exceptions "order" property should be an array'));if(un(e,["sidebar_editable"],"".concat(rn,", exceptions")),_n(e,["hide_all","is_admin"],"".concat(rn,", exceptions")),typeof e.sidebar_mode!==Ce.UNDEFINED&&!(e.sidebar_mode in Tt))throw new SyntaxError("".concat(rn,', exceptions "sidebar_mode" property should be ').concat(he.HIDDEN,", ").concat(he.NARROW," or ").concat(he.EXTENDED));if(e.user&&e.not_user)throw new SyntaxError("".concat(rn,', exceptions "user" and "not_user" properties cannot be used together'));if(e.device&&e.not_device)throw new SyntaxError("".concat(rn,', exceptions "device" and "not_device" properties cannot be used together'));null===(t=e.order)||void 0===t||t.forEach(On)},On=function(e){if(!e.item)throw new SyntaxError("".concat(rn,', every item in an "order" array should have an "item" property'));if(an(e,o(["item","info"],ke,!0),"".concat(rn," in ").concat(e.item,",")),sn(e,o([],je,!0),"".concat(rn," in ").concat(e.item,",")),e.new_item){if(an(e,["href","icon"],"".concat(rn," in ").concat(e.item,",")),!e.href)throw new SyntaxError("".concat(rn," in ").concat(e.item,', if you set "new_item" as "true", "href" property is necessary'));if(!e.icon)throw new SyntaxError("".concat(rn," in ").concat(e.item,', if you set "new_item" as "true", "icon" property is necessary'))}},hn=function(e){var t;if(an(e,o([],cn,!0),"".concat(rn,",")),sn(e,o([],je,!0),"".concat(rn,",")),un(e,["sidebar_editable"],"".concat(rn,",")),_n(e,["hide_all"],"".concat(rn,",")),typeof e.sidebar_mode!==Ce.UNDEFINED&&!(e.sidebar_mode in Tt))throw new SyntaxError("".concat(rn,', "sidebar_mode" property should be ').concat(he.HIDDEN,", ").concat(he.NARROW," or ").concat(he.EXTENDED));if(typeof e.order!==Ce.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(rn,', "order" property should be an array'));if(typeof e.partials!==Ce.UNDEFINED){if(Object.prototype.toString.call(e.partials)!==Fe)throw new SyntaxError("".concat(rn,', "partials" property should be an object'));Object.entries(e.partials).forEach((function(e){var t=e[0];if(typeof e[1]!==Ce.STRING)throw new SyntaxError("".concat(rn,', "partials" should be an object with strings. The partial ').concat(t," is not a string"))}))}En("js_variables",e.js_variables),En("jinja_variables",e.jinja_variables),null===(t=e.order)||void 0===t||t.forEach(On),function(e){if(typeof e!==Ce.UNDEFINED){if(!Array.isArray(e))throw new SyntaxError("".concat(rn,", exceptions should be an array"));e.forEach(dn)}}(e.exceptions)},fn=function(){return t(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){return e="".concat(ye,": JSON config file not found."),t="Make sure you have valid config in /config/www/".concat(De,".json file."),[2,new Promise((function(n){fetch("".concat(ge,".json?hash=").concat(Math.random().toString(16).slice(2))).then((function(o){if(!o.ok)throw Error("".concat(e,"\n").concat(t));o.json().then((function(e){var o;(null===(o=e.id)||void 0===o?void 0:o.startsWith("example_json"))&&console.warn("".concat(ye,": You seem to be using the example configuration.\n").concat(t)),hn(e),n(e)})).catch((function(e){throw Error("".concat(ye,": ").concat(e.message))}))})).catch((function(){throw Error("".concat(e,"\n").concat(t))}))}))]}))}))},pn=function(){function o(){var e=this,t=new re;t.addEventListener(B.ON_LISTEN,(function(t){e._homeAssistant=t.detail.HOME_ASSISTANT,e._main=t.detail.HOME_ASSISTANT_MAIN,e._haDrawer=t.detail.HA_DRAWER,e._sidebar=t.detail.HA_SIDEBAR,e._partialPanelResolver=t.detail.PARTIAL_PANEL_RESOLVER}),{once:!0}),t.addEventListener(B.ON_PANEL_LOAD,this._panelLoaded.bind(this)),t.listen(),this._styleManager=new Se({prefix:ye,namespace:ye,throwWarnings:!1}),this._items=[],this._sidebarScroll=0,this._isSidebarEditable=void 0,this._itemTouchedBinded=this._itemTouched.bind(this),this._mouseEnterBinded=this._mouseEnter.bind(this),this._mouseLeaveBinded=this._mouseLeave.bind(this),this._configPromise=fn(),this._process()}return o.prototype._getConfigWithExceptions=function(){return t(this,void 0,void 0,(function(){var e,t=this;return n(this,(function(n){switch(n.label){case 0:return e=this,[4,this._configPromise.then((function(e){return yt(t._ha.hass.user,navigator.userAgent.toLowerCase(),e)}))];case 1:return e._configWithExceptions=n.sent(),[2]}}))}))},o.prototype._getElements=function(){return t(this,void 0,void 0,(function(){var e,t,o,i;return n(this,(function(n){switch(n.label){case 0:return e={retries:100,delay:50,shouldReject:!1},[4,this._sidebar.selector.$.query(we.PAPER_LISTBOX).element];case 1:return t=n.sent(),[4,r((function(){return t.querySelector(":scope > ".concat(Pe.SPACER))}),(function(e){return!!e}),e)];case 2:return o=n.sent(),[4,r((function(){return t.querySelectorAll(":scope > ".concat(Pe.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(Pe.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 3:return i=n.sent(),[2,[t,i,o]]}}))}))},o.prototype._buildNewItem=function(e){var t=document.createElement("a");return t.href=e.href,t.target=e.target||"",t.tabIndex=-1,t.setAttribute(Ue.ROLE,"option"),t.setAttribute(Ue.PANEL,e.item.toLowerCase().replace(/\s+/,"-")),t.setAttribute(Ue.ARIA_SELECTED,"false"),t.innerHTML='\n \n \n \n ').concat(e.item,'\n \n \n \n ').trim(),t},o.prototype._getTemplateString=function(e){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return t="",e instanceof Promise||"string"==typeof e||"number"==typeof e&&!Number.isNaN(e)||"boolean"==typeof e||"object"==typeof e?"string"!=typeof e?[3,1]:(t=e.trim(),[3,6]):[3,6];case 1:return"number"!=typeof e&&"boolean"!=typeof e?[3,2]:(t=e.toString(),[3,6]);case 2:return e instanceof Promise?[4,e]:[3,5];case 3:return o=n.sent(),[4,this._getTemplateString(o)];case 4:return t=n.sent(),[3,6];case 5:t=JSON.stringify(e),n.label=6;case 6:return[2,t]}}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(Pe.TITLE).element.then((function(t){e._configWithExceptions.title&&e._subscribeTemplate(e._configWithExceptions.title,(function(e){t.innerHTML=e})),e._configWithExceptions.subtitle&&e._subscribeTemplate(e._configWithExceptions.subtitle,(function(e){t.dataset.subtitle=e}))}))},o.prototype._subscribeSideBarEdition=function(){var e=this,t=function(e){e.preventDefault(),e.stopImmediatePropagation()},n=function(e,n){e.removeEventListener(We.HASS_EDIT_SIDEBAR,t,!0),n.removeAttribute(xe)},o=function(e,n){e.removeEventListener(We.HASS_EDIT_SIDEBAR,t,!0),e.addEventListener(We.HASS_EDIT_SIDEBAR,t,!0),n.setAttribute(xe,"")};Promise.all([this._main.element,this._sidebar.selector.$.query(Pe.MENU).element]).then((function(t){var r=t[0],i=t[1];"boolean"==typeof e._configWithExceptions.sidebar_editable&&(e._isSidebarEditable=e._configWithExceptions.sidebar_editable,e._isSidebarEditable||o(r,i)),"string"==typeof e._configWithExceptions.sidebar_editable&&e._subscribeTemplate(e._configWithExceptions.sidebar_editable,(function(t){"true"===t||"false"===t?(e._isSidebarEditable=!("false"===t),e._isSidebarEditable?n(r,i):o(r,i)):(e._isSidebarEditable=void 0,n(r,i)),e._checkProfileEditableButton()}))}))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(Pe.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.innerHTML=e}))},o.prototype._subscribeIcon=function(e,t){this._subscribeTemplate(t,(function(t){var n=e.querySelector(we.HA_ICON);if(!n){(n=document.createElement(we.HA_ICON)).setAttribute("slot","item-icon");var o=e.querySelector(we.HA_SVG_ICON);o?o.replaceWith(n):e.querySelector(we.PAPER_ICON_ITEM).prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(Pe.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector("".concat(Pe.NOTIFICATION_BADGE,":not(").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED,")")),o=e.querySelector(Pe.NOTIFICATIONS_BADGE_COLLAPSED);n||((n=document.createElement("span")).classList.add(Ge.NOTIFICATIONS_BADGE),e.querySelector(we.PAPER_ICON_ITEM).append(n)),o||((o=document.createElement("span")).classList.add(Ge.NOTIFICATIONS_BADGE,Ge.NOTIFICATIONS_BADGE_COLLAPSED),e.querySelector("".concat(we.HA_SVG_ICON,", ").concat(we.HA_ICON)).after(o));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,o.innerHTML=t,e.setAttribute(Ue.WITH_NOTIFICATION,"true")):(n.innerHTML="",o.innerHTML="",e.removeAttribute(Ue.WITH_NOTIFICATION))}))},o.prototype._subscribeTemplateColorChanges=function(e,t,n){var o=this;n.forEach((function(n){var r=n[0],i=n[1];e[r]&&o._subscribeTemplate(e[r],(function(e){t.style.setProperty(i,e)}))}))},o.prototype._subscribeTemplate=function(e,t){Rt.test(e)?this._createJsTemplateSubscription(e.replace(Rt,"$1"),t):Nt.test(e)?this._createJinjaTemplateSubscription(e,t):this._getTemplateString(e).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(gt(e,this._configWithExceptions.partials),(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;window.hassConnection.then((function(r){r.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:We.RENDER_TEMPLATE,template:gt(t,o._configWithExceptions.partials),variables:e({user_name:o._ha.hass.user.name,user_is_admin:o._ha.hass.user.is_admin,user_is_owner:o._ha.hass.user.is_owner,user_agent:window.navigator.userAgent},o._configWithExceptions.jinja_variables)})}))},o.prototype._focusItemByKeyboard=function(e,t){for(var n,o=this._items.length-1,r=e.querySelector("\n ".concat(Pe.SCOPE," > ").concat(Pe.ITEM,":not(.").concat(Ge.IRON_SELECTED,"):focus,\n ").concat(Pe.SCOPE," > ").concat(Pe.ITEM,":focus,\n ").concat(Pe.SCOPE," > ").concat(Pe.ITEM,":has(> ").concat(we.PAPER_ICON_ITEM,":focus)\n ").trim()),i=0,c=0,a=Object.entries(this._items);c0?i-1:o,this._items[n].element.focus(),this._items[n].element.tabIndex=0},o.prototype._focusItemByTab=function(e,t,n){var o=this._items.length-1;if(t.nodeName===Ve.A){var r=t,i=this._items.findIndex((function(e){return e.element===r})),c=NaN;if(n&&i0&&(c=i-1),Number.isNaN(c))if(n)e.querySelector(Pe.SIDEBAR_NOTIFICATIONS).focus();else e.querySelector(we.HA_ICON_BUTTON).focus();else this._items[c].element.querySelector(we.PAPER_ICON_ITEM).focus()}else{if(n)e.querySelector("".concat(Pe.PROFILE," > ").concat(we.PAPER_ICON_ITEM)).focus();else this._items[o].element.querySelector(we.PAPER_ICON_ITEM).focus()}},o.prototype._getActivePaperIconElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&(t.nodeName===Ve.PAPER_ICON_ITEM||t.nodeName===Ve.A&&"option"===t.getAttribute("role"))?t:t.shadowRoot&&It.includes(t.nodeName)?this._getActivePaperIconElement(t.shadowRoot):null:null},o.prototype._processSidebar=function(){var e=this;Promise.all([this._main.element,this._partialPanelResolver.element]).then((function(o){var r=o[0],i=o[1],c=e._configWithExceptions.sidebar_mode,a=matchMedia("(max-width: 870px)");if(c){r.hass.dockedSidebar=Tt[c];var s=function(o){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return c===he.HIDDEN?[3,5]:[4,Dt()];case 1:return e.sent(),r.narrow=!1,[4,Dt()];case 2:return e.sent(),i.narrow=o,[4,Dt()];case 3:return e.sent(),o?[4,this._partialPanelResolver.selector.query(Pe.HA_MENU_BUTTON).element]:[3,5];case 4:e.sent().narrow=!1,e.label=5;case 5:return[2]}}))}))};a.addEventListener("change",(function(e){s(e.matches)})),s(a.matches)}})),Promise.all([this._haDrawer.selector.$.query(Pe.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(we.PAPER_LISTBOX).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._configWithExceptions,o,qe),e._subscribeTemplateColorChanges(e._configWithExceptions,n,[["sidebar_border_color",Be.BORDER_COLOR]]),i.addEventListener(We.KEYDOWN,(function(t){t.key!==Xe.ARROW_DOWN&&t.key!==Xe.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Xe.ARROW_DOWN))}),!0),window.addEventListener(We.KEYDOWN,(function(t){if(t.key===Xe.TAB){var n=e._getActivePaperIconElement();if(n)if(n.nodeName===Ve.PAPER_ICON_ITEM){var o=n.parentElement;o.getAttribute(Ue.HREF)!==At&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey))}else n.getAttribute(Ue.HREF)!==At&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,n,!t.shiftKey))}}),!0),e._styleManager.addStyle(Wt,n),e._styleManager.addStyle([Ht,Mt,Bt,Ft,xt,Gt,Ut,Xt,Vt,kt,jt,Kt,qt,Yt,$t,zt,Jt,Qt,Zt,en,tn,nn,on,e._configWithExceptions.styles||""],r)}))},o.prototype._rearrange=function(){var t=this;this._getElements().then((function(n){var o=t._configWithExceptions,r=o.order,i=o.hide_all,c=n[0],a=n[1],s=n[2],_=0,u=!1,l=Array.from(a),E=new Set;i&&l.forEach((function(e){e.style.display="none"}));var d=r.reduce((function(t,n){var o=n.item,r=n.match,i=n.exact,c=n.new_item,a=o.toLocaleLowerCase(),s=c?void 0:l.find((function(e){var t=r===pe.DATA_PANEL?e.getAttribute(Ue.PANEL):r===pe.HREF?e.getAttribute(Ue.HREF):e.querySelector(Pe.ITEM_TEXT).innerText.trim();return!((!i||o!==t)&&(i||!(null==t?void 0:t.toLowerCase().includes(a))))&&(!E.has(e)&&(E.add(e),!0))}));return s&&s.setAttribute(Ue.PROCESSED,"true"),(c||s)&&t.push(e(e({},n),{element:s})),c||s||console.warn("".concat(ye,": you have an order item in your configuration that didn't match any sidebar item: \"").concat(o,'"')),t}),[]),O=function(){u||(l.forEach((function(e){e.hasAttribute(Ue.PROCESSED)||(e.style.order="".concat(_))})),_++,s.style.order="".concat(_),_++,u=!0)};d.forEach((function(e){if(e.bottom&&O(),e.new_item&&!e.hide){var n=t._buildNewItem(e);n.style.order="".concat(_),c.append(n),e.element=n}else if(e.element){var o=e.element;o.style.order="".concat(_),e.hide?o.style.display="none":o.style.removeProperty("display"),e.href&&(o.href=e.href),e.target&&(o.target=e.target)}e.hide||(e.name&&t._subscribeName(e.element,e.name),e.icon&&t._subscribeIcon(e.element,e.icon),e.info&&t._subscribeInfo(e.element,e.info),e.notification&&t._subscribeNotification(e.element,e.notification),t._subscribeTemplateColorChanges(e,e.element,Ke),e.new_item&&(e.element.addEventListener(We.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(We.MOUSELEAVE,t._mouseLeaveBinded)),e.element.addEventListener(We.MOUSEDOWN,t._itemTouchedBinded),e.element.addEventListener(We.KEYDOWN,(function(e){e.key===Xe.ENTER&&t._itemTouchedBinded()})),t._items.push(e)),_++})),d.length&&O(),t._panelLoaded()}))},o.prototype._itemTouched=function(){return t(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return this._sidebar.selector.$.query(we.PAPER_LISTBOX).element.then((function(t){e._sidebarScroll=t.scrollTop})),[2]}))}))},o.prototype._mouseEnter=function(e){this._sidebar.element.then((function(t){t.alwaysExpand||(t._mouseLeaveTimeout&&(clearTimeout(t._mouseLeaveTimeout),t._mouseLeaveTimeout=void 0),t._showTooltip(e.currentTarget))}))},o.prototype._mouseLeave=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this._sidebar.element.then((function(e){e._mouseLeaveTimeout&&clearTimeout(e._mouseLeaveTimeout),e._mouseLeaveTimeout=window.setTimeout((function(){e._hideTooltip()}),500)})),[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),"/profile/general"!==e.__route.path?[3,3]:[4,this._partialPanelResolver.selector.query(Pe.EDIT_SIDEBAR_BUTTON).element];case 2:(t=n.sent())&&(!1===this._isSidebarEditable?t.setAttribute(Ue.DISABLED,""):t.removeAttribute(Ue.DISABLED)),n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t=e.__route.path,[4,this._sidebar.selector.$.query(we.PAPER_LISTBOX).element];case 2:return o=n.sent(),r=o.querySelector(["".concat(Pe.SCOPE," > ").concat(Pe.ITEM,'[href="').concat(t,'"]'),"".concat(Pe.SCOPE," > ").concat(Pe.ITEM,'[href="').concat(t,'/dashboard"]')].join(",")),i=r?null:this._items.reduce((function(e,n){var o=n.element,r=o.getAttribute(Ue.HREF);return t.startsWith(r)&&(!e||r.length>e.getAttribute(Ue.HREF).length)&&(e=o),e}),null),this._items.forEach((function(e){var t=e.element,n=r&&r===t||!r&&i===t;t.classList.toggle(Ge.IRON_SELECTED,n),t.setAttribute(Ue.ARIA_SELECTED,"".concat(n))})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._checkProfileEditableButton(),[2]}}))}))},o.prototype._process=function(){var e=this;this._homeAssistant.element.then((function(t){e._ha=t,new Ae(e._ha).getRenderer().then((function(t){e._renderer=t,e._getConfigWithExceptions().then((function(){var t;e._renderer.variables=null!==(t=e._configWithExceptions.js_variables)&&void 0!==t?t:{},e._processSidebar(),e._subscribeTitle(),e._subscribeSideBarEdition(),e._rearrange()}))}))}))},o}();window.CustomSidebar||(console.info("%c≡ ".concat(ye.toUpperCase()," (JSON)%cv").concat("7.2.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px"),window.CustomSidebar=new pn)}(); +!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<])(".concat(Object.values(se).join("|"),")($|[ \\?)+:\\}\\]><.])"),"gm"),this._scopped=Oe(e,i),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return e.prototype._executeRenderingFunctions=function(e){var t=this;this._subscriptions.get(e).forEach((function(e,n){e.forEach((function(e){t.trackTemplate(n,e)}))}))},e.prototype._watchForPanelUrlChange=function(){var e=this;window.addEventListener(_e.LOCATION_CHANGED,(function(t){e._panelUrlWatchCallback()})),window.addEventListener(_e.POPSTATE,(function(){e._panelUrlWatchCallback()}))},e.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(se.PANEL_URL)&&this._executeRenderingFunctions(se.PANEL_URL)},e.prototype._watchForEntitiesChange=function(){var e=this;window.hassConnection.then((function(t){t.conn.subscribeMessage((function(t){return e._entityWatchCallback(t)}),{type:_e.SUBSCRIBE_EVENTS,event_type:_e.STATE_CHANGE_EVENT})}))},e.prototype._entityWatchCallback=function(e){if(this._subscriptions.size){var t=e.data.entity_id;this._subscriptions.has(t)&&this._executeRenderingFunctions(t)}},e.prototype._storeTracked=function(e,t){var n=this;this._scopped.tracked.forEach((function(o){if(n._subscriptions.has(o)){var r=n._subscriptions.get(o);if(r.has(e)){var i=r.get(e);i.has(t)||i.add(t)}else r.set(e,new Set([t]))}else n._subscriptions.set(o,new Map([[e,new Set([t])]]))}))},e.prototype._untrackTemplate=function(e,t){var n=this;this._subscriptions.forEach((function(o,r){if(o.has(e)){var i=o.get(e);i.has(t)&&i.delete(t),0===i.size&&(o.delete(e),0===o.size&&n._subscriptions.delete(r))}}))},e.prototype.renderTemplate=function(e){try{var t=new Map(Object.entries(this._variables)),n=e.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),o=n.includes("return")||!this._autoReturn?n:"return ".concat(n);return(new(Function.bind.apply(Function,ie(ie([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide"],Array.from(t.keys()),!1),["".concat('"use strict";'," ").concat(o)],!1)))).apply(void 0,ie([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.user_agent,this._scopped.clientSideProxy],Array.from(t.values()),!1))}catch(e){if(this._throwErrors)throw e;return void(this._throwWarnings&&console.warn(e))}},e.prototype.trackTemplate=function(e,t){var n=this;this._scopped.cleanTracked();var o=this.renderTemplate(e);return this._storeTracked(e,t),t(o),function(){return n._untrackTemplate(e,t)}},e.prototype.cleanTracked=function(e){e?this._subscriptions.has(e)&&this._subscriptions.delete(e):this._subscriptions.clear()},Object.defineProperty(e.prototype,"variables",{get:function(){return this._variables},set:function(e){this._variables=e},enumerable:!1,configurable:!0}),e}(),Re=function(){function e(e,t){void 0===t&&(t={}),this._renderer=r((function(){return e.hass}),(function(e){return!!(e&&e.areas&&e.devices&&e.entities&&e.states&&e.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new Ae(e,t)}))}return e.prototype.getRenderer=function(){return this._renderer},e}(),ve=/([A-Z])([a-z0-9_-]+)/g,Ne=function(e){return Object.entries(e).map((function(e){var t=e[0],n=e[1];return"".concat(function(e){return e.replace(ve,(function(e,t,n,o){var r=t.toLocaleLowerCase();return o?"-".concat(r).concat(n):"--".concat(r).concat(n)}))}(t),":").concat(n)})).join(";")+";"},be=function(e){return(Array.isArray(e)?e:[e]).map((function(e){return"string"==typeof e?e:Object.entries(e).map((function(e){var t=e[0],n=e[1];return!1===n?"".concat(t,"{display: none !important}"):"".concat(t,"{").concat(Ne(n),"}")})).join("")})).join("")},me=function(e,t){return"".concat(t,"_").concat(e)},Se=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},ye=function(e,t){var n=me(Se(e),t);return e.querySelector("#".concat(n))},Le=function(){function e(e){var t,n,o;void 0===e&&(e={}),this._prefix=null!==(t=e.prefix)&&void 0!==t?t:"ha-styles-manager",this._namespace=null!==(n=e.namespace)&&void 0!==n?n:"home-assistant-styles-manager",this._throwWarnings=null===(o=e.throwWarnings)||void 0===o||o}return e.prototype.getStyleElement=function(e){return ye(e,this._prefix)},e.prototype.addStyle=function(e,t){!function(e,t,n,o,r){if(t){var i=ye(t,n);if(!i){var c=me(Se(t),n);(i=document.createElement("style")).setAttribute("id",c),t.appendChild(i)}i.innerHTML="string"==typeof e?e:be(e)}else r&&console.warn("".concat(o,': no element has been provided calling "addStyle"'))}(e,t,this._prefix,this._namespace,this._throwWarnings)},e.prototype.removeStyle=function(e){!function(e,t,n,o){if(e){var r=ye(e,t);r?r.remove():o&&console.warn("".concat(n,': no style to remove calling "removeStyle"'))}else o&&console.warn("".concat(n,': no element has been provided calling "removeStyle"'))}(e,this._prefix,this._namespace,this._throwWarnings)},e}();!function(e){e.HIDDEN="hidden",e.NARROW="narrow",e.EXTENDED="extended"}(fe||(fe={})),function(e){e.DOCKED="docked",e.AUTO="auto",e.ALWAYS_HIDDEN="always_hidden"}(he||(he={})),function(e){e.AND="AND",e.OR="OR"}(pe||(pe={})),function(e){e.TEXT="text",e.DATA_PANEL="data-panel",e.HREF="href"}(Ie||(Ie={}));var Ce,De="custom-sidebar",ge="sidebar-config",we="".concat("/local/").concat(ge),Pe="base";!function(e){e.BOOLEAN="boolean",e.STRING="string",e.UNDEFINED="undefined",e.NUMBER="number"}(Ce||(Ce={}));var He,Me,Be,xe,Fe,Ge="[object Object]",Ue="data-blocked";!function(e){e.SIDEBAR="ha-sidebar",e.PAPER_LISTBOX="paper-listbox",e.PAPER_ICON_ITEM="paper-icon-item",e.HA_SVG_ICON="ha-svg-icon",e.HA_ICON="ha-icon",e.HA_ICON_BUTTON="ha-icon-button"}(He||(He={})),function(e){e.HOST=":host",e.HOST_EXPANDED=":host([expanded])",e.SCOPE=":scope",e.TITLE=".title",e.ITEM='a[role="option"]',e.ITEM_SELECTED=".iron-selected",e.ITEM_HOVER='a[role="option"]:hover',e.SPACER=".spacer",e.ITEM_TEXT=".item-text",e.NOTIFICATION_BADGE=".notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED=".notification-badge-collapsed",e.CONFIGURATION_BADGE=".configuration-badge",e.HA_MENU_BUTTON="ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.PROFILE=".profile",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.HA_SCROLLBAR=".ha-scrollbar",e.DATA_INFO="[data-info]"}(Me||(Me={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(Be||(Be={})),function(e){e.PRIMARY_BACKGROUND_COLOR="--primary-background-color",e.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",e.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",e.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",e.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",e.SIDEBAR_ICON_COLOR="--sidebar-icon-color",e.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",e.SIDEBAR_TEXT_COLOR="--sidebar-text-color",e.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",e.ACCENT_COLOR="--accent-color",e.TEXT_ACCENT_COLOR="--text-accent-color",e.TEXT_PRIMARY_COLOR="--text-primary-color",e.PRIMARY_TEXT_COLOR="--primary-text-color",e.DIVIDER_COLOR="--divider-color",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(xe||(xe={})),function(e){e.BACKGROUND="--custom-sidebar-background",e.BORDER_COLOR="--custom-sidebar-border-color",e.MENU_BACKGROUND="--custom-sidebar-menu-background",e.TITLE_COLOR="--custom-sidebar-title-color",e.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",e.BUTTON_COLOR="--custom-sidebar-button-color",e.DIVIDER_COLOR="--custom-sidebar-divider-color",e.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",e.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",e.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",e.ITEM_BACKGROUND="--custom-sidebar-item-background",e.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",e.ICON_COLOR="--custom-sidebar-icon-color",e.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",e.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",e.TEXT_COLOR="--custom-sidebar-text-color",e.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",e.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",e.SELECTION_BACKGROUND="--custom-sidebar-selection-background",e.SELECTION_OPACITY="--custom-sidebar-selection-opacity",e.INFO_COLOR="--custom-sidebar-info-color",e.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",e.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",e.NOTIFICATION_COLOR="--custom-sidebar-notification-color",e.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",e.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",e.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",e.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",e.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(Fe||(Fe={}));var je,ke,Xe,Ve,We,Ke=["item_background","item_background_hover","icon_color","icon_color_selected","icon_color_hover","text_color","text_color_selected","text_color_hover","selection_background","info_color","info_color_selected","info_color_hover","notification_color","notification_color_selected","notification_color_hover","notification_text_color","notification_text_color_selected","notification_text_color_hover"],qe=["selection_opacity"],Ye=[["item_background",Fe.ITEM_BACKGROUND],["item_background_hover",Fe.ITEM_BACKGROUND_HOVER],["icon_color",Fe.ICON_COLOR],["icon_color_selected",Fe.ICON_COLOR_SELECTED],["icon_color_hover",Fe.ICON_COLOR_HOVER],["text_color",Fe.TEXT_COLOR],["text_color_selected",Fe.TEXT_COLOR_SELECTED],["text_color_hover",Fe.TEXT_COLOR_HOVER],["selection_background",Fe.SELECTION_BACKGROUND],["selection_opacity",Fe.SELECTION_OPACITY],["info_color",Fe.INFO_COLOR],["info_color_selected",Fe.INFO_COLOR_SELECTED],["info_color_hover",Fe.INFO_COLOR_HOVER],["notification_color",Fe.NOTIFICATION_COLOR],["notification_color_selected",Fe.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",Fe.NOTIFICATION_COLOR_HOVER],["notification_text_color",Fe.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",Fe.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",Fe.NOTIFICATION_TEXT_COLOR_HOVER]],$e=o([["title_color",Fe.TITLE_COLOR],["subtitle_color",Fe.SUBTITLE_COLOR],["sidebar_button_color",Fe.BUTTON_COLOR],["sidebar_background",Fe.BACKGROUND],["menu_background",Fe.MENU_BACKGROUND],["scrollbar_thumb_color",Fe.SCROLLBAR_THUMB_COLOR],["divider_color",Fe.DIVIDER_COLOR],["divider_top_color",Fe.DIVIDER_TOP_COLOR],["divider_bottom_color",Fe.DIVIDER_BOTTOM_COLOR]],Ye,!0);!function(e){e.NOTIFICATIONS_BADGE="notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED="notification-badge-collapsed",e.IRON_SELECTED="iron-selected"}(je||(je={})),function(e){e.PANEL="data-panel",e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.ARIA_SELECTED="aria-selected",e.ARIA_DISABLED="aria-disabled",e.DISABLED="disabled",e.HREF="href",e.STYLE="style"}(ke||(ke={})),function(e){e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.HASS_EDIT_SIDEBAR="hass-edit-sidebar",e.RENDER_TEMPLATE="render_template"}(Xe||(Xe={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Ve||(Ve={})),function(e){e.PAPER_ICON_ITEM="PAPER-ICON-ITEM",e.A="A"}(We||(We={}));var ze,Je,Qe,Ze,et,tt,nt,ot,rt,it,ct,at,st,_t,ut,lt,dt,Et,Ot,ft,ht,pt,It,Tt,At=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],Rt=((Te={})[fe.HIDDEN]=he.ALWAYS_HIDDEN,Te[fe.NARROW]=he.AUTO,Te[fe.EXTENDED]=he.DOCKED,Te),vt="/profile",Nt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,bt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,mt=/@partial\s+([\w-]+)/g,St=function(e){return Array.isArray(e)?e.map((function(e){return e.toLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},yt=function(){return new Promise((function(e){setTimeout(e,1)}))},Lt=o(o([],Ke,!0),qe,!0),Ct=["id","exceptions","extendable_configs","extend_from","user","not_user","device","not_device","is_admin"],Dt=["js_variables","jinja_variables","partials"],gt=function(){function t(e,t,n){var o;this._config=e,this._extendable=new Map(Object.entries(null!==(o=this._config.extendable_configs)&&void 0!==o?o:[])),this._user=t,this._userAgent=n,this._exceptions=this._getExceptions(),this._buildFlattenConfig()}return t.prototype._getExceptions=function(){var e=this;if(this._config.exceptions){var t=this._user.name.toLocaleLowerCase();return this._config.exceptions.filter((function(n){var o,r=null!==(o=n.matchers_conditions)&&void 0!==o?o:pe.OR,i=void 0!==n.user&&St(n.user).includes(t),c=void 0!==n.not_user&&!St(n.not_user).includes(t),a=void 0!==n.device&&St(n.device).some((function(t){return e._userAgent.includes(t)})),s=void 0!==n.not_device&&!St(n.not_device).some((function(t){return e._userAgent.includes(t)})),_=void 0!==n.is_admin&&n.is_admin===e._user.is_admin,u=void 0!==n.is_owner&&n.is_owner===e._user.is_owner;return r===pe.OR?i||c||a||s||_||u:(void 0===n.user||i)&&(void 0===n.not_user||c)&&(void 0===n.device||a)&&(void 0===n.not_device||s)&&(void 0===n.is_admin||_)&&(void 0===n.is_owner||u)}))}return[]},t.prototype._mergeConfigs=function(){for(var t=[],n=0;n ")," > ").concat(r));return wt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(De,": partial ").concat(r," doesn't exist")),""}))},Pt=function(){for(var e=[],t=0;t ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={maxWidth:"calc(100% - 100px)"},ze["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},ze["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Be.AFTER)]={content:"attr(data-info)",display:"none",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},ze["{ SELECTOR.HOST_EXPANDED } ".concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED)]={opacity:"0"},ze["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM).concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={zIndex:"1"},ze["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATION_BADGE,":not(").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED,")")]=e({left:"calc(var(--app-drawer-width, 248px) - 22px)",maxWidth:"80px",transform:"translateX(-100%)"},Ht),ze["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED)]=e({bottom:"14px",left:"26px",maxWidth:"20px"},Ht),ze["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.CONFIGURATION_BADGE)]=e({},Ht),ze),Bt=((Je={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(Me.TITLE)]={color:Pt(Fe.TITLE_COLOR,xe.SIDEBAR_TITLE_COLOR,xe.PRIMARY_TEXT_COLOR)},Je),xt=((Qe={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(Me.TITLE).concat(Be.AFTER)]={content:"attr(data-subtitle)",color:Pt(Fe.SUBTITLE_COLOR,Fe.TITLE_COLOR,xe.SIDEBAR_TITLE_COLOR,xe.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},Qe),Ft=((Ze={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(He.HA_ICON_BUTTON)]={color:Pt(Fe.BUTTON_COLOR,xe.SIDEBAR_ICON_COLOR)},Ze),Gt=((et={})[Me.HOST]={background:Pt(Fe.BACKGROUND,xe.SIDEBAR_BACKGROUND_COLOR)+" !important"},et),Ut=((tt={})["".concat(Me.HOST," ").concat(Me.MENU)]={background:Pt(Fe.MENU_BACKGROUND,Fe.BACKGROUND,xe.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,xe.PRIMARY_BACKGROUND_COLOR),borderBottomColor:Pt(Fe.DIVIDER_TOP_COLOR,Fe.DIVIDER_COLOR,xe.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},tt),jt=((nt={})["".concat(Me.HOST," ").concat(Me.DIVIDER).concat(Be.BEFORE)]={backgroundColor:Pt(Fe.DIVIDER_BOTTOM_COLOR,Fe.DIVIDER_COLOR,xe.DIVIDER_COLOR)},nt),kt=((ot={})["".concat(Me.HOST," > ").concat(Me.MC_DRAWER)]={borderColor:Pt(Fe.BORDER_COLOR,xe.DIVIDER_COLOR,"rgba(0,0,0,.12)")},ot),Xt=((rt={})["".concat(Me.HOST," ").concat(He.PAPER_LISTBOX).concat(Me.HA_SCROLLBAR)]={scrollbarColor:Pt(Fe.SCROLLBAR_THUMB_COLOR,xe.SCROLLBAR_THUMB_COLOR)+" transparent"},rt["".concat(Me.HOST," ").concat(He.PAPER_LISTBOX).concat(Me.HA_SCROLLBAR).concat(Be.WEBKIT_SCROLLBAR_THUMB)]={background:Pt(Fe.SCROLLBAR_THUMB_COLOR,xe.SCROLLBAR_THUMB_COLOR)},rt),Vt=((it={})["".concat(Me.MENU,"[").concat(Ue,"]")]={pointerEvents:"none"},it["".concat(Me.MENU,"[").concat(Ue,"] > ").concat(He.HA_ICON_BUTTON)]={pointerEvents:"all"},it),Wt=((ct={})["".concat(Me.HOST," ").concat(Me.ITEM,":not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM)]={background:Pt(Fe.ITEM_BACKGROUND,"none")},ct),Kt=((at={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM)]={background:Pt(Fe.ITEM_BACKGROUND_HOVER,Fe.ITEM_BACKGROUND,"none")},at),qt=((st={})["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR,xe.SIDEBAR_ICON_COLOR)},st),Yt=((_t={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR_SELECTED,xe.SIDEBAR_SELECTED_ICON_COLOR)},_t),$t=((ut={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR_HOVER,Fe.ICON_COLOR,xe.SIDEBAR_ICON_COLOR)},ut),zt=((lt={})["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR,xe.SIDEBAR_TEXT_COLOR)},lt),Jt=((dt={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR_SELECTED,xe.SIDEBAR_SELECTED_TEXT_COLOR)},dt),Qt=((Et={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR_HOVER,Fe.TEXT_COLOR,xe.SIDEBAR_TEXT_COLOR)},Et),Zt=((Ot={})["".concat(Me.HOST," :is(").concat(Me.ITEM,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER,") > ").concat(He.PAPER_ICON_ITEM).concat(Be.BEFORE)]={background:Pt(Fe.SELECTION_BACKGROUND,Fe.ICON_COLOR_SELECTED,xe.SIDEBAR_SELECTED_ICON_COLOR),opacity:Pt(Fe.SELECTION_OPACITY,"0.12")},Ot),en=((ft={})["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR,xe.SIDEBAR_TEXT_COLOR),display:"block"},ft),tn=((ht={})["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM).concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR_SELECTED,xe.SIDEBAR_SELECTED_TEXT_COLOR)},ht),nn=((pt={})["".concat(Me.HOST_EXPANDED," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR_HOVER,Fe.INFO_COLOR,xe.SIDEBAR_TEXT_COLOR)},pt),on=((It={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(Me.NOTIFICATION_BADGE,", ").concat(Me.CONFIGURATION_BADGE,")")]={backgroundColor:Pt(Fe.NOTIFICATION_COLOR_SELECTED,Fe.NOTIFICATION_COLOR,xe.ACCENT_COLOR),color:Pt(Fe.NOTIFICATION_TEXT_COLOR_SELECTED,Fe.NOTIFICATION_TEXT_COLOR,xe.TEXT_ACCENT_COLOR,xe.TEXT_PRIMARY_COLOR)},It),rn=((Tt={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(Me.NOTIFICATION_BADGE,", ").concat(Me.CONFIGURATION_BADGE,")")]={backgroundColor:Pt(Fe.NOTIFICATION_COLOR_HOVER,Fe.NOTIFICATION_COLOR,xe.ACCENT_COLOR),color:Pt(Fe.NOTIFICATION_TEXT_COLOR_HOVER,Fe.NOTIFICATION_TEXT_COLOR,xe.TEXT_ACCENT_COLOR,xe.TEXT_PRIMARY_COLOR)},Tt),cn="Invalid configuration",an=o(["title","subtitle","sidebar_background","title_color","subtitle_color","sidebar_button_color","sidebar_border_color","menu_background","divider_color","divider_top_color","divider_bottom_color","scrollbar_thumb_color","styles"],Ke,!0),sn=["js_variables","jinja_variables","partials","extendable_configs"],_n=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.STRING)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a string'))}))},un=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.STRING&&typeof e[t]!==Ce.NUMBER)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a number or a string'))}))},ln=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.BOOLEAN)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean'))}))},dn=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.BOOLEAN&&typeof e[t]!==Ce.STRING)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean or a string'))}))},En=function(e,t){e.forEach((function(e){var n=e[0],o=e[1];if(!On(o))throw new SyntaxError("".concat(t,' "').concat(n,'" property should be a string or an array of strings'))}))},On=function(e){return typeof e===Ce.UNDEFINED||(typeof e===Ce.STRING||Array.isArray(e)&&e.some((function(e){return typeof e===Ce.STRING})))},fn=function(e,t,n,o){(void 0===o&&(o=!1),e)&&(Array.isArray(e)?e:[e]).forEach((function(e){var r;if(e===Pe&&!o)throw new SyntaxError("".concat(n,' "entend_from" can only be "base" in exceptions'));if(e!==Pe&&!(e in(null!==(r=t.extendable_configs)&&void 0!==r?r:{})))throw new SyntaxError("".concat(n,' "').concat(e,'" doesn\'t exist in "extendable_configs"'))}))},hn=function(e,t,n){e&&(Array.isArray(e)?e:[e]).forEach((function(e){if(n.includes(e))throw new SyntaxError("".concat(cn,', circular extend dependency detected in "').concat(n.join(" > ")," > ").concat(e,'"'));if(e===Pe)throw new SyntaxError("".concat(cn,', error in extendable config "').concat(n[0],'": "entend_from" can only be "base" in exceptions'));if(!(e in t.extendable_configs))throw new SyntaxError("".concat(cn,', error in "').concat(n[n.length-1],'": "').concat(e,'" doesn\'t exist in "extendable_configs"'));hn(t.extendable_configs[e].extend_from,t,o(o([],n,!0),[e],!1))}))},pn=function(e,t){sn.forEach((function(n){if(n in e)throw new SyntaxError("".concat(t,' "').concat(n,'" option can only be placed in the main config'))}))},In=function(e,t,n){if("string"==typeof t&&(Nt.test(t)||bt.test(t)))console.warn('"'.concat(e,'" property should not have templates. "').concat(n.join(" > "),'" seems to be a template'));else if(typeof t!==Ce.STRING&&typeof t!==Ce.NUMBER&&typeof t!==Ce.BOOLEAN)if(Array.isArray(t))t.forEach((function(t,r){In(e,t,o(o([],n,!0),["[".concat(r,"]")],!1))}));else{if(Object.prototype.toString.call(t)!==Ge)throw new SyntaxError("".concat(cn,', "').concat(e,": ").concat(n.join(" > "),'" has a wrong type ').concat(Object.prototype.toString.call(t)));var r=t;Object.entries(r).forEach((function(t){var r=t[0],i=t[1];In(e,i,o(o([],n,!0),[r],!1))}))}},Tn=function(e,t){if(typeof t!==Ce.UNDEFINED){if(Object.prototype.toString.call(t)!==Ge)throw new SyntaxError("".concat(cn,', "').concat(e,'" property should be an object'));Object.entries(t).forEach((function(t){var n=t[0],o=t[1];In(e,o,[n])}))}},An=function(e,t){if(typeof e!==Ce.UNDEFINED){if(!Array.isArray(e))throw new SyntaxError("".concat(cn,", exceptions should be an array"));e.forEach((function(e){!function(e,t){var n;if(pn(e,"".concat(cn,", exceptions")),_n(e,o([],an,!0),"".concat(cn,", exceptions")),un(e,o([],qe,!0),"".concat(cn,", exceptions")),En([["user",e.user],["not_user",e.not_user],["device",e.device],["not_device",e.not_device],["extend_from",e.extend_from]],"".concat(cn,", exceptions")),fn(e.extend_from,t,"".concat(cn,", error in exception:"),!0),typeof e.matchers_conditions!==Ce.UNDEFINED&&e.matchers_conditions!==pe.AND&&e.matchers_conditions!==pe.OR)throw new SyntaxError("".concat(cn,', exceptions "matchers_conditions" property should be "').concat(pe.AND,'" or "').concat(pe.OR,'"'));if(typeof e.order!==Ce.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(cn,', exceptions "order" property should be an array'));if(dn(e,["sidebar_editable"],"".concat(cn,", exceptions")),ln(e,["hide_all","is_admin","is_owner"],"".concat(cn,", exceptions")),typeof e.sidebar_mode!==Ce.UNDEFINED&&!(e.sidebar_mode in Rt))throw new SyntaxError("".concat(cn,', exceptions "sidebar_mode" property should be ').concat(fe.HIDDEN,", ").concat(fe.NARROW," or ").concat(fe.EXTENDED));if(e.user&&e.not_user)throw new SyntaxError("".concat(cn,', exceptions "user" and "not_user" properties cannot be used together'));if(e.device&&e.not_device)throw new SyntaxError("".concat(cn,', exceptions "device" and "not_device" properties cannot be used together'));null===(n=e.order)||void 0===n||n.forEach(Rn)}(e,t)}))}},Rn=function(e){if(pn(e,"".concat(cn," in ").concat(e.item,",")),!e.item)throw new SyntaxError("".concat(cn,', every item in an "order" array should have an "item" property'));if(_n(e,o(["item","info"],Ke,!0),"".concat(cn," in ").concat(e.item,",")),un(e,o([],qe,!0),"".concat(cn," in ").concat(e.item,",")),dn(e,["hide"],"".concat(cn," in ").concat(e.item,",")),e.new_item){if(_n(e,["href","icon"],"".concat(cn," in ").concat(e.item,",")),!e.href)throw new SyntaxError("".concat(cn," in ").concat(e.item,', if you set "new_item" as "true", "href" property is necessary'));if(!e.icon)throw new SyntaxError("".concat(cn," in ").concat(e.item,', if you set "new_item" as "true", "icon" property is necessary'))}},vn=function(e){var t;if(_n(e,o([],an,!0),"".concat(cn,",")),En([["extend_from",e.extend_from]],"".concat(cn,",")),fn(e.extend_from,e,"".concat(cn,", error in main config:")),function(e){e.extendable_configs&&Object.entries(e.extendable_configs).forEach((function(t){var n=t[0],o=t[1];hn(o.extend_from,e,[n])}))}(e),un(e,o([],qe,!0),"".concat(cn,",")),dn(e,["sidebar_editable"],"".concat(cn,",")),ln(e,["hide_all"],"".concat(cn,",")),typeof e.sidebar_mode!==Ce.UNDEFINED&&!(e.sidebar_mode in Rt))throw new SyntaxError("".concat(cn,', "sidebar_mode" property should be ').concat(fe.HIDDEN,", ").concat(fe.NARROW," or ").concat(fe.EXTENDED));if(typeof e.order!==Ce.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(cn,', "order" property should be an array'));if(typeof e.partials!==Ce.UNDEFINED){if(Object.prototype.toString.call(e.partials)!==Ge)throw new SyntaxError("".concat(cn,', "partials" property should be an object'));Object.entries(e.partials).forEach((function(e){var t=e[0];if(typeof e[1]!==Ce.STRING)throw new SyntaxError("".concat(cn,', "partials" should be an object with strings. The partial ').concat(t," is not a string"))}))}Tn("js_variables",e.js_variables),Tn("jinja_variables",e.jinja_variables),null===(t=e.order)||void 0===t||t.forEach(Rn),An(e.exceptions,e)},Nn=function(){return t(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){return e="".concat(De,": JSON config file not found."),t="Make sure you have valid config in /config/www/".concat(ge,".json file."),[2,new Promise((function(n){fetch("".concat(we,".json?hash=").concat(Math.random().toString(16).slice(2))).then((function(o){if(!o.ok)throw Error("".concat(e,"\n").concat(t));o.json().then((function(e){var o;(null===(o=e.id)||void 0===o?void 0:o.startsWith("example_json"))&&console.warn("".concat(De,": You seem to be using the example configuration.\n").concat(t)),vn(e),n(e)})).catch((function(e){throw Error("".concat(De,": ").concat(e.message))}))})).catch((function(){throw Error("".concat(e,"\n").concat(t))}))}))]}))}))},bn=function(){function o(){var e=this,t=new re;t.addEventListener(B.ON_LISTEN,(function(t){e._homeAssistant=t.detail.HOME_ASSISTANT,e._main=t.detail.HOME_ASSISTANT_MAIN,e._haDrawer=t.detail.HA_DRAWER,e._sidebar=t.detail.HA_SIDEBAR,e._partialPanelResolver=t.detail.PARTIAL_PANEL_RESOLVER}),{once:!0}),t.addEventListener(B.ON_PANEL_LOAD,this._panelLoaded.bind(this)),t.listen(),this._styleManager=new Le({prefix:De,namespace:De,throwWarnings:!1}),this._items=[],this._sidebarScroll=0,this._isSidebarEditable=void 0,this._itemTouchedBinded=this._itemTouched.bind(this),this._mouseEnterBinded=this._mouseEnter.bind(this),this._mouseLeaveBinded=this._mouseLeave.bind(this),this._configPromise=Nn(),this._process()}return o.prototype._getConfig=function(){return t(this,void 0,void 0,(function(){var e,t=this;return n(this,(function(n){switch(n.label){case 0:return e=this,[4,this._configPromise.then((function(e){return function(e,t,n){return new gt(n,e,t).config}(t._ha.hass.user,navigator.userAgent.toLowerCase(),e)}))];case 1:return e._config=n.sent(),[2]}}))}))},o.prototype._getElements=function(){return t(this,void 0,void 0,(function(){var e,t,o,i;return n(this,(function(n){switch(n.label){case 0:return e={retries:100,delay:50,shouldReject:!1},[4,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element];case 1:return t=n.sent(),[4,r((function(){return t.querySelector(":scope > ".concat(Me.SPACER))}),(function(e){return!!e}),e)];case 2:return o=n.sent(),[4,r((function(){return t.querySelectorAll(":scope > ".concat(Me.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(Me.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 3:return i=n.sent(),[2,[t,i,o]]}}))}))},o.prototype._hideAnchor=function(e,t){t?e.style.display="none":e.style.removeProperty("display")},o.prototype._buildNewItem=function(e){var t=document.createElement("a");return t.href=e.href,t.target=e.target||"",t.tabIndex=-1,t.setAttribute(ke.ROLE,"option"),t.setAttribute(ke.PANEL,e.item.toLowerCase().replace(/\s+/,"-")),t.setAttribute(ke.ARIA_SELECTED,"false"),t.innerHTML='\n \n \n \n ').concat(e.item,'\n \n \n \n ').trim(),t},o.prototype._getTemplateString=function(e){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return t="",e instanceof Promise||"string"==typeof e||"number"==typeof e&&!Number.isNaN(e)||"boolean"==typeof e||"object"==typeof e?"string"!=typeof e?[3,1]:(t=e.trim(),[3,6]):[3,6];case 1:return"number"!=typeof e&&"boolean"!=typeof e?[3,2]:(t=e.toString(),[3,6]);case 2:return e instanceof Promise?[4,e]:[3,5];case 3:return o=n.sent(),[4,this._getTemplateString(o)];case 4:return t=n.sent(),[3,6];case 5:t=JSON.stringify(e),n.label=6;case 6:return[2,t]}}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(Me.TITLE).element.then((function(t){e._config.title&&e._subscribeTemplate(e._config.title,(function(e){t.innerHTML=e})),e._config.subtitle&&e._subscribeTemplate(e._config.subtitle,(function(e){t.dataset.subtitle=e}))}))},o.prototype._subscribeSideBarEdition=function(){var e=this,t=function(e){e.preventDefault(),e.stopImmediatePropagation()},n=function(e,n){e.removeEventListener(Xe.HASS_EDIT_SIDEBAR,t,!0),n.removeAttribute(Ue)},o=function(e,n){e.removeEventListener(Xe.HASS_EDIT_SIDEBAR,t,!0),e.addEventListener(Xe.HASS_EDIT_SIDEBAR,t,!0),n.setAttribute(Ue,"")};Promise.all([this._main.element,this._sidebar.selector.$.query(Me.MENU).element]).then((function(t){var r=t[0],i=t[1];"boolean"==typeof e._config.sidebar_editable&&(e._isSidebarEditable=e._config.sidebar_editable,e._isSidebarEditable||o(r,i)),"string"==typeof e._config.sidebar_editable&&e._subscribeTemplate(e._config.sidebar_editable,(function(t){"true"===t||"false"===t?(e._isSidebarEditable=!("false"===t),e._isSidebarEditable?n(r,i):o(r,i)):(e._isSidebarEditable=void 0,n(r,i)),e._checkProfileEditableButton()}))}))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(Me.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.innerHTML=e}))},o.prototype._subscribeIcon=function(e,t){this._subscribeTemplate(t,(function(t){var n=e.querySelector(He.HA_ICON);if(!n){(n=document.createElement(He.HA_ICON)).setAttribute("slot","item-icon");var o=e.querySelector(He.HA_SVG_ICON);o?o.replaceWith(n):e.querySelector(He.PAPER_ICON_ITEM).prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(Me.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector("".concat(Me.NOTIFICATION_BADGE,":not(").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED,")")),o=e.querySelector(Me.NOTIFICATIONS_BADGE_COLLAPSED);n||((n=document.createElement("span")).classList.add(je.NOTIFICATIONS_BADGE),e.querySelector(He.PAPER_ICON_ITEM).append(n)),o||((o=document.createElement("span")).classList.add(je.NOTIFICATIONS_BADGE,je.NOTIFICATIONS_BADGE_COLLAPSED),e.querySelector("".concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON)).after(o));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,o.innerHTML=t,e.setAttribute(ke.WITH_NOTIFICATION,"true")):(n.innerHTML="",o.innerHTML="",e.removeAttribute(ke.WITH_NOTIFICATION))}))},o.prototype._subscribeHide=function(e,t){var n=this;"boolean"==typeof t?this._hideAnchor(e,t):this._subscribeTemplate(t,(function(t){n._hideAnchor(e,"true"===t)}))},o.prototype._subscribeTemplateColorChanges=function(e,t,n){var o=this;n.forEach((function(n){var r=n[0],i=n[1];e[r]&&o._subscribeTemplate(e[r],(function(e){t.style.setProperty(i,e)}))}))},o.prototype._subscribeTemplate=function(e,t){Nt.test(e)?this._createJsTemplateSubscription(e.replace(Nt,"$1"),t):bt.test(e)?this._createJinjaTemplateSubscription(e,t):this._getTemplateString(e).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(wt(e,this._config.partials),(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;window.hassConnection.then((function(r){r.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:Xe.RENDER_TEMPLATE,template:wt(t,o._config.partials),variables:e({user_name:o._ha.hass.user.name,user_is_admin:o._ha.hass.user.is_admin,user_is_owner:o._ha.hass.user.is_owner,user_agent:window.navigator.userAgent},o._config.jinja_variables)})}))},o.prototype._focusItem=function(e,t,n){var o=this._items.length,r="none",i=0;if(t)for(var c=(_=e+1)+o,a=_;ao-1?a-o:a;if(this._items[s].style.display!==r){i=s;break}}else{var _;for(c=(_=e-1)-o,a=_;a>c;a--){s=a<0?o+a:a;if(this._items[s].style.display!==r){i=s;break}}}n?this._items[i].querySelector(He.PAPER_ICON_ITEM).focus():(this._items[i].focus(),this._items[i].tabIndex=0)},o.prototype._focusItemByKeyboard=function(e,t){var n=e.querySelector("\n ".concat(Me.SCOPE," > ").concat(Me.ITEM,":not(.").concat(je.IRON_SELECTED,"):focus,\n ").concat(Me.SCOPE," > ").concat(Me.ITEM,":focus,\n ").concat(Me.SCOPE," > ").concat(Me.ITEM,":has(> ").concat(He.PAPER_ICON_ITEM,":focus)\n ")),o=0;this._items.forEach((function(e,t){e===n&&(o=t),e.tabIndex=-1})),this._focusItem(o,t,!1)},o.prototype._focusItemByTab=function(e,t,n){if(t.nodeName===We.A){var o=t,r=this._items.indexOf(o),i=this._items.length-1;if(n&&r0)this._focusItem(r,n,!0);else(n?e.querySelector(Me.SIDEBAR_NOTIFICATIONS):e.querySelector(He.HA_ICON_BUTTON)).focus()}else{if(n)e.querySelector("".concat(Me.PROFILE," > ").concat(He.PAPER_ICON_ITEM)).focus();else this._focusItem(0,n,!0)}},o.prototype._getActivePaperIconElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&(t.nodeName===We.PAPER_ICON_ITEM||t.nodeName===We.A&&"option"===t.getAttribute("role"))?t:t.shadowRoot&&At.includes(t.nodeName)?this._getActivePaperIconElement(t.shadowRoot):null:null},o.prototype._processSidebar=function(){var e=this;Promise.all([this._main.element,this._partialPanelResolver.element]).then((function(o){var r=o[0],i=o[1],c=e._config.sidebar_mode,a=matchMedia("(max-width: 870px)");if(c){r.hass.dockedSidebar=Rt[c];var s=function(o){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return c===fe.HIDDEN?[3,5]:[4,yt()];case 1:return e.sent(),r.narrow=!1,[4,yt()];case 2:return e.sent(),i.narrow=o,[4,yt()];case 3:return e.sent(),o?[4,this._partialPanelResolver.selector.query(Me.HA_MENU_BUTTON).element]:[3,5];case 4:e.sent().narrow=!1,e.label=5;case 5:return[2]}}))}))};a.addEventListener("change",(function(e){s(e.matches)})),s(a.matches)}})),Promise.all([this._haDrawer.selector.$.query(Me.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._config,o,$e),e._subscribeTemplateColorChanges(e._config,n,[["sidebar_border_color",Fe.BORDER_COLOR]]),i.addEventListener(Xe.KEYDOWN,(function(t){t.key!==Ve.ARROW_DOWN&&t.key!==Ve.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Ve.ARROW_DOWN))}),!0),window.addEventListener(Xe.KEYDOWN,(function(t){if(t.key===Ve.TAB){var n=e._getActivePaperIconElement();if(n)if(n.nodeName===We.PAPER_ICON_ITEM){var o=n.parentElement;o.getAttribute(ke.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey))}else n.getAttribute(ke.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,n,!t.shiftKey))}}),!0),e._styleManager.addStyle(kt,n),e._styleManager.addStyle([Mt,Bt,xt,Ft,Gt,Ut,jt,Xt,Vt,Wt,Kt,qt,Yt,$t,zt,Jt,Qt,Zt,en,tn,nn,on,rn,e._config.styles||""],r)}))},o.prototype._rearrange=function(){var t=this;this._getElements().then((function(n){var o=t._config,r=o.order,i=o.hide_all,c=n[0],a=n[1],s=n[2],_=0,u=!1;t._items=Array.from(a);var l=new Set;i&&t._items.forEach((function(e){t._hideAnchor(e,!0)}));var d=r.reduce((function(n,o){var r=o.item,i=o.match,c=o.exact,a=o.new_item,s=r.toLocaleLowerCase(),_=a?void 0:t._items.find((function(e){var t=i===Ie.DATA_PANEL?e.getAttribute(ke.PANEL):i===Ie.HREF?e.getAttribute(ke.HREF):e.querySelector(Me.ITEM_TEXT).innerText.trim();return!((!c||r!==t)&&(c||!(null==t?void 0:t.toLowerCase().includes(s))))&&(!l.has(e)&&(l.add(e),!0))}));return _&&_.setAttribute(ke.PROCESSED,"true"),(a||_)&&n.push(e(e({},o),{element:_})),a||_||console.warn("".concat(De,": you have an order item in your configuration that didn't match any sidebar item: \"").concat(r,'"')),n}),[]),E=function(){u||(t._items.forEach((function(e){e.hasAttribute(ke.PROCESSED)||(e.style.order="".concat(_))})),_++,s.style.order="".concat(_),_++,u=!0)};d.forEach((function(e){if(e.bottom&&E(),e.new_item){var n=t._buildNewItem(e);c.append(n),e.element=n,e.element.setAttribute(ke.PROCESSED,"true"),t._items.push(e.element)}else if(e.element){var o=e.element;e.href&&(o.href=e.href),e.target&&(o.target=e.target)}e.element.style.order="".concat(_),e.name&&t._subscribeName(e.element,e.name),e.icon&&t._subscribeIcon(e.element,e.icon),e.info&&t._subscribeInfo(e.element,e.info),e.notification&&t._subscribeNotification(e.element,e.notification),void 0!==e.hide&&t._subscribeHide(e.element,e.hide),t._subscribeTemplateColorChanges(e,e.element,Ye),e.new_item&&(e.element.addEventListener(Xe.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(Xe.MOUSELEAVE,t._mouseLeaveBinded)),e.element.addEventListener(Xe.MOUSEDOWN,t._itemTouchedBinded),e.element.addEventListener(Xe.KEYDOWN,(function(e){e.key===Ve.ENTER&&t._itemTouchedBinded()})),_++})),d.length&&E(),t._items.sort((function(e,t){return+e.style.order-+t.style.order})),t._panelLoaded()}))},o.prototype._itemTouched=function(){return t(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return this._sidebar.selector.$.query(He.PAPER_LISTBOX).element.then((function(t){e._sidebarScroll=t.scrollTop})),[2]}))}))},o.prototype._mouseEnter=function(e){this._sidebar.element.then((function(t){t.alwaysExpand||(t._mouseLeaveTimeout&&(clearTimeout(t._mouseLeaveTimeout),t._mouseLeaveTimeout=void 0),t._showTooltip(e.currentTarget))}))},o.prototype._mouseLeave=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this._sidebar.element.then((function(e){e._mouseLeaveTimeout&&clearTimeout(e._mouseLeaveTimeout),e._mouseLeaveTimeout=window.setTimeout((function(){e._hideTooltip()}),500)})),[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),"/profile/general"!==e.__route.path?[3,3]:[4,this._partialPanelResolver.selector.query(Me.EDIT_SIDEBAR_BUTTON).element];case 2:(t=n.sent())&&(!1===this._isSidebarEditable?t.setAttribute(ke.DISABLED,""):t.removeAttribute(ke.DISABLED)),n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t=e.__route.path,[4,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element];case 2:return o=n.sent(),r=o.querySelector("\n ".concat(Me.SCOPE," > ").concat(Me.ITEM,'[href="').concat(t,'"],\n ').concat(Me.SCOPE," > ").concat(Me.ITEM,'[href="').concat(t,'/dashboard"]\n ')),i=r?null:this._items.reduce((function(e,n){var o=n.getAttribute(ke.HREF);return t.startsWith(o)&&(!e||o.length>e.getAttribute(ke.HREF).length)&&(e=n),e}),null),this._items.forEach((function(e){var t=r&&r===e||!r&&i===e;e.classList.toggle(je.IRON_SELECTED,t),e.setAttribute(ke.ARIA_SELECTED,"".concat(t))})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._checkProfileEditableButton(),[2]}}))}))},o.prototype._process=function(){var e=this;this._homeAssistant.element.then((function(t){e._ha=t,new Re(e._ha).getRenderer().then((function(t){e._renderer=t,e._getConfig().then((function(){var t;e._renderer.variables=null!==(t=e._config.js_variables)&&void 0!==t?t:{},e._processSidebar(),e._subscribeTitle(),e._subscribeSideBarEdition(),e._rearrange()}))}))}))},o}();window.CustomSidebar||(console.info("%c≡ ".concat(De.toUpperCase()," (JSON)%cv").concat("8.2.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px"),window.CustomSidebar=new bn)}(); diff --git a/www/community/custom-sidebar/custom-sidebar-json.js.gz b/www/community/custom-sidebar/custom-sidebar-json.js.gz index 754e3f36..2a36fd85 100644 Binary files a/www/community/custom-sidebar/custom-sidebar-json.js.gz and b/www/community/custom-sidebar/custom-sidebar-json.js.gz differ diff --git a/www/community/custom-sidebar/custom-sidebar-yaml.js b/www/community/custom-sidebar/custom-sidebar-yaml.js index 72b3fb92..afcd69c0 100644 --- a/www/community/custom-sidebar/custom-sidebar-yaml.js +++ b/www/community/custom-sidebar/custom-sidebar-yaml.js @@ -1 +1 @@ -!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1] ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.PROFILE=".profile",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.HA_SCROLLBAR=".ha-scrollbar",e.DATA_INFO="[data-info]"}(Me||(Me={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(xe||(xe={})),function(e){e.PRIMARY_BACKGROUND_COLOR="--primary-background-color",e.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",e.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",e.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",e.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",e.SIDEBAR_ICON_COLOR="--sidebar-icon-color",e.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",e.SIDEBAR_TEXT_COLOR="--sidebar-text-color",e.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",e.ACCENT_COLOR="--accent-color",e.TEXT_ACCENT_COLOR="--text-accent-color",e.TEXT_PRIMARY_COLOR="--text-primary-color",e.PRIMARY_TEXT_COLOR="--primary-text-color",e.DIVIDER_COLOR="--divider-color",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(Pe||(Pe={})),function(e){e.BACKGROUND="--custom-sidebar-background",e.BORDER_COLOR="--custom-sidebar-border-color",e.MENU_BACKGROUND="--custom-sidebar-menu-background",e.TITLE_COLOR="--custom-sidebar-title-color",e.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",e.BUTTON_COLOR="--custom-sidebar-button-color",e.DIVIDER_COLOR="--custom-sidebar-divider-color",e.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",e.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",e.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",e.ITEM_BACKGROUND="--custom-sidebar-item-background",e.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",e.ICON_COLOR="--custom-sidebar-icon-color",e.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",e.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",e.TEXT_COLOR="--custom-sidebar-text-color",e.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",e.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",e.SELECTION_BACKGROUND="--custom-sidebar-selection-background",e.SELECTION_OPACITY="--custom-sidebar-selection-opacity",e.INFO_COLOR="--custom-sidebar-info-color",e.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",e.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",e.NOTIFICATION_COLOR="--custom-sidebar-notification-color",e.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",e.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",e.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",e.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",e.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(He||(He={}));var ke,Ge,je,Ue,We,Ve=["item_background","item_background_hover","icon_color","icon_color_selected","icon_color_hover","text_color","text_color_selected","text_color_hover","selection_background","info_color","info_color_selected","info_color_hover","notification_color","notification_color_selected","notification_color_hover","notification_text_color","notification_text_color_selected","notification_text_color_hover"],Xe=["selection_opacity"],qe=[["item_background",He.ITEM_BACKGROUND],["item_background_hover",He.ITEM_BACKGROUND_HOVER],["icon_color",He.ICON_COLOR],["icon_color_selected",He.ICON_COLOR_SELECTED],["icon_color_hover",He.ICON_COLOR_HOVER],["text_color",He.TEXT_COLOR],["text_color_selected",He.TEXT_COLOR_SELECTED],["text_color_hover",He.TEXT_COLOR_HOVER],["selection_background",He.SELECTION_BACKGROUND],["selection_opacity",He.SELECTION_OPACITY],["info_color",He.INFO_COLOR],["info_color_selected",He.INFO_COLOR_SELECTED],["info_color_hover",He.INFO_COLOR_HOVER],["notification_color",He.NOTIFICATION_COLOR],["notification_color_selected",He.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",He.NOTIFICATION_COLOR_HOVER],["notification_text_color",He.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",He.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",He.NOTIFICATION_TEXT_COLOR_HOVER]],Ke=o([["title_color",He.TITLE_COLOR],["subtitle_color",He.SUBTITLE_COLOR],["sidebar_button_color",He.BUTTON_COLOR],["sidebar_background",He.BACKGROUND],["menu_background",He.MENU_BACKGROUND],["scrollbar_thumb_color",He.SCROLLBAR_THUMB_COLOR],["divider_color",He.DIVIDER_COLOR],["divider_top_color",He.DIVIDER_TOP_COLOR],["divider_bottom_color",He.DIVIDER_BOTTOM_COLOR]],qe,!0);!function(e){e.NOTIFICATIONS_BADGE="notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED="notification-badge-collapsed",e.IRON_SELECTED="iron-selected"}(ke||(ke={})),function(e){e.PANEL="data-panel",e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.ARIA_SELECTED="aria-selected",e.ARIA_DISABLED="aria-disabled",e.DISABLED="disabled",e.HREF="href",e.STYLE="style"}(Ge||(Ge={})),function(e){e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.HASS_EDIT_SIDEBAR="hass-edit-sidebar",e.RENDER_TEMPLATE="render_template"}(je||(je={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Ue||(Ue={})),function(e){e.PAPER_ICON_ITEM="PAPER-ICON-ITEM",e.A="A"}(We||(We={}));var Ye,$e,ze,Qe,Je,Ze,et,tt,nt,ot,rt,it,at,ct,st,lt,ut,dt,pt,_t,ft,ht,Et,Ot,At=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],It=((Ae={})[he.HIDDEN]=Ee.ALWAYS_HIDDEN,Ae[he.NARROW]=Ee.AUTO,Ae[he.EXTENDED]=Ee.DOCKED,Ae),Tt="/profile",mt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,vt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,bt=/@partial\s+([\w-]+)/g,yt=o(o([],Ve,!0),Xe,!0),Nt=o(["title","subtitle","hide_all","sidebar_editable","sidebar_mode","sidebar_background","title_color","subtitle_color","sidebar_button_color","sidebar_border_color","menu_background","divider_color","divider_top_color","divider_bottom_color","scrollbar_thumb_color","styles"],yt,!0),gt=["js_variables","jinja_variables","partials"],Rt=function(e){return Array.isArray(e)?e.map((function(e){return e.toLocaleLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},Ct=function(e,t){var n=new Map;return e.forEach((function(e){n.set(e.item,e)})),n.forEach((function(e){yt.forEach((function(n){void 0===e[n]&&void 0!==t[n]&&("selection_opacity"===n?e.selection_opacity=t.selection_opacity:e[n]=t[n])})),e.new_item||void 0!==e.hide||void 0===t.hide_all||(e.hide=t.hide_all)})),Array.from(n.values()).sort((function(e,t){return!!e.bottom!=!!t.bottom?e.bottom?1:-1:typeof e.order===Ce.UNDEFINED||typeof t.order===Ce.UNDEFINED?e.order===t.order?0:typeof e.order===Ce.UNDEFINED?1:-1:e.order-t.order}))},St=function(t,n,r){if(r.exceptions){var i=t.name.toLocaleLowerCase(),a=r.exceptions.filter((function(e){return e.user&&Rt(e.user).includes(i)||e.not_user&&!Rt(e.not_user).includes(i)||e.device&&Rt(e.device).some((function(e){return n.includes(e)}))||e.not_device&&!Rt(e.not_device).some((function(e){return n.includes(e)}))||void 0!==e.is_admin&&e.is_admin===t.is_admin})),c=a.length?a[a.length-1]:null,s=a.flatMap((function(e){return e.order||[]})),l=!a.some((function(e){return!e.extend_from_base})),u=function(e,t,n){var o={};return Nt.forEach((function(r){var i=null==t?void 0:t[r],a=n?null!=i?i:e[r]:i;typeof a!==Ce.UNDEFINED&&(o[r]=a)})),gt.forEach((function(t){o[t]=e[t]})),o}(r,c,l);return e(e({},u),l?{order:Ct(o(o([],r.order||[],!0),s,!0),u)}:{order:Ct(s,u)})}return e(e({},r),{order:Ct(r.order||[],r)})},Lt=function(){return new Promise((function(e){setTimeout(e,1)}))},Dt=function(e,t,n){return void 0===n&&(n=[]),e.replace(bt,(function(e,r){if(null==t?void 0:t[r]){if(n.includes(r))throw new SyntaxError("".concat(Se,": circular partials dependency ").concat(n.join(" > ")," > ").concat(r));return Dt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(Se,": partial ").concat(r," doesn't exist")),""}))},wt=function(){for(var e=[],t=0;t ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={maxWidth:"calc(100% - 100px)"},Ye["".concat(Me.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},Ye["".concat(Me.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(xe.AFTER)]={content:"attr(data-info)",display:"none",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Ye["{ SELECTOR.HOST_EXPANDED } ".concat(we.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED)]={opacity:"0"},Ye["".concat(Me.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Me.ITEM).concat(Me.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={zIndex:"1"},Ye["".concat(Me.HOST," ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATION_BADGE,":not(").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED,")")]=e({left:"calc(var(--app-drawer-width, 248px) - 22px)",maxWidth:"80px",transform:"translateX(-100%)"},Mt),Ye["".concat(Me.HOST," ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED)]=e({bottom:"14px",left:"26px",maxWidth:"20px"},Mt),Ye["".concat(Me.HOST," ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.CONFIGURATION_BADGE)]=e({},Mt),Ye),Pt=(($e={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(Me.TITLE)]={color:wt(He.TITLE_COLOR,Pe.SIDEBAR_TITLE_COLOR,Pe.PRIMARY_TEXT_COLOR)},$e),Ht=((ze={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(Me.TITLE).concat(xe.AFTER)]={content:"attr(data-subtitle)",color:wt(He.SUBTITLE_COLOR,He.TITLE_COLOR,Pe.SIDEBAR_TITLE_COLOR,Pe.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},ze),Bt=((Qe={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(we.HA_ICON_BUTTON)]={color:wt(He.BUTTON_COLOR,Pe.SIDEBAR_ICON_COLOR)},Qe),Ft=((Je={})[Me.HOST]={background:wt(He.BACKGROUND,Pe.SIDEBAR_BACKGROUND_COLOR)+" !important"},Je),kt=((Ze={})["".concat(Me.HOST," ").concat(Me.MENU)]={background:wt(He.MENU_BACKGROUND,He.BACKGROUND,Pe.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,Pe.PRIMARY_BACKGROUND_COLOR),borderBottomColor:wt(He.DIVIDER_TOP_COLOR,He.DIVIDER_COLOR,Pe.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},Ze),Gt=((et={})["".concat(Me.HOST," ").concat(Me.DIVIDER).concat(xe.BEFORE)]={backgroundColor:wt(He.DIVIDER_BOTTOM_COLOR,He.DIVIDER_COLOR,Pe.DIVIDER_COLOR)},et),jt=((tt={})["".concat(Me.HOST," > ").concat(Me.MC_DRAWER)]={borderColor:wt(He.BORDER_COLOR,Pe.DIVIDER_COLOR,"rgba(0,0,0,.12)")},tt),Ut=((nt={})["".concat(Me.HOST," ").concat(we.PAPER_LISTBOX).concat(Me.HA_SCROLLBAR)]={scrollbarColor:wt(He.SCROLLBAR_THUMB_COLOR,Pe.SCROLLBAR_THUMB_COLOR)+" transparent"},nt["".concat(Me.HOST," ").concat(we.PAPER_LISTBOX).concat(Me.HA_SCROLLBAR).concat(xe.WEBKIT_SCROLLBAR_THUMB)]={background:wt(He.SCROLLBAR_THUMB_COLOR,Pe.SCROLLBAR_THUMB_COLOR)},nt),Wt=((ot={})["".concat(Me.MENU,"[").concat(Fe,"]")]={pointerEvents:"none"},ot["".concat(Me.MENU,"[").concat(Fe,"] > ").concat(we.HA_ICON_BUTTON)]={pointerEvents:"all"},ot),Vt=((rt={})["".concat(Me.HOST," ").concat(Me.ITEM,":not(").concat(Me.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM)]={background:wt(He.ITEM_BACKGROUND,"none")},rt),Xt=((it={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM)]={background:wt(He.ITEM_BACKGROUND_HOVER,He.ITEM_BACKGROUND,"none")},it),qt=((at={})["".concat(Me.HOST," ").concat(we.PAPER_ICON_ITEM," > :is(").concat(we.HA_SVG_ICON,", ").concat(we.HA_ICON,")")]={color:wt(He.ICON_COLOR,Pe.SIDEBAR_ICON_COLOR)},at),Kt=((ct={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > :is(").concat(we.HA_SVG_ICON,", ").concat(we.HA_ICON,")")]={color:wt(He.ICON_COLOR_SELECTED,Pe.SIDEBAR_SELECTED_ICON_COLOR)},ct),Yt=((st={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM," > :is(").concat(we.HA_SVG_ICON,", ").concat(we.HA_ICON,")")]={color:wt(He.ICON_COLOR_HOVER,He.ICON_COLOR,Pe.SIDEBAR_ICON_COLOR)},st),$t=((lt={})["".concat(Me.HOST," ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:wt(He.TEXT_COLOR,Pe.SIDEBAR_TEXT_COLOR)},lt),zt=((ut={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:wt(He.TEXT_COLOR_SELECTED,Pe.SIDEBAR_SELECTED_TEXT_COLOR)},ut),Qt=((dt={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:wt(He.TEXT_COLOR_HOVER,He.TEXT_COLOR,Pe.SIDEBAR_TEXT_COLOR)},dt),Jt=((pt={})["".concat(Me.HOST," :is(").concat(Me.ITEM,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER,") > ").concat(we.PAPER_ICON_ITEM).concat(xe.BEFORE)]={background:wt(He.SELECTION_BACKGROUND,He.ICON_COLOR_SELECTED,Pe.SIDEBAR_SELECTED_ICON_COLOR),opacity:wt(He.SELECTION_OPACITY,"0.12")},pt),Zt=((_t={})["".concat(Me.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(xe.AFTER)]={color:wt(He.INFO_COLOR,Pe.SIDEBAR_TEXT_COLOR),display:"block"},_t),en=((ft={})["".concat(Me.HOST_EXPANDED," ").concat(we.PAPER_LISTBOX," > ").concat(Me.ITEM).concat(Me.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(xe.AFTER)]={color:wt(He.INFO_COLOR_SELECTED,Pe.SIDEBAR_SELECTED_TEXT_COLOR)},ft),tn=((ht={})["".concat(Me.HOST_EXPANDED," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(xe.AFTER)]={color:wt(He.INFO_COLOR_HOVER,He.INFO_COLOR,Pe.SIDEBAR_TEXT_COLOR)},ht),nn=((Et={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(we.PAPER_ICON_ITEM," > :is(").concat(Me.NOTIFICATION_BADGE,", ").concat(Me.CONFIGURATION_BADGE,")")]={backgroundColor:wt(He.NOTIFICATION_COLOR_SELECTED,He.NOTIFICATION_COLOR,Pe.ACCENT_COLOR),color:wt(He.NOTIFICATION_TEXT_COLOR_SELECTED,He.NOTIFICATION_TEXT_COLOR,Pe.TEXT_ACCENT_COLOR,Pe.TEXT_PRIMARY_COLOR)},Et),on=((Ot={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(we.PAPER_ICON_ITEM," > :is(").concat(Me.NOTIFICATION_BADGE,", ").concat(Me.CONFIGURATION_BADGE,")")]={backgroundColor:wt(He.NOTIFICATION_COLOR_HOVER,He.NOTIFICATION_COLOR,Pe.ACCENT_COLOR),color:wt(He.NOTIFICATION_TEXT_COLOR_HOVER,He.NOTIFICATION_TEXT_COLOR,Pe.TEXT_ACCENT_COLOR,Pe.TEXT_PRIMARY_COLOR)},Ot);function rn(e){return null==e}var an={isNothing:rn,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:rn(e)?[]:[e]},repeat:function(e,t){var n,o="";for(n=0;nc&&(t=o-c+(i=" ... ").length),n-o>c&&(n=o+c-(a=" ...").length),{str:i+e.slice(t,n).replace(/\t/g,"→")+a,pos:o-t+i.length}}function dn(e,t){return an.repeat(" ",t-e.length)+e}var pn=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,o=/\r?\n|\r|\0/g,r=[0],i=[],a=-1;n=o.exec(e.buffer);)i.push(n.index),r.push(n.index+n[0].length),e.position<=n.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var c,s,l="",u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(a-c<0);c++)s=un(e.buffer,r[a-c],i[a-c],e.position-(r[a]-r[a-c]),d),l=an.repeat(" ",t.indent)+dn((e.line-c+1).toString(),u)+" | "+s.str+"\n"+l;for(s=un(e.buffer,r[a],i[a],e.position,d),l+=an.repeat(" ",t.indent)+dn((e.line+1).toString(),u)+" | "+s.str+"\n",l+=an.repeat("-",t.indent+u+3+s.pos)+"^\n",c=1;c<=t.linesAfter&&!(a+c>=i.length);c++)s=un(e.buffer,r[a+c],i[a+c],e.position-(r[a]-r[a+c]),d),l+=an.repeat(" ",t.indent)+dn((e.line+c+1).toString(),u)+" | "+s.str+"\n";return l.replace(/\n$/,"")},_n=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],fn=["scalar","sequence","mapping"];var hn=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===_n.indexOf(t))throw new ln('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===fn.indexOf(this.kind))throw new ln('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function En(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,o){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=o)})),n[t]=e})),n}function On(e){return this.extend(e)}On.prototype.extend=function(e){var t=[],n=[];if(e instanceof hn)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new ln("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof hn))throw new ln("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new ln("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new ln("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof hn))throw new ln("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var o=Object.create(On.prototype);return o.implicit=(this.implicit||[]).concat(t),o.explicit=(this.explicit||[]).concat(n),o.compiledImplicit=En(o,"implicit"),o.compiledExplicit=En(o,"explicit"),o.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function o(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Sn=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var Ln=/^[-+]?[0-9]+e/;var Dn=new hn("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!Sn.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||an.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(an.isNegativeZero(e))return"-0.0";return n=e.toString(10),Ln.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),wn=vn.extend({implicit:[bn,yn,Cn,Dn]}),Mn=wn,xn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Pn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var Hn=new hn("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==xn.exec(e)||null!==Pn.exec(e))},construct:function(e){var t,n,o,r,i,a,c,s,l=0,u=null;if(null===(t=xn.exec(e))&&(t=Pn.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],o=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,o,r));if(i=+t[4],a=+t[5],c=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),s=new Date(Date.UTC(n,o,r,i,a,c,l)),u&&s.setTime(s.getTime()-u),s},instanceOf:Date,represent:function(e){return e.toISOString()}});var Bn=new hn("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var kn=new hn("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,o=0,r=e.length,i=Fn;for(n=0;n64)){if(t<0)return!1;o+=6}return o%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),r=o.length,i=Fn,a=0,c=[];for(t=0;t>16&255),c.push(a>>8&255),c.push(255&a)),a=a<<6|i.indexOf(o.charAt(t));return 0===(n=r%4*6)?(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)):18===n?(c.push(a>>10&255),c.push(a>>2&255)):12===n&&c.push(a>>4&255),new Uint8Array(c)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,o="",r=0,i=e.length,a=Fn;for(t=0;t>18&63],o+=a[r>>12&63],o+=a[r>>6&63],o+=a[63&r]),r=(r<<8)+e[t];return 0===(n=i%3)?(o+=a[r>>18&63],o+=a[r>>12&63],o+=a[r>>6&63],o+=a[63&r]):2===n?(o+=a[r>>10&63],o+=a[r>>4&63],o+=a[r<<2&63],o+=a[64]):1===n&&(o+=a[r>>2&63],o+=a[r<<4&63],o+=a[64],o+=a[64]),o}}),Gn=Object.prototype.hasOwnProperty,jn=Object.prototype.toString;var Un=new hn("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,o,r,i,a=[],c=e;for(t=0,n=c.length;t>10),56320+(e-65536&1023))}for(var Ao=new Array(256),Io=new Array(256),To=0;To<256;To++)Ao[To]=Eo(To)?1:0,Io[To]=Eo(To);function mo(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Kn,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function vo(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=pn(n),new ln(t,n)}function bo(e,t){throw vo(e,t)}function yo(e,t){e.onWarning&&e.onWarning.call(null,vo(e,t))}var No={YAML:function(e,t,n){var o,r,i;null!==e.version&&bo(e,"duplication of %YAML directive"),1!==n.length&&bo(e,"YAML directive accepts exactly one argument"),null===(o=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&bo(e,"ill-formed argument of the YAML directive"),r=parseInt(o[1],10),i=parseInt(o[2],10),1!==r&&bo(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&yo(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var o,r;2!==n.length&&bo(e,"TAG directive accepts exactly two arguments"),o=n[0],r=n[1],io.test(o)||bo(e,"ill-formed tag handle (first argument) of the TAG directive"),Yn.call(e.tagMap,o)&&bo(e,'there is a previously declared suffix for "'+o+'" tag handle'),ao.test(r)||bo(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){bo(e,"tag prefix is malformed: "+r)}e.tagMap[o]=r}};function go(e,t,n,o){var r,i,a,c;if(t1&&(e.result+=an.repeat("\n",t-1))}function Mo(e,t){var n,o,r=e.tag,i=e.anchor,a=[],c=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),o=e.input.charCodeAt(e.position);0!==o&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,bo(e,"tab characters must not be used in indentation")),45===o)&&uo(e.input.charCodeAt(e.position+1));)if(c=!0,e.position++,Lo(e,!0,-1)&&e.lineIndent<=t)a.push(null),o=e.input.charCodeAt(e.position);else if(n=e.line,Ho(e,t,Qn,!1,!0),a.push(e.result),Lo(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==o)bo(e,"bad indentation of a sequence entry");else if(e.lineIndentt?f=1:e.lineIndent===t?f=0:e.lineIndentt?f=1:e.lineIndent===t?f=0:e.lineIndentt)&&(O&&(a=e.line,c=e.lineStart,s=e.position),Ho(e,t,Jn,!0,r)&&(O?h=e.result:E=e.result),O||(Co(e,p,_,f,h,E,a,c,s),f=h=E=null),Lo(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==l)bo(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===r?bo(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?bo(e,"repeat of an indentation width identifier"):(l=t+r-1,s=!0)}if(lo(i)){do{i=e.input.charCodeAt(++e.position)}while(lo(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!so(i)&&0!==i)}for(;0!==i;){for(So(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!s||e.lineIndentl&&(l=e.lineIndent),so(i))u++;else{if(e.lineIndent0){for(r=a,i=0;r>0;r--)(a=_o(c=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:bo(e,"expected hexadecimal character");e.result+=Oo(i),e.position++}else bo(e,"unknown escape sequence");n=o=e.position}else so(c)?(go(e,n,o,!0),wo(e,Lo(e,!1,t)),n=o=e.position):e.position===e.lineStart&&Do(e)?bo(e,"unexpected end of the document within a double quoted scalar"):(e.position++,o=e.position)}bo(e,"unexpected end of the stream within a double quoted scalar")}(e,p)?E=!0:!function(e){var t,n,o;if(42!==(o=e.input.charCodeAt(e.position)))return!1;for(o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!uo(o)&&!po(o);)o=e.input.charCodeAt(++e.position);return e.position===t&&bo(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Yn.call(e.anchorMap,n)||bo(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Lo(e,!0,-1),!0}(e)?function(e,t,n){var o,r,i,a,c,s,l,u,d=e.kind,p=e.result;if(uo(u=e.input.charCodeAt(e.position))||po(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(uo(o=e.input.charCodeAt(e.position+1))||n&&po(o)))return!1;for(e.kind="scalar",e.result="",r=i=e.position,a=!1;0!==u;){if(58===u){if(uo(o=e.input.charCodeAt(e.position+1))||n&&po(o))break}else if(35===u){if(uo(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Do(e)||n&&po(u))break;if(so(u)){if(c=e.line,s=e.lineStart,l=e.lineIndent,Lo(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=i,e.line=c,e.lineStart=s,e.lineIndent=l;break}}a&&(go(e,r,i,!1),wo(e,e.line-c),r=i=e.position,a=!1),lo(u)||(i=e.position+1),u=e.input.charCodeAt(++e.position)}return go(e,r,i,!1),!!e.result||(e.kind=d,e.result=p,!1)}(e,p,$n===n)&&(E=!0,null===e.tag&&(e.tag="?")):(E=!0,null===e.tag&&null===e.anchor||bo(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===f&&(E=c&&Mo(e,_))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&bo(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,l=e.implicitTypes.length;s"),null!==e.result&&d.kind!==e.kind&&bo(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+d.kind+'", not "'+e.kind+'"'),d.resolve(e.result,e.tag)?(e.result=d.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):bo(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||E}function Bo(e){var t,n,o,r,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(Lo(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!uo(r);)r=e.input.charCodeAt(++e.position);for(o=[],(n=e.input.slice(t,e.position)).length<1&&bo(e,"directive name must not be less than one character in length");0!==r;){for(;lo(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!so(r));break}if(so(r))break;for(t=e.position;0!==r&&!uo(r);)r=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}0!==r&&So(e),Yn.call(No,n)?No[n](e,n,o):yo(e,'unknown document directive "'+n+'"')}Lo(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,Lo(e,!0,-1)):a&&bo(e,"directives end mark is expected"),Ho(e,e.lineIndent-1,Jn,!1,!0),Lo(e,!0,-1),e.checkLineBreaks&&oo.test(e.input.slice(i,e.position))&&yo(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Do(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,Lo(e,!0,-1)):e.position=55296&&o<=56319&&t+1=56320&&n<=57343?1024*(o-55296)+n-56320+65536:o}function Rr(e){return/^\n* /.test(e)}var Cr=1,Sr=2,Lr=3,Dr=4,wr=5;function Mr(e,t,n,o,r,i,a,c){var s,l=0,u=null,d=!1,p=!1,_=-1!==o,f=-1,h=function(e){return br(e)&&e!==Uo&&!vr(e)&&e!==tr&&e!==ir&&e!==nr&&e!==er&&e!==cr&&e!==sr&&e!==ur&&e!==pr&&e!==$o&&e!==Qo&&e!==Zo&&e!==Ko&&e!==dr&&e!==or&&e!==rr&&e!==Jo&&e!==Yo&&e!==zo&&e!==ar&&e!==lr}(gr(e,0))&&function(e){return!vr(e)&&e!==nr}(gr(e,e.length-1));if(t||a)for(s=0;s=65536?s+=2:s++){if(!br(l=gr(e,s)))return wr;h=h&&Nr(l,u,c),u=l}else{for(s=0;s=65536?s+=2:s++){if((l=gr(e,s))===Vo)d=!0,_&&(p=p||s-f-1>o&&" "!==e[f+1],f=s);else if(!br(l))return wr;h=h&&Nr(l,u,c),u=l}p=p||_&&s-f-1>o&&" "!==e[f+1]}return d||p?n>9&&Rr(e)?wr:a?i===Ar?wr:Sr:p?Dr:Lr:!h||a||r(e)?i===Ar?wr:Sr:Cr}function xr(e,t,n,o,r){e.dump=function(){if(0===t.length)return e.quotingType===Ar?'""':"''";if(!e.noCompatMode&&(-1!==fr.indexOf(t)||hr.test(t)))return e.quotingType===Ar?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),a=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),c=o||e.flowLevel>-1&&n>=e.flowLevel;switch(Mr(t,c,e.indent,a,(function(t){return function(e,t){var n,o;for(n=0,o=e.implicitTypes.length;n"+Pr(t,e.indent)+Hr(Tr(function(e,t){var n,o,r=/(\n+)([^\n]*)/g,i=(c=e.indexOf("\n"),c=-1!==c?c:e.length,r.lastIndex=c,Br(e.slice(0,c),t)),a="\n"===e[0]||" "===e[0];var c;for(;o=r.exec(e);){var s=o[1],l=o[2];n=" "===l[0],i+=s+(a||n||""===l?"":"\n")+Br(l,t),a=n}return i}(t,a),i));case wr:return'"'+function(e){for(var t,n="",o=0,r=0;r=65536?r+=2:r++)o=gr(e,r),!(t=_r[o])&&br(o)?(n+=e[r],o>=65536&&(n+=e[r+1])):n+=t||Er(o);return n}(t)+'"';default:throw new ln("impossible error: invalid scalar style")}}()}function Pr(e,t){var n=Rr(e)?String(t):"",o="\n"===e[e.length-1];return n+(o&&("\n"===e[e.length-2]||"\n"===e)?"+":o?"":"-")+"\n"}function Hr(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Br(e,t){if(""===e||" "===e[0])return e;for(var n,o,r=/ [^ ]/g,i=0,a=0,c=0,s="";n=r.exec(e);)(c=n.index)-i>t&&(o=a>i?a:c,s+="\n"+e.slice(i,o),i=o+1),a=c;return s+="\n",e.length-i>t&&a>i?s+=e.slice(i,a)+"\n"+e.slice(a+1):s+=e.slice(i),s.slice(1)}function Fr(e,t,n,o){var r,i,a,c="",s=e.tag;for(r=0,i=n.length;r tag resolver accepts not "'+s+'" style');o=c.represent[s](t,s)}e.dump=o}return!0}return!1}function Gr(e,t,n,o,r,i,a){e.tag=null,e.dump=n,kr(e,n,!1)||kr(e,n,!0);var c,s=Go.call(e.dump),l=o;o&&(o=e.flowLevel<0||e.flowLevel>t);var u,d,p="[object Object]"===s||"[object Array]"===s;if(p&&(d=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||d||2!==e.indent&&t>0)&&(r=!1),d&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(p&&d&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===s)o&&0!==Object.keys(e.dump).length?(!function(e,t,n,o){var r,i,a,c,s,l,u="",d=e.tag,p=Object.keys(n);if(!0===e.sortKeys)p.sort();else if("function"==typeof e.sortKeys)p.sort(e.sortKeys);else if(e.sortKeys)throw new ln("sortKeys must be a boolean or a function");for(r=0,i=p.length;r1024)&&(e.dump&&Vo===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,s&&(l+=mr(e,t)),Gr(e,t+1,c,!0,s)&&(e.dump&&Vo===e.dump.charCodeAt(0)?l+=":":l+=": ",u+=l+=e.dump));e.tag=d,e.dump=u||"{}"}(e,t,e.dump,r),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var o,r,i,a,c,s="",l=e.tag,u=Object.keys(n);for(o=0,r=u.length;o1024&&(c+="? "),c+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Gr(e,t,a,!1,!1)&&(s+=c+=e.dump));e.tag=l,e.dump="{"+s+"}"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===s)o&&0!==e.dump.length?(e.noArrayIndent&&!a&&t>0?Fr(e,t-1,e.dump,r):Fr(e,t,e.dump,r),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var o,r,i,a="",c=e.tag;for(o=0,r=n.length;o",e.dump=c+" "+e.dump)}return!0}function jr(e,t){var n,o,r=[],i=[];for(Ur(e,r,i),n=0,o=i.length;n ".concat(Me.SPACER))}),(function(e){return!!e}),e)];case 2:return o=n.sent(),[4,r((function(){return t.querySelectorAll(":scope > ".concat(Me.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(Me.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 3:return i=n.sent(),[2,[t,i,o]]}}))}))},o.prototype._buildNewItem=function(e){var t=document.createElement("a");return t.href=e.href,t.target=e.target||"",t.tabIndex=-1,t.setAttribute(Ge.ROLE,"option"),t.setAttribute(Ge.PANEL,e.item.toLowerCase().replace(/\s+/,"-")),t.setAttribute(Ge.ARIA_SELECTED,"false"),t.innerHTML='\n \n \n \n ').concat(e.item,'\n \n \n \n ').trim(),t},o.prototype._getTemplateString=function(e){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return t="",e instanceof Promise||"string"==typeof e||"number"==typeof e&&!Number.isNaN(e)||"boolean"==typeof e||"object"==typeof e?"string"!=typeof e?[3,1]:(t=e.trim(),[3,6]):[3,6];case 1:return"number"!=typeof e&&"boolean"!=typeof e?[3,2]:(t=e.toString(),[3,6]);case 2:return e instanceof Promise?[4,e]:[3,5];case 3:return o=n.sent(),[4,this._getTemplateString(o)];case 4:return t=n.sent(),[3,6];case 5:t=JSON.stringify(e),n.label=6;case 6:return[2,t]}}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(Me.TITLE).element.then((function(t){e._configWithExceptions.title&&e._subscribeTemplate(e._configWithExceptions.title,(function(e){t.innerHTML=e})),e._configWithExceptions.subtitle&&e._subscribeTemplate(e._configWithExceptions.subtitle,(function(e){t.dataset.subtitle=e}))}))},o.prototype._subscribeSideBarEdition=function(){var e=this,t=function(e){e.preventDefault(),e.stopImmediatePropagation()},n=function(e,n){e.removeEventListener(je.HASS_EDIT_SIDEBAR,t,!0),n.removeAttribute(Fe)},o=function(e,n){e.removeEventListener(je.HASS_EDIT_SIDEBAR,t,!0),e.addEventListener(je.HASS_EDIT_SIDEBAR,t,!0),n.setAttribute(Fe,"")};Promise.all([this._main.element,this._sidebar.selector.$.query(Me.MENU).element]).then((function(t){var r=t[0],i=t[1];"boolean"==typeof e._configWithExceptions.sidebar_editable&&(e._isSidebarEditable=e._configWithExceptions.sidebar_editable,e._isSidebarEditable||o(r,i)),"string"==typeof e._configWithExceptions.sidebar_editable&&e._subscribeTemplate(e._configWithExceptions.sidebar_editable,(function(t){"true"===t||"false"===t?(e._isSidebarEditable=!("false"===t),e._isSidebarEditable?n(r,i):o(r,i)):(e._isSidebarEditable=void 0,n(r,i)),e._checkProfileEditableButton()}))}))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(Me.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.innerHTML=e}))},o.prototype._subscribeIcon=function(e,t){this._subscribeTemplate(t,(function(t){var n=e.querySelector(we.HA_ICON);if(!n){(n=document.createElement(we.HA_ICON)).setAttribute("slot","item-icon");var o=e.querySelector(we.HA_SVG_ICON);o?o.replaceWith(n):e.querySelector(we.PAPER_ICON_ITEM).prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(Me.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector("".concat(Me.NOTIFICATION_BADGE,":not(").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED,")")),o=e.querySelector(Me.NOTIFICATIONS_BADGE_COLLAPSED);n||((n=document.createElement("span")).classList.add(ke.NOTIFICATIONS_BADGE),e.querySelector(we.PAPER_ICON_ITEM).append(n)),o||((o=document.createElement("span")).classList.add(ke.NOTIFICATIONS_BADGE,ke.NOTIFICATIONS_BADGE_COLLAPSED),e.querySelector("".concat(we.HA_SVG_ICON,", ").concat(we.HA_ICON)).after(o));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,o.innerHTML=t,e.setAttribute(Ge.WITH_NOTIFICATION,"true")):(n.innerHTML="",o.innerHTML="",e.removeAttribute(Ge.WITH_NOTIFICATION))}))},o.prototype._subscribeTemplateColorChanges=function(e,t,n){var o=this;n.forEach((function(n){var r=n[0],i=n[1];e[r]&&o._subscribeTemplate(e[r],(function(e){t.style.setProperty(i,e)}))}))},o.prototype._subscribeTemplate=function(e,t){mt.test(e)?this._createJsTemplateSubscription(e.replace(mt,"$1"),t):vt.test(e)?this._createJinjaTemplateSubscription(e,t):this._getTemplateString(e).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(Dt(e,this._configWithExceptions.partials),(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;window.hassConnection.then((function(r){r.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:je.RENDER_TEMPLATE,template:Dt(t,o._configWithExceptions.partials),variables:e({user_name:o._ha.hass.user.name,user_is_admin:o._ha.hass.user.is_admin,user_is_owner:o._ha.hass.user.is_owner,user_agent:window.navigator.userAgent},o._configWithExceptions.jinja_variables)})}))},o.prototype._focusItemByKeyboard=function(e,t){for(var n,o=this._items.length-1,r=e.querySelector("\n ".concat(Me.SCOPE," > ").concat(Me.ITEM,":not(.").concat(ke.IRON_SELECTED,"):focus,\n ").concat(Me.SCOPE," > ").concat(Me.ITEM,":focus,\n ").concat(Me.SCOPE," > ").concat(Me.ITEM,":has(> ").concat(we.PAPER_ICON_ITEM,":focus)\n ").trim()),i=0,a=0,c=Object.entries(this._items);a0?i-1:o,this._items[n].element.focus(),this._items[n].element.tabIndex=0},o.prototype._focusItemByTab=function(e,t,n){var o=this._items.length-1;if(t.nodeName===We.A){var r=t,i=this._items.findIndex((function(e){return e.element===r})),a=NaN;if(n&&i0&&(a=i-1),Number.isNaN(a))if(n)e.querySelector(Me.SIDEBAR_NOTIFICATIONS).focus();else e.querySelector(we.HA_ICON_BUTTON).focus();else this._items[a].element.querySelector(we.PAPER_ICON_ITEM).focus()}else{if(n)e.querySelector("".concat(Me.PROFILE," > ").concat(we.PAPER_ICON_ITEM)).focus();else this._items[o].element.querySelector(we.PAPER_ICON_ITEM).focus()}},o.prototype._getActivePaperIconElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&(t.nodeName===We.PAPER_ICON_ITEM||t.nodeName===We.A&&"option"===t.getAttribute("role"))?t:t.shadowRoot&&At.includes(t.nodeName)?this._getActivePaperIconElement(t.shadowRoot):null:null},o.prototype._processSidebar=function(){var e=this;Promise.all([this._main.element,this._partialPanelResolver.element]).then((function(o){var r=o[0],i=o[1],a=e._configWithExceptions.sidebar_mode,c=matchMedia("(max-width: 870px)");if(a){r.hass.dockedSidebar=It[a];var s=function(o){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return a===he.HIDDEN?[3,5]:[4,Lt()];case 1:return e.sent(),r.narrow=!1,[4,Lt()];case 2:return e.sent(),i.narrow=o,[4,Lt()];case 3:return e.sent(),o?[4,this._partialPanelResolver.selector.query(Me.HA_MENU_BUTTON).element]:[3,5];case 4:e.sent().narrow=!1,e.label=5;case 5:return[2]}}))}))};c.addEventListener("change",(function(e){s(e.matches)})),s(c.matches)}})),Promise.all([this._haDrawer.selector.$.query(Me.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(we.PAPER_LISTBOX).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._configWithExceptions,o,Ke),e._subscribeTemplateColorChanges(e._configWithExceptions,n,[["sidebar_border_color",He.BORDER_COLOR]]),i.addEventListener(je.KEYDOWN,(function(t){t.key!==Ue.ARROW_DOWN&&t.key!==Ue.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Ue.ARROW_DOWN))}),!0),window.addEventListener(je.KEYDOWN,(function(t){if(t.key===Ue.TAB){var n=e._getActivePaperIconElement();if(n)if(n.nodeName===We.PAPER_ICON_ITEM){var o=n.parentElement;o.getAttribute(Ge.HREF)!==Tt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey))}else n.getAttribute(Ge.HREF)!==Tt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,n,!t.shiftKey))}}),!0),e._styleManager.addStyle(jt,n),e._styleManager.addStyle([xt,Pt,Ht,Bt,Ft,kt,Gt,Ut,Wt,Vt,Xt,qt,Kt,Yt,$t,zt,Qt,Jt,Zt,en,tn,nn,on,e._configWithExceptions.styles||""],r)}))},o.prototype._rearrange=function(){var t=this;this._getElements().then((function(n){var o=t._configWithExceptions,r=o.order,i=o.hide_all,a=n[0],c=n[1],s=n[2],l=0,u=!1,d=Array.from(c),p=new Set;i&&d.forEach((function(e){e.style.display="none"}));var _=r.reduce((function(t,n){var o=n.item,r=n.match,i=n.exact,a=n.new_item,c=o.toLocaleLowerCase(),s=a?void 0:d.find((function(e){var t=r===Oe.DATA_PANEL?e.getAttribute(Ge.PANEL):r===Oe.HREF?e.getAttribute(Ge.HREF):e.querySelector(Me.ITEM_TEXT).innerText.trim();return!((!i||o!==t)&&(i||!(null==t?void 0:t.toLowerCase().includes(c))))&&(!p.has(e)&&(p.add(e),!0))}));return s&&s.setAttribute(Ge.PROCESSED,"true"),(a||s)&&t.push(e(e({},n),{element:s})),a||s||console.warn("".concat(Se,": you have an order item in your configuration that didn't match any sidebar item: \"").concat(o,'"')),t}),[]),f=function(){u||(d.forEach((function(e){e.hasAttribute(Ge.PROCESSED)||(e.style.order="".concat(l))})),l++,s.style.order="".concat(l),l++,u=!0)};_.forEach((function(e){if(e.bottom&&f(),e.new_item&&!e.hide){var n=t._buildNewItem(e);n.style.order="".concat(l),a.append(n),e.element=n}else if(e.element){var o=e.element;o.style.order="".concat(l),e.hide?o.style.display="none":o.style.removeProperty("display"),e.href&&(o.href=e.href),e.target&&(o.target=e.target)}e.hide||(e.name&&t._subscribeName(e.element,e.name),e.icon&&t._subscribeIcon(e.element,e.icon),e.info&&t._subscribeInfo(e.element,e.info),e.notification&&t._subscribeNotification(e.element,e.notification),t._subscribeTemplateColorChanges(e,e.element,qe),e.new_item&&(e.element.addEventListener(je.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(je.MOUSELEAVE,t._mouseLeaveBinded)),e.element.addEventListener(je.MOUSEDOWN,t._itemTouchedBinded),e.element.addEventListener(je.KEYDOWN,(function(e){e.key===Ue.ENTER&&t._itemTouchedBinded()})),t._items.push(e)),l++})),_.length&&f(),t._panelLoaded()}))},o.prototype._itemTouched=function(){return t(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return this._sidebar.selector.$.query(we.PAPER_LISTBOX).element.then((function(t){e._sidebarScroll=t.scrollTop})),[2]}))}))},o.prototype._mouseEnter=function(e){this._sidebar.element.then((function(t){t.alwaysExpand||(t._mouseLeaveTimeout&&(clearTimeout(t._mouseLeaveTimeout),t._mouseLeaveTimeout=void 0),t._showTooltip(e.currentTarget))}))},o.prototype._mouseLeave=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this._sidebar.element.then((function(e){e._mouseLeaveTimeout&&clearTimeout(e._mouseLeaveTimeout),e._mouseLeaveTimeout=window.setTimeout((function(){e._hideTooltip()}),500)})),[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),"/profile/general"!==e.__route.path?[3,3]:[4,this._partialPanelResolver.selector.query(Me.EDIT_SIDEBAR_BUTTON).element];case 2:(t=n.sent())&&(!1===this._isSidebarEditable?t.setAttribute(Ge.DISABLED,""):t.removeAttribute(Ge.DISABLED)),n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t=e.__route.path,[4,this._sidebar.selector.$.query(we.PAPER_LISTBOX).element];case 2:return o=n.sent(),r=o.querySelector(["".concat(Me.SCOPE," > ").concat(Me.ITEM,'[href="').concat(t,'"]'),"".concat(Me.SCOPE," > ").concat(Me.ITEM,'[href="').concat(t,'/dashboard"]')].join(",")),i=r?null:this._items.reduce((function(e,n){var o=n.element,r=o.getAttribute(Ge.HREF);return t.startsWith(r)&&(!e||r.length>e.getAttribute(Ge.HREF).length)&&(e=o),e}),null),this._items.forEach((function(e){var t=e.element,n=r&&r===t||!r&&i===t;t.classList.toggle(ke.IRON_SELECTED,n),t.setAttribute(Ge.ARIA_SELECTED,"".concat(n))})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._checkProfileEditableButton(),[2]}}))}))},o.prototype._process=function(){var e=this;this._homeAssistant.element.then((function(t){e._ha=t,new Te(e._ha).getRenderer().then((function(t){e._renderer=t,e._getConfigWithExceptions().then((function(){var t;e._renderer.variables=null!==(t=e._configWithExceptions.js_variables)&&void 0!==t?t:{},e._processSidebar(),e._subscribeTitle(),e._subscribeSideBarEdition(),e._rearrange()}))}))}))},o}();window.CustomSidebar||(console.info("%c≡ ".concat(Se.toUpperCase()," (YAML)%cv").concat("7.2.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px"),window.CustomSidebar=new oi)}(); +!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]<])(".concat(Object.values(se).join("|"),")($|[ \\?)+:\\}\\]><.])"),"gm"),this._scopped=pe(e,i),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return e.prototype._executeRenderingFunctions=function(e){var t=this;this._subscriptions.get(e).forEach((function(e,n){e.forEach((function(e){t.trackTemplate(n,e)}))}))},e.prototype._watchForPanelUrlChange=function(){var e=this;window.addEventListener(le.LOCATION_CHANGED,(function(t){e._panelUrlWatchCallback()})),window.addEventListener(le.POPSTATE,(function(){e._panelUrlWatchCallback()}))},e.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(se.PANEL_URL)&&this._executeRenderingFunctions(se.PANEL_URL)},e.prototype._watchForEntitiesChange=function(){var e=this;window.hassConnection.then((function(t){t.conn.subscribeMessage((function(t){return e._entityWatchCallback(t)}),{type:le.SUBSCRIBE_EVENTS,event_type:le.STATE_CHANGE_EVENT})}))},e.prototype._entityWatchCallback=function(e){if(this._subscriptions.size){var t=e.data.entity_id;this._subscriptions.has(t)&&this._executeRenderingFunctions(t)}},e.prototype._storeTracked=function(e,t){var n=this;this._scopped.tracked.forEach((function(o){if(n._subscriptions.has(o)){var r=n._subscriptions.get(o);if(r.has(e)){var i=r.get(e);i.has(t)||i.add(t)}else r.set(e,new Set([t]))}else n._subscriptions.set(o,new Map([[e,new Set([t])]]))}))},e.prototype._untrackTemplate=function(e,t){var n=this;this._subscriptions.forEach((function(o,r){if(o.has(e)){var i=o.get(e);i.has(t)&&i.delete(t),0===i.size&&(o.delete(e),0===o.size&&n._subscriptions.delete(r))}}))},e.prototype.renderTemplate=function(e){try{var t=new Map(Object.entries(this._variables)),n=e.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),o=n.includes("return")||!this._autoReturn?n:"return ".concat(n);return(new(Function.bind.apply(Function,ie(ie([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide"],Array.from(t.keys()),!1),["".concat('"use strict";'," ").concat(o)],!1)))).apply(void 0,ie([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.user_agent,this._scopped.clientSideProxy],Array.from(t.values()),!1))}catch(e){if(this._throwErrors)throw e;return void(this._throwWarnings&&console.warn(e))}},e.prototype.trackTemplate=function(e,t){var n=this;this._scopped.cleanTracked();var o=this.renderTemplate(e);return this._storeTracked(e,t),t(o),function(){return n._untrackTemplate(e,t)}},e.prototype.cleanTracked=function(e){e?this._subscriptions.has(e)&&this._subscriptions.delete(e):this._subscriptions.clear()},Object.defineProperty(e.prototype,"variables",{get:function(){return this._variables},set:function(e){this._variables=e},enumerable:!1,configurable:!0}),e}(),Te=function(){function e(e,t){void 0===t&&(t={}),this._renderer=r((function(){return e.hass}),(function(e){return!!(e&&e.areas&&e.devices&&e.entities&&e.states&&e.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new Ie(e,t)}))}return e.prototype.getRenderer=function(){return this._renderer},e}(),ve=/([A-Z])([a-z0-9_-]+)/g,be=function(e){return Object.entries(e).map((function(e){var t=e[0],n=e[1];return"".concat(function(e){return e.replace(ve,(function(e,t,n,o){var r=t.toLocaleLowerCase();return o?"-".concat(r).concat(n):"--".concat(r).concat(n)}))}(t),":").concat(n)})).join(";")+";"},ge=function(e){return(Array.isArray(e)?e:[e]).map((function(e){return"string"==typeof e?e:Object.entries(e).map((function(e){var t=e[0],n=e[1];return!1===n?"".concat(t,"{display: none !important}"):"".concat(t,"{").concat(be(n),"}")})).join("")})).join("")},ye=function(e,t){return"".concat(t,"_").concat(e)},Ne=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},Re=function(e,t){var n=ye(Ne(e),t);return e.querySelector("#".concat(n))},Ce=function(){function e(e){var t,n,o;void 0===e&&(e={}),this._prefix=null!==(t=e.prefix)&&void 0!==t?t:"ha-styles-manager",this._namespace=null!==(n=e.namespace)&&void 0!==n?n:"home-assistant-styles-manager",this._throwWarnings=null===(o=e.throwWarnings)||void 0===o||o}return e.prototype.getStyleElement=function(e){return Re(e,this._prefix)},e.prototype.addStyle=function(e,t){!function(e,t,n,o,r){if(t){var i=Re(t,n);if(!i){var a=ye(Ne(t),n);(i=document.createElement("style")).setAttribute("id",a),t.appendChild(i)}i.innerHTML="string"==typeof e?e:ge(e)}else r&&console.warn("".concat(o,': no element has been provided calling "addStyle"'))}(e,t,this._prefix,this._namespace,this._throwWarnings)},e.prototype.removeStyle=function(e){!function(e,t,n,o){if(e){var r=Re(e,t);r?r.remove():o&&console.warn("".concat(n,': no style to remove calling "removeStyle"'))}else o&&console.warn("".concat(n,': no element has been provided calling "removeStyle"'))}(e,this._prefix,this._namespace,this._throwWarnings)},e}();!function(e){e.HIDDEN="hidden",e.NARROW="narrow",e.EXTENDED="extended"}(he||(he={})),function(e){e.DOCKED="docked",e.AUTO="auto",e.ALWAYS_HIDDEN="always_hidden"}(Ee||(Ee={})),function(e){e.AND="AND",e.OR="OR"}(Oe||(Oe={})),function(e){e.TEXT="text",e.DATA_PANEL="data-panel",e.HREF="href"}(Ae||(Ae={}));var Se,Le="custom-sidebar",we="sidebar-config",De="".concat("/local/").concat(we),xe="base";!function(e){e.BOOLEAN="boolean",e.STRING="string",e.UNDEFINED="undefined",e.NUMBER="number"}(Se||(Se={}));var Me,Pe,He,Fe,Be,ke="[object Object]",je="data-blocked";!function(e){e.SIDEBAR="ha-sidebar",e.PAPER_LISTBOX="paper-listbox",e.PAPER_ICON_ITEM="paper-icon-item",e.HA_SVG_ICON="ha-svg-icon",e.HA_ICON="ha-icon",e.HA_ICON_BUTTON="ha-icon-button"}(Me||(Me={})),function(e){e.HOST=":host",e.HOST_EXPANDED=":host([expanded])",e.SCOPE=":scope",e.TITLE=".title",e.ITEM='a[role="option"]',e.ITEM_SELECTED=".iron-selected",e.ITEM_HOVER='a[role="option"]:hover',e.SPACER=".spacer",e.ITEM_TEXT=".item-text",e.NOTIFICATION_BADGE=".notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED=".notification-badge-collapsed",e.CONFIGURATION_BADGE=".configuration-badge",e.HA_MENU_BUTTON="ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.PROFILE=".profile",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.HA_SCROLLBAR=".ha-scrollbar",e.DATA_INFO="[data-info]"}(Pe||(Pe={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(He||(He={})),function(e){e.PRIMARY_BACKGROUND_COLOR="--primary-background-color",e.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",e.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",e.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",e.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",e.SIDEBAR_ICON_COLOR="--sidebar-icon-color",e.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",e.SIDEBAR_TEXT_COLOR="--sidebar-text-color",e.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",e.ACCENT_COLOR="--accent-color",e.TEXT_ACCENT_COLOR="--text-accent-color",e.TEXT_PRIMARY_COLOR="--text-primary-color",e.PRIMARY_TEXT_COLOR="--primary-text-color",e.DIVIDER_COLOR="--divider-color",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(Fe||(Fe={})),function(e){e.BACKGROUND="--custom-sidebar-background",e.BORDER_COLOR="--custom-sidebar-border-color",e.MENU_BACKGROUND="--custom-sidebar-menu-background",e.TITLE_COLOR="--custom-sidebar-title-color",e.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",e.BUTTON_COLOR="--custom-sidebar-button-color",e.DIVIDER_COLOR="--custom-sidebar-divider-color",e.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",e.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",e.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",e.ITEM_BACKGROUND="--custom-sidebar-item-background",e.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",e.ICON_COLOR="--custom-sidebar-icon-color",e.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",e.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",e.TEXT_COLOR="--custom-sidebar-text-color",e.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",e.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",e.SELECTION_BACKGROUND="--custom-sidebar-selection-background",e.SELECTION_OPACITY="--custom-sidebar-selection-opacity",e.INFO_COLOR="--custom-sidebar-info-color",e.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",e.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",e.NOTIFICATION_COLOR="--custom-sidebar-notification-color",e.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",e.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",e.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",e.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",e.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(Be||(Be={}));var Ge,Ue,Ve,Xe,We,qe=["item_background","item_background_hover","icon_color","icon_color_selected","icon_color_hover","text_color","text_color_selected","text_color_hover","selection_background","info_color","info_color_selected","info_color_hover","notification_color","notification_color_selected","notification_color_hover","notification_text_color","notification_text_color_selected","notification_text_color_hover"],Ke=["selection_opacity"],Ye=[["item_background",Be.ITEM_BACKGROUND],["item_background_hover",Be.ITEM_BACKGROUND_HOVER],["icon_color",Be.ICON_COLOR],["icon_color_selected",Be.ICON_COLOR_SELECTED],["icon_color_hover",Be.ICON_COLOR_HOVER],["text_color",Be.TEXT_COLOR],["text_color_selected",Be.TEXT_COLOR_SELECTED],["text_color_hover",Be.TEXT_COLOR_HOVER],["selection_background",Be.SELECTION_BACKGROUND],["selection_opacity",Be.SELECTION_OPACITY],["info_color",Be.INFO_COLOR],["info_color_selected",Be.INFO_COLOR_SELECTED],["info_color_hover",Be.INFO_COLOR_HOVER],["notification_color",Be.NOTIFICATION_COLOR],["notification_color_selected",Be.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",Be.NOTIFICATION_COLOR_HOVER],["notification_text_color",Be.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",Be.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",Be.NOTIFICATION_TEXT_COLOR_HOVER]],$e=o([["title_color",Be.TITLE_COLOR],["subtitle_color",Be.SUBTITLE_COLOR],["sidebar_button_color",Be.BUTTON_COLOR],["sidebar_background",Be.BACKGROUND],["menu_background",Be.MENU_BACKGROUND],["scrollbar_thumb_color",Be.SCROLLBAR_THUMB_COLOR],["divider_color",Be.DIVIDER_COLOR],["divider_top_color",Be.DIVIDER_TOP_COLOR],["divider_bottom_color",Be.DIVIDER_BOTTOM_COLOR]],Ye,!0);!function(e){e.NOTIFICATIONS_BADGE="notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED="notification-badge-collapsed",e.IRON_SELECTED="iron-selected"}(Ge||(Ge={})),function(e){e.PANEL="data-panel",e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.ARIA_SELECTED="aria-selected",e.ARIA_DISABLED="aria-disabled",e.DISABLED="disabled",e.HREF="href",e.STYLE="style"}(Ue||(Ue={})),function(e){e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.HASS_EDIT_SIDEBAR="hass-edit-sidebar",e.RENDER_TEMPLATE="render_template"}(Ve||(Ve={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Xe||(Xe={})),function(e){e.PAPER_ICON_ITEM="PAPER-ICON-ITEM",e.A="A"}(We||(We={}));var ze,Qe,Je,Ze,et,tt,nt,ot,rt,it,at,ct,st,lt,ut,dt,ft,_t,pt,ht,Et,Ot,At,mt,It=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],Tt=((me={})[he.HIDDEN]=Ee.ALWAYS_HIDDEN,me[he.NARROW]=Ee.AUTO,me[he.EXTENDED]=Ee.DOCKED,me),vt="/profile",bt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,gt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,yt=/@partial\s+([\w-]+)/g,Nt=function(e){return Array.isArray(e)?e.map((function(e){return e.toLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},Rt=function(){return new Promise((function(e){setTimeout(e,1)}))},Ct=o(o([],qe,!0),Ke,!0),St=["id","exceptions","extendable_configs","extend_from","user","not_user","device","not_device","is_admin"],Lt=["js_variables","jinja_variables","partials"],wt=function(){function t(e,t,n){var o;this._config=e,this._extendable=new Map(Object.entries(null!==(o=this._config.extendable_configs)&&void 0!==o?o:[])),this._user=t,this._userAgent=n,this._exceptions=this._getExceptions(),this._buildFlattenConfig()}return t.prototype._getExceptions=function(){var e=this;if(this._config.exceptions){var t=this._user.name.toLocaleLowerCase();return this._config.exceptions.filter((function(n){var o,r=null!==(o=n.matchers_conditions)&&void 0!==o?o:Oe.OR,i=void 0!==n.user&&Nt(n.user).includes(t),a=void 0!==n.not_user&&!Nt(n.not_user).includes(t),c=void 0!==n.device&&Nt(n.device).some((function(t){return e._userAgent.includes(t)})),s=void 0!==n.not_device&&!Nt(n.not_device).some((function(t){return e._userAgent.includes(t)})),l=void 0!==n.is_admin&&n.is_admin===e._user.is_admin,u=void 0!==n.is_owner&&n.is_owner===e._user.is_owner;return r===Oe.OR?i||a||c||s||l||u:(void 0===n.user||i)&&(void 0===n.not_user||a)&&(void 0===n.device||c)&&(void 0===n.not_device||s)&&(void 0===n.is_admin||l)&&(void 0===n.is_owner||u)}))}return[]},t.prototype._mergeConfigs=function(){for(var t=[],n=0;n ")," > ").concat(r));return Dt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(Le,": partial ").concat(r," doesn't exist")),""}))},xt=function(){for(var e=[],t=0;t ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={maxWidth:"calc(100% - 100px)"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(He.AFTER)]={content:"attr(data-info)",display:"none",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},ze["{ SELECTOR.HOST_EXPANDED } ".concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED)]={opacity:"0"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM).concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={zIndex:"1"},ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATION_BADGE,":not(").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED,")")]=e({left:"calc(var(--app-drawer-width, 248px) - 22px)",maxWidth:"80px",transform:"translateX(-100%)"},Mt),ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED)]=e({bottom:"14px",left:"26px",maxWidth:"20px"},Mt),ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.CONFIGURATION_BADGE)]=e({},Mt),ze),Ht=((Qe={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Pe.TITLE)]={color:xt(Be.TITLE_COLOR,Fe.SIDEBAR_TITLE_COLOR,Fe.PRIMARY_TEXT_COLOR)},Qe),Ft=((Je={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Pe.TITLE).concat(He.AFTER)]={content:"attr(data-subtitle)",color:xt(Be.SUBTITLE_COLOR,Be.TITLE_COLOR,Fe.SIDEBAR_TITLE_COLOR,Fe.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},Je),Bt=((Ze={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Me.HA_ICON_BUTTON)]={color:xt(Be.BUTTON_COLOR,Fe.SIDEBAR_ICON_COLOR)},Ze),kt=((et={})[Pe.HOST]={background:xt(Be.BACKGROUND,Fe.SIDEBAR_BACKGROUND_COLOR)+" !important"},et),jt=((tt={})["".concat(Pe.HOST," ").concat(Pe.MENU)]={background:xt(Be.MENU_BACKGROUND,Be.BACKGROUND,Fe.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,Fe.PRIMARY_BACKGROUND_COLOR),borderBottomColor:xt(Be.DIVIDER_TOP_COLOR,Be.DIVIDER_COLOR,Fe.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},tt),Gt=((nt={})["".concat(Pe.HOST," ").concat(Pe.DIVIDER).concat(He.BEFORE)]={backgroundColor:xt(Be.DIVIDER_BOTTOM_COLOR,Be.DIVIDER_COLOR,Fe.DIVIDER_COLOR)},nt),Ut=((ot={})["".concat(Pe.HOST," > ").concat(Pe.MC_DRAWER)]={borderColor:xt(Be.BORDER_COLOR,Fe.DIVIDER_COLOR,"rgba(0,0,0,.12)")},ot),Vt=((rt={})["".concat(Pe.HOST," ").concat(Me.PAPER_LISTBOX).concat(Pe.HA_SCROLLBAR)]={scrollbarColor:xt(Be.SCROLLBAR_THUMB_COLOR,Fe.SCROLLBAR_THUMB_COLOR)+" transparent"},rt["".concat(Pe.HOST," ").concat(Me.PAPER_LISTBOX).concat(Pe.HA_SCROLLBAR).concat(He.WEBKIT_SCROLLBAR_THUMB)]={background:xt(Be.SCROLLBAR_THUMB_COLOR,Fe.SCROLLBAR_THUMB_COLOR)},rt),Xt=((it={})["".concat(Pe.MENU,"[").concat(je,"]")]={pointerEvents:"none"},it["".concat(Pe.MENU,"[").concat(je,"] > ").concat(Me.HA_ICON_BUTTON)]={pointerEvents:"all"},it),Wt=((at={})["".concat(Pe.HOST," ").concat(Pe.ITEM,":not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM)]={background:xt(Be.ITEM_BACKGROUND,"none")},at),qt=((ct={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM)]={background:xt(Be.ITEM_BACKGROUND_HOVER,Be.ITEM_BACKGROUND,"none")},ct),Kt=((st={})["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR,Fe.SIDEBAR_ICON_COLOR)},st),Yt=((lt={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_ICON_COLOR)},lt),$t=((ut={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR_HOVER,Be.ICON_COLOR,Fe.SIDEBAR_ICON_COLOR)},ut),zt=((dt={})["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR,Fe.SIDEBAR_TEXT_COLOR)},dt),Qt=((ft={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_TEXT_COLOR)},ft),Jt=((_t={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR_HOVER,Be.TEXT_COLOR,Fe.SIDEBAR_TEXT_COLOR)},_t),Zt=((pt={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER,") > ").concat(Me.PAPER_ICON_ITEM).concat(He.BEFORE)]={background:xt(Be.SELECTION_BACKGROUND,Be.ICON_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_ICON_COLOR),opacity:xt(Be.SELECTION_OPACITY,"0.12")},pt),en=((ht={})["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR,Fe.SIDEBAR_TEXT_COLOR),display:"block"},ht),tn=((Et={})["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM).concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_TEXT_COLOR)},Et),nn=((Ot={})["".concat(Pe.HOST_EXPANDED," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR_HOVER,Be.INFO_COLOR,Fe.SIDEBAR_TEXT_COLOR)},Ot),on=((At={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Pe.NOTIFICATION_BADGE,", ").concat(Pe.CONFIGURATION_BADGE,")")]={backgroundColor:xt(Be.NOTIFICATION_COLOR_SELECTED,Be.NOTIFICATION_COLOR,Fe.ACCENT_COLOR),color:xt(Be.NOTIFICATION_TEXT_COLOR_SELECTED,Be.NOTIFICATION_TEXT_COLOR,Fe.TEXT_ACCENT_COLOR,Fe.TEXT_PRIMARY_COLOR)},At),rn=((mt={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Pe.NOTIFICATION_BADGE,", ").concat(Pe.CONFIGURATION_BADGE,")")]={backgroundColor:xt(Be.NOTIFICATION_COLOR_HOVER,Be.NOTIFICATION_COLOR,Fe.ACCENT_COLOR),color:xt(Be.NOTIFICATION_TEXT_COLOR_HOVER,Be.NOTIFICATION_TEXT_COLOR,Fe.TEXT_ACCENT_COLOR,Fe.TEXT_PRIMARY_COLOR)},mt);function an(e){return null==e}var cn={isNothing:an,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:an(e)?[]:[e]},repeat:function(e,t){var n,o="";for(n=0;nc&&(t=o-c+(i=" ... ").length),n-o>c&&(n=o+c-(a=" ...").length),{str:i+e.slice(t,n).replace(/\t/g,"→")+a,pos:o-t+i.length}}function fn(e,t){return cn.repeat(" ",t-e.length)+e}var _n=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,o=/\r?\n|\r|\0/g,r=[0],i=[],a=-1;n=o.exec(e.buffer);)i.push(n.index),r.push(n.index+n[0].length),e.position<=n.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var c,s,l="",u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(a-c<0);c++)s=dn(e.buffer,r[a-c],i[a-c],e.position-(r[a]-r[a-c]),d),l=cn.repeat(" ",t.indent)+fn((e.line-c+1).toString(),u)+" | "+s.str+"\n"+l;for(s=dn(e.buffer,r[a],i[a],e.position,d),l+=cn.repeat(" ",t.indent)+fn((e.line+1).toString(),u)+" | "+s.str+"\n",l+=cn.repeat("-",t.indent+u+3+s.pos)+"^\n",c=1;c<=t.linesAfter&&!(a+c>=i.length);c++)s=dn(e.buffer,r[a+c],i[a+c],e.position-(r[a]-r[a+c]),d),l+=cn.repeat(" ",t.indent)+fn((e.line+c+1).toString(),u)+" | "+s.str+"\n";return l.replace(/\n$/,"")},pn=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],hn=["scalar","sequence","mapping"];var En=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===pn.indexOf(t))throw new un('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===hn.indexOf(this.kind))throw new un('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function On(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,o){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=o)})),n[t]=e})),n}function An(e){return this.extend(e)}An.prototype.extend=function(e){var t=[],n=[];if(e instanceof En)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new un("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof En))throw new un("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new un("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new un("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof En))throw new un("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var o=Object.create(An.prototype);return o.implicit=(this.implicit||[]).concat(t),o.explicit=(this.explicit||[]).concat(n),o.compiledImplicit=On(o,"implicit"),o.compiledExplicit=On(o,"explicit"),o.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function o(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ln=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var wn=/^[-+]?[0-9]+e/;var Dn=new En("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!Ln.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||cn.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(cn.isNegativeZero(e))return"-0.0";return n=e.toString(10),wn.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),xn=bn.extend({implicit:[gn,yn,Sn,Dn]}),Mn=xn,Pn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Hn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var Fn=new En("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==Pn.exec(e)||null!==Hn.exec(e))},construct:function(e){var t,n,o,r,i,a,c,s,l=0,u=null;if(null===(t=Pn.exec(e))&&(t=Hn.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],o=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,o,r));if(i=+t[4],a=+t[5],c=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),s=new Date(Date.UTC(n,o,r,i,a,c,l)),u&&s.setTime(s.getTime()-u),s},instanceOf:Date,represent:function(e){return e.toISOString()}});var Bn=new En("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var jn=new En("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,o=0,r=e.length,i=kn;for(n=0;n64)){if(t<0)return!1;o+=6}return o%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),r=o.length,i=kn,a=0,c=[];for(t=0;t>16&255),c.push(a>>8&255),c.push(255&a)),a=a<<6|i.indexOf(o.charAt(t));return 0===(n=r%4*6)?(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)):18===n?(c.push(a>>10&255),c.push(a>>2&255)):12===n&&c.push(a>>4&255),new Uint8Array(c)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,o="",r=0,i=e.length,a=kn;for(t=0;t>18&63],o+=a[r>>12&63],o+=a[r>>6&63],o+=a[63&r]),r=(r<<8)+e[t];return 0===(n=i%3)?(o+=a[r>>18&63],o+=a[r>>12&63],o+=a[r>>6&63],o+=a[63&r]):2===n?(o+=a[r>>10&63],o+=a[r>>4&63],o+=a[r<<2&63],o+=a[64]):1===n&&(o+=a[r>>2&63],o+=a[r<<4&63],o+=a[64],o+=a[64]),o}}),Gn=Object.prototype.hasOwnProperty,Un=Object.prototype.toString;var Vn=new En("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,o,r,i,a=[],c=e;for(t=0,n=c.length;t>10),56320+(e-65536&1023))}for(var mo=new Array(256),Io=new Array(256),To=0;To<256;To++)mo[To]=Oo(To)?1:0,Io[To]=Oo(To);function vo(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Yn,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function bo(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=_n(n),new un(t,n)}function go(e,t){throw bo(e,t)}function yo(e,t){e.onWarning&&e.onWarning.call(null,bo(e,t))}var No={YAML:function(e,t,n){var o,r,i;null!==e.version&&go(e,"duplication of %YAML directive"),1!==n.length&&go(e,"YAML directive accepts exactly one argument"),null===(o=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&go(e,"ill-formed argument of the YAML directive"),r=parseInt(o[1],10),i=parseInt(o[2],10),1!==r&&go(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&yo(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var o,r;2!==n.length&&go(e,"TAG directive accepts exactly two arguments"),o=n[0],r=n[1],ao.test(o)||go(e,"ill-formed tag handle (first argument) of the TAG directive"),$n.call(e.tagMap,o)&&go(e,'there is a previously declared suffix for "'+o+'" tag handle'),co.test(r)||go(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){go(e,"tag prefix is malformed: "+r)}e.tagMap[o]=r}};function Ro(e,t,n,o){var r,i,a,c;if(t1&&(e.result+=cn.repeat("\n",t-1))}function Mo(e,t){var n,o,r=e.tag,i=e.anchor,a=[],c=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),o=e.input.charCodeAt(e.position);0!==o&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,go(e,"tab characters must not be used in indentation")),45===o)&&fo(e.input.charCodeAt(e.position+1));)if(c=!0,e.position++,wo(e,!0,-1)&&e.lineIndent<=t)a.push(null),o=e.input.charCodeAt(e.position);else if(n=e.line,Fo(e,t,Jn,!1,!0),a.push(e.result),wo(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==o)go(e,"bad indentation of a sequence entry");else if(e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt)&&(O&&(a=e.line,c=e.lineStart,s=e.position),Fo(e,t,Zn,!0,r)&&(O?h=e.result:E=e.result),O||(So(e,f,_,p,h,E,a,c,s),p=h=E=null),wo(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==l)go(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===r?go(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?go(e,"repeat of an indentation width identifier"):(l=t+r-1,s=!0)}if(uo(i)){do{i=e.input.charCodeAt(++e.position)}while(uo(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!lo(i)&&0!==i)}for(;0!==i;){for(Lo(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!s||e.lineIndentl&&(l=e.lineIndent),lo(i))u++;else{if(e.lineIndent0){for(r=a,i=0;r>0;r--)(a=po(c=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:go(e,"expected hexadecimal character");e.result+=Ao(i),e.position++}else go(e,"unknown escape sequence");n=o=e.position}else lo(c)?(Ro(e,n,o,!0),xo(e,wo(e,!1,t)),n=o=e.position):e.position===e.lineStart&&Do(e)?go(e,"unexpected end of the document within a double quoted scalar"):(e.position++,o=e.position)}go(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?E=!0:!function(e){var t,n,o;if(42!==(o=e.input.charCodeAt(e.position)))return!1;for(o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!fo(o)&&!_o(o);)o=e.input.charCodeAt(++e.position);return e.position===t&&go(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),$n.call(e.anchorMap,n)||go(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],wo(e,!0,-1),!0}(e)?function(e,t,n){var o,r,i,a,c,s,l,u,d=e.kind,f=e.result;if(fo(u=e.input.charCodeAt(e.position))||_o(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(fo(o=e.input.charCodeAt(e.position+1))||n&&_o(o)))return!1;for(e.kind="scalar",e.result="",r=i=e.position,a=!1;0!==u;){if(58===u){if(fo(o=e.input.charCodeAt(e.position+1))||n&&_o(o))break}else if(35===u){if(fo(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Do(e)||n&&_o(u))break;if(lo(u)){if(c=e.line,s=e.lineStart,l=e.lineIndent,wo(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=i,e.line=c,e.lineStart=s,e.lineIndent=l;break}}a&&(Ro(e,r,i,!1),xo(e,e.line-c),r=i=e.position,a=!1),uo(u)||(i=e.position+1),u=e.input.charCodeAt(++e.position)}return Ro(e,r,i,!1),!!e.result||(e.kind=d,e.result=f,!1)}(e,f,zn===n)&&(E=!0,null===e.tag&&(e.tag="?")):(E=!0,null===e.tag&&null===e.anchor||go(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===p&&(E=c&&Mo(e,_))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&go(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,l=e.implicitTypes.length;s"),null!==e.result&&d.kind!==e.kind&&go(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+d.kind+'", not "'+e.kind+'"'),d.resolve(e.result,e.tag)?(e.result=d.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):go(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||E}function Bo(e){var t,n,o,r,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(wo(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!fo(r);)r=e.input.charCodeAt(++e.position);for(o=[],(n=e.input.slice(t,e.position)).length<1&&go(e,"directive name must not be less than one character in length");0!==r;){for(;uo(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!lo(r));break}if(lo(r))break;for(t=e.position;0!==r&&!fo(r);)r=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}0!==r&&Lo(e),$n.call(No,n)?No[n](e,n,o):yo(e,'unknown document directive "'+n+'"')}wo(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,wo(e,!0,-1)):a&&go(e,"directives end mark is expected"),Fo(e,e.lineIndent-1,Zn,!1,!0),wo(e,!0,-1),e.checkLineBreaks&&ro.test(e.input.slice(i,e.position))&&yo(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Do(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,wo(e,!0,-1)):e.position=55296&&o<=56319&&t+1=56320&&n<=57343?1024*(o-55296)+n-56320+65536:o}function Cr(e){return/^\n* /.test(e)}var Sr=1,Lr=2,wr=3,Dr=4,xr=5;function Mr(e,t,n,o,r,i,a,c){var s,l=0,u=null,d=!1,f=!1,_=-1!==o,p=-1,h=function(e){return gr(e)&&e!==Vo&&!br(e)&&e!==nr&&e!==ar&&e!==or&&e!==tr&&e!==sr&&e!==lr&&e!==dr&&e!==_r&&e!==zo&&e!==Jo&&e!==er&&e!==Yo&&e!==fr&&e!==rr&&e!==ir&&e!==Zo&&e!==$o&&e!==Qo&&e!==cr&&e!==ur}(Rr(e,0))&&function(e){return!br(e)&&e!==or}(Rr(e,e.length-1));if(t||a)for(s=0;s=65536?s+=2:s++){if(!gr(l=Rr(e,s)))return xr;h=h&&Nr(l,u,c),u=l}else{for(s=0;s=65536?s+=2:s++){if((l=Rr(e,s))===Wo)d=!0,_&&(f=f||s-p-1>o&&" "!==e[p+1],p=s);else if(!gr(l))return xr;h=h&&Nr(l,u,c),u=l}f=f||_&&s-p-1>o&&" "!==e[p+1]}return d||f?n>9&&Cr(e)?xr:a?i===mr?xr:Lr:f?Dr:wr:!h||a||r(e)?i===mr?xr:Lr:Sr}function Pr(e,t,n,o,r){e.dump=function(){if(0===t.length)return e.quotingType===mr?'""':"''";if(!e.noCompatMode&&(-1!==hr.indexOf(t)||Er.test(t)))return e.quotingType===mr?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),a=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),c=o||e.flowLevel>-1&&n>=e.flowLevel;switch(Mr(t,c,e.indent,a,(function(t){return function(e,t){var n,o;for(n=0,o=e.implicitTypes.length;n"+Hr(t,e.indent)+Fr(Tr(function(e,t){var n,o,r=/(\n+)([^\n]*)/g,i=(c=e.indexOf("\n"),c=-1!==c?c:e.length,r.lastIndex=c,Br(e.slice(0,c),t)),a="\n"===e[0]||" "===e[0];var c;for(;o=r.exec(e);){var s=o[1],l=o[2];n=" "===l[0],i+=s+(a||n||""===l?"":"\n")+Br(l,t),a=n}return i}(t,a),i));case xr:return'"'+function(e){for(var t,n="",o=0,r=0;r=65536?r+=2:r++)o=Rr(e,r),!(t=pr[o])&&gr(o)?(n+=e[r],o>=65536&&(n+=e[r+1])):n+=t||Or(o);return n}(t)+'"';default:throw new un("impossible error: invalid scalar style")}}()}function Hr(e,t){var n=Cr(e)?String(t):"",o="\n"===e[e.length-1];return n+(o&&("\n"===e[e.length-2]||"\n"===e)?"+":o?"":"-")+"\n"}function Fr(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Br(e,t){if(""===e||" "===e[0])return e;for(var n,o,r=/ [^ ]/g,i=0,a=0,c=0,s="";n=r.exec(e);)(c=n.index)-i>t&&(o=a>i?a:c,s+="\n"+e.slice(i,o),i=o+1),a=c;return s+="\n",e.length-i>t&&a>i?s+=e.slice(i,a)+"\n"+e.slice(a+1):s+=e.slice(i),s.slice(1)}function kr(e,t,n,o){var r,i,a,c="",s=e.tag;for(r=0,i=n.length;r tag resolver accepts not "'+s+'" style');o=c.represent[s](t,s)}e.dump=o}return!0}return!1}function Gr(e,t,n,o,r,i,a){e.tag=null,e.dump=n,jr(e,n,!1)||jr(e,n,!0);var c,s=Go.call(e.dump),l=o;o&&(o=e.flowLevel<0||e.flowLevel>t);var u,d,f="[object Object]"===s||"[object Array]"===s;if(f&&(d=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||d||2!==e.indent&&t>0)&&(r=!1),d&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&d&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===s)o&&0!==Object.keys(e.dump).length?(!function(e,t,n,o){var r,i,a,c,s,l,u="",d=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new un("sortKeys must be a boolean or a function");for(r=0,i=f.length;r1024)&&(e.dump&&Wo===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,s&&(l+=vr(e,t)),Gr(e,t+1,c,!0,s)&&(e.dump&&Wo===e.dump.charCodeAt(0)?l+=":":l+=": ",u+=l+=e.dump));e.tag=d,e.dump=u||"{}"}(e,t,e.dump,r),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var o,r,i,a,c,s="",l=e.tag,u=Object.keys(n);for(o=0,r=u.length;o1024&&(c+="? "),c+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Gr(e,t,a,!1,!1)&&(s+=c+=e.dump));e.tag=l,e.dump="{"+s+"}"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===s)o&&0!==e.dump.length?(e.noArrayIndent&&!a&&t>0?kr(e,t-1,e.dump,r):kr(e,t,e.dump,r),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var o,r,i,a="",c=e.tag;for(o=0,r=n.length;o",e.dump=c+" "+e.dump)}return!0}function Ur(e,t){var n,o,r=[],i=[];for(Vr(e,r,i),n=0,o=i.length;n ")," > ").concat(e,'"'));if(e===xe)throw new SyntaxError("".concat(qr,', error in extendable config "').concat(n[0],'": "entend_from" can only be "base" in exceptions'));if(!(e in t.extendable_configs))throw new SyntaxError("".concat(qr,', error in "').concat(n[n.length-1],'": "').concat(e,'" doesn\'t exist in "extendable_configs"'));ni(t.extendable_configs[e].extend_from,t,o(o([],n,!0),[e],!1))}))},oi=function(e,t){Yr.forEach((function(n){if(n in e)throw new SyntaxError("".concat(t,' "').concat(n,'" option can only be placed in the main config'))}))},ri=function(e,t,n){if("string"==typeof t&&(bt.test(t)||gt.test(t)))console.warn('"'.concat(e,'" property should not have templates. "').concat(n.join(" > "),'" seems to be a template'));else if(typeof t!==Se.STRING&&typeof t!==Se.NUMBER&&typeof t!==Se.BOOLEAN)if(Array.isArray(t))t.forEach((function(t,r){ri(e,t,o(o([],n,!0),["[".concat(r,"]")],!1))}));else{if(Object.prototype.toString.call(t)!==ke)throw new SyntaxError("".concat(qr,', "').concat(e,": ").concat(n.join(" > "),'" has a wrong type ').concat(Object.prototype.toString.call(t)));var r=t;Object.entries(r).forEach((function(t){var r=t[0],i=t[1];ri(e,i,o(o([],n,!0),[r],!1))}))}},ii=function(e,t){if(typeof t!==Se.UNDEFINED){if(Object.prototype.toString.call(t)!==ke)throw new SyntaxError("".concat(qr,', "').concat(e,'" property should be an object'));Object.entries(t).forEach((function(t){var n=t[0],o=t[1];ri(e,o,[n])}))}},ai=function(e,t){if(typeof e!==Se.UNDEFINED){if(!Array.isArray(e))throw new SyntaxError("".concat(qr,", exceptions should be an array"));e.forEach((function(e){!function(e,t){var n;if(oi(e,"".concat(qr,", exceptions")),$r(e,o([],Kr,!0),"".concat(qr,", exceptions")),zr(e,o([],Ke,!0),"".concat(qr,", exceptions")),Zr([["user",e.user],["not_user",e.not_user],["device",e.device],["not_device",e.not_device],["extend_from",e.extend_from]],"".concat(qr,", exceptions")),ti(e.extend_from,t,"".concat(qr,", error in exception:"),!0),typeof e.matchers_conditions!==Se.UNDEFINED&&e.matchers_conditions!==Oe.AND&&e.matchers_conditions!==Oe.OR)throw new SyntaxError("".concat(qr,', exceptions "matchers_conditions" property should be "').concat(Oe.AND,'" or "').concat(Oe.OR,'"'));if(typeof e.order!==Se.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(qr,', exceptions "order" property should be an array'));if(Jr(e,["sidebar_editable"],"".concat(qr,", exceptions")),Qr(e,["hide_all","is_admin","is_owner"],"".concat(qr,", exceptions")),typeof e.sidebar_mode!==Se.UNDEFINED&&!(e.sidebar_mode in Tt))throw new SyntaxError("".concat(qr,', exceptions "sidebar_mode" property should be ').concat(he.HIDDEN,", ").concat(he.NARROW," or ").concat(he.EXTENDED));if(e.user&&e.not_user)throw new SyntaxError("".concat(qr,', exceptions "user" and "not_user" properties cannot be used together'));if(e.device&&e.not_device)throw new SyntaxError("".concat(qr,', exceptions "device" and "not_device" properties cannot be used together'));null===(n=e.order)||void 0===n||n.forEach(ci)}(e,t)}))}},ci=function(e){if(oi(e,"".concat(qr," in ").concat(e.item,",")),!e.item)throw new SyntaxError("".concat(qr,', every item in an "order" array should have an "item" property'));if($r(e,o(["item","info"],qe,!0),"".concat(qr," in ").concat(e.item,",")),zr(e,o([],Ke,!0),"".concat(qr," in ").concat(e.item,",")),Jr(e,["hide"],"".concat(qr," in ").concat(e.item,",")),e.new_item){if($r(e,["href","icon"],"".concat(qr," in ").concat(e.item,",")),!e.href)throw new SyntaxError("".concat(qr," in ").concat(e.item,', if you set "new_item" as "true", "href" property is necessary'));if(!e.icon)throw new SyntaxError("".concat(qr," in ").concat(e.item,', if you set "new_item" as "true", "icon" property is necessary'))}},si=function(e){var t;if($r(e,o([],Kr,!0),"".concat(qr,",")),Zr([["extend_from",e.extend_from]],"".concat(qr,",")),ti(e.extend_from,e,"".concat(qr,", error in main config:")),function(e){e.extendable_configs&&Object.entries(e.extendable_configs).forEach((function(t){var n=t[0],o=t[1];ni(o.extend_from,e,[n])}))}(e),zr(e,o([],Ke,!0),"".concat(qr,",")),Jr(e,["sidebar_editable"],"".concat(qr,",")),Qr(e,["hide_all"],"".concat(qr,",")),typeof e.sidebar_mode!==Se.UNDEFINED&&!(e.sidebar_mode in Tt))throw new SyntaxError("".concat(qr,', "sidebar_mode" property should be ').concat(he.HIDDEN,", ").concat(he.NARROW," or ").concat(he.EXTENDED));if(typeof e.order!==Se.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(qr,', "order" property should be an array'));if(typeof e.partials!==Se.UNDEFINED){if(Object.prototype.toString.call(e.partials)!==ke)throw new SyntaxError("".concat(qr,', "partials" property should be an object'));Object.entries(e.partials).forEach((function(e){var t=e[0];if(typeof e[1]!==Se.STRING)throw new SyntaxError("".concat(qr,', "partials" should be an object with strings. The partial ').concat(t," is not a string"))}))}ii("js_variables",e.js_variables),ii("jinja_variables",e.jinja_variables),null===(t=e.order)||void 0===t||t.forEach(ci),ai(e.exceptions,e)},li=function(){return t(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){return e="".concat(Le,": YAML config file not found."),t="Make sure you have valid config in /config/www/".concat(we,".yaml file."),[2,new Promise((function(n){fetch("".concat(De,".yaml?hash=").concat(Math.random().toString(16).slice(2))).then((function(o){if(!o.ok)throw Error("".concat(e,"\n").concat(t));o.text().then((function(e){return Wr.load(e)})).then((function(e){var o;(null===(o=e.id)||void 0===o?void 0:o.startsWith("example_yaml"))&&console.warn("".concat(Le,": You seem to be using the example configuration.\n").concat(t)),si(e),n(e)})).catch((function(e){throw Error("".concat(Le,": ").concat((null==e?void 0:e.message)||e))}))})).catch((function(){throw Error("".concat(e,"\n").concat(t))}))}))]}))}))},ui=function(){function o(){var e=this,t=new re;t.addEventListener(H.ON_LISTEN,(function(t){e._homeAssistant=t.detail.HOME_ASSISTANT,e._main=t.detail.HOME_ASSISTANT_MAIN,e._haDrawer=t.detail.HA_DRAWER,e._sidebar=t.detail.HA_SIDEBAR,e._partialPanelResolver=t.detail.PARTIAL_PANEL_RESOLVER}),{once:!0}),t.addEventListener(H.ON_PANEL_LOAD,this._panelLoaded.bind(this)),t.listen(),this._styleManager=new Ce({prefix:Le,namespace:Le,throwWarnings:!1}),this._items=[],this._sidebarScroll=0,this._isSidebarEditable=void 0,this._itemTouchedBinded=this._itemTouched.bind(this),this._mouseEnterBinded=this._mouseEnter.bind(this),this._mouseLeaveBinded=this._mouseLeave.bind(this),this._configPromise=li(),this._process()}return o.prototype._getConfig=function(){return t(this,void 0,void 0,(function(){var e,t=this;return n(this,(function(n){switch(n.label){case 0:return e=this,[4,this._configPromise.then((function(e){return function(e,t,n){return new wt(n,e,t).config}(t._ha.hass.user,navigator.userAgent.toLowerCase(),e)}))];case 1:return e._config=n.sent(),[2]}}))}))},o.prototype._getElements=function(){return t(this,void 0,void 0,(function(){var e,t,o,i;return n(this,(function(n){switch(n.label){case 0:return e={retries:100,delay:50,shouldReject:!1},[4,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element];case 1:return t=n.sent(),[4,r((function(){return t.querySelector(":scope > ".concat(Pe.SPACER))}),(function(e){return!!e}),e)];case 2:return o=n.sent(),[4,r((function(){return t.querySelectorAll(":scope > ".concat(Pe.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(Pe.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 3:return i=n.sent(),[2,[t,i,o]]}}))}))},o.prototype._hideAnchor=function(e,t){t?e.style.display="none":e.style.removeProperty("display")},o.prototype._buildNewItem=function(e){var t=document.createElement("a");return t.href=e.href,t.target=e.target||"",t.tabIndex=-1,t.setAttribute(Ue.ROLE,"option"),t.setAttribute(Ue.PANEL,e.item.toLowerCase().replace(/\s+/,"-")),t.setAttribute(Ue.ARIA_SELECTED,"false"),t.innerHTML='\n \n \n \n ').concat(e.item,'\n \n \n \n ').trim(),t},o.prototype._getTemplateString=function(e){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return t="",e instanceof Promise||"string"==typeof e||"number"==typeof e&&!Number.isNaN(e)||"boolean"==typeof e||"object"==typeof e?"string"!=typeof e?[3,1]:(t=e.trim(),[3,6]):[3,6];case 1:return"number"!=typeof e&&"boolean"!=typeof e?[3,2]:(t=e.toString(),[3,6]);case 2:return e instanceof Promise?[4,e]:[3,5];case 3:return o=n.sent(),[4,this._getTemplateString(o)];case 4:return t=n.sent(),[3,6];case 5:t=JSON.stringify(e),n.label=6;case 6:return[2,t]}}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(Pe.TITLE).element.then((function(t){e._config.title&&e._subscribeTemplate(e._config.title,(function(e){t.innerHTML=e})),e._config.subtitle&&e._subscribeTemplate(e._config.subtitle,(function(e){t.dataset.subtitle=e}))}))},o.prototype._subscribeSideBarEdition=function(){var e=this,t=function(e){e.preventDefault(),e.stopImmediatePropagation()},n=function(e,n){e.removeEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),n.removeAttribute(je)},o=function(e,n){e.removeEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),e.addEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),n.setAttribute(je,"")};Promise.all([this._main.element,this._sidebar.selector.$.query(Pe.MENU).element]).then((function(t){var r=t[0],i=t[1];"boolean"==typeof e._config.sidebar_editable&&(e._isSidebarEditable=e._config.sidebar_editable,e._isSidebarEditable||o(r,i)),"string"==typeof e._config.sidebar_editable&&e._subscribeTemplate(e._config.sidebar_editable,(function(t){"true"===t||"false"===t?(e._isSidebarEditable=!("false"===t),e._isSidebarEditable?n(r,i):o(r,i)):(e._isSidebarEditable=void 0,n(r,i)),e._checkProfileEditableButton()}))}))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(Pe.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.innerHTML=e}))},o.prototype._subscribeIcon=function(e,t){this._subscribeTemplate(t,(function(t){var n=e.querySelector(Me.HA_ICON);if(!n){(n=document.createElement(Me.HA_ICON)).setAttribute("slot","item-icon");var o=e.querySelector(Me.HA_SVG_ICON);o?o.replaceWith(n):e.querySelector(Me.PAPER_ICON_ITEM).prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(Pe.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector("".concat(Pe.NOTIFICATION_BADGE,":not(").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED,")")),o=e.querySelector(Pe.NOTIFICATIONS_BADGE_COLLAPSED);n||((n=document.createElement("span")).classList.add(Ge.NOTIFICATIONS_BADGE),e.querySelector(Me.PAPER_ICON_ITEM).append(n)),o||((o=document.createElement("span")).classList.add(Ge.NOTIFICATIONS_BADGE,Ge.NOTIFICATIONS_BADGE_COLLAPSED),e.querySelector("".concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON)).after(o));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,o.innerHTML=t,e.setAttribute(Ue.WITH_NOTIFICATION,"true")):(n.innerHTML="",o.innerHTML="",e.removeAttribute(Ue.WITH_NOTIFICATION))}))},o.prototype._subscribeHide=function(e,t){var n=this;"boolean"==typeof t?this._hideAnchor(e,t):this._subscribeTemplate(t,(function(t){n._hideAnchor(e,"true"===t)}))},o.prototype._subscribeTemplateColorChanges=function(e,t,n){var o=this;n.forEach((function(n){var r=n[0],i=n[1];e[r]&&o._subscribeTemplate(e[r],(function(e){t.style.setProperty(i,e)}))}))},o.prototype._subscribeTemplate=function(e,t){bt.test(e)?this._createJsTemplateSubscription(e.replace(bt,"$1"),t):gt.test(e)?this._createJinjaTemplateSubscription(e,t):this._getTemplateString(e).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(Dt(e,this._config.partials),(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;window.hassConnection.then((function(r){r.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:Ve.RENDER_TEMPLATE,template:Dt(t,o._config.partials),variables:e({user_name:o._ha.hass.user.name,user_is_admin:o._ha.hass.user.is_admin,user_is_owner:o._ha.hass.user.is_owner,user_agent:window.navigator.userAgent},o._config.jinja_variables)})}))},o.prototype._focusItem=function(e,t,n){var o=this._items.length,r="none",i=0;if(t)for(var a=(l=e+1)+o,c=l;co-1?c-o:c;if(this._items[s].style.display!==r){i=s;break}}else{var l;for(a=(l=e-1)-o,c=l;c>a;c--){s=c<0?o+c:c;if(this._items[s].style.display!==r){i=s;break}}}n?this._items[i].querySelector(Me.PAPER_ICON_ITEM).focus():(this._items[i].focus(),this._items[i].tabIndex=0)},o.prototype._focusItemByKeyboard=function(e,t){var n=e.querySelector("\n ".concat(Pe.SCOPE," > ").concat(Pe.ITEM,":not(.").concat(Ge.IRON_SELECTED,"):focus,\n ").concat(Pe.SCOPE," > ").concat(Pe.ITEM,":focus,\n ").concat(Pe.SCOPE," > ").concat(Pe.ITEM,":has(> ").concat(Me.PAPER_ICON_ITEM,":focus)\n ")),o=0;this._items.forEach((function(e,t){e===n&&(o=t),e.tabIndex=-1})),this._focusItem(o,t,!1)},o.prototype._focusItemByTab=function(e,t,n){if(t.nodeName===We.A){var o=t,r=this._items.indexOf(o),i=this._items.length-1;if(n&&r0)this._focusItem(r,n,!0);else(n?e.querySelector(Pe.SIDEBAR_NOTIFICATIONS):e.querySelector(Me.HA_ICON_BUTTON)).focus()}else{if(n)e.querySelector("".concat(Pe.PROFILE," > ").concat(Me.PAPER_ICON_ITEM)).focus();else this._focusItem(0,n,!0)}},o.prototype._getActivePaperIconElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&(t.nodeName===We.PAPER_ICON_ITEM||t.nodeName===We.A&&"option"===t.getAttribute("role"))?t:t.shadowRoot&&It.includes(t.nodeName)?this._getActivePaperIconElement(t.shadowRoot):null:null},o.prototype._processSidebar=function(){var e=this;Promise.all([this._main.element,this._partialPanelResolver.element]).then((function(o){var r=o[0],i=o[1],a=e._config.sidebar_mode,c=matchMedia("(max-width: 870px)");if(a){r.hass.dockedSidebar=Tt[a];var s=function(o){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return a===he.HIDDEN?[3,5]:[4,Rt()];case 1:return e.sent(),r.narrow=!1,[4,Rt()];case 2:return e.sent(),i.narrow=o,[4,Rt()];case 3:return e.sent(),o?[4,this._partialPanelResolver.selector.query(Pe.HA_MENU_BUTTON).element]:[3,5];case 4:e.sent().narrow=!1,e.label=5;case 5:return[2]}}))}))};c.addEventListener("change",(function(e){s(e.matches)})),s(c.matches)}})),Promise.all([this._haDrawer.selector.$.query(Pe.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._config,o,$e),e._subscribeTemplateColorChanges(e._config,n,[["sidebar_border_color",Be.BORDER_COLOR]]),i.addEventListener(Ve.KEYDOWN,(function(t){t.key!==Xe.ARROW_DOWN&&t.key!==Xe.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Xe.ARROW_DOWN))}),!0),window.addEventListener(Ve.KEYDOWN,(function(t){if(t.key===Xe.TAB){var n=e._getActivePaperIconElement();if(n)if(n.nodeName===We.PAPER_ICON_ITEM){var o=n.parentElement;o.getAttribute(Ue.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey))}else n.getAttribute(Ue.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,n,!t.shiftKey))}}),!0),e._styleManager.addStyle(Ut,n),e._styleManager.addStyle([Pt,Ht,Ft,Bt,kt,jt,Gt,Vt,Xt,Wt,qt,Kt,Yt,$t,zt,Qt,Jt,Zt,en,tn,nn,on,rn,e._config.styles||""],r)}))},o.prototype._rearrange=function(){var t=this;this._getElements().then((function(n){var o=t._config,r=o.order,i=o.hide_all,a=n[0],c=n[1],s=n[2],l=0,u=!1;t._items=Array.from(c);var d=new Set;i&&t._items.forEach((function(e){t._hideAnchor(e,!0)}));var f=r.reduce((function(n,o){var r=o.item,i=o.match,a=o.exact,c=o.new_item,s=r.toLocaleLowerCase(),l=c?void 0:t._items.find((function(e){var t=i===Ae.DATA_PANEL?e.getAttribute(Ue.PANEL):i===Ae.HREF?e.getAttribute(Ue.HREF):e.querySelector(Pe.ITEM_TEXT).innerText.trim();return!((!a||r!==t)&&(a||!(null==t?void 0:t.toLowerCase().includes(s))))&&(!d.has(e)&&(d.add(e),!0))}));return l&&l.setAttribute(Ue.PROCESSED,"true"),(c||l)&&n.push(e(e({},o),{element:l})),c||l||console.warn("".concat(Le,": you have an order item in your configuration that didn't match any sidebar item: \"").concat(r,'"')),n}),[]),_=function(){u||(t._items.forEach((function(e){e.hasAttribute(Ue.PROCESSED)||(e.style.order="".concat(l))})),l++,s.style.order="".concat(l),l++,u=!0)};f.forEach((function(e){if(e.bottom&&_(),e.new_item){var n=t._buildNewItem(e);a.append(n),e.element=n,e.element.setAttribute(Ue.PROCESSED,"true"),t._items.push(e.element)}else if(e.element){var o=e.element;e.href&&(o.href=e.href),e.target&&(o.target=e.target)}e.element.style.order="".concat(l),e.name&&t._subscribeName(e.element,e.name),e.icon&&t._subscribeIcon(e.element,e.icon),e.info&&t._subscribeInfo(e.element,e.info),e.notification&&t._subscribeNotification(e.element,e.notification),void 0!==e.hide&&t._subscribeHide(e.element,e.hide),t._subscribeTemplateColorChanges(e,e.element,Ye),e.new_item&&(e.element.addEventListener(Ve.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(Ve.MOUSELEAVE,t._mouseLeaveBinded)),e.element.addEventListener(Ve.MOUSEDOWN,t._itemTouchedBinded),e.element.addEventListener(Ve.KEYDOWN,(function(e){e.key===Xe.ENTER&&t._itemTouchedBinded()})),l++})),f.length&&_(),t._items.sort((function(e,t){return+e.style.order-+t.style.order})),t._panelLoaded()}))},o.prototype._itemTouched=function(){return t(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element.then((function(t){e._sidebarScroll=t.scrollTop})),[2]}))}))},o.prototype._mouseEnter=function(e){this._sidebar.element.then((function(t){t.alwaysExpand||(t._mouseLeaveTimeout&&(clearTimeout(t._mouseLeaveTimeout),t._mouseLeaveTimeout=void 0),t._showTooltip(e.currentTarget))}))},o.prototype._mouseLeave=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this._sidebar.element.then((function(e){e._mouseLeaveTimeout&&clearTimeout(e._mouseLeaveTimeout),e._mouseLeaveTimeout=window.setTimeout((function(){e._hideTooltip()}),500)})),[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),"/profile/general"!==e.__route.path?[3,3]:[4,this._partialPanelResolver.selector.query(Pe.EDIT_SIDEBAR_BUTTON).element];case 2:(t=n.sent())&&(!1===this._isSidebarEditable?t.setAttribute(Ue.DISABLED,""):t.removeAttribute(Ue.DISABLED)),n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t=e.__route.path,[4,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element];case 2:return o=n.sent(),r=o.querySelector("\n ".concat(Pe.SCOPE," > ").concat(Pe.ITEM,'[href="').concat(t,'"],\n ').concat(Pe.SCOPE," > ").concat(Pe.ITEM,'[href="').concat(t,'/dashboard"]\n ')),i=r?null:this._items.reduce((function(e,n){var o=n.getAttribute(Ue.HREF);return t.startsWith(o)&&(!e||o.length>e.getAttribute(Ue.HREF).length)&&(e=n),e}),null),this._items.forEach((function(e){var t=r&&r===e||!r&&i===e;e.classList.toggle(Ge.IRON_SELECTED,t),e.setAttribute(Ue.ARIA_SELECTED,"".concat(t))})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._checkProfileEditableButton(),[2]}}))}))},o.prototype._process=function(){var e=this;this._homeAssistant.element.then((function(t){e._ha=t,new Te(e._ha).getRenderer().then((function(t){e._renderer=t,e._getConfig().then((function(){var t;e._renderer.variables=null!==(t=e._config.js_variables)&&void 0!==t?t:{},e._processSidebar(),e._subscribeTitle(),e._subscribeSideBarEdition(),e._rearrange()}))}))}))},o}();window.CustomSidebar||(console.info("%c≡ ".concat(Le.toUpperCase()," (YAML)%cv").concat("8.2.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px"),window.CustomSidebar=new ui)}(); diff --git a/www/community/custom-sidebar/custom-sidebar-yaml.js.gz b/www/community/custom-sidebar/custom-sidebar-yaml.js.gz index 6efd2170..9449c0cd 100644 Binary files a/www/community/custom-sidebar/custom-sidebar-yaml.js.gz and b/www/community/custom-sidebar/custom-sidebar-yaml.js.gz differ diff --git a/www/community/custom-sidebar/custom-sidebar.js b/www/community/custom-sidebar/custom-sidebar.js index 64626315..8cc60988 100644 --- a/www/community/custom-sidebar/custom-sidebar.js +++ b/www/community/custom-sidebar/custom-sidebar.js @@ -1 +1 @@ -!function(){"use strict";var o,e,t,O;"function"==typeof SuppressedError&&SuppressedError,function(o){o.HIDDEN="hidden",o.NARROW="narrow",o.EXTENDED="extended"}(o||(o={})),function(o){o.DOCKED="docked",o.AUTO="auto",o.ALWAYS_HIDDEN="always_hidden"}(e||(e={})),function(o){o.TEXT="text",o.DATA_PANEL="data-panel",o.HREF="href"}(t||(t={}));var r,i,c,_,E,n;!function(o){o.BOOLEAN="boolean",o.STRING="string",o.UNDEFINED="undefined",o.NUMBER="number"}(r||(r={})),function(o){o.SIDEBAR="ha-sidebar",o.PAPER_LISTBOX="paper-listbox",o.PAPER_ICON_ITEM="paper-icon-item",o.HA_SVG_ICON="ha-svg-icon",o.HA_ICON="ha-icon",o.HA_ICON_BUTTON="ha-icon-button"}(i||(i={})),function(o){o.HOST=":host",o.HOST_EXPANDED=":host([expanded])",o.SCOPE=":scope",o.TITLE=".title",o.ITEM='a[role="option"]',o.ITEM_SELECTED=".iron-selected",o.ITEM_HOVER='a[role="option"]:hover',o.SPACER=".spacer",o.ITEM_TEXT=".item-text",o.NOTIFICATION_BADGE=".notification-badge",o.NOTIFICATIONS_BADGE_COLLAPSED=".notification-badge-collapsed",o.CONFIGURATION_BADGE=".configuration-badge",o.HA_MENU_BUTTON="ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button",o.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",o.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",o.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",o.SIDEBAR_NOTIFICATIONS=".notifications",o.PROFILE=".profile",o.MENU=".menu",o.DIVIDER=".divider",o.MC_DRAWER=".mdc-drawer",o.HA_SCROLLBAR=".ha-scrollbar",o.DATA_INFO="[data-info]"}(c||(c={})),function(o){o.AFTER="::after",o.BEFORE="::before",o.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(_||(_={})),function(o){o.PRIMARY_BACKGROUND_COLOR="--primary-background-color",o.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",o.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",o.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",o.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",o.SIDEBAR_ICON_COLOR="--sidebar-icon-color",o.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",o.SIDEBAR_TEXT_COLOR="--sidebar-text-color",o.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",o.ACCENT_COLOR="--accent-color",o.TEXT_ACCENT_COLOR="--text-accent-color",o.TEXT_PRIMARY_COLOR="--text-primary-color",o.PRIMARY_TEXT_COLOR="--primary-text-color",o.DIVIDER_COLOR="--divider-color",o.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(E||(E={})),function(o){o.BACKGROUND="--custom-sidebar-background",o.BORDER_COLOR="--custom-sidebar-border-color",o.MENU_BACKGROUND="--custom-sidebar-menu-background",o.TITLE_COLOR="--custom-sidebar-title-color",o.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",o.BUTTON_COLOR="--custom-sidebar-button-color",o.DIVIDER_COLOR="--custom-sidebar-divider-color",o.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",o.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",o.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",o.ITEM_BACKGROUND="--custom-sidebar-item-background",o.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",o.ICON_COLOR="--custom-sidebar-icon-color",o.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",o.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",o.TEXT_COLOR="--custom-sidebar-text-color",o.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",o.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",o.SELECTION_BACKGROUND="--custom-sidebar-selection-background",o.SELECTION_OPACITY="--custom-sidebar-selection-opacity",o.INFO_COLOR="--custom-sidebar-info-color",o.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",o.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",o.NOTIFICATION_COLOR="--custom-sidebar-notification-color",o.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",o.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",o.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",o.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",o.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(n||(n={}));var a,T,R,I,s,C=[["item_background",n.ITEM_BACKGROUND],["item_background_hover",n.ITEM_BACKGROUND_HOVER],["icon_color",n.ICON_COLOR],["icon_color_selected",n.ICON_COLOR_SELECTED],["icon_color_hover",n.ICON_COLOR_HOVER],["text_color",n.TEXT_COLOR],["text_color_selected",n.TEXT_COLOR_SELECTED],["text_color_hover",n.TEXT_COLOR_HOVER],["selection_background",n.SELECTION_BACKGROUND],["selection_opacity",n.SELECTION_OPACITY],["info_color",n.INFO_COLOR],["info_color_selected",n.INFO_COLOR_SELECTED],["info_color_hover",n.INFO_COLOR_HOVER],["notification_color",n.NOTIFICATION_COLOR],["notification_color_selected",n.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",n.NOTIFICATION_COLOR_HOVER],["notification_text_color",n.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",n.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",n.NOTIFICATION_TEXT_COLOR_HOVER]];!function(o,e,t){if(t||2===arguments.length)for(var O,r=0,i=e.length;r extra_module_url module.\nCheck the documentation: https://github.com/elchininet/custom-sidebar#installation"))}))}(); +!function(){"use strict";var o,e,t,O,r;"function"==typeof SuppressedError&&SuppressedError,function(o){o.HIDDEN="hidden",o.NARROW="narrow",o.EXTENDED="extended"}(o||(o={})),function(o){o.DOCKED="docked",o.AUTO="auto",o.ALWAYS_HIDDEN="always_hidden"}(e||(e={})),function(o){o.AND="AND",o.OR="OR"}(t||(t={})),function(o){o.TEXT="text",o.DATA_PANEL="data-panel",o.HREF="href"}(O||(O={}));var i,c,_,E,n,a;!function(o){o.BOOLEAN="boolean",o.STRING="string",o.UNDEFINED="undefined",o.NUMBER="number"}(i||(i={})),function(o){o.SIDEBAR="ha-sidebar",o.PAPER_LISTBOX="paper-listbox",o.PAPER_ICON_ITEM="paper-icon-item",o.HA_SVG_ICON="ha-svg-icon",o.HA_ICON="ha-icon",o.HA_ICON_BUTTON="ha-icon-button"}(c||(c={})),function(o){o.HOST=":host",o.HOST_EXPANDED=":host([expanded])",o.SCOPE=":scope",o.TITLE=".title",o.ITEM='a[role="option"]',o.ITEM_SELECTED=".iron-selected",o.ITEM_HOVER='a[role="option"]:hover',o.SPACER=".spacer",o.ITEM_TEXT=".item-text",o.NOTIFICATION_BADGE=".notification-badge",o.NOTIFICATIONS_BADGE_COLLAPSED=".notification-badge-collapsed",o.CONFIGURATION_BADGE=".configuration-badge",o.HA_MENU_BUTTON="ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button",o.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",o.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",o.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",o.SIDEBAR_NOTIFICATIONS=".notifications",o.PROFILE=".profile",o.MENU=".menu",o.DIVIDER=".divider",o.MC_DRAWER=".mdc-drawer",o.HA_SCROLLBAR=".ha-scrollbar",o.DATA_INFO="[data-info]"}(_||(_={})),function(o){o.AFTER="::after",o.BEFORE="::before",o.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(E||(E={})),function(o){o.PRIMARY_BACKGROUND_COLOR="--primary-background-color",o.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",o.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",o.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",o.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",o.SIDEBAR_ICON_COLOR="--sidebar-icon-color",o.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",o.SIDEBAR_TEXT_COLOR="--sidebar-text-color",o.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",o.ACCENT_COLOR="--accent-color",o.TEXT_ACCENT_COLOR="--text-accent-color",o.TEXT_PRIMARY_COLOR="--text-primary-color",o.PRIMARY_TEXT_COLOR="--primary-text-color",o.DIVIDER_COLOR="--divider-color",o.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(n||(n={})),function(o){o.BACKGROUND="--custom-sidebar-background",o.BORDER_COLOR="--custom-sidebar-border-color",o.MENU_BACKGROUND="--custom-sidebar-menu-background",o.TITLE_COLOR="--custom-sidebar-title-color",o.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",o.BUTTON_COLOR="--custom-sidebar-button-color",o.DIVIDER_COLOR="--custom-sidebar-divider-color",o.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",o.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",o.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",o.ITEM_BACKGROUND="--custom-sidebar-item-background",o.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",o.ICON_COLOR="--custom-sidebar-icon-color",o.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",o.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",o.TEXT_COLOR="--custom-sidebar-text-color",o.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",o.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",o.SELECTION_BACKGROUND="--custom-sidebar-selection-background",o.SELECTION_OPACITY="--custom-sidebar-selection-opacity",o.INFO_COLOR="--custom-sidebar-info-color",o.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",o.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",o.NOTIFICATION_COLOR="--custom-sidebar-notification-color",o.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",o.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",o.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",o.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",o.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(a||(a={}));var T,R,I,s,C,d=[["item_background",a.ITEM_BACKGROUND],["item_background_hover",a.ITEM_BACKGROUND_HOVER],["icon_color",a.ICON_COLOR],["icon_color_selected",a.ICON_COLOR_SELECTED],["icon_color_hover",a.ICON_COLOR_HOVER],["text_color",a.TEXT_COLOR],["text_color_selected",a.TEXT_COLOR_SELECTED],["text_color_hover",a.TEXT_COLOR_HOVER],["selection_background",a.SELECTION_BACKGROUND],["selection_opacity",a.SELECTION_OPACITY],["info_color",a.INFO_COLOR],["info_color_selected",a.INFO_COLOR_SELECTED],["info_color_hover",a.INFO_COLOR_HOVER],["notification_color",a.NOTIFICATION_COLOR],["notification_color_selected",a.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",a.NOTIFICATION_COLOR_HOVER],["notification_text_color",a.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",a.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",a.NOTIFICATION_TEXT_COLOR_HOVER]];!function(o,e,t){if(t||2===arguments.length)for(var O,r=0,i=e.length;r extra_module_url module.\nCheck the documentation: https://github.com/elchininet/custom-sidebar#installation"))}))}(); diff --git a/www/community/custom-sidebar/custom-sidebar.js.gz b/www/community/custom-sidebar/custom-sidebar.js.gz index 2aa6cf6c..6dffc55b 100644 Binary files a/www/community/custom-sidebar/custom-sidebar.js.gz and b/www/community/custom-sidebar/custom-sidebar.js.gz differ diff --git a/www/community/flex-table-card/flex-table-card.js b/www/community/flex-table-card/flex-table-card.js index c4db41c7..e8caedf0 100644 --- a/www/community/flex-table-card/flex-table-card.js +++ b/www/community/flex-table-card/flex-table-card.js @@ -1,7 +1,7 @@ "use strict"; // VERSION info -var VERSION = "0.7.7"; +var VERSION = "0.7.8"; // typical [[1,2,3], [6,7,8]] to [[1, 6], [2, 7], [3, 8]] converter var transpose = m => m[0].map((x, i) => m.map(x => x[i])); @@ -155,8 +155,8 @@ class DataTable { this.rows.sort((x, y) => sort_conf.reduce((out, conf) => out || conf.dir * compare( - x.data[conf.idx] && x.data[conf.idx].content, - y.data[conf.idx] && y.data[conf.idx].content), + x.data[conf.idx] && (x.data[conf.idx].sort_unmodified ? x.data[conf.idx].raw_content : x.data[conf.idx].content), + y.data[conf.idx] && (y.data[conf.idx].sort_unmodified ? y.data[conf.idx].raw_content : y.data[conf.idx].content)), false ) ); @@ -287,6 +287,12 @@ class DataRow { // 'icon' will show the entity's default icon let _icon = this.entity.attributes.icon; raw_content.push(``); + } else if (col_key === "area") { + // 'area' will show the entity's or its device's assigned area, if any + raw_content.push(this._get_area_name(this.entity.entity_id, hass)); + } else if (col_key === "device") { + // 'device' will show the entity's device name, if any + raw_content.push(this._get_device_name(this.entity.entity_id, hass)); } else if (col_key === "state" && config.auto_format && !col.no_auto_format) { // format entity state raw_content.push(hass.formatEntityState(this.entity)); @@ -317,14 +323,25 @@ class DataRow { // until the final object value is found. // if at any point in the traversal, the object is not found // then null will be used as the value. + // Works for arrays as well as single values. let objs = col_key.split('.'); - let value = this.entity.attributes; - if (value) { - for (let idx = 0; value && idx < objs.length; idx++) { - value = (objs[idx] in value) ? value[objs[idx]] : null; + let struct = this.entity.attributes; + let values = []; + if (struct) { + for (let idx = 0; struct && idx < objs.length; idx++) { + if (Array.isArray(struct)) { + struct.forEach(function (item, index) { + values.push(struct[index][objs[idx]]); + }); + } + else { + struct = (objs[idx] in struct) ? struct[objs[idx]] : null; + } } + // If no array found, single value is in struct. + if (values.length == 0) values = struct; } - raw_content.push(value); + raw_content.push(values); } } @@ -394,14 +411,33 @@ class DataRow { return null; } + _get_device_name(entity_id, hass) { + var device_id; + if (hass.entities[entity_id] !== undefined) { + device_id = hass.entities[entity_id].device_id; + } + return device_id === undefined ? "-" : hass.devices[device_id].name_by_user || hass.devices[device_id].name; + } + + _get_area_name(entity_id, hass) { + var area_id; + if (hass.entities[entity_id] !== undefined) { + area_id = hass.entities[entity_id].area_id; + if (area_id === undefined) { + let device_id = hass.entities[entity_id].device_id; + if (device_id !== undefined) area_id = hass.devices[device_id].area_id; + } + } + return area_id === undefined || hass.areas[area_id] === undefined ? "-" : hass.areas[area_id].name; + } + render_data(col_cfgs) { // apply passed "modify" configuration setting by using eval() // assuming the data is available inside the function as "x" this.data = this.raw_data.map((raw, idx) => { let x = raw; let cfg = col_cfgs[idx]; - - let fmt = new CellFormatters(); + let fmt = new CellFormatters(); if (cfg.fmt) { x = fmt[cfg.fmt](x); if (fmt.failed) @@ -420,7 +456,9 @@ class DataRow { pre: cfg.prefix || "", suf: cfg.suffix || "", css: cfg.align || "left", - hide: cfg.hidden + hide: cfg.hidden, + raw_content: raw, + sort_unmodified: cfg.sort_unmodified }); }); this.hidden = this.data.some(data => (data === null)); @@ -492,10 +530,10 @@ class FlexTableCard extends HTMLElement { throw new Error('Please provide the "columns" option as a list.'); } - if (config.service) { - const service_config = config.service.split('.'); - if (service_config.length != 2) { - throw new Error('Please specify service in "domain.service" format.'); + if (config.action || config.service) { + const action_config = config.action ? config.action.split('.') : config.service.split('.'); + if (action_config.length != 2) { + throw new Error('Please specify action in "domain.action" format.'); } } @@ -533,7 +571,8 @@ class FlexTableCard extends HTMLElement { "text-decoration: underline; ", "tbody tr:nth-child(odd)": "background-color: var(--table-row-background-color); ", "tbody tr:nth-child(even)": "background-color: var(--table-row-alternative-background-color); ", - "th ha-icon": "height: 1em; vertical-align: top; " + "th ha-icon": "height: 1em; vertical-align: top; ", + "tfoot *": "border-style: solid none solid none;" } // apply CSS-styles from configuration // ("+" suffix to key means "append" instead of replace) @@ -562,7 +601,7 @@ class FlexTableCard extends HTMLElement { })); - // table skeleton, body identified with: 'flextbl' + // table skeleton, body identified with: 'flextbl', footer with 'flexfoot' content.innerHTML = ` @@ -572,6 +611,7 @@ class FlexTableCard extends HTMLElement { +
`; // push css-style & table as content into the card's DOM tree @@ -630,6 +670,118 @@ class FlexTableCard extends HTMLElement { }); } + _updateFooter(footer, config, rows) { + var innerHTML = ''; + var colnum = -1; + var raw = ""; + var colspan_remainder = 0 + + config.columns.map((col, idx) => { + if (!col.hidden) { + colnum++; + if (colspan_remainder > 0) + // Skip column if previous colspan would overlap it + colspan_remainder--; + else { + var cfg = config.columns[idx]; + if (col.footer_type) { + switch (col.footer_type) { + case 'sum': + raw = this._sumColumn(rows, colnum); + break; + case 'average': + raw = this._avgColumn(rows, colnum); + break; + case 'count': + raw = rows.length; + break; + case 'max': + raw = this._maxColumn(rows, colnum); + break; + case 'min': + raw = this._minColumn(rows, colnum); + break; + case 'text': + raw = col.footer_text; + break; + default: + console.log("Invalid footer_type: ", col.footer_type); + } + let x = raw; + let value = cfg.footer_modify ? eval(cfg.footer_modify) : x; + if (col.footer_type == 'text') { + let colspan = cfg.footer_colspan ? cfg.footer_colspan : 1; + innerHTML += `${value}`; + colspan_remainder = colspan - 1; + } + else + innerHTML += `${cfg.prefix || ""}${value}${cfg.suffix || ""}`; + } + else { + innerHTML += '' + } + } + } + }); + + innerHTML += ''; + footer.innerHTML = innerHTML; + } + + _sumColumn(rows, colnum) { + var sum = 0; + for (var i = 0; i < rows.length; i++) { + let cellValue = this._findNumber(rows[i].data[colnum].sort_unmodified ? rows[i].data[colnum].raw_content : rows[i].data[colnum].content); + if (!Number.isNaN(cellValue)) sum += cellValue; + } + return sum; + } + + _avgColumn(rows, colnum) { + var sum = 0; + var count = 0; + for (var i = 0; i < rows.length; i++) { + let cellValue = this._findNumber(rows[i].data[colnum].sort_unmodified ? rows[i].data[colnum].raw_content : rows[i].data[colnum].content); + if (!Number.isNaN(cellValue)) { + sum += cellValue; + count++; + } + } + return sum / count; + } + + _maxColumn(rows, colnum) { + var max = Number.MIN_VALUE; + for (var i = 0; i < rows.length; i++) { + let cellValue = this._findNumber(rows[i].data[colnum].sort_unmodified ? rows[i].data[colnum].raw_content : rows[i].data[colnum].content); + if (!Number.isNaN(cellValue)) { + if (cellValue > max) max = cellValue; + } + } + return max == Number.MIN_VALUE ? Number.NaN : max; + } + + _minColumn(rows, colnum) { + var min = Number.MAX_VALUE; + for (var i = 0; i < rows.length; i++) { + let cellValue = this._findNumber(rows[i].data[colnum].sort_unmodified ? rows[i].data[colnum].raw_content : rows[i].data[colnum].content); + if (!Number.isNaN(cellValue)) { + if (cellValue < min) min = cellValue; + } + } + return min == Number.MAX_VALUE ? Number.NaN : min; + } + + // Trim whitespace and leading non-numeric, but not minus sign + _findNumber(val) { + if (typeof val === "number") { + return val; + } + else { + let value = val.trim(); + return (Number.isNaN(parseFloat(value[0])) && value[0] !== '-') ? parseFloat(value.substring(1)) : parseFloat(value); + } + } set hass(hass) { const config = this._config; const root = this.shadowRoot; @@ -648,12 +800,12 @@ class FlexTableCard extends HTMLElement { } this.#old_rowcount = rowcount; - if (config.service) { - // Use service to populate - const service_config = config.service.split('.'); - let domain = service_config[0]; - let service = service_config[1]; - let service_data = config.service_data; + if (config.action || config.service) { + // Use action to populate + const action_config = config.action ? config.action.split('.') : config.service.split('.'); + let domain = action_config[0]; + let action = action_config[1]; + let action_data = config.action_data || config.service_data; let entity_list = entities.map((entity) => entity.entity_id @@ -662,9 +814,9 @@ class FlexTableCard extends HTMLElement { hass.callWS({ "type": "call_service", "domain": domain, - "service": service, - "service_data": service_data, - "target": { "entity_id": entity_list }, + "service": action, + "service_data": action_data, + "target": entity_list.length ? { "entity_id": entity_list } : undefined, "return_response": true, }).then(return_response => { const entities = new Array(); @@ -710,7 +862,9 @@ class FlexTableCard extends HTMLElement { // finally set card height and insert card this._setCardSize(this.tbl.rows.length); // all preprocessing / rendering will be done here inside DataTable::get_rows() - this._updateContent(root.getElementById('flextbl'), this.tbl.get_rows()); + let data_rows = this.tbl.get_rows(); + this._updateContent(root.getElementById('flextbl'), data_rows); + if (config.display_footer) this._updateFooter(root.getElementById("flexfoot"), config, data_rows); } _setCardSize(num_rows) { diff --git a/www/community/flex-table-card/flex-table-card.js.gz b/www/community/flex-table-card/flex-table-card.js.gz index 86a3662e..5606f16c 100644 Binary files a/www/community/flex-table-card/flex-table-card.js.gz and b/www/community/flex-table-card/flex-table-card.js.gz differ diff --git a/www/community/frigate-hass-card/audio-cf3a75aa.js b/www/community/frigate-hass-card/audio-cf3a75aa.js new file mode 100644 index 00000000..268044d1 --- /dev/null +++ b/www/community/frigate-hass-card/audio-cf3a75aa.js @@ -0,0 +1 @@ +const o=o=>void 0!==o.mozHasAudio?o.mozHasAudio:void 0===o.audioTracks||Boolean(o.audioTracks?.length);export{o as m}; diff --git a/www/community/frigate-hass-card/audio-cf3a75aa.js.gz b/www/community/frigate-hass-card/audio-cf3a75aa.js.gz new file mode 100644 index 00000000..70294547 Binary files /dev/null and b/www/community/frigate-hass-card/audio-cf3a75aa.js.gz differ diff --git a/www/community/frigate-hass-card/card-09c4bade.js b/www/community/frigate-hass-card/card-09c4bade.js new file mode 100644 index 00000000..0d54082a --- /dev/null +++ b/www/community/frigate-hass-card/card-09c4bade.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-458c9005.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-7cd5392b.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-3521f17f.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-c0a1587c.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=()=>!!navigator.userAgent.match(/CrKey\//),yb=(e,t)=>!!((e.attributes.supported_features??0)&t),bb=e=>(e=>yb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,wb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},xb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},Cb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Mb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},kb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},Sb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Eb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?Sb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":kb[a]},$b=e=>{const t=e?.attributes.device_class;if(t&&t in Mb)return Mb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Eb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},Ab="mdi:bookmark",zb={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function Ib(e,t,n,a){switch(e){case"alarm_control_panel":return wb(n);case"binary_sensor":return xb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return Cb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=$b(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?zb[e]:"mdi:weather-night";case"update":return"on"===t?.state?bb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in zb?zb[e]:a??Ab}async function Tb(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function jb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function Ob(e,t,n,a){return!!jb(e,t,n,{...a,firstOnly:!0}).length}function Db(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Rb(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Pb(e){return{color:Rb(e),filter:Db(e)}}function Lb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Pb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Fb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Nb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Fb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:Ib(Ye(t),a,a?.state,n)}const Vb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Hb=e=>!!e&&["on","open"].includes(e),Bb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function qb(e){return!!e?.startsWith("/")}function Ub(e,t){return qb(t)?e.hassUrl(t):t??null}class Wb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Zb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Zb||(Zb={}));class Qb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Wb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Zb.LANGUAGES,Zb.SIDE_LOAD_ELEMENTS,Zb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Zb.MICROPHONE_CONNECT]:[],Zb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Zb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Zb.SIDE_LOAD_ELEMENTS]:async()=>await Vb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Zb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Zb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Zb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Gb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,vb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),of(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Zb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Yb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Yb(e,t,n)},Jb=(e,t,n)=>fv(e,t,n),ew=(e,t)=>{!function(e,t){null==e||Kb(e,t)}(e,t)},tw=e=>u_(e),nw=(e,t)=>e.replace("#",`[${t.toString()}]`),aw=function(e){let t=!1;for(let n=0;n{const i=Jb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(ew(e,t),0):void 0===r||(a?.keepOriginal||ew(e,t),Xb(e,n,r),0)))})(a,e,t,n)}},ow=function(e,t,n){return function(a){let i=rw(e,t,n)(a);return i=lw(bs,rw(e,t,n),(e=>e.overrides))(a)||i,i}},sw=function(e,t){return ow(e,e,{transform:t})},cw=function(e){return ow(e,e,{transform:e=>null})},lw=function(e,t,n){return function(a){let i=!1;const r=Jb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},dw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},uw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),hw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),mw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),gw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),fw=[lw(bs,uw,(e=>e.conditions)),e=>dw(uw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),ow("event_gallery",or),ow("menu.buttons.frigate_ui",is),e=>dw(gw)("object"==typeof e&&e?e:{}),lw(Ca,sw("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),ow("live.jsmpeg",ki),ow("live.image",Ci),ow("live.webrtc_card",Si),lw(Ca,ow("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),lw(Ca,ow("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>dw(mw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Yb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},ow("view.timeout_seconds",Ri),sw("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),sw("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),sw("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),sw("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),ow("live.controls.thumbnails.media",io),ow("timeline.media",Ho),ow("live.controls.timeline.media",po),ow("media_viewer.controls.timeline.media",Rr),ow("view.scan",Xi),ow("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),ow("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),ow("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),ow("live.layout",Ai),cw("media_viewer.layout"),cw("image.layout"),lw(bs,hw),e=>dw(hw)("object"==typeof e&&e?e[Ii]:{}),e=>dw(hw)("object"==typeof e&&e?e.automations:{}),lw(Ca,ow("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),ow("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),lw(bs,rw("overrides","merge")),ow("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),sw("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),ow("view.update_cycle_camera",Wi),ow("view.update_force",Qi,{transform:e=>!0===e?"all":null}),ow("view.update_seconds",Gi),ow("view.update_entities",Yi),rw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),cw("live.controls.title"),cw("media_viewer.controls.title"),e=>dw(pw)("object"==typeof e&&e?e:{}),ow("dimensions.max_height",ys),cw("dimensions.min_height")];class _w extends zs{}class vw extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function yw(e,t,n){let a=tw(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{ew(a,e)})),Object.keys(t.set??{}).forEach((e=>{Xb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Xb(a,e,Ly({},Jb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new _w(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class bw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const ww={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},xw=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in ww&&Object.entries(ww[e]).forEach((([e,n])=>{return r=n,void(void 0===Jb(i,a=e)&&Xb(t,a,r));var a,r}));return t},Cw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Mw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=Cw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class kw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=iw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=xw(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Zb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Mw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=yw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Zb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Zb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class Sw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Ew=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},$w=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Tb(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Ew(i)},Aw=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class zw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await $w(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Ew(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class Iw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Tw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],jw=(()=>{if("undefined"==typeof document)return!1;const e=Tw[0],t={};for(const n of Tw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),Ow={change:jw.fullscreenchange,error:jw.fullscreenerror};let Dw={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Dw.off("change",i),n()};Dw.on("change",i);const r=e[jw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Dw.isFullscreen)return void e();const n=()=>{Dw.off("change",n),e()};Dw.on("change",n);const a=document[jw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Dw.isFullscreen?Dw.exit():Dw.request(e,t),onchange(e){Dw.on("change",e)},onerror(e){Dw.on("error",e)},on(e,t){const n=Ow[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=Ow[e];n&&document.removeEventListener(n,t,!1)},raw:jw};Object.defineProperties(Dw,{isFullscreen:{get:()=>Boolean(document[jw.fullscreenElement])},element:{enumerable:!0,get:()=>document[jw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[jw.fullscreenEnabled])}}),jw||(Dw={isEnabled:!1});var Rw=Dw;class Pw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Rw.isEnabled&&Rw.on("change",this._fullscreenHandler)}disconnect(){Rw.isEnabled&&Rw.off("change",this._fullscreenHandler)}isInFullscreen(){return Rw.isEnabled&&Rw.isFullscreen}toggleFullscreen(){Rw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Rw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Lw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=jb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Nw{constructor(e){this._hass=null,this._stateWatcher=new Lw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Fw=function(){return th.Date.now()},Vw="Expected a function",Hw=Math.max,Bw=Math.min;function qw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Vw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Fw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Bw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Fw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Hw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Fw())},_}function Uw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),qw(e,t,{leading:a,maxWait:t,trailing:i})}class Ww{constructor(e){this._timer=new xf,this.reportInteraction=Uw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Zw{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Qw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Gw(e,t,n){const a=Qw(t,n);a&&Yw(e,a)}function Yw(e,t){Bg(e,"media:loaded",t)}function Kw(e){Bg(e,"media:unloaded")}function Xw(e){Bg(e,"media:volumechange")}function Jw(e){Bg(e,"media:play")}function ex(e){Bg(e,"media:pause")}class tx{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class nx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class ax{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&yb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(yb(n,4096))a="media_stop";else{if(!yb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:nx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ix{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class ox{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class sx{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class cx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class lx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=Uw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function dx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class ux{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=dx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class hx extends ux{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class px extends ux{}class mx{static areEventQueries(e){return e instanceof hx}static areRecordingQueries(e){return e instanceof px}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const gx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},fx=(e,t)=>Ly({},e,t);class _x{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new _x({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new _x({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=fx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const vx=(e,t)=>{t?.forEach((t=>t.modify(e)))};class yx extends zs{}class bx extends zs{}class wx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...gx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=gx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new yx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new bx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new _x(o);return vx(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!gx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class xx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class Cx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Mx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class kx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new kx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Ex{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new hx(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new px(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new Sx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Mx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class $x{constructor(e,t){this._api=e,this._executor=t??new Ex(e)}async getExistingQueryModifiers(e,t){return e.query?[new Cx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new Cx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new xx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new xx("mediaViewer","seek")]}}class Ax{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new wx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new $x(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),vx(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=mx.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!gx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class zx{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new kw(this),this._defaultManager=new Sw(this),this._downloadManager=new zw(this),this._expandManager=new Iw(this),this._fullscreenManager=new Pw(this),this._hassManager=new Nw(this),this._initializationManager=new Qb(this),this._interactionManager=new Ww(this),this._keyboardStateManager=new Zw(this),this._mediaLoadedInfoManager=new tx(this),this._mediaPlayerManager=new ax(this),this._messageManager=new ix(this),this._microphoneManager=new rx(this),this._queryStringManager=new ox(this),this._statusBarItemManager=new sx(this),this._styleManager=new cx(this),this._triggersManager=new lx(this),this._viewManager=new Ax(this),e.addController(this),this._conditionsManager=new bw(this,a),this._cardElementManager=new Gb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-837da8b4.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class Ix{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!vb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return vb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Nb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Fb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?gx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Tx(e){return null==e}var jx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Nx(e,t){return Ox.repeat(" ",t-e.length)+e}var Fx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Lx(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=Ox.repeat(" ",t.indent)+Nx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Lx(e.buffer,i[o],r[o],e.position,u),l+=Ox.repeat(" ",t.indent)+Nx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=Ox.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Lx(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=Ox.repeat(" ",t.indent)+Nx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Vx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Hx=["scalar","sequence","mapping"];var Bx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Vx.indexOf(t))throw new Px('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Hx.indexOf(this.kind))throw new Px('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function qx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function Ux(e){return this.extend(e)}Ux.prototype.extend=function(e){var t=[],n=[];if(e instanceof Bx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Px("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Bx))throw new Px("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Px("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Px("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Bx))throw new Px("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Ux.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=qx(a,"implicit"),a.compiledExplicit=qx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),aC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var iC=/^[-+]?[0-9]+e/;var rC=new Bx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!aC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||Ox.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Ox.isNegativeZero(e))return"-0.0";return n=e.toString(10),iC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),oC=Yx.extend({implicit:[Kx,Xx,nC,rC]}),sC=oC,cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),lC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var dC=new Bx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==cC.exec(e)||null!==lC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=cC.exec(e))&&(t=lC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var uC=new Bx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),hC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var pC=new Bx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=hC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=hC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=hC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),mC=Object.prototype.hasOwnProperty,gC=Object.prototype.toString;var fC=new Bx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var UC=new Array(256),WC=new Array(256),ZC=0;ZC<256;ZC++)UC[ZC]=BC(ZC)?1:0,WC[ZC]=BC(ZC);function QC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||wC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function GC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Fx(n),new Px(t,n)}function YC(e,t){throw GC(e,t)}function KC(e,t){e.onWarning&&e.onWarning.call(null,GC(e,t))}var XC={YAML:function(e,t,n){var a,i,r;null!==e.version&&YC(e,"duplication of %YAML directive"),1!==n.length&&YC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&YC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&YC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&KC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&YC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],jC.test(a)||YC(e,"ill-formed tag handle (first argument) of the TAG directive"),xC.call(e.tagMap,a)&&YC(e,'there is a previously declared suffix for "'+a+'" tag handle'),OC.test(i)||YC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){YC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function JC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=Ox.repeat("\n",t-1))}function oM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,YC(e,"tab characters must not be used in indentation")),45===a)&&LC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,aM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,lM(e,t,kC,!1,!0),o.push(e.result),aM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)YC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),lM(e,t,SC,!0,i)&&(_?g=e.result:f=e.result),_||(tM(e,h,p,m,g,f,o,s,c),m=g=f=null),aM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)YC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?YC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?YC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(PC(r)){do{r=e.input.charCodeAt(++e.position)}while(PC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!RC(r)&&0!==r)}for(;0!==r;){for(nM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),RC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=FC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:YC(e,"expected hexadecimal character");e.result+=qC(r),e.position++}else YC(e,"unknown escape sequence");n=a=e.position}else RC(s)?(JC(e,n,a,!0),rM(e,aM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&iM(e)?YC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}YC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!LC(a)&&!NC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&YC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),xC.call(e.anchorMap,n)||YC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],aM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(LC(d=e.input.charCodeAt(e.position))||NC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(LC(a=e.input.charCodeAt(e.position+1))||n&&NC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(LC(a=e.input.charCodeAt(e.position+1))||n&&NC(a))break}else if(35===d){if(LC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&iM(e)||n&&NC(d))break;if(RC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,aM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(JC(e,i,r,!1),rM(e,e.line-s),i=r=e.position,o=!1),PC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return JC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,CC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||YC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&oM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&YC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&YC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):YC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function dM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(aM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!LC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&YC(e,"directive name must not be less than one character in length");0!==i;){for(;PC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!RC(i));break}if(RC(i))break;for(t=e.position;0!==i&&!LC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&nM(e),xC.call(XC,n)?XC[n](e,n,a):KC(e,'unknown document directive "'+n+'"')}aM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,aM(e,!0,-1)):o&&YC(e,"directives end mark is expected"),lM(e,e.lineIndent-1,SC,!1,!0),aM(e,!0,-1),e.checkLineBreaks&&IC.test(e.input.slice(r,e.position))&&KC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&iM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,aM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function ek(e){return/^\n* /.test(e)}var tk=1,nk=2,ak=3,ik=4,rk=5;function ok(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return YM(e)&&e!==gM&&!GM(e)&&e!==$M&&e!==TM&&e!==AM&&e!==EM&&e!==OM&&e!==DM&&e!==PM&&e!==NM&&e!==xM&&e!==MM&&e!==SM&&e!==bM&&e!==LM&&e!==zM&&e!==IM&&e!==kM&&e!==wM&&e!==CM&&e!==jM&&e!==RM}(JM(e,0))&&function(e){return!GM(e)&&e!==AM}(JM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!YM(l=JM(e,c)))return rk;g=g&&XM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=JM(e,c))===_M)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!YM(l))return rk;g=g&&XM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&ek(e)?rk:o?r===UM?rk:nk:h?ik:ak:!g||o||i(e)?r===UM?rk:nk:tk}function sk(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===UM?'""':"''";if(!e.noCompatMode&&(-1!==VM.indexOf(t)||HM.test(t)))return e.quotingType===UM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(ok(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+ck(t,e.indent)+lk(ZM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,dk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+dk(l,t),o=n}return r}(t,o),r));case rk:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=JM(e,i),!(t=FM[a])&&YM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||BM(a);return n}(t)+'"';default:throw new Px("impossible error: invalid scalar style")}}()}function ck(e,t){var n=ek(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function lk(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function dk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function uk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function pk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,hk(e,n,!1)||hk(e,n,!0);var s,c=pM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Px("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&_M===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=QM(e,t)),pk(e,t+1,s,!0,c)&&(e.dump&&_M===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),pk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?uk(e,t-1,e.dump,i):uk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function mk(e,t){var n,a,i=[],r=[];for(gk(e,i,r),n=0,a=r.length;nq`
${_k.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(vk)}};e([he({attribute:!1})],yk.prototype,"message",void 0),e([he({attribute:!1})],yk.prototype,"context",void 0),e([he({attribute:!1})],yk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],yk.prototype,"dotdotdot",void 0),yk=e([le("frigate-card-message")],yk);let bk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(vk)}};e([he({attribute:!1})],bk.prototype,"message",void 0),bk=e([le("frigate-card-error-message")],bk);let wk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(vk)}};function xk(e){return"error"===e?.type?q` `:e?q` `:q``}function Ck(e){return q` + + + `}function Mk(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function kk(e,t,n){Mk(e,t,"error",{context:n?.context})}function Sk(e,t){t instanceof Error&&kk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],wk.prototype,"message",void 0),e([he({attribute:!1})],wk.prototype,"animated",void 0),e([he({attribute:!1})],wk.prototype,"size",void 0),wk=e([le("frigate-card-progress-indicator")],wk);let Ek=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return Sk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Ek.prototype,"elements",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"hass",void 0),Ek=e([le("frigate-card-elements-core")],Ek);let $k=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],$k.prototype,"hass",void 0),e([he({attribute:!1})],$k.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],$k.prototype,"elements",void 0),$k=e([le("frigate-card-elements")],$k);let Ak=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new vw(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],Ak.prototype,"hass",void 0),Ak=e([le("frigate-card-conditional")],Ak);class zk extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],zk.prototype,"_config",void 0);class Ik extends zk{constructor(){super("menu")}}let Tk=class extends Ik{};Tk=e([le("frigate-card-menu-icon")],Tk);let jk=class extends Ik{};jk=e([le("frigate-card-menu-state-icon")],jk);let Ok=class extends Ik{};Ok=e([le("frigate-card-menu-submenu")],Ok);let Dk=class extends Ik{};Dk=e([le("frigate-card-menu-submenu-select")],Dk);class Rk extends zk{constructor(){super("status-bar")}}let Pk=class extends Rk{};Pk=e([le("frigate-card-status-bar-icon")],Pk);let Lk=class extends Rk{};Lk=e([le("frigate-card-status-bar-image")],Lk);let Nk=class extends Rk{};Nk=e([le("frigate-card-status-bar-string")],Nk);let Fk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Fk=e([le("frigate-card-loading")],Fk);const Vk=(e,t)=>{Bg(e,"action:execution-request",t)};class Hk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Vk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Lb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Uk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Wk=e=>{switch(e){case"frigate":return Bk;case"motioneye":return qk;case"reolink":return Uk;default:return null}};const Zk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Qk=class extends se{_renderItem(e){if(!this.hass)return;const t=Lb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Wk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenu",void 0),Qk=e([le("frigate-card-submenu")],Qk);let Gk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||Ob(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Zk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:Ib("select"),...Lb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Gk.prototype,"hass",void 0),e([he({attribute:!1})],Gk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([pe()],Gk.prototype,"_optionTitles",void 0),Gk=e([le("frigate-card-submenu-select")],Gk);let Yk=class extends se{constructor(){super(...arguments),this._controller=new Hk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Wk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Yk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Yk.prototype,"hass",void 0),Yk=e([le("frigate-card-menu")],Yk);let Kk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Kk=e([le("frigate-card-overlay")],Kk);class Xk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Vk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Jk=class extends se{constructor(){super(...arguments),this._controller=new Xk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Wk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Jk.prototype,"items",void 0),e([he({attribute:!1})],Jk.prototype,"config",void 0),Jk=e([le("frigate-card-status-bar")],Jk);function eS(e){return"number"==typeof e}function tS(e){return"string"==typeof e}function nS(e){return"boolean"==typeof e}function aS(e){return"[object Object]"===Object.prototype.toString.call(e)}function iS(e){return Math.abs(e)}function rS(e){return Math.sign(e)}function oS(e,t){return iS(e-t)}function sS(e){return hS(e).map(Number)}function cS(e){return e[lS(e)]}function lS(e){return Math.max(0,e.length-1)}function dS(e,t){return t===lS(e)}function uS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function hS(e){return Object.keys(e)}function pS(e,t){return[e,t].reduce(((e,t)=>(hS(t).forEach((n=>{const a=e[n],i=t[n],r=aS(a)&&aS(i);e[n]=r?pS(a,i):i})),e)),{})}function mS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function gS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function fS(e,t,n,a){const i=gS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function _S(e=0,t=0){const n=iS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function vS(e,t,n){const{constrain:a}=_S(0,e),i=e+1;let r=o(t);function o(e){return n?iS((i+e)%i):a(e)}function s(){return r}function c(){return vS(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function yS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=gS(),M=gS(),k=_S(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!mS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=oS(t,z),c=oS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*rS(e)),a=d.byDistance(e,!m).distance;return m||iS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function bS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(mS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&iS(c)>.1?c:0},readPoint:r}}function wS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(nS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(iS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function xS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=_S(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=iS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&iS(u)e.add(i)))}};return c}function MS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>iS(e)-iS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>rS(e)===a));return r.length?c(r):cS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>iS(e.diff)-iS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function kS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(nS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));eS(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function SS(e){let t=e;function n(e){return eS(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function ES(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function $S(e,t,n,a,i,r,o,s,c){const l=.5,d=sS(i),u=sS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:SS(-1),translate:ES(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function AS(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(nS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function zS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return hS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function IS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=eS(n);const p={groupSlides:function(e){return h?function(e,t){return sS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?sS(e).reduce(((n,h,p)=>{const m=cS(n)||0,g=0===m,f=h===lS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=iS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function TS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return tS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return iS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(cS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=dS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(iS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=IS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>cS(e)[o]-e[0][r])).map(iS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-iS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-cS(P)+cS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=_S(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=dS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=cS(o);return _S(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return oS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:_S(n?a-e:cS(t),a)}}(N,H,u),q=vS(lS(H),d,u),U=q.clone(),W=sS(n),Z=fS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=SS(Q),Y=SS(Q),K=SS(Q),X=SS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=rS(p),u=d,m},settled:function(){return iS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=MS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=gS(),ie=zS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=dS(n,t);return a?uS(cS(n[0])+1):i?uS(lS(r)-cS(n)[0]+1,cS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=kS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:yS(S,e,a,i,X,bS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:wS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:xS(B,K,X,J,$),scrollLooper:CS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:$S(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:AS(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:ES(S,t)};return se}const jS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function OS(e){function t(e,t){return pS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=hS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>hS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function DS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=OS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=gS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(jS,DS.globalOptions),x=l(w),C=[];function M(t){const n=TS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=tS(t)?e.querySelector(t):t;v=a||e.children[0];const i=tS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function RS(){return RS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=LS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===WS?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(LS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=US&&e>=qS},b=function(){if(l.accelerationFactors.length>=ZS){if(d&&(d=!1,NS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*ZS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=YS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return FS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),FS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var XS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function JS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(XS,JS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=KS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}JS.globalOptions=void 0;class eE{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=DS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[JS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let tE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new eE(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],tE.prototype,"direction",void 0),e([he({attribute:!0})],tE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],tE.prototype,"loop",void 0),e([he({attribute:!1})],tE.prototype,"dragFree",void 0),e([he({attribute:!1})],tE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],tE.prototype,"plugins",void 0),e([he({attribute:!1})],tE.prototype,"selected",void 0),tE=e([le("frigate-card-carousel")],tE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const nE=window,aE=nE.ShadowRoot&&(void 0===nE.ShadyCSS||nE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,iE=Symbol(),rE=new WeakMap;let oE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==iE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(aE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=rE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&rE.set(t,e))}return e}toString(){return this.cssText}};const sE=(e,t)=>{aE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=nE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},cE=aE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new oE("string"==typeof e?e:e+"",void 0,iE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var lE;const dE=window,uE=dE.trustedTypes,hE=uE?uE.emptyScript:"",pE=dE.reactiveElementPolyfillSupport,mE={toAttribute(e,t){switch(t){case Boolean:e=e?hE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},gE=(e,t)=>t!==e&&(t==t||e==e),fE={attribute:!0,type:String,converter:mE,reflect:!1,hasChanged:gE},_E="finalized";class vE extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=fE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||fE}static finalize(){if(this.hasOwnProperty(_E))return!1;this[_E]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(cE(e))}else void 0!==e&&t.push(cE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return sE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=fE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:mE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:mE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||gE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}vE[_E]=!0,vE.elementProperties=new Map,vE.elementStyles=[],vE.shadowRootOptions={mode:"open"},null==pE||pE({ReactiveElement:vE}),(null!==(lE=dE.reactiveElementVersions)&&void 0!==lE?lE:dE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const yE=0,bE=Symbol();class wE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===bE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>gE(e,t[n]))):e!==t}}class xE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var CE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const ME=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??Ck(i),pending:()=>a?.inProgressFunc?.()??Ck(i),error:t=>{Gg(t),Sk(e,t)},complete:n})}`},kE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,SE=(e,t,n,a=!0)=>new wE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(kE)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),EE=300;let $E=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=SE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===yE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?ME(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],$E.prototype,"thumbnail",void 0),e([he({attribute:!1})],$E.prototype,"hass",void 0),$E=e([le("frigate-card-thumbnail-feature-thumbnail")],$E);let AE=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],AE.prototype,"date",void 0),e([he({attribute:!1})],AE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],AE.prototype,"showCameraTitle",void 0),AE=e([le("frigate-card-thumbnail-feature-text")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(CE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-event")],zE);let IE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(CE)}};e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),e([he({attribute:!1})],IE.prototype,"cameraTitle",void 0),IE=e([le("frigate-card-thumbnail-details-recording")],IE);let TE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!nx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${nx.isEvent(this.media)&&e?q``:nx.isEvent(this.media)||nx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&nx.isEvent(this.media)?q``:this.details&&nx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new xE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await $w(this.hass,this.cameraManager,this.media)}catch(e){Sk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],TE.prototype,"show_download_control",void 0),e([he({attribute:!1})],TE.prototype,"seek",void 0),TE=e([le("frigate-card-thumbnail")],TE);let jE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],jE.prototype,"hass",void 0),e([he({attribute:!1})],jE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],jE.prototype,"cameraManager",void 0),e([he({attribute:!1})],jE.prototype,"config",void 0),e([he({attribute:!1})],jE.prototype,"fadeThumbnails",void 0),jE=e([le("frigate-card-thumbnail-carousel")],jE);var OE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const DE=document.createElement("template");DE.innerHTML='\n
\n
\n';class RE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(DE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",RE);let PE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],PE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],PE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],PE.prototype,"open",void 0),e([he({attribute:!1})],PE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],PE.prototype,"empty",void 0),PE=e([le("frigate-card-drawer")],PE);let LE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],LE.prototype,"drawerIcons",void 0),LE=e([le("frigate-card-surround-basic")],LE);let NE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-b390cfa1.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new xE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(OE)}};e([he({attribute:!1})],NE.prototype,"hass",void 0),e([he({attribute:!1})],NE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],NE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],NE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],NE.prototype,"cameraManager",void 0),e([he({attribute:!1})],NE.prototype,"cardWideConfig",void 0),NE=e([le("frigate-card-surround")],NE);var FE="Fri, 13 Dec 2024 16:12:40 GMT",VE="ed0bb99",HE="Fri, 13 Dec 2024 08:11:26 -0800";const BE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),qE="hass_web_proxy",UE=(e,t)=>`/api/${qE}/v${t??0}/?url=${encodeURIComponent(e)}`,WE=(e,t,n="media")=>(e=>e.config.components.includes(qE))(e)&&!!t[n];async function ZE(e,t,n){await e.callService(qE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const QE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,BE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let GE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.6",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:VE,build_date:FE,commit_date:HE},...e&&{ha_version:e.config.version},integrations:{reolink:await QE("reolink",e),frigate:{...await QE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await QE(qE,e),motioneye:await QE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return xk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(OE)}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([pe()],GE.prototype,"_diagnostics",void 0),GE=e([le("frigate-card-diagnostics")],GE);let YE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-e610f971.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-9024cb87.js"):e?.isViewerView()?import("./index-76cab2a3.js"):e?.is("image")?import("./image-1c1ebdfa.js"):e?.is("timeline")&&import("./timeline-c3ef17c4.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],YE.prototype,"hass",void 0),e([he({attribute:!1})],YE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],YE.prototype,"cameraManager",void 0),e([he({attribute:!1})],YE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],YE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],YE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],YE.prototype,"rawConfig",void 0),e([he({attribute:!1})],YE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],YE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],YE.prototype,"hide",void 0),e([he({attribute:!1})],YE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],YE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],YE.prototype,"deviceRegistryManager",void 0),YE=e([le("frigate-card-views")],YE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.6`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let KE=class extends se{constructor(){super(...arguments),this._controller=new zx(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new Ix,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await zx.getConfigElement()}static getStubConfig(e,t){return zx.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${xk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};KE=e([le("frigate-card")],KE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,nw as a1,et as a2,aw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,ew as bQ,Xb as bR,Wk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,tw as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Yw as cP,kk as cQ,ze as cR,Kw as cS,df as cT,xk as cU,je as cV,Qg as cW,yw as cX,td as cY,Sk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,iw as d,ba as d$,My as d0,ve as d1,OE as d2,Vd as d3,nu as d4,c as d5,hx as d6,Qv as d7,px as d8,dx as d9,xx as dA,Mk as dB,U as dC,xf as dD,qw as dE,SE as dF,ME as dG,yf as dH,Vk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Mx as dU,Gy as dV,fx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,mx as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,Uw as dh,af as di,EE as dj,Sx as dk,Ck as dl,Aw as dm,nx as dn,hy as dp,qb as dq,Ub as dr,WE as ds,ZE as dt,Tb as du,UE as dv,Gw as dw,Xw as dx,Jw as dy,ex as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Hb as eB,Zv as eC,Fb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,Qw as eP,wE as eQ,me as eR,be as eS,Ob as eT,Gv as ea,Bk as eb,Hv as ec,rf as ed,Tv as ee,qk as ef,Iv as eg,zv as eh,jv as ei,Uk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,xw as f,Vb as g,Jb as h,Dv as i,Nb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Bb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/www/community/frigate-hass-card/card-09c4bade.js.gz b/www/community/frigate-hass-card/card-09c4bade.js.gz new file mode 100644 index 00000000..cabdf127 Binary files /dev/null and b/www/community/frigate-hass-card/card-09c4bade.js.gz differ diff --git a/www/community/frigate-hass-card/card-0be2c6a9.js b/www/community/frigate-hass-card/card-0be2c6a9.js new file mode 100644 index 00000000..8db8481f --- /dev/null +++ b/www/community/frigate-hass-card/card-0be2c6a9.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="cameras",xa=`${wa}.#.camera_entity`,Ca=`${wa}.#.frigate.camera_name`,Ma=`${wa}.#.capabilities.disable`,ka=`${wa}.#.capabilities.disable_except`,Sa=`${wa}.#.cast.method`,Ea=`${wa}.#.cast.dashboard.dashboard_path`,$a=`${wa}.#.cast.dashboard.view_path`,Aa=`${wa}.#.dimensions.aspect_ratio`,za=`${wa}.#.frigate.client_id`,Ia=`${wa}.#.frigate.labels`,Ta=`${wa}.#.frigate.url`,ja=`${wa}.#.frigate.zones`,Oa=`${wa}.#.go2rtc.modes`,Da=`${wa}.#.go2rtc.stream`,Ra=`${wa}.#.icon`,Pa=`${wa}.#.id`,La=`${wa}.#.image.entity`,Na=`${wa}.#.image.entity_parameters`,Fa=`${wa}.#.image.mode`,Va=`${wa}.#.image.refresh_seconds`,Ha=`${wa}.#.image.url`,Ba=`${wa}.#.motioneye.images.directory_pattern`,qa=`${wa}.#.motioneye.images.file_pattern`,Ua=`${wa}.#.motioneye.movies.directory_pattern`,Wa=`${wa}.#.motioneye.movies.file_pattern`,Za=`${wa}.#.motioneye.url`,Qa=`${wa}.#.title`,Ga=`${wa}.#.webrtc_card.entity`,Ya=`${wa}.#.webrtc_card.url`,Ka=`${wa}.#.live_provider`,Xa=`${wa}.#.dependencies.cameras`,Ja=`${wa}.#.dependencies.all_cameras`,ei=`${wa}.#.dimensions.layout.fit`,ti=`${wa}.#.dimensions.layout.pan.x`,ni=`${wa}.#.dimensions.layout.pan.y`,ai=`${wa}.#.dimensions.layout.position.x`,ii=`${wa}.#.dimensions.layout.position.y`,ri=`${wa}.#.dimensions.layout.view_box.top`,oi=`${wa}.#.dimensions.layout.view_box.bottom`,si=`${wa}.#.dimensions.layout.view_box.left`,ci=`${wa}.#.dimensions.layout.view_box.right`,li=`${wa}.#.dimensions.layout.zoom`,di=`${wa}.#.proxy.dynamic`,ui=`${wa}.#.proxy.media`,hi=`${wa}.#.proxy.ssl_ciphers`,pi=`${wa}.#.proxy.ssl_verification`,mi=`${wa}.#.reolink.media_resolution`,gi=`${wa}.#.reolink.url`,fi=`${wa}.#.triggers.motion`,_i=`${wa}.#.triggers.occupancy`,vi=`${wa}.#.triggers.entities`,yi=`${wa}.#.triggers.events`,bi="cameras_global",wi=`${bi}.image`,xi=`${bi}.live_provider`,Ci=`${bi}.jsmpeg`,Mi=`${bi}.webrtc_card`,ki=`${bi}.triggers.occupancy`,Si=`${bi}.image.refresh_seconds`,Ei=`${bi}.dimensions.layout`,$i=`${bi}.ptz`,Ai="elements",zi="view",Ii=`${zi}.camera_select`,Ti=`${zi}.dark_mode`,ji=`${zi}.default`,Oi=`${zi}.interaction_seconds`,Di=`${zi}.keyboard_shortcuts`,Ri=`${zi}.keyboard_shortcuts.enabled`,Pi=`${Di}.ptz_left`,Li=`${Di}.ptz_right`,Ni=`${Di}.ptz_up`,Fi=`${Di}.ptz_down`,Vi=`${Di}.ptz_zoom_in`,Hi=`${Di}.ptz_zoom_out`,Bi=`${Di}.ptz_home`,qi=`${zi}.default_cycle_camera`,Ui=`${zi}.default_reset`,Wi=`${Ui}.interaction_mode`,Zi=`${Ui}.every_seconds`,Qi=`${Ui}.entities`,Gi=`${Ui}.after_interaction`,Yi=`${zi}.triggers`,Ki=`${Yi}.show_trigger_status`,Xi=`${Yi}.filter_selected_camera`,Ji=`${Yi}.untrigger_seconds`,er=`${Yi}.actions`,tr=`${er}.trigger`,nr=`${er}.untrigger`,ar=`${er}.interaction_mode`,ir="media_gallery",rr=`${ir}.controls.filter.mode`,or=`${ir}.controls.thumbnails.show_details`,sr=`${ir}.controls.thumbnails.show_download_control`,cr=`${ir}.controls.thumbnails.show_favorite_control`,lr=`${ir}.controls.thumbnails.show_timeline_control`,dr=`${ir}.controls.thumbnails.size`,ur="media_viewer",hr=`${ur}.auto_play`,pr=`${ur}.auto_pause`,mr=`${ur}.auto_mute`,gr=`${ur}.auto_unmute`,fr=`${ur}.display.mode`,_r=`${ur}.display.grid_columns`,vr=`${ur}.display.grid_max_columns`,yr=`${ur}.display.grid_selected_width_factor`,br=`${ur}.draggable`,wr=`${ur}.lazy_load`,xr=`${ur}.snapshot_click_plays_clip`,Cr=`${ur}.transition_effect`,Mr=`${ur}.controls.builtin`,kr=`${ur}.controls.next_previous.style`,Sr=`${ur}.controls.next_previous.size`,Er=`${ur}.controls.thumbnails.mode`,$r=`${ur}.controls.thumbnails.show_details`,Ar=`${ur}.controls.thumbnails.show_download_control`,zr=`${ur}.controls.thumbnails.show_favorite_control`,Ir=`${ur}.controls.thumbnails.show_timeline_control`,Tr=`${ur}.controls.thumbnails.size`,jr=`${ur}.controls.timeline.clustering_threshold`,Or=`${ur}.controls.timeline.events_media_type`,Dr=`${ur}.controls.timeline.mode`,Rr=`${ur}.controls.timeline.pan_mode`,Pr=`${ur}.controls.timeline.show_recordings`,Lr=`${ur}.controls.timeline.style`,Nr=`${ur}.controls.timeline.window_seconds`,Fr=`${ur}.zoomable`,Vr="live",Hr=`${Vr}.auto_play`,Br=`${Vr}.auto_pause`,qr=`${Vr}.auto_mute`,Ur=`${Vr}.auto_unmute`,Wr=`${Vr}.controls.builtin`,Zr=`${Vr}.controls.next_previous.style`,Qr=`${Vr}.controls.next_previous.size`,Gr=`${Vr}.controls.ptz.hide_home`,Yr=`${Vr}.controls.ptz.hide_pan_tilt`,Kr=`${Vr}.controls.ptz.hide_zoom`,Xr=`${Vr}.controls.ptz.mode`,Jr=`${Vr}.controls.ptz.orientation`,eo=`${Vr}.controls.ptz.position`,to=`${Vr}.controls.thumbnails.media_type`,no=`${Vr}.controls.thumbnails.events_media_type`,ao=`${Vr}.controls.thumbnails.mode`,io=`${Vr}.controls.thumbnails.size`,ro=`${Vr}.controls.thumbnails.show_details`,oo=`${Vr}.controls.thumbnails.show_download_control`,so=`${Vr}.controls.thumbnails.show_favorite_control`,co=`${Vr}.controls.thumbnails.show_timeline_control`,lo=`${Vr}.controls.timeline.clustering_threshold`,uo=`${Vr}.controls.timeline.events_media_type`,ho=`${Vr}.controls.timeline.mode`,po=`${Vr}.controls.timeline.pan_mode`,mo=`${Vr}.controls.timeline.show_recordings`,go=`${Vr}.controls.timeline.style`,fo=`${Vr}.controls.timeline.window_seconds`,_o=`${Vr}.display.mode`,vo=`${Vr}.display.grid_columns`,yo=`${Vr}.display.grid_max_columns`,bo=`${Vr}.display.grid_selected_width_factor`,wo=`${Vr}.draggable`,xo=`${Vr}.lazy_load`,Co=`${Vr}.lazy_unload`,Mo=`${Vr}.preload`,ko=`${Vr}.transition_effect`,So=`${Vr}.show_image_during_load`,Eo=`${Vr}.microphone.disconnect_seconds`,$o=`${Vr}.microphone.mute_after_microphone_mute_seconds`,Ao=`${Vr}.microphone.always_connected`,zo=`${Vr}.zoomable`,Io="image",To=`${Io}.entity`,jo=`${Io}.entity_parameters`,Oo=`${Io}.mode`,Do=`${Io}.refresh_seconds`,Ro=`${Io}.url`,Po="timeline",Lo=`${Po}.window_seconds`,No=`${Po}.clustering_threshold`,Fo=`${Po}.events_media_type`,Vo=`${Po}.show_recordings`,Ho=`${Po}.style`,Bo=`${Po}.controls.thumbnails.mode`,qo=`${Po}.controls.thumbnails.size`,Uo=`${Po}.controls.thumbnails.show_details`,Wo=`${Po}.controls.thumbnails.show_download_control`,Zo=`${Po}.controls.thumbnails.show_favorite_control`,Qo=`${Po}.controls.thumbnails.show_timeline_control`,Go="menu",Yo=`${Go}.alignment`,Ko=`${Go}.position`,Xo=`${Go}.style`,Jo=`${Go}.button_size`,es=`${Go}.buttons`,ts=`${es}.frigate`,ns=`${es}.camera_ui`,as=`${es}.fullscreen`,is=`${es}.play`,rs=`${es}.mute`,os=`${es}.media_player`,ss=`${es}.timeline`,cs="status_bar",ls=`${cs}.position`,ds=`${cs}.style`,us=`${cs}.popup_seconds`,hs=`${cs}.height`,ps=`${cs}.items`,ms="dimensions",gs=`${ms}.aspect_ratio`,fs=`${ms}.aspect_ratio_mode`,_s=`${ms}.height`,vs="overrides",ys="performance",bs=`${ys}.features.animated_progress_indicator`,ws=`${ys}.features.media_chunk_size`,xs=`${ys}.features.max_simultaneous_engine_requests`,Cs=`${ys}.profile`,Ms=`${ys}.style.box_shadow`,ks=`${ys}.style.border_radius`,Ss="profiles",Es=1e3;class $s extends Error{constructor(e,t){super(e),this.context=t}}const As={info:10,error:20,connection:30,diagnostics:40},zs=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],Is=ba.object({url:ba.string(),mime_type:ba.string()}),Ts=ba.object({path:ba.string()});function js(e){if(e instanceof ba.ZodDefault)return js(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(js(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(js(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(js(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(js(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>js(e)))):e}function Os(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ds=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ds(n).forEach(t.add,t)}else t.add(Rs(n.path));return t},Rs=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(Js,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),gc=mc.extend({frigate_card_action:ba.enum(Us)}),fc=mc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),_c=mc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),vc=mc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),yc=mc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),bc=mc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:nc}),wc=mc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional(),ptz_preset:ba.string().optional()}),xc=mc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:tc.optional(),pan:ec.optional()}).optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional()}),Cc=mc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional(),ptz_preset:ba.string().optional()}),Mc=mc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),kc=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),Sc=mc.extend({frigate_card_action:ba.literal("sleep"),duration:kc.optional().default({s:1})}),Ec=mc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>il)).array().optional()}),$c=mc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ac=ba.union([_c,fc,vc,$c,yc,wc,xc,Cc,Mc,gc,bc,Sc,Ec]),zc=ba.union([rc,cc,sc,lc,dc,uc,pc,hc,Ac]),Ic=ba.object({tap_action:zc.or(zc.array()).optional(),hold_action:zc.or(zc.array()).optional(),double_tap_action:zc.or(zc.array()).optional(),start_tap_action:zc.or(zc.array()).optional(),end_tap_action:zc.or(zc.array()).optional()}).passthrough(),Tc=ba.object({actions:Ic.optional()}),jc=Ic.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Oc=jc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Dc=jc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Rc=jc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Pc=jc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Lc=jc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Nc=jc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Fc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Vc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),Hc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Bc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),qc=ba.discriminatedUnion("condition",[Fc,Vc,Hc,Bc]),Uc=ba.object({type:ba.literal("conditional"),conditions:qc.array(),elements:ba.lazy((()=>_l))}),Wc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Zc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Bs).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Qc=Zc.merge(Lc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Gc=Zc.merge(Dc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Zc),Yc=jc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Kc=Zc.merge(Lc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Yc.array()}),Xc=Zc.merge(Dc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Yc.deepPartial()).optional()}),Jc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),el=Jc.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:Ic.optional()}),tl=el.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),nl=el.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),al=el.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),il=ba.union([tl,nl,al]),rl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),ol=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),sl=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),cl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ll=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),dl=ba.object({condition:ba.literal("display_mode"),display_mode:nc}),ul=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),hl=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),pl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),ml=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),gl=ba.discriminatedUnion("condition",[Fc,Vc,Hc,Bc,rl,ol,sl,cl,ll,dl,ul,hl,pl,ml]),fl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:gl.array(),elements:ba.lazy((()=>_l))}),_l=ba.union([Uc,Wc,fl,Lc,Nc,Qc,Gc,Kc,Xc,Pc,Oc,Dc,Rc,tl,nl,al]).array().optional(),vl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:ec.optional(),zoom:tc.optional()}),yl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),bl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},wl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},xl=ba.preprocess(wl("actions_"),ba.object({actions_left:sc.optional(),actions_left_start:sc.optional(),actions_left_stop:sc.optional(),actions_right:sc.optional(),actions_right_start:sc.optional(),actions_right_stop:sc.optional(),actions_up:sc.optional(),actions_up_start:sc.optional(),actions_up_stop:sc.optional(),actions_down:sc.optional(),actions_down_start:sc.optional(),actions_down_stop:sc.optional(),actions_zoom_in:sc.optional(),actions_zoom_in_start:sc.optional(),actions_zoom_in_stop:sc.optional(),actions_zoom_out:sc.optional(),actions_zoom_out_start:sc.optional(),actions_zoom_out_stop:sc.optional(),r2c_delay_between_calls_seconds:ba.number().default(bl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(bl.c2r_delay_between_calls_seconds),presets:ba.preprocess(wl(""),ba.union([ba.record(sc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),Cl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Ml=ba.object({mode:ba.enum(["off","auto","on"]).default(Cl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(Cl.position),orientation:ba.enum(["vertical","horizontal"]).default(Cl.orientation),hide_pan_tilt:ba.boolean().default(Cl.hide_pan_tilt),hide_zoom:ba.boolean().default(Cl.hide_zoom),hide_home:ba.boolean().default(Cl.hide_home),style:ba.object({}).passthrough().optional()}),kl={mode:"auto",refresh_seconds:1},Sl=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(kl.mode),refresh_seconds:ba.number().min(0).default(kl.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),El=Sl.merge(Tc).default(kl),$l=75,Al=300,zl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},Il=ba.object({size:ba.number().min(75).max(300).default(zl.size),show_details:ba.boolean().default(zl.show_details),show_favorite_control:ba.boolean().default(zl.show_favorite_control),show_timeline_control:ba.boolean().default(zl.show_timeline_control),show_download_control:ba.boolean().default(zl.show_download_control)}),Tl={...zl,mode:"right"},jl=Il.extend({mode:ba.enum(["none","above","below","left","right"]).default(Tl.mode)}),Ol=ba.enum(["all","clips","snapshots"]),Dl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Rl=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Pl=ba.object({clustering_threshold:ba.number().optional().default(Dl.clustering_threshold),events_media_type:Ol.optional().default(Dl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Dl.window_seconds),show_recordings:ba.boolean().optional().default(Dl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Dl.style),pan_mode:Rl.optional().default(Dl.pan_mode)}),Ll={...Dl,mode:"none",style:"ribbon"},Nl=Pl.extend({mode:ba.enum(["none","above","below"]).default(Ll.mode),style:Pl.shape.style.default(Ll.style)}),Fl={...Dl,controls:{thumbnails:Tl}},Vl=Pl.extend({controls:ba.object({thumbnails:jl.default(Fl.controls.thumbnails)}).default(Fl.controls)}).default(Fl),Hl=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Bl=ba.enum(["none","slide"]),ql={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Ul=ba.object({always_connected:ba.boolean().default(ql.always_connected),disconnect_seconds:ba.number().min(0).default(ql.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(ql.mute_after_microphone_mute_seconds)}).default(ql),Wl=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Zl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Ql=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Gl={...Tl,media_type:"events",events_media_type:"all"},Yl={auto_play:[...Qs],auto_pause:[],auto_mute:[...Ys],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:Cl,thumbnails:Gl,timeline:Ll},microphone:{...ql}},Kl=jl.extend({media_type:ba.enum(["events","recordings"]).default(Yl.controls.thumbnails.media_type),events_media_type:Ol.default(Yl.controls.thumbnails.events_media_type)}),Xl=ba.object({auto_pause:ba.enum(Zs).array().default(Yl.auto_pause),auto_play:ba.enum(Qs).array().default(Yl.auto_play),auto_mute:ba.enum(Ys).array().default(Yl.auto_mute),auto_unmute:ba.enum(Gs).array().default(Yl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Yl.controls.builtin),next_previous:Hl.extend({style:ba.enum(["none","chevrons","icons"]).default(Yl.controls.next_previous.style),size:Hl.shape.size.default(Yl.controls.next_previous.size)}).default(Yl.controls.next_previous),ptz:Ml.default(Yl.controls.ptz),thumbnails:Kl.default(Yl.controls.thumbnails),timeline:Nl.default(Yl.controls.timeline)}).default(Yl.controls),display:ac,draggable:ba.boolean().default(Yl.draggable),lazy_load:ba.boolean().default(Yl.lazy_load),lazy_unload:ba.enum(Zs).array().default(Yl.lazy_unload),microphone:Ul.default(Yl.microphone),preload:ba.boolean().default(Yl.preload),show_image_during_load:ba.boolean().default(Yl.show_image_during_load),transition_effect:Bl.default(Yl.transition_effect),zoomable:ba.boolean().default(Yl.zoomable)}).merge(Tc).default(Yl),Jl=ba.object({live:Xl}),ed=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),td={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:bl,triggers:{motion:!1,occupancy:!1,events:[...Xs],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},nd=ba.object({media:ba.boolean().or(ba.literal("auto")).default(td.proxy.media),dynamic:ba.boolean().default(td.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(td.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(td.proxy.ssl_ciphers)}),ad=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(zs).array().optional(),disable_except:ba.enum(zs).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(td.dependencies.all_cameras),cameras:ba.string().array().default(td.dependencies.cameras)}).default(td.dependencies),triggers:ba.object({motion:ba.boolean().default(td.triggers.motion),occupancy:ba.boolean().default(td.triggers.occupancy),entities:ba.string().array().default(td.triggers.entities),events:ba.enum(Xs).array().default(td.triggers.events)}).default(td.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(td.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(td.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(td.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(td.motioneye.images.file_pattern)}).default(td.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(td.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(td.motioneye.movies.file_pattern)}).default(td.motioneye.movies)}).default(td.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(td.reolink.media_resolution)}).default(td.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(td.live_provider),go2rtc:Wl.optional(),image:Sl.optional().default(kl),jsmpeg:Ql.optional(),webrtc_card:Zl.optional(),cast:ed.optional(),ptz:xl.default(td.ptz),dimensions:ba.object({aspect_ratio:yl.optional(),layout:vl.optional()}).optional(),proxy:nd.default(td.proxy)}).default(td),id=ad.array().min(1),rd={default:Ws,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Ls},od=ba.enum(["all","inactive","active"]).default("inactive"),sd=ba.object({actions:ba.object({interaction_mode:od,trigger:ba.enum(["default","live","media","none","update"]).default(rd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(rd.triggers.actions.untrigger)}).default(rd.triggers.actions),filter_selected_camera:ba.boolean().default(rd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(rd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(rd.triggers.untrigger_seconds)}),cd=ba.object({default:ba.enum(Us).default(rd.default),camera_select:ba.enum([...Us,"current"]).default(rd.camera_select),interaction_seconds:ba.number().default(rd.interaction_seconds),default_cycle_camera:ba.boolean().default(rd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(rd.default_reset.after_interaction),every_seconds:ba.number().default(rd.default_reset.every_seconds),entities:ba.string().array().default(rd.default_reset.entities),interaction_mode:od.default(rd.default_reset.interaction_mode)}).default(rd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:sd.default(rd.triggers),keyboard_shortcuts:Ns.default(rd.keyboard_shortcuts)}).merge(Tc).default(rd),ld=["left","right","top","bottom"],dd=ld,ud={priority:50,enabled:!0},hd={priority:50,enabled:!1},pd={alignment:"left",button_size:40,buttons:{camera_ui:ud,cameras:ud,clips:ud,ptz_home:hd,display_mode:ud,download:ud,expand:hd,frigate:ud,fullscreen:ud,image:hd,live:ud,media_player:ud,microphone:{...hd,type:"momentary"},mute:hd,play:hd,ptz_controls:hd,recordings:hd,screenshot:hd,snapshots:ud,substreams:ud,timeline:ud},position:"top",style:"hidden"},md=Zc.extend({enabled:Zc.shape.enabled.default(ud.enabled),priority:Zc.shape.priority.default(ud.priority)}),gd=Zc.extend({enabled:Zc.shape.enabled.default(hd.enabled),priority:Zc.shape.priority.default(hd.priority)}),fd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(pd.style),position:ba.enum(ld).default(pd.position),alignment:ba.enum(dd).default(pd.alignment),buttons:ba.object({camera_ui:md.default(pd.buttons.camera_ui),cameras:md.default(pd.buttons.cameras),clips:md.default(pd.buttons.clips),ptz_home:gd.default(pd.buttons.ptz_home),display_mode:md.default(pd.buttons.display_mode),download:md.default(pd.buttons.download),expand:gd.default(pd.buttons.expand),frigate:md.default(pd.buttons.frigate),fullscreen:md.default(pd.buttons.fullscreen),image:gd.default(pd.buttons.image),live:md.default(pd.buttons.live),media_player:md.default(pd.buttons.media_player),microphone:gd.extend({type:ba.enum(["momentary","toggle"]).default(pd.buttons.microphone.type)}).default(pd.buttons.microphone),mute:gd.default(pd.buttons.mute),play:gd.default(pd.buttons.play),ptz_controls:gd.default(pd.buttons.ptz_controls),recordings:gd.default(pd.buttons.recordings),screenshot:gd.default(pd.buttons.screenshot),snapshots:md.default(pd.buttons.snapshots),substreams:md.default(pd.buttons.substreams),timeline:md.default(pd.buttons.timeline)}).default(pd.buttons),button_size:ba.number().min(20).default(pd.button_size)}).default(pd),_d={priority:50,enabled:!0},vd={height:46,items:{engine:_d,resolution:_d,technology:_d,title:_d},position:"bottom",style:"popup",popup_seconds:3},yd=ba.object({position:ba.enum(["top","bottom"]).default(vd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(vd.style),popup_seconds:ba.number().min(0).max(60).default(vd.popup_seconds),height:ba.number().min(20).default(vd.height),items:ba.object({engine:Jc.default(vd.items.engine),technology:Jc.default(vd.items.technology),resolution:Jc.default(vd.items.resolution),title:Jc.default(vd.items.title)}).default(vd.items)}).default(vd),bd={auto_play:[...Qs],auto_pause:[...Zs],auto_mute:[...Zs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Tl,timeline:Ll,ptz:{...Cl,mode:"off"}}},wd=Hl.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(bd.controls.next_previous.style),size:Hl.shape.size.default(bd.controls.next_previous.size)}),xd=ba.object({auto_play:ba.enum(Qs).array().default(bd.auto_play),auto_pause:ba.enum(Zs).array().default(bd.auto_pause),auto_mute:ba.enum(Zs).array().default(bd.auto_mute),auto_unmute:ba.enum(Qs).array().default(bd.auto_unmute),lazy_load:ba.boolean().default(bd.lazy_load),draggable:ba.boolean().default(bd.draggable),zoomable:ba.boolean().default(bd.zoomable),transition_effect:Bl.default(bd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(bd.snapshot_click_plays_clip),display:ac,controls:ba.object({builtin:ba.boolean().default(bd.controls.builtin),next_previous:wd.default(bd.controls.next_previous),ptz:Ml.extend({mode:ba.enum(["off","on"]).default(bd.controls.ptz.mode)}).default(bd.controls.ptz),thumbnails:jl.default(bd.controls.thumbnails),timeline:Nl.default(bd.controls.timeline)}).default(bd.controls)}).merge(Tc).default(bd),Cd={...Tl,show_details:!1},Md={controls:{thumbnails:Cd,filter:{mode:"right"}}},kd=jl.extend({show_details:ba.boolean().default(Cd.show_details)}),Sd=ba.object({controls:ba.object({thumbnails:kd.default(Md.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Md.controls.filter.mode)}).default(Md.controls.filter)}).default(Md.controls)}).merge(Tc).default(Md),Ed={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},$d=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ed.aspect_ratio_mode),aspect_ratio:yl.default(Ed.aspect_ratio),height:ba.string().default(Ed.height)}).default(Ed),Ad=ba.object({conditions:gl.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),zd=zc.array(),Id=ba.object({conditions:gl.array(),actions:zd.optional(),actions_not:zd.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Td={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},jd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Td.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Td.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Td.features),style:ba.object({border_radius:ba.boolean().default(Td.style.border_radius),box_shadow:ba.boolean().default(Td.style.box_shadow)}).default(Td.style)}).default(Td),Od={logging:!1},Dd=ba.object({logging:ba.boolean().default(Od.logging)}).default(Od),Rd=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Pd=ba.object({cameras:js(id),cameras_global:ad,view:cd,menu:fd,status_bar:yd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,elements:_l,dimensions:$d,timeline:Vl,performance:jd,debug:Dd,automations:Id.optional(),profiles:Rd,overrides:Ad,card_mod:ba.unknown(),card_id:ba.string().regex(Js).optional(),type:ba.string()}),Ld={cameras:td,view:rd,menu:pd,status_bar:vd,live:Yl,media_gallery:Md,media_viewer:bd,image:kl,timeline:Fl,performance:Td,debug:Od};function Nd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Fd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Vd(e,t){const n=Nd(e);return isNaN(t)?Fd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function Hd(e,t){const n=Nd(e);if(isNaN(t))return Fd(e,NaN);if(!t)return n;const a=n.getDate(),i=Fd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Bd(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Nd(e),d=a||n?Hd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Fd(e,(r||i?Vd(d,r+7*i):d).getTime()+u)}const qd=6048e5,Ud=864e5,Wd=6e4,Zd=36e5,Qd=1e3;let Gd={};function Yd(){return Gd}function Kd(e,t){const n=Yd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Nd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function eu(e){const t=Nd(e);return t.setHours(0,0,0,0),t}function tu(e){const t=Nd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function nu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Nd(e);return!isNaN(Number(n))}function au(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function iu(e,t){return+Nd(e)-+Nd(t)}function ru(e,t,n){const a=iu(e,t)/1e3;return au(n?.roundingMethod)(a)}const ou={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function su(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const cu={date:su({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:su({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:su({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},lu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function du(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function uu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var hu;const pu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=ou[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:cu,formatRelative:(e,t,n,a)=>lu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:du({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:du({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:du({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:du({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:du({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(hu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(hu.matchPattern);if(!n)return null;const a=n[0],i=e.match(hu.parsePattern);if(!i)return null;let r=hu.valueCallback?hu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:uu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:uu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:uu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:uu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:uu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function mu(e){const t=Nd(e),n=function(e,t){const n=eu(e),a=eu(t),i=+n-tu(n),r=+a-tu(a);return Math.round((i-r)/Ud)}(t,function(e){const t=Nd(e),n=Fd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function gu(e){const t=Nd(e),n=+Xd(t)-+function(e){const t=Jd(e),n=Fd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Xd(n)}(t);return Math.round(n/qd)+1}function fu(e,t){const n=Nd(e),a=n.getFullYear(),i=Yd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Fd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Kd(o,t),c=Fd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Kd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function _u(e,t){const n=Nd(e),a=+Kd(n,t)-+function(e,t){const n=Yd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=fu(e,t),r=Fd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Kd(r,t)}(n,t);return Math.round(a/qd)+1}function vu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const yu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return vu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):vu(n+1,2)},d:(e,t)=>vu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>vu(e.getHours()%12||12,t.length),H:(e,t)=>vu(e.getHours(),t.length),m:(e,t)=>vu(e.getMinutes(),t.length),s:(e,t)=>vu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return vu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},bu="midnight",wu="noon",xu="morning",Cu="afternoon",Mu="evening",ku="night",Su={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return yu.y(e,t)},Y:function(e,t,n,a){const i=fu(e,a),r=i>0?i:1-i;if("YY"===t){return vu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):vu(r,t.length)},R:function(e,t){return vu(Jd(e),t.length)},u:function(e,t){return vu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return vu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return vu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return yu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return vu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=_u(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):vu(i,t.length)},I:function(e,t,n){const a=gu(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):vu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):yu.d(e,t)},D:function(e,t,n){const a=mu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):vu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return vu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return vu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return vu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?wu:0===a?bu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Mu:a>=12?Cu:a>=4?xu:ku,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return yu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):yu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):vu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):vu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):yu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):yu.s(e,t)},S:function(e,t){return yu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return $u(a);case"XXXX":case"XX":return Au(a);default:return Au(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return $u(a);case"xxxx":case"xx":return Au(a);default:return Au(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Eu(a,":");default:return"GMT"+Au(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Eu(a,":");default:return"GMT"+Au(a,":")}},t:function(e,t,n){return vu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return vu(e.getTime(),t.length)}};function Eu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+vu(r,2)}function $u(e,t){if(e%60==0){return(e>0?"-":"+")+vu(Math.abs(e)/60,2)}return Au(e,t)}function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+vu(Math.trunc(a/60),2)+t+vu(a%60,2)}const zu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Iu=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Tu={p:Iu,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return zu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",zu(a,t)).replace("{{time}}",Iu(i,t))}},ju=/^D+$/,Ou=/^Y+$/,Du=["D","DD","YY","YYYY"];function Ru(e){return ju.test(e)}function Pu(e){return Ou.test(e)}function Lu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Du.includes(e))throw new RangeError(a)}const Nu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Fu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vu=/^'([^]*?)'?$/,Hu=/''/g,Bu=/[a-zA-Z]/;function qu(e,t,n){const a=Yd(),i=n?.locale??a.locale??pu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Nd(e);if(!nu(s))throw new RangeError("Invalid time value");let c=t.match(Fu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Tu[t])(e,i.formatLong)}return e})).join("").match(Nu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Uu(e)};if(Su[t])return{isToken:!0,value:e};if(t.match(Bu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Pu(r)||!n?.useAdditionalDayOfYearTokens&&Ru(r))&&Lu(r,t,String(e));return(0,Su[r[0]])(s,r,i.localize,l)})).join("")}function Uu(e){const t=e.match(Vu);return t?t[1].replace(Hu,"'"):e}function Wu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return Hd(e,-t)}(e,a+12*n),d=function(e,t){return Vd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Fd(e,d.getTime()-u)}function Zu(e,t){return e===t||e!=e&&t!=t}function Qu(e,t){for(var n=e.length;n--;)if(Zu(e[n][0],t))return n;return-1}var Gu=Array.prototype.splice;function Yu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Yu.prototype.set=function(e,t){var n=this.__data__,a=Qu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ku="object"==typeof global&&global&&global.Object===Object&&global,Xu="object"==typeof self&&self&&self.Object===Object&&self,Ju=Ku||Xu||Function("return this")(),eh=Ju.Symbol,th=Object.prototype,nh=th.hasOwnProperty,ah=th.toString,ih=eh?eh.toStringTag:void 0;var rh=Object.prototype.toString;var oh="[object Null]",sh="[object Undefined]",ch=eh?eh.toStringTag:void 0;function lh(e){return null==e?void 0===e?sh:oh:ch&&ch in Object(e)?function(e){var t=nh.call(e,ih),n=e[ih];try{e[ih]=void 0;var a=!0}catch(e){}var i=ah.call(e);return a&&(t?e[ih]=n:delete e[ih]),i}(e):function(e){return rh.call(e)}(e)}function dh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var uh="[object AsyncFunction]",hh="[object Function]",ph="[object GeneratorFunction]",mh="[object Proxy]";function gh(e){if(!dh(e))return!1;var t=lh(e);return t==hh||t==ph||t==uh||t==mh}var fh,_h=Ju["__core-js_shared__"],vh=(fh=/[^.]+$/.exec(_h&&_h.keys&&_h.keys.IE_PROTO||""))?"Symbol(src)_1."+fh:"";var yh=Function.prototype.toString;function bh(e){if(null!=e){try{return yh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var wh=/^\[object .+?Constructor\]$/,xh=Function.prototype,Ch=Object.prototype,Mh=xh.toString,kh=Ch.hasOwnProperty,Sh=RegExp("^"+Mh.call(kh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Eh(e){return!(!dh(e)||(t=e,vh&&vh in t))&&(gh(e)?Sh:wh).test(bh(e));var t}function $h(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Eh(n)?n:void 0}var Ah=$h(Ju,"Map"),zh=$h(Object,"create");var Ih=Object.prototype.hasOwnProperty;var Th=Object.prototype.hasOwnProperty;function jh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Vh?new Ph:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ep}var Ap={};function zp(e){return function(t){return e(t)}}Ap["[object Float32Array]"]=Ap["[object Float64Array]"]=Ap["[object Int8Array]"]=Ap["[object Int16Array]"]=Ap["[object Int32Array]"]=Ap["[object Uint8Array]"]=Ap["[object Uint8ClampedArray]"]=Ap["[object Uint16Array]"]=Ap["[object Uint32Array]"]=!0,Ap["[object Arguments]"]=Ap["[object Array]"]=Ap["[object ArrayBuffer]"]=Ap["[object Boolean]"]=Ap["[object DataView]"]=Ap["[object Date]"]=Ap["[object Error]"]=Ap["[object Function]"]=Ap["[object Map]"]=Ap["[object Number]"]=Ap["[object Object]"]=Ap["[object RegExp]"]=Ap["[object Set]"]=Ap["[object String]"]=Ap["[object WeakMap]"]=!1;var Ip="object"==typeof exports&&exports&&!exports.nodeType&&exports,Tp=Ip&&"object"==typeof module&&module&&!module.nodeType&&module,jp=Tp&&Tp.exports===Ip&&Ku.process,Op=function(){try{var e=Tp&&Tp.require&&Tp.require("util").types;return e||jp&&jp.binding&&jp.binding("util")}catch(e){}}(),Dp=Op,Rp=Dp&&Dp.isTypedArray,Pp=Rp?zp(Rp):function(e){return mp(e)&&$p(e.length)&&!!Ap[lh(e)]},Lp=Object.prototype.hasOwnProperty;function Np(e,t){var n=cp(e),a=!n&&yp(e),i=!n&&!a&&Cp(e),r=!n&&!a&&!i&&Pp(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++ig>=800)return arguments[0]}else ig=0;return ag.apply(void 0,arguments)});function sg(e,t){return og(function(e,t,n){return t=Jm(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=Jm(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&cg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Pg(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Ng){var l=t?null:Lg(e);if(l)return Uh(l);o=!1,i=Nh,c=new Ph}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Bg(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const qg=e=>Array.isArray(e)?e:[e],Ug=e=>e instanceof Set?e:new Set(qg(e));function Wg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?vm(e,t,void 0,n):!!a}(e,t,n)}function Zg(e,t=console.warn){e instanceof $s&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Qg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Gg=(e,t)=>qu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Yg=e=>qu(e,"yyyy-MM-dd"),Kg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function Xg(e,t){const n=function(e,t,n){const a=iu(e,t)/Zd;return au(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=iu(e,t)/Wd;return au(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${ru(t,e)-60*n*60-60*a}s`,i}const Jg=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),ef=e=>new Date(`${e}T00:00:00`),tf=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},nf=e=>!isNaN(e.getTime()),af=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},rf=e=>!!e,of=e=>e instanceof HTMLElement,sf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(of),cf=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",lf=e=>({"aspect-ratio":cf(e)}),df=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>df(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=df(e[n]);return t}return e},uf=(e,t,n)=>Og(e,n)===Og(t,n);function hf(e){if(!e)return null;const t=Ac.safeParse(e);return t.success?t.data:null}function pf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function mf(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function gf(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function ff(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function _f(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const vf=e=>qg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),yf=e=>{e.stopPropagation()};class bf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class wf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new bf,this.doubleClickTimer=new bf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||yf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",wf);const xf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},Cf=ge(class extends fe{update(e,[t]){return xf(e.element,t),U}render(e){}});var Mf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)sp(t,pp(e)),e=Dm(e);return t}:dp;function kf(e){return lp(e,Gm,Mf)}var Sf=Object.prototype.hasOwnProperty;var Ef=/\w*$/;var $f=eh?eh.prototype:void 0,Af=$f?$f.valueOf:void 0;var zf="[object Boolean]",If="[object Date]",Tf="[object Map]",jf="[object Number]",Of="[object RegExp]",Df="[object Set]",Rf="[object String]",Pf="[object Symbol]",Lf="[object ArrayBuffer]",Nf="[object DataView]",Ff="[object Float32Array]",Vf="[object Float64Array]",Hf="[object Int8Array]",Bf="[object Int16Array]",qf="[object Int32Array]",Uf="[object Uint8Array]",Wf="[object Uint8ClampedArray]",Zf="[object Uint16Array]",Qf="[object Uint32Array]";function Gf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Lf:return zm(e);case zf:case If:return new o(+e);case Nf:return function(e,t){var n=t?zm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Ff:case Vf:case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:return Im(e,n);case Tf:return new o;case jf:case Rf:return new o(e);case Of:return(r=new(i=e).constructor(i.source,Ef.exec(i))).lastIndex=i.lastIndex,r;case Df:return new o;case Pf:return a=e,Af?Object(Af.call(a)):{}}}var Yf=Dp&&Dp.isMap,Kf=Yf?zp(Yf):function(e){return mp(e)&&"[object Map]"==um(e)};var Xf=Dp&&Dp.isSet,Jf=Xf?zp(Xf):function(e){return mp(e)&&"[object Set]"==um(e)},e_=1,t_=2,n_=4,a_="[object Arguments]",i_="[object Function]",r_="[object GeneratorFunction]",o_="[object Object]",s_={};function c_(e,t,n,a,i,r){var o,s=t&e_,c=t&t_,l=t&n_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!dh(e))return e;var d=cp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Sf.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Tm(e,o)}else{var u=um(e),h=u==i_||u==r_;if(Cp(e))return Am(e,s);if(u==o_||u==a_||h&&!i){if(o=c||h?{}:Rm(e),!s)return c?function(e,t){return Wm(e,Mf(e),t)}(e,function(e,t){return e&&Wm(t,Gm(t),e)}(o,e)):function(e,t){return Wm(e,pp(e),t)}(e,function(e,t){return e&&Wm(t,Wp(t),e)}(o,e))}else{if(!s_[u])return i?e:{};o=Gf(e,u,s)}}r||(r=new Rh);var p=r.get(e);if(p)return p;r.set(e,o),Jf(e)?e.forEach((function(a){o.add(c_(a,t,n,a,e,r))})):Kf(e)&&e.forEach((function(a,i){o.set(i,c_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?kf:Zp:c?Gm:Wp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new g_(e):new DOMException(e),__=e=>{const t=void 0===e.reason?f_("This operation was aborted."):e.reason;return t instanceof Error?t:f_(t)};class v_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class y_ extends p_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:v_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(__(e)),e.addEventListener("abort",(()=>{c(__(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new m_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof m_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var b_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},w_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},x_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},C_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},M_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},k_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},S_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},E_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},$_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},A_={unseekable:"Seek time not found in media"},z_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},I_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},T_={select_date:"Choose date"},j_={common:b_,config:w_,display_modes:x_,editor:C_,elements:M_,error:k_,event:S_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:z_,thumbnail:I_,timeline:T_},O_=Object.freeze({__proto__:null,common:b_,config:w_,default:j_,display_modes:x_,editor:C_,elements:M_,error:k_,event:S_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:z_,thumbnail:I_,timeline:T_});const D_="en",R_={[D_]:O_};let P_;function L_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in R_)return n}return D_}function N_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),R_[P_??D_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),R_[D_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function F_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const V_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},H_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,B_=(e,t,n)=>!!H_(e,t,n),q_=(e,t)=>{const n=B_(e,t,{phase:"start"})&&B_(e,t,{phase:"stop"}),a=B_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},U_=e=>{const t=q_(e,"left"),n=q_(e,"right"),a=q_(e,"up"),i=q_(e,"down"),r=q_(e,"zoom_in"),o=q_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class W_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of zs)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function Z_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function kv(e,t,n,a){return null==e?[]:(cp(t)||(t=null==t?[]:[t]),cp(n=a?void 0:n)||(n=null==n?[]:[n]),Mv(e,t,n))}async function Sv(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new $s(N_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new $s(N_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new $s(N_("error.invalid_response"),{request:n,response:i,invalid_keys:Os(r.error)});return r.data}const Ev=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Ev).nullable().optional()}))),$v="video",Av="image",zv=60,Iv=e=>kv(e,(e=>e._metadata?.startDate),"desc");class Tv{async walkBrowseMedias(e,t,n){return t&&t.length?(await Jg(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?cg(e,t,n):void 0===t)?1:G_(Mg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Q_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await Sv(e,Ev,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Bd(new Date,{seconds:60})),o}}function jv(e,t){return vm(e,t)}function Ov(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nPv(t,e)))}add(e){this._ranges.push(e),this._ranges=Nv(this._ranges)}clear(){this._ranges=[]}}class Rv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Lv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Nv=(e,t=0)=>{const n=[];e=kv(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Fv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return jv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Bv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new Hv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class qv extends $s{}class Uv extends $s{}var Wv,Zv,Qv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Wv||(Wv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Zv||(Zv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Qv||(Qv={}));const Gv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Yv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Qv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-9f6fcaee.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Qv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-6500f302.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Bv,new Vv,t.eventCallback);break;case Qv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-9f2f0410.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Tv,t.resolvedMediaCache,new Vv,t.eventCallback);break;case Qv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-8ab85d2e.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Tv,t.resolvedMediaCache,new Vv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Qv.Frigate;else if("motioneye"===t.engine)n=Qv.MotionEye;else if("generic"===t.engine)n=Qv.Generic;else if("reolink"===t.engine)n=Qv.Reolink;else{const a=Gv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Qv.Generic;throw new qv(N_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Qv.Frigate;break;case"motioneye":n=Qv.MotionEye;break;case"reolink":n=Qv.Reolink;break;default:n=Qv.Generic}}else t.frigate.camera_name?n=Qv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Qv.Generic)}return n}}class Kv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await Jg(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const Xv=e=>{return kv((n=e=>e.getID()??e,(t=e)&&t.length?Fg(t,bv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class Jv{static isEventQuery(e){return e.type===Wv.Event}static isRecordingQuery(e){return e.type===Wv.Recording}static isRecordingSegmentsQuery(e){return e.type===Wv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Wv.MediaMetadata}}class ey{static isEventQueryResult(e){return e.type===Zv.Event}static isRecordingQueryResult(e){return e.type===Zv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Zv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Zv.MediaMetadata}}class ty{constructor(e,t){this._requestLimit=new y_,this._api=e,this._engineFactory=t?.factory??new Yv(this._api.getEntityRegistryManager()),this._store=t?.store??new Kv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=l_(e?.cameras_global),dg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,N_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await Jg(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new qv(N_("error.no_camera_engine"),l_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await Jg(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=F_(e.getConfig());if(!t)throw await r(),new qv(N_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new qv(N_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Wv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Wv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Wv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Ug(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jv.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):Jv.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):Jv.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Wv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=Xv(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Bd(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=qg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jv.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):Jv.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):Jv.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):Jv.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(rf);return new W_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=H_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class ny{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ay=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class iy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await Sv(e,ay,{type:"config/device_registry/list"})}catch(e){return void Zg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const ry=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),oy=ry.array();class sy{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await Sv(e,ry,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Zg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await Sv(e,oy,{type:"config/entity_registry/list"})}catch(e){return void Zg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class cy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class ly{constructor(){this._cache=new cy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const dy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await Sv(e,Is,i)}catch(e){Zg(e)}return n&&r&&n.set(t,r),r};class uy{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class hy extends uy{}class py extends hy{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class my extends hy{async execute(e){e.getCameraURLManager().openURL()}}class gy extends hy{async execute(e){await e.getViewManager().setViewDefaultWithNewQuery()}}class fy extends hy{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class _y extends hy{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class vy extends hy{async execute(e){e.getExpandManager().toggleExpanded()}}class yy extends hy{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class by extends uy{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class wy extends hy{async execute(e){console[this._action.level](this._action.message)}}const xy=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,Cy=e=>xy(e)!==e.camera,My=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class ky extends hy{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,xy(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class Sy extends hy{async execute(e){e.getCardElementManager().toggleMenu()}}class Ey extends hy{async execute(e){await e.getMicrophoneManager().connect()}}class $y extends hy{async execute(e){e.getMicrophoneManager().disconnect()}}class Ay extends hy{async execute(e){e.getMicrophoneManager().mute()}}class zy extends hy{async execute(e){await e.getMicrophoneManager().unmute()}}class Iy extends hy{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Ty extends hy{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class jy extends hy{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Oy=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=xy(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Dy(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Dy=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ry=lg((function(e,t,n){Km(e,t,n)}));const Py=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Ly=(e,t,n,a)=>{Ry(t,{[n]:{[e]:{inProgressAction:a}}})};class Ny extends hy{constructor(){super(...arguments),this._timer=new bf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Oy(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Py(n,this._context.ptz),Ly(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Py(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Fy extends hy{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function Vy(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=wg(n))==n?n:0),void 0!==t&&(t=(t=wg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(wg(e),t,n)}const Hy=50,By=50,qy=1,Uy=4,Wy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Zy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Qy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Gy=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Zy(Qy(n,{observed:e.detail}))]})};class Yy extends hy{constructor(){super(...arguments),this._timer=new bf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Qy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Oy(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Py(n,this._context.ptzDigital),Ly(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Py(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:Vy(t+i,1,10),pan:{x:Vy(n+r,0,100),y:Vy(a+o,0,100)}}}}class Ky extends hy{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Dy(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Oy(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Ny(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Yy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class Xy extends hy{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class Jy extends hy{async execute(e){var t;await tf((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class eb extends hy{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class tb{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class nb extends hy{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new tb]})}}class ab{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=xy(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;My(e,t[i])}}class ib extends hy{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab(e)]})}}class rb{constructor(e){this._substreamID=e}modify(e){My(e,this._substreamID)}}class ob extends hy{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(this._action.camera)]})}}class sb extends hy{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class cb extends hy{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class lb{createAction(e,t,n){const a=hf(t);if("fire-dom-event"!==t.action||!a)return new by(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new gy(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new cb(e,a,n?.config);case"sleep":return new Jy(e,a,n?.config);case"download":return new _y(e,a,n?.config);case"camera_ui":return new my(e,a,n?.config);case"expand":return new vy(e,a,n?.config);case"fullscreen":return new yy(e,a,n?.config);case"menu_toggle":return new Sy(e,a,n?.config);case"camera_select":return new py(e,a,n?.config);case"live_substream_select":return new ob(e,a,n?.config);case"live_substream_off":return new nb(e,a,n?.config);case"live_substream_on":return new ib(e,a,n?.config);case"media_player":return new ky(e,a,n?.config);case"microphone_connect":return new Ey(e,a,n?.config);case"microphone_disconnect":return new $y(e,a,n?.config);case"microphone_mute":return new Ay(e,a,n?.config);case"microphone_unmute":return new zy(e,a,n?.config);case"mute":return new Iy(e,a,n?.config);case"unmute":return new sb(e,a,n?.config);case"play":return new jy(e,a,n?.config);case"pause":return new Ty(e,a,n?.config);case"screenshot":return new Xy(e,a,n?.config);case"display_mode_select":return new fy(e,a,n?.config);case"ptz":return new Ny(e,a,n?.config);case"ptz_digital":return new Yy(e,a,n?.config);case"ptz_multi":return new Ky(e,a,n?.config);case"ptz_controls":return new Fy(e,a,n?.config);case"log":return new wy(e,a,n?.config);case"status_bar":return new eb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class db{constructor(e,t,n){this._actions=[],this._factory=new lb,this._stopped=!1,this._context=e;for(const a of qg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const ub=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),hb=ba.object({detail:ub});class pb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=hb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=_f(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new db(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class mb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:N_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class gb{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const fb=()=>!!navigator.userAgent.match(/CrKey\//),_b=(e,t)=>!!((e.attributes.supported_features??0)&t),vb=e=>(e=>_b(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,yb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},bb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},wb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},xb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Cb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},Mb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},kb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?Mb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Cb[a]},Sb=e=>{const t=e?.attributes.device_class;if(t&&t in xb)return xb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return kb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},Eb="mdi:bookmark",$b={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function Ab(e,t,n,a){switch(e){case"alarm_control_panel":return yb(n);case"binary_sensor":return bb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return wb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Sb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?$b[e]:"mdi:weather-night";case"update":return"on"===t?.state?vb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in $b?$b[e]:a??Eb}async function zb(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await Sv(e,Ts,a);return i?e.hassUrl(i.path):null}function Ib(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function Tb(e,t,n,a){return!!Ib(e,t,n,{...a,firstOnly:!0}).length}function jb(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Ob(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Db(e){return{color:Ob(e),filter:jb(e)}}function Rb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Db(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Lb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Pb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Lb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:Ab(Ye(t),a,a?.state,n)}const Nb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Fb=e=>!!e&&["on","open"].includes(e),Vb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Hb(e){return!!e?.startsWith("/")}function Bb(e,t){return Hb(t)?e.hassUrl(t):t??null}class qb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await Jg(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Ub;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Ub||(Ub={}));class Wb{constructor(e,t){this._initializationQueue=new y_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new qb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Ub.LANGUAGES,Ub.SIDE_LOAD_ELEMENTS,Ub.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Ub.MICROPHONE_CONNECT]:[],Ub.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Ub.LANGUAGES]:async()=>await(async e=>{const t=L_(e);return"ca"===t?R_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?R_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?R_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?R_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(R_[t]=await import("./lang-fr-ea16daba.js")),t&&(P_=t),!0})(e),[Ub.SIDE_LOAD_ELEMENTS]:async()=>await Nb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Ub.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Ub.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Ub.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Zb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),af(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),af(this._element,fb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){af(this._element,!1,"panel"),af(this._element,!1,"tabindex"),af(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Ub.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Qb(e,t,n){return null==e?e:function(e,t,n,a){if(!dh(e))return e;for(var i=-1,r=(t=rv(t,e)).length,o=r-1,s=e;null!=s&&++i{Qb(e,t,n)},Kb=(e,t,n)=>mv(e,t,n),Xb=(e,t)=>{!function(e,t){null==e||Gb(e,t)}(e,t)},Jb=e=>l_(e),ew=(e,t)=>e.replace("#",`[${t.toString()}]`),tw=function(e){let t=!1;for(let n=0;n{const i=Kb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&jv(i,r)||(null===r?a?.keepOriginal||(Xb(e,t),0):void 0===r||(a?.keepOriginal||Xb(e,t),Yb(e,n,r),0)))})(a,e,t,n)}},iw=function(e,t,n){return function(a){let i=aw(e,t,n)(a);return i=sw(vs,aw(e,t,n),(e=>e.overrides))(a)||i,i}},rw=function(e,t){return iw(e,e,{transform:t})},ow=function(e){return iw(e,e,{transform:e=>null})},sw=function(e,t,n){return function(a){let i=!1;const r=Kb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},cw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},lw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),dw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},uw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),pw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),mw=[sw(vs,lw,(e=>e.conditions)),e=>cw(lw,(e=>e.conditions))("object"==typeof e&&e?e[Ai]:{}),iw("event_gallery",ir),iw("menu.buttons.frigate_ui",ns),e=>cw(pw)("object"==typeof e&&e?e:{}),sw(wa,rw("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),iw("live.jsmpeg",Ci),iw("live.image",wi),iw("live.webrtc_card",Mi),sw(wa,iw("frigate.zone","frigate.zones",{transform:e=>qg(e)})),sw(wa,iw("frigate.label","frigate.labels",{transform:e=>qg(e)})),e=>cw(hw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ai in e)||!Array.isArray(e[Ai]))return!1;let t=!1;const n=n=>{if(!t){if(!mv(e,"live.controls.ptz")){const{type:t,...a}=n;Qb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ai]);return t&&(i.length?e[Ai]=i:delete e[Ai]),t},iw("view.timeout_seconds",Oi),rw("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qg(e))),rw("live.auto_play",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qg(e))),rw("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:qg(e))),rw("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:qg(e))),iw("live.controls.thumbnails.media",no),iw("timeline.media",Fo),iw("live.controls.timeline.media",uo),iw("media_viewer.controls.timeline.media",Or),iw("view.scan",Yi),iw("view.triggers.enabled",tr,{transform:e=>!0===e?"live":null,keepOriginal:!0}),iw("view.triggers.enabled",Xi,{transform:e=>!0!==e&&null}),iw("view.triggers.untrigger_reset",nr,{transform:e=>e?"default":null}),iw("live.layout",Ei),ow("media_viewer.layout"),ow("image.layout"),sw(vs,dw),e=>cw(dw)("object"==typeof e&&e?e[Ai]:{}),e=>cw(dw)("object"==typeof e&&e?e.automations:{}),sw(wa,iw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),iw("performance.profile",Ss,{transform:e=>"low"===e?["low-performance"]:null}),sw(vs,aw("overrides","merge")),iw("live.controls.ptz",$i,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),rw("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),iw("view.update_cycle_camera",qi),iw("view.update_force",Wi,{transform:e=>!0===e?"all":null}),iw("view.update_seconds",Zi),iw("view.update_entities",Qi),aw("live.controls.title",cs,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),ow("live.controls.title"),ow("media_viewer.controls.title"),e=>cw(uw)("object"==typeof e&&e?e:{}),iw("dimensions.max_height",_s),ow("dimensions.min_height")];class gw extends $s{}class fw extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function _w(e,t,n){let a=Jb(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Xb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Yb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Yb(a,e,Ry({},Kb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=df(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new gw(N_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class vw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=fl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>jv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const yw={casting:{[Wr]:!1,[Mr]:!1,[Xo]:"none",[`${is}.enabled`]:!0,[`${rs}.enabled`]:!0,[`${as}.enabled`]:!1,[`${os}.enabled`]:!1,[Ur]:["selected","visible"],[fs]:"static",[gs]:"16:9",[Si]:1,[So]:!0},"low-performance":{[ao]:"none",[Er]:"none",[Bo]:"none",[mo]:!1,[Pr]:!1,[Vo]:!1,[qr]:[],[hr]:[],[pr]:[],[mr]:[],[Co]:["unselected","hidden"],[wo]:!1,[br]:!1,[ko]:"none",[Cr]:"none",[So]:!1,[kr]:"chevrons",[ds]:"none",[Xo]:"outside",[`${ts}.enabled`]:!1,[`${ss}.enabled`]:!1,[`${ss}.enabled`]:!1,[`${os}.enabled`]:!1,[sr]:!1,[cr]:!1,[lr]:!1,[or]:!1,[oo]:!1,[so]:!1,[co]:!1,[ro]:!1,[Ar]:!1,[zr]:!1,[Ir]:!1,[$r]:!1,[Wo]:!1,[Zo]:!1,[Qo]:!1,[Uo]:!1,[bs]:!1,[ws]:10,[ks]:!1,[Ms]:!1,[xr]:!1,[ki]:!1,[xi]:"image",[Si]:10,[tr]:"none",[xs]:1},scrubbing:{[ho]:"below",[go]:"ribbon",[po]:"seek",[Dr]:"below",[Lr]:"ribbon",[Rr]:"seek"}},bw=(e,t,n)=>{const a=js(Pd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in yw&&Object.entries(yw[e]).forEach((([e,n])=>{return r=n,void(void 0===Kb(i,a=e)&&Yb(t,a,r));var a,r}));return t},ww=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},xw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=ww(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[ff({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[ff({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[ff()],tag:e}),n};class Cw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(N_("error.invalid_configuration"));const t=Pd.safeParse(e);if(!t.success){const n=nw(e),a=Ds(t.error);let i="";throw n&&(i=`${N_("error.upgrade_available")}. `),new Error(i+`${N_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):N_("error.invalid_configuration_no_hint")))}const n=bw(e,t.data,t.data.profiles);var a;(this._rawConfig=e,jv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Ub.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=xw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=_w(e,this._config,{configOverrides:this._config.overrides,schema:Pd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(jv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||jv(n?.cameras,this._overriddenConfig?.cameras)&&jv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Ub.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Ub.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class Mw{constructor(e){this._timer=new bf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){jv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[pf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const kw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Sw=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new $s(N_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await zb(e,a.endpoint)}catch(e){Zg(e)}if(!t)throw new $s(N_("error.download_sign_failed"));i=t}kw(i)},Ew=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class $w{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Sw(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&kw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${qu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class Aw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const zw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Iw=(()=>{if("undefined"==typeof document)return!1;const e=zw[0],t={};for(const n of zw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),Tw={change:Iw.fullscreenchange,error:Iw.fullscreenerror};let jw={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{jw.off("change",i),n()};jw.on("change",i);const r=e[Iw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!jw.isFullscreen)return void e();const n=()=>{jw.off("change",n),e()};jw.on("change",n);const a=document[Iw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>jw.isFullscreen?jw.exit():jw.request(e,t),onchange(e){jw.on("change",e)},onerror(e){jw.on("error",e)},on(e,t){const n=Tw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=Tw[e];n&&document.removeEventListener(n,t,!1)},raw:Iw};Object.defineProperties(jw,{isFullscreen:{get:()=>Boolean(document[Iw.fullscreenElement])},element:{enumerable:!0,get:()=>document[Iw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[Iw.fullscreenEnabled])}}),Iw||(jw={isEnabled:!1});var Ow=jw;class Dw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Ow.isEnabled&&Ow.on("change",this._fullscreenHandler)}disconnect(){Ow.isEnabled&&Ow.off("change",this._fullscreenHandler)}isInFullscreen(){return Ow.isEnabled&&Ow.isFullscreen}toggleFullscreen(){Ow.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Ow.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Rw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=Ib(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Pw{constructor(e){this._hass=null,this._stateWatcher=new Rw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:N_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Lw=function(){return Ju.Date.now()},Nw="Expected a function",Fw=Math.max,Vw=Math.min;function Hw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Nw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Lw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Vw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Lw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=wg(t)||0,dh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Fw(wg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Lw())},_}function Bw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return dh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Hw(e,t,{leading:a,maxWait:t,trailing:i})}class qw{constructor(e){this._timer=new bf,this.reportInteraction=Bw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Uw{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};jv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Ww(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Zw(e,t,n){const a=Ww(t,n);a&&Qw(e,a)}function Qw(e,t){Vg(e,"media:loaded",t)}function Gw(e){Vg(e,"media:unloaded")}function Yw(e){Vg(e,"media:volumechange")}function Kw(e){Vg(e,"media:play")}function Xw(e){Vg(e,"media:pause")}class Jw{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class ex{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class tx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&_b(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Zg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(_b(n,4096))a="media_stop";else{if(!_b(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:N_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:ex.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class nx{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Zg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof $s&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?As[this._message.type]:0,n=As[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class ix{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=mf(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=pf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class rx{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!jv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class ox{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);af(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return lf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return lf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return lf({defaultStatic:!0})}}class sx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=Bw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=kv([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;jv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new bf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function cx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Fg(e,void 0,t):[]}class lx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return l_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Ug(e)}))),this._queries=cx(t,jv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class dx extends lx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class ux extends lx{}class hx{static areEventQueries(e){return e instanceof dx}static areRecordingQueries(e){return e instanceof ux}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const px=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},mx=(e,t)=>Ry({},e,t);class gx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new gx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new gx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=mx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const fx=(e,t)=>{t?.forEach((t=>t.modify(e)))};class _x extends $s{}class vx extends $s{}class yx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...px(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=px(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new _x(N_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Ws)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new vx(N_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Ws}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new gx(o);return fx(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!px(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class bx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class wx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const xx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Cx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Cx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class kx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new dx(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new ux(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new Mx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>xx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Sx{constructor(e,t){this._api=e,this._executor=t??new kx(e)}async getExistingQueryModifiers(e,t){return e.query?[new wx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new wx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Zy({timeline:{window:{start:Wu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new bx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Zy({mediaViewer:{seek:e}})]:[new bx("mediaViewer","seek")]}}class Ex{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new yx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Sx(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),fx(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=hx.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!px(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&xy(e)!==xy(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class $x{constructor(e,t,n,a){this._deviceRegistryManager=new iy(new ny((e=>e.id))),this._entityRegistryManager=new sy(new ny((e=>e.entity_id))),this._resolvedMediaCache=new ly,this._actionsManager=new pb(this),this._automationsManager=new mb(this),this._cameraManager=new ty(this),this._cameraURLManager=new gb(this),this._configManager=new Cw(this),this._defaultManager=new Mw(this),this._downloadManager=new $w(this),this._expandManager=new Aw(this),this._fullscreenManager=new Dw(this),this._hassManager=new Pw(this),this._initializationManager=new Wb(this),this._interactionManager=new qw(this),this._keyboardStateManager=new Uw(this),this._mediaLoadedInfoManager=new Jw(this),this._mediaPlayerManager=new tx(this),this._messageManager=new nx(this),this._microphoneManager=new ax(this),this._queryStringManager=new ix(this),this._statusBarItemManager=new rx(this),this._styleManager=new ox(this),this._triggersManager=new sx(this),this._viewManager=new Ex(this),e.addController(this),this._conditionsManager=new vw(this,a),this._cardElementManager=new Zb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-63147535.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class Ax{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(rf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?pf("menu_toggle"):pf("default"),hold_action:pf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=mf("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=xy(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:N_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:pf(Cy(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=mf("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:N_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:pf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:pf("clips"),hold_action:pf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:pf("snapshots"),hold_action:pf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:pf("recordings"),hold_action:pf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:pf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:pf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!fb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.download"),tap_action:pf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.camera_ui"),tap_action:pf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:pf("microphone_unmute"),end_tap_action:pf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:pf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.expand"),tap_action:pf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return fb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.fullscreen"),tap_action:pf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Pb(e,t)||t,a=e.states[t],i=gf(t,"play"),r=gf(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Lb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.play"),tap_action:pf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.mute"),tap_action:pf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.screenshot"),tap_action:pf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?px(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Oy(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Oy(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_home"),tap_action:ff({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Us.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function zx(e){return null==e}var Ix=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Px(e,t){return Tx.repeat(" ",t-e.length)+e}var Lx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Rx(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=Tx.repeat(" ",t.indent)+Px((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Rx(e.buffer,i[o],r[o],e.position,u),l+=Tx.repeat(" ",t.indent)+Px((e.line+1).toString(),d)+" | "+c.str+"\n",l+=Tx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Rx(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=Tx.repeat(" ",t.indent)+Px((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Nx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Fx=["scalar","sequence","mapping"];var Vx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Nx.indexOf(t))throw new Dx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Fx.indexOf(this.kind))throw new Dx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Hx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function Bx(e){return this.extend(e)}Bx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Vx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Dx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Vx))throw new Dx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Dx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Dx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Vx))throw new Dx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Bx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Hx(a,"implicit"),a.compiledExplicit=Hx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),tC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var nC=/^[-+]?[0-9]+e/;var aC=new Vx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!tC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||Tx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Tx.isNegativeZero(e))return"-0.0";return n=e.toString(10),nC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),iC=Qx.extend({implicit:[Gx,Yx,eC,aC]}),rC=iC,oC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var cC=new Vx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==oC.exec(e)||null!==sC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=oC.exec(e))&&(t=sC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var lC=new Vx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),dC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var uC=new Vx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=dC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=dC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=dC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),hC=Object.prototype.hasOwnProperty,pC=Object.prototype.toString;var mC=new Vx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var BC=new Array(256),qC=new Array(256),UC=0;UC<256;UC++)BC[UC]=VC(UC)?1:0,qC[UC]=VC(UC);function WC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||yC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function ZC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Lx(n),new Dx(t,n)}function QC(e,t){throw ZC(e,t)}function GC(e,t){e.onWarning&&e.onWarning.call(null,ZC(e,t))}var YC={YAML:function(e,t,n){var a,i,r;null!==e.version&&QC(e,"duplication of %YAML directive"),1!==n.length&&QC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&QC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&QC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&GC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&QC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],IC.test(a)||QC(e,"ill-formed tag handle (first argument) of the TAG directive"),bC.call(e.tagMap,a)&&QC(e,'there is a previously declared suffix for "'+a+'" tag handle'),TC.test(i)||QC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){QC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function KC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=Tx.repeat("\n",t-1))}function iM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,QC(e,"tab characters must not be used in indentation")),45===a)&&RC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,tM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,sM(e,t,CC,!1,!0),o.push(e.result),tM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)QC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),sM(e,t,MC,!0,i)&&(_?g=e.result:f=e.result),_||(JC(e,h,p,m,g,f,o,s,c),m=g=f=null),tM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)QC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?QC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?QC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(DC(r)){do{r=e.input.charCodeAt(++e.position)}while(DC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!OC(r)&&0!==r)}for(;0!==r;){for(eM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),OC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=LC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:QC(e,"expected hexadecimal character");e.result+=HC(r),e.position++}else QC(e,"unknown escape sequence");n=a=e.position}else OC(s)?(KC(e,n,a,!0),aM(e,tM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&nM(e)?QC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}QC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!RC(a)&&!PC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&QC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),bC.call(e.anchorMap,n)||QC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],tM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(RC(d=e.input.charCodeAt(e.position))||PC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(RC(a=e.input.charCodeAt(e.position+1))||n&&PC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(RC(a=e.input.charCodeAt(e.position+1))||n&&PC(a))break}else if(35===d){if(RC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&nM(e)||n&&PC(d))break;if(OC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,tM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(KC(e,i,r,!1),aM(e,e.line-s),i=r=e.position,o=!1),DC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return KC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,wC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||QC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&iM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&QC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&QC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):QC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function cM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(tM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!RC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&QC(e,"directive name must not be less than one character in length");0!==i;){for(;DC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!OC(i));break}if(OC(i))break;for(t=e.position;0!==i&&!RC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&eM(e),bC.call(YC,n)?YC[n](e,n,a):GC(e,'unknown document directive "'+n+'"')}tM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,tM(e,!0,-1)):o&&QC(e,"directives end mark is expected"),sM(e,e.lineIndent-1,MC,!1,!0),tM(e,!0,-1),e.checkLineBreaks&&AC.test(e.input.slice(r,e.position))&&GC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&nM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,tM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function XM(e){return/^\n* /.test(e)}var JM=1,ek=2,tk=3,nk=4,ak=5;function ik(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return QM(e)&&e!==pM&&!ZM(e)&&e!==SM&&e!==zM&&e!==EM&&e!==kM&&e!==TM&&e!==jM&&e!==DM&&e!==PM&&e!==bM&&e!==xM&&e!==MM&&e!==vM&&e!==RM&&e!==$M&&e!==AM&&e!==CM&&e!==yM&&e!==wM&&e!==IM&&e!==OM}(KM(e,0))&&function(e){return!ZM(e)&&e!==EM}(KM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!QM(l=KM(e,c)))return ak;g=g&&YM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=KM(e,c))===gM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!QM(l))return ak;g=g&&YM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&XM(e)?ak:o?r===BM?ak:ek:h?nk:tk:!g||o||i(e)?r===BM?ak:ek:JM}function rk(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===BM?'""':"''";if(!e.noCompatMode&&(-1!==NM.indexOf(t)||FM.test(t)))return e.quotingType===BM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(ik(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+ok(t,e.indent)+sk(UM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,ck(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+ck(l,t),o=n}return r}(t,o),r));case ak:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=KM(e,i),!(t=LM[a])&&QM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||VM(a);return n}(t)+'"';default:throw new Dx("impossible error: invalid scalar style")}}()}function ok(e,t){var n=XM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function sk(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function ck(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function lk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function uk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,dk(e,n,!1)||dk(e,n,!0);var s,c=uM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Dx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&gM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=WM(e,t)),uk(e,t+1,s,!0,c)&&(e.dump&&gM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),uk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?lk(e,t-1,e.dump,i):lk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function hk(e,t){var n,a,i=[],r=[];for(pk(e,i,r),n=0,a=r.length;nq`
${gk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(fk)}};e([he({attribute:!1})],_k.prototype,"message",void 0),e([he({attribute:!1})],_k.prototype,"context",void 0),e([he({attribute:!1})],_k.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],_k.prototype,"dotdotdot",void 0),_k=e([le("frigate-card-message")],_k);let vk=class extends se{render(){if(this.message)return q` ${N_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(fk)}};e([he({attribute:!1})],vk.prototype,"message",void 0),vk=e([le("frigate-card-error-message")],vk);let yk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(fk)}};function bk(e){return"error"===e?.type?q` `:e?q` `:q``}function wk(e){return q` + + + `}function xk(e,t,n){!function(e,t,n,a){Vg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}(e,t,"error",{context:n?.context})}function Ck(e,t){t instanceof Error&&xk(e,t.message,{...t instanceof $s&&{context:t.context}})}e([he({attribute:!1})],yk.prototype,"message",void 0),e([he({attribute:!1})],yk.prototype,"animated",void 0),e([he({attribute:!1})],yk.prototype,"size",void 0),yk=e([le("frigate-card-progress-indicator")],yk);let Mk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(N_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Zg(e,console.error),new $s(N_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return Ck(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Mk.prototype,"elements",void 0),e([he({attribute:!1})],Mk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Mk.prototype,"hass",void 0),Mk=e([le("frigate-card-elements-core")],Mk);let kk=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Vg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Vg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],kk.prototype,"hass",void 0),e([he({attribute:!1})],kk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],kk.prototype,"elements",void 0),kk=e([le("frigate-card-elements")],kk);let Sk=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new fw(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-conditional")],Sk);class Ek extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Vg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Vg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ek.prototype,"_config",void 0);class $k extends Ek{constructor(){super("menu")}}let Ak=class extends $k{};Ak=e([le("frigate-card-menu-icon")],Ak);let zk=class extends $k{};zk=e([le("frigate-card-menu-state-icon")],zk);let Ik=class extends $k{};Ik=e([le("frigate-card-menu-submenu")],Ik);let Tk=class extends $k{};Tk=e([le("frigate-card-menu-submenu-select")],Tk);class jk extends Ek{constructor(){super("status-bar")}}let Ok=class extends jk{};Ok=e([le("frigate-card-status-bar-icon")],Ok);let Dk=class extends jk{};Dk=e([le("frigate-card-status-bar-image")],Dk);let Rk=class extends jk{};Rk=e([le("frigate-card-status-bar-string")],Rk);let Pk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Pk=e([le("frigate-card-loading")],Pk);const Lk=(e,t)=>{Vg(e,"action:execution-request",t)};class Nk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,af(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=_f(n,t);if(!a)return;const i=qg(a);let r=!1;const o=i.filter((e=>rf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Lk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=_f("hold",t),a=_f("double_tap",t),i=_f("tap",t),r=_f("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Rb(e,n):n}_sortButtons(){this._buttons=kv(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Bs:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=hf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Fk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Vk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Bk=e=>{switch(e){case"frigate":return Fk;case"motioneye":return Vk;case"reolink":return Hk;default:return null}};const qk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Uk=class extends se{_renderItem(e){if(!this.hass)return;const t=Rb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${Cf({hasHold:vf(e.hold_action),hasDoubleClick:vf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Bk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>yf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Uk.prototype,"hass",void 0),e([he({attribute:!1})],Uk.prototype,"submenu",void 0),Uk=e([le("frigate-card-submenu")],Uk);let Wk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||Tb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=qk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:Ab("select"),...Rb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Wk.prototype,"hass",void 0),e([he({attribute:!1})],Wk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Wk.prototype,"entityRegistryManager",void 0),e([pe()],Wk.prototype,"_optionTitles",void 0),Wk=e([le("frigate-card-submenu-select")],Wk);let Zk=class extends se{constructor(){super(...arguments),this._controller=new Nk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Bk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Zk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Zk.prototype,"hass",void 0),Zk=e([le("frigate-card-menu")],Zk);let Qk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Qk=e([le("frigate-card-overlay")],Qk);class Gk{constructor(e){this._config=null,this._popupTimer=new bf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=kv(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||jv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=_f(e.detail.action,t);n&&Lk(this._host,{action:qg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){af(this._host,!1,"hide")}_hide(){af(this._host,!0,"hide")}}let Yk=class extends se{constructor(){super(...arguments),this._controller=new Gk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=Cf({hasHold:vf(e.actions?.hold_action),hasDoubleClick:vf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Bk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Yk.prototype,"items",void 0),e([he({attribute:!1})],Yk.prototype,"config",void 0),Yk=e([le("frigate-card-status-bar")],Yk);function Kk(e){return"number"==typeof e}function Xk(e){return"string"==typeof e}function Jk(e){return"boolean"==typeof e}function eS(e){return"[object Object]"===Object.prototype.toString.call(e)}function tS(e){return Math.abs(e)}function nS(e){return Math.sign(e)}function aS(e,t){return tS(e-t)}function iS(e){return lS(e).map(Number)}function rS(e){return e[oS(e)]}function oS(e){return Math.max(0,e.length-1)}function sS(e,t){return t===oS(e)}function cS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function lS(e){return Object.keys(e)}function dS(e,t){return[e,t].reduce(((e,t)=>(lS(t).forEach((n=>{const a=e[n],i=t[n],r=eS(a)&&eS(i);e[n]=r?dS(a,i):i})),e)),{})}function uS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function hS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function pS(e,t,n,a){const i=hS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function mS(e=0,t=0){const n=tS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function gS(e,t,n){const{constrain:a}=mS(0,e),i=e+1;let r=o(t);function o(e){return n?tS((i+e)%i):a(e)}function s(){return r}function c(){return gS(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function fS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=hS(),M=hS(),k=mS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!uS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=aS(t,z),c=aS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*nS(e)),a=d.byDistance(e,!m).distance;return m||tS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function _S(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(uS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&tS(c)>.1?c:0},readPoint:r}}function vS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(Jk(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(tS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function yS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=mS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=tS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&tS(u)e.add(i)))}};return c}function wS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>tS(e)-tS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>nS(e)===a));return r.length?c(r):rS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>tS(e.diff)-tS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function xS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(Jk(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Kk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function CS(e){let t=e;function n(e){return Kk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function MS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function kS(e,t,n,a,i,r,o,s,c){const l=.5,d=iS(i),u=iS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:CS(-1),translate:MS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function SS(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(Jk(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function ES(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return lS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function $S(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Kk(n);const p={groupSlides:function(e){return h?function(e,t){return iS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?iS(e).reduce(((n,h,p)=>{const m=rS(n)||0,g=0===m,f=h===oS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=tS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function AS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return Xk(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return tS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(rS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=sS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(tS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=$S(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>rS(e)[o]-e[0][r])).map(tS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-tS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-rS(P)+rS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=mS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=sS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=rS(o);return mS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return aS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:mS(n?a-e:rS(t),a)}}(N,H,u),q=gS(oS(H),d,u),U=q.clone(),W=iS(n),Z=pS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=CS(Q),Y=CS(Q),K=CS(Q),X=CS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=nS(p),u=d,m},settled:function(){return tS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=wS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=hS(),ie=ES(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=sS(n,t);return a?cS(rS(n[0])+1):i?cS(oS(r)-rS(n)[0]+1,rS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=xS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:fS(S,e,a,i,X,_S(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:vS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:yS(B,K,X,J,$),scrollLooper:bS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:kS(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:SS(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:MS(S,t)};return se}const zS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function IS(e){function t(e,t){return dS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=lS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>lS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function TS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=IS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=hS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(zS,TS.globalOptions),x=l(w),C=[];function M(t){const n=AS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=Xk(t)?e.querySelector(t):t;v=a||e.children[0];const i=Xk(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function jS(){return jS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=DS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===BS?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(DS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=HS&&e>=VS},b=function(){if(l.accelerationFactors.length>=qS){if(d&&(d=!1,RS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*qS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=ZS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return PS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),PS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var GS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function YS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(GS,YS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=QS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}YS.globalOptions=void 0;class KS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=sf(this._parent);!jv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._textDirection=n?.textDirection??"ltr",this._carousel=this._createCarousel(sf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Vg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=TS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable,direction:this._textDirection},[...this._plugins,...e.length>1?[YS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Vg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}const XS=e=>"rtl"===getComputedStyle(e).direction?"rtl":"ltr";let JS=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new KS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins,textDirection:XS(this)}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],JS.prototype,"direction",void 0),e([he({attribute:!0})],JS.prototype,"transitionEffect",void 0),e([he({attribute:!1})],JS.prototype,"loop",void 0),e([he({attribute:!1})],JS.prototype,"dragFree",void 0),e([he({attribute:!1})],JS.prototype,"dragEnabled",void 0),e([he({attribute:!1})],JS.prototype,"plugins",void 0),e([he({attribute:!1})],JS.prototype,"selected",void 0),JS=e([le("frigate-card-carousel")],JS); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const eE=window,tE=eE.ShadowRoot&&(void 0===eE.ShadyCSS||eE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nE=Symbol(),aE=new WeakMap;let iE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==nE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(tE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=aE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&aE.set(t,e))}return e}toString(){return this.cssText}};const rE=(e,t)=>{tE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=eE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},oE=tE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new iE("string"==typeof e?e:e+"",void 0,nE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var sE;const cE=window,lE=cE.trustedTypes,dE=lE?lE.emptyScript:"",uE=cE.reactiveElementPolyfillSupport,hE={toAttribute(e,t){switch(t){case Boolean:e=e?dE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},pE=(e,t)=>t!==e&&(t==t||e==e),mE={attribute:!0,type:String,converter:hE,reflect:!1,hasChanged:pE},gE="finalized";class fE extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=mE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||mE}static finalize(){if(this.hasOwnProperty(gE))return!1;this[gE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(oE(e))}else void 0!==e&&t.push(oE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return rE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=mE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:hE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:hE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||pE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}fE[gE]=!0,fE.elementProperties=new Map,fE.elementStyles=[],fE.shadowRootOptions={mode:"open"},null==uE||uE({ReactiveElement:fE}),(null!==(sE=cE.reactiveElementVersions)&&void 0!==sE?sE:cE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const _E=0,vE=Symbol();class yE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===vE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>pE(e,t[n]))):e!==t}}class bE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var wE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const xE=(e,t,n)=>{const a={...n?.cardWideConfig&&{cardWideConfig:n.cardWideConfig}};return q` ${e.render({initial:()=>n?.inProgressFunc?.()??wk(a),pending:()=>n?.inProgressFunc?.()??wk(a),error:e=>{Zg(e),n?.errorFunc&&n.errorFunc(e)},complete:t})}`},CE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,ME=(e,t,n,a=!0)=>new yE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(CE)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})).catch((e=>a(e))):a()})):null)(a,n):null},autoRun:a}),kE=300;let SE=class extends se{constructor(){super(),this._thumbnailError=!1,this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=ME(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===_E&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return!this._embedThumbnailTask||this._thumbnailError?e:q`${this.thumbnail?xE(this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e,errorFunc:()=>{this._thumbnailError=!0}}):e} `}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],SE.prototype,"thumbnail",void 0),e([he({attribute:!1})],SE.prototype,"hass",void 0),e([pe()],SE.prototype,"_thumbnailError",void 0),SE=e([le("frigate-card-thumbnail-feature-thumbnail")],SE);let EE=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${qu(this.date,"HH:mm")}
+
${qu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],EE.prototype,"date",void 0),e([he({attribute:!1})],EE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],EE.prototype,"showCameraTitle",void 0),EE=e([le("frigate-card-thumbnail-feature-text")],EE);let $E=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Gg(n):null,i=this.media.getEndTime(),r=n&&i?Xg(n,i):null,o=this.media.inProgress()?N_("event.in_progress"):null,s=Hg(this.media.getWhat()?.join(", "))??null,c=Hg(this.media.getWhere()?.join(", "))??null,l=Hg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?qu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(wE)}};e([he({attribute:!1})],$E.prototype,"media",void 0),e([he({attribute:!1})],$E.prototype,"seek",void 0),e([he({attribute:!1})],$E.prototype,"cameraTitle",void 0),$E=e([le("frigate-card-thumbnail-details-event")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Gg(e):null,n=this.media.getEndTime(),a=e&&n?Xg(e,n):null,i=this.media.inProgress()?N_("recording.in_progress"):null,r=this.seek?qu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(wE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-recording")],AE);let zE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!ex.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${ex.isEvent(this.media)&&e?q``:ex.isEvent(this.media)||ex.isRecording(this.media)?q``:q``} + ${r?q` {if(yf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Zg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&ex.isEvent(this.media)?q``:this.details&&ex.isRecording(this.media)?q``:q``} + ${a?q`{yf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new bE(["timeline"])]})}} + >`:""} + ${o?q` {if(yf(e),this.hass&&this.cameraManager&&this.media)try{await Sw(this.hass,this.cameraManager,this.media)}catch(e){Ck(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],zE.prototype,"cameraManager",void 0),e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],zE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],zE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],zE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],zE.prototype,"show_download_control",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),zE=e([le("frigate-card-thumbnail")],zE);let IE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Vg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),yf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],IE.prototype,"hass",void 0),e([he({attribute:!1})],IE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"config",void 0),e([he({attribute:!1})],IE.prototype,"fadeThumbnails",void 0),IE=e([le("frigate-card-thumbnail-carousel")],IE);var TE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const jE=document.createElement("template");jE.innerHTML='\n
\n
\n';class OE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(jE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",OE);let DE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Qg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?sf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?sf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{yf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],DE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],DE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],DE.prototype,"open",void 0),e([he({attribute:!1})],DE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],DE.prototype,"empty",void 0),DE=e([le("frigate-card-drawer")],DE);let RE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],RE.prototype,"drawerIcons",void 0),RE=e([le("frigate-card-surround-basic")],RE);let PE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-f0615f7e.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Vg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new bE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(TE)}};e([he({attribute:!1})],PE.prototype,"hass",void 0),e([he({attribute:!1})],PE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Wg})],PE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Wg})],PE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],PE.prototype,"cameraManager",void 0),e([he({attribute:!1})],PE.prototype,"cardWideConfig",void 0),PE=e([le("frigate-card-surround")],PE);var LE="Mon, 16 Dec 2024 05:43:24 GMT",NE="e2b6d38",FE="Sun, 15 Dec 2024 21:42:12 -0800";const VE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),HE="hass_web_proxy",BE=(e,t)=>`/api/${HE}/v${t??0}/?url=${encodeURIComponent(e)}`,qE=(e,t,n="media")=>(e=>e.config.components.includes(HE))(e)&&!!t[n];async function UE(e,t,n){await e.callService(HE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const WE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await Sv(e,VE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let ZE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.12",browser:navigator.userAgent,date:new Date,lang:L_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:NE,build_date:LE,commit_date:FE},...e&&{ha_version:e.config.version},custom_integrations:{frigate:{...await WE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await WE(HE,e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return bk({message:N_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(TE)}};e([he({attribute:!1})],ZE.prototype,"hass",void 0),e([he({attribute:!1})],ZE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],ZE.prototype,"rawConfig",void 0),e([pe()],ZE.prototype,"_diagnostics",void 0),ZE=e([le("frigate-card-diagnostics")],ZE);let QE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-b82fe5da.js"),e?.isGalleryView()?import("./gallery-cc224df7.js"):e?.isViewerView()?import("./index-e376cdd8.js"):e?.is("image")?import("./image-8d44d210.js"):e?.is("timeline")&&import("./timeline-ce21ea94.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],QE.prototype,"cameraManager",void 0),e([he({attribute:!1})],QE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],QE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],QE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([he({attribute:!1})],QE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],QE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],QE.prototype,"hide",void 0),e([he({attribute:!1})],QE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],QE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),QE=e([le("frigate-card-views")],QE);console.info(`%c FRIGATE-HASS-CARD \n%c ${N_("common.version")} 6.0.12`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:N_("common.frigate_card"),description:N_("common.frigate_card_description"),preview:!0,documentationURL:"https://github.com/dermotduffy/frigate-hass-card"});let GE=class extends se{constructor(){super(...arguments),this._controller=new $x(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new Ax,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await $x.getConfigElement()}static getStubConfig(e,t){return $x.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${bk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};GE=e([le("frigate-card")],GE);export{Al as $,Ji as A,er as B,Ui as C,tr as D,nr as E,ar as F,Di as G,Ri as H,Pi as I,Li as J,Ni as K,Fi as L,Vi as M,Hi as N,Bi as O,ps as P,qs as Q,es as R,Bs as S,Ho as T,Lo as U,No as V,Fo as W,Vo as X,Vs as Y,$l as Z,e as _,se as a,cr as a$,F_ as a0,ew as a1,et as a2,tw as a3,Ss as a4,ji as a5,Ii as a6,Ti as a7,Oi as a8,qi as a9,Qr as aA,io as aB,ro as aC,so as aD,co as aE,oo as aF,to as aG,no as aH,ao as aI,ho as aJ,go as aK,fo as aL,lo as aM,uo as aN,mo as aO,po as aP,Xr as aQ,eo as aR,Jr as aS,Yr as aT,Kr as aU,Gr as aV,Eo as aW,Ao as aX,$o as aY,dr as aZ,or as a_,Xo as aa,Ko as ab,Yo as ac,Jo as ad,ds as ae,ls as af,hs as ag,Hs as ah,us as ai,Mo as aj,wo as ak,zo as al,xo as am,Co as an,Hr as ao,Br as ap,qr as aq,Ur as ar,ko as as,So as at,_o as au,bo as av,vo as aw,yo as ax,Wr as ay,Zr as az,pe as b,Ia as b$,lr as b0,sr as b1,rr as b2,hr as b3,pr as b4,mr as b5,gr as b6,br as b7,Fr as b8,wr as b9,Do as bA,qo as bB,Uo as bC,Zo as bD,Qo as bE,Wo as bF,Bo as bG,fs as bH,gs as bI,_s as bJ,bs as bK,ws as bL,Es as bM,xs as bN,ks as bO,Ms as bP,Xb as bQ,Yb as bR,Bk as bS,Bg as bT,xa as bU,Ka as bV,Qa as bW,Ra as bX,Pa as bY,Ca as bZ,Ta as b_,Cr as ba,xr as bb,fr as bc,yr as bd,_r as be,vr as bf,Mr as bg,kr as bh,Sr as bi,Tr as bj,$r as bk,zr as bl,Ir as bm,Ar as bn,Er as bo,Dr as bp,Lr as bq,Nr as br,jr as bs,Or as bt,Pr as bu,Rr as bv,Oo as bw,Ro as bx,To as by,jo as bz,Jb as c,Nd as c$,ja as c0,za as c1,Za as c2,Ba as c3,qa as c4,Ua as c5,Wa as c6,gi as c7,mi as c8,Oa as c9,ti as cA,ni as cB,Ma as cC,ka as cD,ui as cE,di as cF,pi as cG,hi as cH,Ld as cI,wa as cJ,Cs as cK,Qw as cL,ze as cM,Gw as cN,cf as cO,bk as cP,je as cQ,Wg as cR,_w as cS,Jl as cT,Ck as cU,Gy as cV,XS as cW,yf as cX,xy as cY,ve as cZ,TE as c_,Da as ca,Fa as cb,Ha as cc,La as cd,Na as ce,Va as cf,Ga as cg,Ya as ch,Ja as ci,Xa as cj,_i as ck,fi as cl,vi as cm,yi as cn,Sa as co,Ea as cp,$a as cq,Aa as cr,ei as cs,ai as ct,ii as cu,ri as cv,oi as cw,si as cx,ci as cy,li as cz,nw as d,$s as d$,eu as d0,c as d1,dx as d2,Wv as d3,ux as d4,cx as d5,hx as d6,Zg as d7,kv as d8,qu as d9,bf as dA,Hw as dB,ME as dC,xE as dD,_f as dE,Lk as dF,ff as dG,Cf as dH,vf as dI,u_ as dJ,d_ as dK,Dv as dL,Rv as dM,Bd as dN,Nv as dO,Qg as dP,Gg as dQ,xx as dR,Zy as dS,mx as dT,ru as dU,rf as dV,Lv as dW,Fg as dX,ba as dY,ef as dZ,Sv as d_,Yg as da,Wu as db,Vg as dc,Bw as dd,tf as de,kE as df,Mx as dg,wk as dh,Ew as di,ex as dj,dy as dk,Hb as dl,Bb as dm,qE as dn,UE as dp,zb as dq,BE as dr,Zw as ds,Yw as dt,Kw as du,Xw as dv,bx as dw,ge as dx,fe as dy,U as dz,_e as e,Gv as e0,qv as e1,U_ as e2,W_ as e3,Qv as e4,Kg as e5,Jg as e6,Zv as e7,Fk as e8,Fv as e9,Lb as eA,sf as eB,Hy as eC,By as eD,qy as eE,uf as eF,Wy as eG,Og as eH,Uy as eI,s as eJ,Ae as eK,ye as eL,W as eM,Ww as eN,yE as eO,me as eP,be as eQ,xe as eR,Tb as eS,nf as ea,zv as eb,Vk as ec,Av as ed,$v as ee,Iv as ef,Hk as eg,Yd as eh,Fd as ei,Zd as ej,Wd as ek,Qd as el,fu as em,Kd as en,Xd as eo,_u as ep,gu as eq,Vd as er,tu as es,pu as et,Tu as eu,Pu as ev,Lu as ew,Ru as ex,Fb as ey,Uv as ez,bw as f,Nb as g,Kb as h,jv as i,Pb as j,Hg as k,N_ as l,Gi as m,he as n,Zi as o,Rd as p,Wi as q,o as r,af as s,le as t,Qi as u,Vb as v,Yi as w,q as x,Xi as y,Ki as z}; diff --git a/www/community/frigate-hass-card/card-0be2c6a9.js.gz b/www/community/frigate-hass-card/card-0be2c6a9.js.gz new file mode 100644 index 00000000..34f153d9 Binary files /dev/null and b/www/community/frigate-hass-card/card-0be2c6a9.js.gz differ diff --git a/www/community/frigate-hass-card/card-19444f74.js b/www/community/frigate-hass-card/card-19444f74.js new file mode 100644 index 00000000..d2096441 --- /dev/null +++ b/www/community/frigate-hass-card/card-19444f74.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,I="?"+A,z=`<${I}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+z:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Ie=()=>new ze;let ze=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const It=/^c[^\s-]{8,}$/i,zt=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class In extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}In.create=e=>new In({typeName:Pn.ZodNaN,...$t(e)});const zn=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=In.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:In,BRAND:zn,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="cameras",xa=`${wa}.#.camera_entity`,Ca=`${wa}.#.frigate.camera_name`,Ma=`${wa}.#.capabilities.disable`,ka=`${wa}.#.capabilities.disable_except`,Sa=`${wa}.#.cast.method`,Ea=`${wa}.#.cast.dashboard.dashboard_path`,$a=`${wa}.#.cast.dashboard.view_path`,Aa=`${wa}.#.dimensions.aspect_ratio`,Ia=`${wa}.#.frigate.client_id`,za=`${wa}.#.frigate.labels`,Ta=`${wa}.#.frigate.url`,ja=`${wa}.#.frigate.zones`,Oa=`${wa}.#.go2rtc.modes`,Da=`${wa}.#.go2rtc.stream`,Ra=`${wa}.#.icon`,Pa=`${wa}.#.id`,La=`${wa}.#.image.entity`,Na=`${wa}.#.image.entity_parameters`,Fa=`${wa}.#.image.mode`,Va=`${wa}.#.image.refresh_seconds`,Ha=`${wa}.#.image.url`,Ba=`${wa}.#.motioneye.images.directory_pattern`,qa=`${wa}.#.motioneye.images.file_pattern`,Ua=`${wa}.#.motioneye.movies.directory_pattern`,Wa=`${wa}.#.motioneye.movies.file_pattern`,Za=`${wa}.#.motioneye.url`,Qa=`${wa}.#.title`,Ga=`${wa}.#.webrtc_card.entity`,Ya=`${wa}.#.webrtc_card.url`,Ka=`${wa}.#.live_provider`,Xa=`${wa}.#.dependencies.cameras`,Ja=`${wa}.#.dependencies.all_cameras`,ei=`${wa}.#.dimensions.layout.fit`,ti=`${wa}.#.dimensions.layout.pan.x`,ni=`${wa}.#.dimensions.layout.pan.y`,ai=`${wa}.#.dimensions.layout.position.x`,ii=`${wa}.#.dimensions.layout.position.y`,ri=`${wa}.#.dimensions.layout.view_box.top`,oi=`${wa}.#.dimensions.layout.view_box.bottom`,si=`${wa}.#.dimensions.layout.view_box.left`,ci=`${wa}.#.dimensions.layout.view_box.right`,li=`${wa}.#.dimensions.layout.zoom`,di=`${wa}.#.proxy.dynamic`,ui=`${wa}.#.proxy.media`,hi=`${wa}.#.proxy.ssl_ciphers`,pi=`${wa}.#.proxy.ssl_verification`,mi=`${wa}.#.reolink.media_resolution`,gi=`${wa}.#.reolink.url`,fi=`${wa}.#.triggers.motion`,_i=`${wa}.#.triggers.occupancy`,vi=`${wa}.#.triggers.entities`,yi=`${wa}.#.triggers.events`,bi="cameras_global",wi=`${bi}.image`,xi=`${bi}.live_provider`,Ci=`${bi}.jsmpeg`,Mi=`${bi}.webrtc_card`,ki=`${bi}.triggers.occupancy`,Si=`${bi}.image.refresh_seconds`,Ei=`${bi}.dimensions.layout`,$i=`${bi}.ptz`,Ai="elements",Ii="view",zi=`${Ii}.camera_select`,Ti=`${Ii}.dark_mode`,ji=`${Ii}.default`,Oi=`${Ii}.interaction_seconds`,Di=`${Ii}.keyboard_shortcuts`,Ri=`${Ii}.keyboard_shortcuts.enabled`,Pi=`${Di}.ptz_left`,Li=`${Di}.ptz_right`,Ni=`${Di}.ptz_up`,Fi=`${Di}.ptz_down`,Vi=`${Di}.ptz_zoom_in`,Hi=`${Di}.ptz_zoom_out`,Bi=`${Di}.ptz_home`,qi=`${Ii}.default_cycle_camera`,Ui=`${Ii}.default_reset`,Wi=`${Ui}.interaction_mode`,Zi=`${Ui}.every_seconds`,Qi=`${Ui}.entities`,Gi=`${Ui}.after_interaction`,Yi=`${Ii}.triggers`,Ki=`${Yi}.show_trigger_status`,Xi=`${Yi}.filter_selected_camera`,Ji=`${Yi}.untrigger_seconds`,er=`${Yi}.actions`,tr=`${er}.trigger`,nr=`${er}.untrigger`,ar=`${er}.interaction_mode`,ir="media_gallery",rr=`${ir}.controls.filter.mode`,or=`${ir}.controls.thumbnails.show_details`,sr=`${ir}.controls.thumbnails.show_download_control`,cr=`${ir}.controls.thumbnails.show_favorite_control`,lr=`${ir}.controls.thumbnails.show_timeline_control`,dr=`${ir}.controls.thumbnails.size`,ur="media_viewer",hr=`${ur}.auto_play`,pr=`${ur}.auto_pause`,mr=`${ur}.auto_mute`,gr=`${ur}.auto_unmute`,fr=`${ur}.display.mode`,_r=`${ur}.display.grid_columns`,vr=`${ur}.display.grid_max_columns`,yr=`${ur}.display.grid_selected_width_factor`,br=`${ur}.draggable`,wr=`${ur}.lazy_load`,xr=`${ur}.snapshot_click_plays_clip`,Cr=`${ur}.transition_effect`,Mr=`${ur}.controls.builtin`,kr=`${ur}.controls.next_previous.style`,Sr=`${ur}.controls.next_previous.size`,Er=`${ur}.controls.thumbnails.mode`,$r=`${ur}.controls.thumbnails.show_details`,Ar=`${ur}.controls.thumbnails.show_download_control`,Ir=`${ur}.controls.thumbnails.show_favorite_control`,zr=`${ur}.controls.thumbnails.show_timeline_control`,Tr=`${ur}.controls.thumbnails.size`,jr=`${ur}.controls.timeline.clustering_threshold`,Or=`${ur}.controls.timeline.events_media_type`,Dr=`${ur}.controls.timeline.mode`,Rr=`${ur}.controls.timeline.pan_mode`,Pr=`${ur}.controls.timeline.show_recordings`,Lr=`${ur}.controls.timeline.style`,Nr=`${ur}.controls.timeline.window_seconds`,Fr=`${ur}.zoomable`,Vr="live",Hr=`${Vr}.auto_play`,Br=`${Vr}.auto_pause`,qr=`${Vr}.auto_mute`,Ur=`${Vr}.auto_unmute`,Wr=`${Vr}.controls.builtin`,Zr=`${Vr}.controls.next_previous.style`,Qr=`${Vr}.controls.next_previous.size`,Gr=`${Vr}.controls.ptz.hide_home`,Yr=`${Vr}.controls.ptz.hide_pan_tilt`,Kr=`${Vr}.controls.ptz.hide_zoom`,Xr=`${Vr}.controls.ptz.mode`,Jr=`${Vr}.controls.ptz.orientation`,eo=`${Vr}.controls.ptz.position`,to=`${Vr}.controls.thumbnails.media_type`,no=`${Vr}.controls.thumbnails.events_media_type`,ao=`${Vr}.controls.thumbnails.mode`,io=`${Vr}.controls.thumbnails.size`,ro=`${Vr}.controls.thumbnails.show_details`,oo=`${Vr}.controls.thumbnails.show_download_control`,so=`${Vr}.controls.thumbnails.show_favorite_control`,co=`${Vr}.controls.thumbnails.show_timeline_control`,lo=`${Vr}.controls.timeline.clustering_threshold`,uo=`${Vr}.controls.timeline.events_media_type`,ho=`${Vr}.controls.timeline.mode`,po=`${Vr}.controls.timeline.pan_mode`,mo=`${Vr}.controls.timeline.show_recordings`,go=`${Vr}.controls.timeline.style`,fo=`${Vr}.controls.timeline.window_seconds`,_o=`${Vr}.display.mode`,vo=`${Vr}.display.grid_columns`,yo=`${Vr}.display.grid_max_columns`,bo=`${Vr}.display.grid_selected_width_factor`,wo=`${Vr}.draggable`,xo=`${Vr}.lazy_load`,Co=`${Vr}.lazy_unload`,Mo=`${Vr}.preload`,ko=`${Vr}.transition_effect`,So=`${Vr}.show_image_during_load`,Eo=`${Vr}.microphone.disconnect_seconds`,$o=`${Vr}.microphone.mute_after_microphone_mute_seconds`,Ao=`${Vr}.microphone.always_connected`,Io=`${Vr}.zoomable`,zo="image",To=`${zo}.entity`,jo=`${zo}.entity_parameters`,Oo=`${zo}.mode`,Do=`${zo}.refresh_seconds`,Ro=`${zo}.url`,Po="timeline",Lo=`${Po}.window_seconds`,No=`${Po}.clustering_threshold`,Fo=`${Po}.events_media_type`,Vo=`${Po}.show_recordings`,Ho=`${Po}.style`,Bo=`${Po}.controls.thumbnails.mode`,qo=`${Po}.controls.thumbnails.size`,Uo=`${Po}.controls.thumbnails.show_details`,Wo=`${Po}.controls.thumbnails.show_download_control`,Zo=`${Po}.controls.thumbnails.show_favorite_control`,Qo=`${Po}.controls.thumbnails.show_timeline_control`,Go="menu",Yo=`${Go}.alignment`,Ko=`${Go}.position`,Xo=`${Go}.style`,Jo=`${Go}.button_size`,es=`${Go}.buttons`,ts=`${es}.frigate`,ns=`${es}.camera_ui`,as=`${es}.fullscreen`,is=`${es}.play`,rs=`${es}.mute`,os=`${es}.media_player`,ss=`${es}.timeline`,cs="status_bar",ls=`${cs}.position`,ds=`${cs}.style`,us=`${cs}.popup_seconds`,hs=`${cs}.height`,ps=`${cs}.items`,ms="dimensions",gs=`${ms}.aspect_ratio`,fs=`${ms}.aspect_ratio_mode`,_s=`${ms}.height`,vs="overrides",ys="performance",bs=`${ys}.features.animated_progress_indicator`,ws=`${ys}.features.media_chunk_size`,xs=`${ys}.features.max_simultaneous_engine_requests`,Cs=`${ys}.profile`,Ms=`${ys}.style.box_shadow`,ks=`${ys}.style.border_radius`,Ss="profiles",Es=1e3;class $s extends Error{constructor(e,t){super(e),this.context=t}}const As={info:10,error:20,connection:30,diagnostics:40},Is=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],zs=ba.object({url:ba.string(),mime_type:ba.string()}),Ts=ba.object({path:ba.string()});function js(e){if(e instanceof ba.ZodDefault)return js(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(js(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(js(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(js(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(js(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>js(e)))):e}function Os(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ds=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ds(n).forEach(t.add,t)}else t.add(Rs(n.path));return t},Rs=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(Js,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),gc=mc.extend({frigate_card_action:ba.enum(Us)}),fc=mc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),_c=mc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),vc=mc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),yc=mc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),bc=mc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:nc}),wc=mc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional(),ptz_preset:ba.string().optional()}),xc=mc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:tc.optional(),pan:ec.optional()}).optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional()}),Cc=mc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional(),ptz_preset:ba.string().optional()}),Mc=mc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),kc=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),Sc=mc.extend({frigate_card_action:ba.literal("sleep"),duration:kc.optional().default({s:1})}),Ec=mc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>il)).array().optional()}),$c=mc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ac=ba.union([_c,fc,vc,$c,yc,wc,xc,Cc,Mc,gc,bc,Sc,Ec]),Ic=ba.union([rc,cc,sc,lc,dc,uc,pc,hc,Ac]),zc=ba.object({tap_action:Ic.or(Ic.array()).optional(),hold_action:Ic.or(Ic.array()).optional(),double_tap_action:Ic.or(Ic.array()).optional(),start_tap_action:Ic.or(Ic.array()).optional(),end_tap_action:Ic.or(Ic.array()).optional()}).passthrough(),Tc=ba.object({actions:zc.optional()}),jc=zc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Oc=jc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Dc=jc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Rc=jc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Pc=jc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Lc=jc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Nc=jc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Fc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Vc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),Hc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Bc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),qc=ba.discriminatedUnion("condition",[Fc,Vc,Hc,Bc]),Uc=ba.object({type:ba.literal("conditional"),conditions:qc.array(),elements:ba.lazy((()=>_l))}),Wc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Zc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Bs).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Qc=Zc.merge(Lc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Gc=Zc.merge(Dc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Zc),Yc=jc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Kc=Zc.merge(Lc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Yc.array()}),Xc=Zc.merge(Dc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Yc.deepPartial()).optional()}),Jc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),el=Jc.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:zc.optional()}),tl=el.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),nl=el.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),al=el.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),il=ba.union([tl,nl,al]),rl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),ol=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),sl=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),cl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ll=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),dl=ba.object({condition:ba.literal("display_mode"),display_mode:nc}),ul=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),hl=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),pl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),ml=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),gl=ba.discriminatedUnion("condition",[Fc,Vc,Hc,Bc,rl,ol,sl,cl,ll,dl,ul,hl,pl,ml]),fl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:gl.array(),elements:ba.lazy((()=>_l))}),_l=ba.union([Uc,Wc,fl,Lc,Nc,Qc,Gc,Kc,Xc,Pc,Oc,Dc,Rc,tl,nl,al]).array().optional(),vl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:ec.optional(),zoom:tc.optional()}),yl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),bl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},wl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},xl=ba.preprocess(wl("actions_"),ba.object({actions_left:sc.optional(),actions_left_start:sc.optional(),actions_left_stop:sc.optional(),actions_right:sc.optional(),actions_right_start:sc.optional(),actions_right_stop:sc.optional(),actions_up:sc.optional(),actions_up_start:sc.optional(),actions_up_stop:sc.optional(),actions_down:sc.optional(),actions_down_start:sc.optional(),actions_down_stop:sc.optional(),actions_zoom_in:sc.optional(),actions_zoom_in_start:sc.optional(),actions_zoom_in_stop:sc.optional(),actions_zoom_out:sc.optional(),actions_zoom_out_start:sc.optional(),actions_zoom_out_stop:sc.optional(),r2c_delay_between_calls_seconds:ba.number().default(bl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(bl.c2r_delay_between_calls_seconds),presets:ba.preprocess(wl(""),ba.union([ba.record(sc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),Cl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Ml=ba.object({mode:ba.enum(["off","auto","on"]).default(Cl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(Cl.position),orientation:ba.enum(["vertical","horizontal"]).default(Cl.orientation),hide_pan_tilt:ba.boolean().default(Cl.hide_pan_tilt),hide_zoom:ba.boolean().default(Cl.hide_zoom),hide_home:ba.boolean().default(Cl.hide_home),style:ba.object({}).passthrough().optional()}),kl={mode:"auto",refresh_seconds:1},Sl=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(kl.mode),refresh_seconds:ba.number().min(0).default(kl.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),El=Sl.merge(Tc).default(kl),$l=75,Al=300,Il={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},zl=ba.object({size:ba.number().min(75).max(300).default(Il.size),show_details:ba.boolean().default(Il.show_details),show_favorite_control:ba.boolean().default(Il.show_favorite_control),show_timeline_control:ba.boolean().default(Il.show_timeline_control),show_download_control:ba.boolean().default(Il.show_download_control)}),Tl={...Il,mode:"right"},jl=zl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Tl.mode)}),Ol=ba.enum(["all","clips","snapshots"]),Dl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Rl=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Pl=ba.object({clustering_threshold:ba.number().optional().default(Dl.clustering_threshold),events_media_type:Ol.optional().default(Dl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Dl.window_seconds),show_recordings:ba.boolean().optional().default(Dl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Dl.style),pan_mode:Rl.optional().default(Dl.pan_mode)}),Ll={...Dl,mode:"none",style:"ribbon"},Nl=Pl.extend({mode:ba.enum(["none","above","below"]).default(Ll.mode),style:Pl.shape.style.default(Ll.style)}),Fl={...Dl,controls:{thumbnails:Tl}},Vl=Pl.extend({controls:ba.object({thumbnails:jl.default(Fl.controls.thumbnails)}).default(Fl.controls)}).default(Fl),Hl=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Bl=ba.enum(["none","slide"]),ql={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Ul=ba.object({always_connected:ba.boolean().default(ql.always_connected),disconnect_seconds:ba.number().min(0).default(ql.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(ql.mute_after_microphone_mute_seconds)}).default(ql),Wl=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Zl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Ql=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Gl={...Tl,media_type:"events",events_media_type:"all"},Yl={auto_play:[...Qs],auto_pause:[],auto_mute:[...Ys],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:Cl,thumbnails:Gl,timeline:Ll},microphone:{...ql}},Kl=jl.extend({media_type:ba.enum(["events","recordings"]).default(Yl.controls.thumbnails.media_type),events_media_type:Ol.default(Yl.controls.thumbnails.events_media_type)}),Xl=ba.object({auto_pause:ba.enum(Zs).array().default(Yl.auto_pause),auto_play:ba.enum(Qs).array().default(Yl.auto_play),auto_mute:ba.enum(Ys).array().default(Yl.auto_mute),auto_unmute:ba.enum(Gs).array().default(Yl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Yl.controls.builtin),next_previous:Hl.extend({style:ba.enum(["none","chevrons","icons"]).default(Yl.controls.next_previous.style),size:Hl.shape.size.default(Yl.controls.next_previous.size)}).default(Yl.controls.next_previous),ptz:Ml.default(Yl.controls.ptz),thumbnails:Kl.default(Yl.controls.thumbnails),timeline:Nl.default(Yl.controls.timeline)}).default(Yl.controls),display:ac,draggable:ba.boolean().default(Yl.draggable),lazy_load:ba.boolean().default(Yl.lazy_load),lazy_unload:ba.enum(Zs).array().default(Yl.lazy_unload),microphone:Ul.default(Yl.microphone),preload:ba.boolean().default(Yl.preload),show_image_during_load:ba.boolean().default(Yl.show_image_during_load),transition_effect:Bl.default(Yl.transition_effect),zoomable:ba.boolean().default(Yl.zoomable)}).merge(Tc).default(Yl),Jl=ba.object({live:Xl}),ed=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),td={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:bl,triggers:{motion:!1,occupancy:!1,events:[...Xs],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},nd=ba.object({media:ba.boolean().or(ba.literal("auto")).default(td.proxy.media),dynamic:ba.boolean().default(td.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(td.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(td.proxy.ssl_ciphers)}),ad=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Is).array().optional(),disable_except:ba.enum(Is).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(td.dependencies.all_cameras),cameras:ba.string().array().default(td.dependencies.cameras)}).default(td.dependencies),triggers:ba.object({motion:ba.boolean().default(td.triggers.motion),occupancy:ba.boolean().default(td.triggers.occupancy),entities:ba.string().array().default(td.triggers.entities),events:ba.enum(Xs).array().default(td.triggers.events)}).default(td.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(td.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(td.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(td.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(td.motioneye.images.file_pattern)}).default(td.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(td.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(td.motioneye.movies.file_pattern)}).default(td.motioneye.movies)}).default(td.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(td.reolink.media_resolution)}).default(td.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(td.live_provider),go2rtc:Wl.optional(),image:Sl.optional().default(kl),jsmpeg:Ql.optional(),webrtc_card:Zl.optional(),cast:ed.optional(),ptz:xl.default(td.ptz),dimensions:ba.object({aspect_ratio:yl.optional(),layout:vl.optional()}).optional(),proxy:nd.default(td.proxy)}).default(td),id=ad.array().min(1),rd={default:Ws,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Ls},od=ba.enum(["all","inactive","active"]).default("inactive"),sd=ba.object({actions:ba.object({interaction_mode:od,trigger:ba.enum(["default","live","media","none","update"]).default(rd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(rd.triggers.actions.untrigger)}).default(rd.triggers.actions),filter_selected_camera:ba.boolean().default(rd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(rd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(rd.triggers.untrigger_seconds)}),cd=ba.object({default:ba.enum(Us).default(rd.default),camera_select:ba.enum([...Us,"current"]).default(rd.camera_select),interaction_seconds:ba.number().default(rd.interaction_seconds),default_cycle_camera:ba.boolean().default(rd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(rd.default_reset.after_interaction),every_seconds:ba.number().default(rd.default_reset.every_seconds),entities:ba.string().array().default(rd.default_reset.entities),interaction_mode:od.default(rd.default_reset.interaction_mode)}).default(rd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:sd.default(rd.triggers),keyboard_shortcuts:Ns.default(rd.keyboard_shortcuts)}).merge(Tc).default(rd),ld=["left","right","top","bottom"],dd=ld,ud={priority:50,enabled:!0},hd={priority:50,enabled:!1},pd={alignment:"left",button_size:40,buttons:{camera_ui:ud,cameras:ud,clips:ud,ptz_home:hd,display_mode:ud,download:ud,expand:hd,frigate:ud,fullscreen:ud,image:hd,live:ud,media_player:ud,microphone:{...hd,type:"momentary"},mute:hd,play:hd,ptz_controls:hd,recordings:hd,screenshot:hd,snapshots:ud,substreams:ud,timeline:ud},position:"top",style:"hidden"},md=Zc.extend({enabled:Zc.shape.enabled.default(ud.enabled),priority:Zc.shape.priority.default(ud.priority)}),gd=Zc.extend({enabled:Zc.shape.enabled.default(hd.enabled),priority:Zc.shape.priority.default(hd.priority)}),fd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(pd.style),position:ba.enum(ld).default(pd.position),alignment:ba.enum(dd).default(pd.alignment),buttons:ba.object({camera_ui:md.default(pd.buttons.camera_ui),cameras:md.default(pd.buttons.cameras),clips:md.default(pd.buttons.clips),ptz_home:gd.default(pd.buttons.ptz_home),display_mode:md.default(pd.buttons.display_mode),download:md.default(pd.buttons.download),expand:gd.default(pd.buttons.expand),frigate:md.default(pd.buttons.frigate),fullscreen:md.default(pd.buttons.fullscreen),image:gd.default(pd.buttons.image),live:md.default(pd.buttons.live),media_player:md.default(pd.buttons.media_player),microphone:gd.extend({type:ba.enum(["momentary","toggle"]).default(pd.buttons.microphone.type)}).default(pd.buttons.microphone),mute:gd.default(pd.buttons.mute),play:gd.default(pd.buttons.play),ptz_controls:gd.default(pd.buttons.ptz_controls),recordings:gd.default(pd.buttons.recordings),screenshot:gd.default(pd.buttons.screenshot),snapshots:md.default(pd.buttons.snapshots),substreams:md.default(pd.buttons.substreams),timeline:md.default(pd.buttons.timeline)}).default(pd.buttons),button_size:ba.number().min(20).default(pd.button_size)}).default(pd),_d={priority:50,enabled:!0},vd={height:46,items:{engine:_d,resolution:_d,technology:_d,title:_d},position:"bottom",style:"popup",popup_seconds:3},yd=ba.object({position:ba.enum(["top","bottom"]).default(vd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(vd.style),popup_seconds:ba.number().min(0).max(60).default(vd.popup_seconds),height:ba.number().min(20).default(vd.height),items:ba.object({engine:Jc.default(vd.items.engine),technology:Jc.default(vd.items.technology),resolution:Jc.default(vd.items.resolution),title:Jc.default(vd.items.title)}).default(vd.items)}).default(vd),bd={auto_play:[...Qs],auto_pause:[...Zs],auto_mute:[...Zs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Tl,timeline:Ll,ptz:{...Cl,mode:"off"}}},wd=Hl.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(bd.controls.next_previous.style),size:Hl.shape.size.default(bd.controls.next_previous.size)}),xd=ba.object({auto_play:ba.enum(Qs).array().default(bd.auto_play),auto_pause:ba.enum(Zs).array().default(bd.auto_pause),auto_mute:ba.enum(Zs).array().default(bd.auto_mute),auto_unmute:ba.enum(Qs).array().default(bd.auto_unmute),lazy_load:ba.boolean().default(bd.lazy_load),draggable:ba.boolean().default(bd.draggable),zoomable:ba.boolean().default(bd.zoomable),transition_effect:Bl.default(bd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(bd.snapshot_click_plays_clip),display:ac,controls:ba.object({builtin:ba.boolean().default(bd.controls.builtin),next_previous:wd.default(bd.controls.next_previous),ptz:Ml.extend({mode:ba.enum(["off","on"]).default(bd.controls.ptz.mode)}).default(bd.controls.ptz),thumbnails:jl.default(bd.controls.thumbnails),timeline:Nl.default(bd.controls.timeline)}).default(bd.controls)}).merge(Tc).default(bd),Cd={...Tl,show_details:!1},Md={controls:{thumbnails:Cd,filter:{mode:"right"}}},kd=jl.extend({show_details:ba.boolean().default(Cd.show_details)}),Sd=ba.object({controls:ba.object({thumbnails:kd.default(Md.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Md.controls.filter.mode)}).default(Md.controls.filter)}).default(Md.controls)}).merge(Tc).default(Md),Ed={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},$d=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ed.aspect_ratio_mode),aspect_ratio:yl.default(Ed.aspect_ratio),height:ba.string().default(Ed.height)}).default(Ed),Ad=ba.object({conditions:gl.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Id=Ic.array(),zd=ba.object({conditions:gl.array(),actions:Id.optional(),actions_not:Id.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Td={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},jd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Td.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Td.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Td.features),style:ba.object({border_radius:ba.boolean().default(Td.style.border_radius),box_shadow:ba.boolean().default(Td.style.box_shadow)}).default(Td.style)}).default(Td),Od={logging:!1},Dd=ba.object({logging:ba.boolean().default(Od.logging)}).default(Od),Rd=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Pd=ba.object({cameras:js(id),cameras_global:ad,view:cd,menu:fd,status_bar:yd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,elements:_l,dimensions:$d,timeline:Vl,performance:jd,debug:Dd,automations:zd.optional(),profiles:Rd,overrides:Ad,card_mod:ba.unknown(),card_id:ba.string().regex(Js).optional(),type:ba.string()}),Ld={cameras:td,view:rd,menu:pd,status_bar:vd,live:Yl,media_gallery:Md,media_viewer:bd,image:kl,timeline:Fl,performance:Td,debug:Od};function Nd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Fd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Vd(e,t){const n=Nd(e);return isNaN(t)?Fd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function Hd(e,t){const n=Nd(e);if(isNaN(t))return Fd(e,NaN);if(!t)return n;const a=n.getDate(),i=Fd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Bd(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Nd(e),d=a||n?Hd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Fd(e,(r||i?Vd(d,r+7*i):d).getTime()+u)}const qd=6048e5,Ud=864e5,Wd=6e4,Zd=36e5,Qd=1e3;let Gd={};function Yd(){return Gd}function Kd(e,t){const n=Yd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Nd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function eu(e){const t=Nd(e);return t.setHours(0,0,0,0),t}function tu(e){const t=Nd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function nu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Nd(e);return!isNaN(Number(n))}function au(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function iu(e,t){return+Nd(e)-+Nd(t)}function ru(e,t,n){const a=iu(e,t)/1e3;return au(n?.roundingMethod)(a)}const ou={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function su(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const cu={date:su({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:su({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:su({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},lu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function du(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function uu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var hu;const pu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=ou[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:cu,formatRelative:(e,t,n,a)=>lu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:du({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:du({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:du({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:du({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:du({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(hu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(hu.matchPattern);if(!n)return null;const a=n[0],i=e.match(hu.parsePattern);if(!i)return null;let r=hu.valueCallback?hu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:uu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:uu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:uu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:uu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:uu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function mu(e){const t=Nd(e),n=function(e,t){const n=eu(e),a=eu(t),i=+n-tu(n),r=+a-tu(a);return Math.round((i-r)/Ud)}(t,function(e){const t=Nd(e),n=Fd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function gu(e){const t=Nd(e),n=+Xd(t)-+function(e){const t=Jd(e),n=Fd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Xd(n)}(t);return Math.round(n/qd)+1}function fu(e,t){const n=Nd(e),a=n.getFullYear(),i=Yd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Fd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Kd(o,t),c=Fd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Kd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function _u(e,t){const n=Nd(e),a=+Kd(n,t)-+function(e,t){const n=Yd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=fu(e,t),r=Fd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Kd(r,t)}(n,t);return Math.round(a/qd)+1}function vu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const yu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return vu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):vu(n+1,2)},d:(e,t)=>vu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>vu(e.getHours()%12||12,t.length),H:(e,t)=>vu(e.getHours(),t.length),m:(e,t)=>vu(e.getMinutes(),t.length),s:(e,t)=>vu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return vu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},bu="midnight",wu="noon",xu="morning",Cu="afternoon",Mu="evening",ku="night",Su={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return yu.y(e,t)},Y:function(e,t,n,a){const i=fu(e,a),r=i>0?i:1-i;if("YY"===t){return vu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):vu(r,t.length)},R:function(e,t){return vu(Jd(e),t.length)},u:function(e,t){return vu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return vu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return vu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return yu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return vu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=_u(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):vu(i,t.length)},I:function(e,t,n){const a=gu(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):vu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):yu.d(e,t)},D:function(e,t,n){const a=mu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):vu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return vu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return vu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return vu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?wu:0===a?bu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Mu:a>=12?Cu:a>=4?xu:ku,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return yu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):yu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):vu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):vu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):yu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):yu.s(e,t)},S:function(e,t){return yu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return $u(a);case"XXXX":case"XX":return Au(a);default:return Au(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return $u(a);case"xxxx":case"xx":return Au(a);default:return Au(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Eu(a,":");default:return"GMT"+Au(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Eu(a,":");default:return"GMT"+Au(a,":")}},t:function(e,t,n){return vu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return vu(e.getTime(),t.length)}};function Eu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+vu(r,2)}function $u(e,t){if(e%60==0){return(e>0?"-":"+")+vu(Math.abs(e)/60,2)}return Au(e,t)}function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+vu(Math.trunc(a/60),2)+t+vu(a%60,2)}const Iu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},zu=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Tu={p:zu,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Iu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Iu(a,t)).replace("{{time}}",zu(i,t))}},ju=/^D+$/,Ou=/^Y+$/,Du=["D","DD","YY","YYYY"];function Ru(e){return ju.test(e)}function Pu(e){return Ou.test(e)}function Lu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Du.includes(e))throw new RangeError(a)}const Nu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Fu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vu=/^'([^]*?)'?$/,Hu=/''/g,Bu=/[a-zA-Z]/;function qu(e,t,n){const a=Yd(),i=n?.locale??a.locale??pu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Nd(e);if(!nu(s))throw new RangeError("Invalid time value");let c=t.match(Fu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Tu[t])(e,i.formatLong)}return e})).join("").match(Nu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Uu(e)};if(Su[t])return{isToken:!0,value:e};if(t.match(Bu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Pu(r)||!n?.useAdditionalDayOfYearTokens&&Ru(r))&&Lu(r,t,String(e));return(0,Su[r[0]])(s,r,i.localize,l)})).join("")}function Uu(e){const t=e.match(Vu);return t?t[1].replace(Hu,"'"):e}function Wu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return Hd(e,-t)}(e,a+12*n),d=function(e,t){return Vd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Fd(e,d.getTime()-u)}function Zu(e,t){return e===t||e!=e&&t!=t}function Qu(e,t){for(var n=e.length;n--;)if(Zu(e[n][0],t))return n;return-1}var Gu=Array.prototype.splice;function Yu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Yu.prototype.set=function(e,t){var n=this.__data__,a=Qu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ku="object"==typeof global&&global&&global.Object===Object&&global,Xu="object"==typeof self&&self&&self.Object===Object&&self,Ju=Ku||Xu||Function("return this")(),eh=Ju.Symbol,th=Object.prototype,nh=th.hasOwnProperty,ah=th.toString,ih=eh?eh.toStringTag:void 0;var rh=Object.prototype.toString;var oh="[object Null]",sh="[object Undefined]",ch=eh?eh.toStringTag:void 0;function lh(e){return null==e?void 0===e?sh:oh:ch&&ch in Object(e)?function(e){var t=nh.call(e,ih),n=e[ih];try{e[ih]=void 0;var a=!0}catch(e){}var i=ah.call(e);return a&&(t?e[ih]=n:delete e[ih]),i}(e):function(e){return rh.call(e)}(e)}function dh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var uh="[object AsyncFunction]",hh="[object Function]",ph="[object GeneratorFunction]",mh="[object Proxy]";function gh(e){if(!dh(e))return!1;var t=lh(e);return t==hh||t==ph||t==uh||t==mh}var fh,_h=Ju["__core-js_shared__"],vh=(fh=/[^.]+$/.exec(_h&&_h.keys&&_h.keys.IE_PROTO||""))?"Symbol(src)_1."+fh:"";var yh=Function.prototype.toString;function bh(e){if(null!=e){try{return yh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var wh=/^\[object .+?Constructor\]$/,xh=Function.prototype,Ch=Object.prototype,Mh=xh.toString,kh=Ch.hasOwnProperty,Sh=RegExp("^"+Mh.call(kh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Eh(e){return!(!dh(e)||(t=e,vh&&vh in t))&&(gh(e)?Sh:wh).test(bh(e));var t}function $h(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Eh(n)?n:void 0}var Ah=$h(Ju,"Map"),Ih=$h(Object,"create");var zh=Object.prototype.hasOwnProperty;var Th=Object.prototype.hasOwnProperty;function jh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Vh?new Ph:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ep}var Ap={};function Ip(e){return function(t){return e(t)}}Ap["[object Float32Array]"]=Ap["[object Float64Array]"]=Ap["[object Int8Array]"]=Ap["[object Int16Array]"]=Ap["[object Int32Array]"]=Ap["[object Uint8Array]"]=Ap["[object Uint8ClampedArray]"]=Ap["[object Uint16Array]"]=Ap["[object Uint32Array]"]=!0,Ap["[object Arguments]"]=Ap["[object Array]"]=Ap["[object ArrayBuffer]"]=Ap["[object Boolean]"]=Ap["[object DataView]"]=Ap["[object Date]"]=Ap["[object Error]"]=Ap["[object Function]"]=Ap["[object Map]"]=Ap["[object Number]"]=Ap["[object Object]"]=Ap["[object RegExp]"]=Ap["[object Set]"]=Ap["[object String]"]=Ap["[object WeakMap]"]=!1;var zp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Tp=zp&&"object"==typeof module&&module&&!module.nodeType&&module,jp=Tp&&Tp.exports===zp&&Ku.process,Op=function(){try{var e=Tp&&Tp.require&&Tp.require("util").types;return e||jp&&jp.binding&&jp.binding("util")}catch(e){}}(),Dp=Op,Rp=Dp&&Dp.isTypedArray,Pp=Rp?Ip(Rp):function(e){return mp(e)&&$p(e.length)&&!!Ap[lh(e)]},Lp=Object.prototype.hasOwnProperty;function Np(e,t){var n=cp(e),a=!n&&yp(e),i=!n&&!a&&Cp(e),r=!n&&!a&&!i&&Pp(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++ig>=800)return arguments[0]}else ig=0;return ag.apply(void 0,arguments)});function sg(e,t){return og(function(e,t,n){return t=Jm(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=Jm(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&cg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Pg(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Ng){var l=t?null:Lg(e);if(l)return Uh(l);o=!1,i=Nh,c=new Ph}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Bg(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const qg=e=>Array.isArray(e)?e:[e],Ug=e=>e instanceof Set?e:new Set(qg(e));function Wg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?vm(e,t,void 0,n):!!a}(e,t,n)}function Zg(e,t=console.warn){e instanceof $s&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Qg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Gg=(e,t)=>qu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Yg=e=>qu(e,"yyyy-MM-dd"),Kg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function Xg(e,t){const n=function(e,t,n){const a=iu(e,t)/Zd;return au(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=iu(e,t)/Wd;return au(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${ru(t,e)-60*n*60-60*a}s`,i}const Jg=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),ef=e=>new Date(`${e}T00:00:00`),tf=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},nf=e=>!isNaN(e.getTime()),af=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},rf=e=>!!e,of=e=>e instanceof HTMLElement,sf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(of),cf=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",lf=e=>({"aspect-ratio":cf(e)}),df=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>df(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=df(e[n]);return t}return e},uf=(e,t,n)=>Og(e,n)===Og(t,n);function hf(e){if(!e)return null;const t=Ac.safeParse(e);return t.success?t.data:null}function pf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function mf(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function gf(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function ff(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function _f(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const vf=e=>qg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),yf=e=>{e.stopPropagation()};class bf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class wf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new bf,this.doubleClickTimer=new bf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||yf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",wf);const xf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},Cf=ge(class extends fe{update(e,[t]){return xf(e.element,t),U}render(e){}});var Mf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)sp(t,pp(e)),e=Dm(e);return t}:dp;function kf(e){return lp(e,Gm,Mf)}var Sf=Object.prototype.hasOwnProperty;var Ef=/\w*$/;var $f=eh?eh.prototype:void 0,Af=$f?$f.valueOf:void 0;var If="[object Boolean]",zf="[object Date]",Tf="[object Map]",jf="[object Number]",Of="[object RegExp]",Df="[object Set]",Rf="[object String]",Pf="[object Symbol]",Lf="[object ArrayBuffer]",Nf="[object DataView]",Ff="[object Float32Array]",Vf="[object Float64Array]",Hf="[object Int8Array]",Bf="[object Int16Array]",qf="[object Int32Array]",Uf="[object Uint8Array]",Wf="[object Uint8ClampedArray]",Zf="[object Uint16Array]",Qf="[object Uint32Array]";function Gf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Lf:return Im(e);case If:case zf:return new o(+e);case Nf:return function(e,t){var n=t?Im(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Ff:case Vf:case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:return zm(e,n);case Tf:return new o;case jf:case Rf:return new o(e);case Of:return(r=new(i=e).constructor(i.source,Ef.exec(i))).lastIndex=i.lastIndex,r;case Df:return new o;case Pf:return a=e,Af?Object(Af.call(a)):{}}}var Yf=Dp&&Dp.isMap,Kf=Yf?Ip(Yf):function(e){return mp(e)&&"[object Map]"==um(e)};var Xf=Dp&&Dp.isSet,Jf=Xf?Ip(Xf):function(e){return mp(e)&&"[object Set]"==um(e)},e_=1,t_=2,n_=4,a_="[object Arguments]",i_="[object Function]",r_="[object GeneratorFunction]",o_="[object Object]",s_={};function c_(e,t,n,a,i,r){var o,s=t&e_,c=t&t_,l=t&n_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!dh(e))return e;var d=cp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Sf.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Tm(e,o)}else{var u=um(e),h=u==i_||u==r_;if(Cp(e))return Am(e,s);if(u==o_||u==a_||h&&!i){if(o=c||h?{}:Rm(e),!s)return c?function(e,t){return Wm(e,Mf(e),t)}(e,function(e,t){return e&&Wm(t,Gm(t),e)}(o,e)):function(e,t){return Wm(e,pp(e),t)}(e,function(e,t){return e&&Wm(t,Wp(t),e)}(o,e))}else{if(!s_[u])return i?e:{};o=Gf(e,u,s)}}r||(r=new Rh);var p=r.get(e);if(p)return p;r.set(e,o),Jf(e)?e.forEach((function(a){o.add(c_(a,t,n,a,e,r))})):Kf(e)&&e.forEach((function(a,i){o.set(i,c_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?kf:Zp:c?Gm:Wp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new g_(e):new DOMException(e),__=e=>{const t=void 0===e.reason?f_("This operation was aborted."):e.reason;return t instanceof Error?t:f_(t)};class v_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class y_ extends p_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:v_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(__(e)),e.addEventListener("abort",(()=>{c(__(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new m_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof m_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var b_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},w_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},x_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},C_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},M_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},k_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},S_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},E_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},$_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},A_={unseekable:"Seek time not found in media"},I_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},z_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},T_={select_date:"Choose date"},j_={common:b_,config:w_,display_modes:x_,editor:C_,elements:M_,error:k_,event:S_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:I_,thumbnail:z_,timeline:T_},O_=Object.freeze({__proto__:null,common:b_,config:w_,default:j_,display_modes:x_,editor:C_,elements:M_,error:k_,event:S_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:I_,thumbnail:z_,timeline:T_});const D_="en",R_={[D_]:O_};let P_;function L_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in R_)return n}return D_}function N_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),R_[P_??D_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),R_[D_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function F_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const V_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},H_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,B_=(e,t,n)=>!!H_(e,t,n),q_=(e,t)=>{const n=B_(e,t,{phase:"start"})&&B_(e,t,{phase:"stop"}),a=B_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},U_=e=>{const t=q_(e,"left"),n=q_(e,"right"),a=q_(e,"up"),i=q_(e,"down"),r=q_(e,"zoom_in"),o=q_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class W_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Is)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function Z_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function kv(e,t,n,a){return null==e?[]:(cp(t)||(t=null==t?[]:[t]),cp(n=a?void 0:n)||(n=null==n?[]:[n]),Mv(e,t,n))}async function Sv(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new $s(N_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new $s(N_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new $s(N_("error.invalid_response"),{request:n,response:i,invalid_keys:Os(r.error)});return r.data}const Ev=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Ev).nullable().optional()}))),$v="video",Av="image",Iv=60,zv=e=>kv(e,(e=>e._metadata?.startDate),"desc");class Tv{async walkBrowseMedias(e,t,n){return t&&t.length?(await Jg(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?cg(e,t,n):void 0===t)?1:G_(Mg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Q_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await Sv(e,Ev,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Bd(new Date,{seconds:60})),o}}function jv(e,t){return vm(e,t)}function Ov(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nPv(t,e)))}add(e){this._ranges.push(e),this._ranges=Nv(this._ranges)}clear(){this._ranges=[]}}class Rv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Lv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Nv=(e,t=0)=>{const n=[];e=kv(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Fv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return jv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Bv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new Hv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class qv extends $s{}class Uv extends $s{}var Wv,Zv,Qv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Wv||(Wv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Zv||(Zv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Qv||(Qv={}));const Gv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Yv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Qv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-7a4c33a6.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Qv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-b057d766.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Bv,new Vv,t.eventCallback);break;case Qv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-1c667c17.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Tv,t.resolvedMediaCache,new Vv,t.eventCallback);break;case Qv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-86c7521a.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Tv,t.resolvedMediaCache,new Vv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Qv.Frigate;else if("motioneye"===t.engine)n=Qv.MotionEye;else if("generic"===t.engine)n=Qv.Generic;else if("reolink"===t.engine)n=Qv.Reolink;else{const a=Gv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Qv.Generic;throw new qv(N_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Qv.Frigate;break;case"motioneye":n=Qv.MotionEye;break;case"reolink":n=Qv.Reolink;break;default:n=Qv.Generic}}else t.frigate.camera_name?n=Qv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Qv.Generic)}return n}}class Kv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await Jg(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const Xv=e=>{return kv((n=e=>e.getID()??e,(t=e)&&t.length?Fg(t,bv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class Jv{static isEventQuery(e){return e.type===Wv.Event}static isRecordingQuery(e){return e.type===Wv.Recording}static isRecordingSegmentsQuery(e){return e.type===Wv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Wv.MediaMetadata}}class ey{static isEventQueryResult(e){return e.type===Zv.Event}static isRecordingQueryResult(e){return e.type===Zv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Zv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Zv.MediaMetadata}}class ty{constructor(e,t){this._requestLimit=new y_,this._api=e,this._engineFactory=t?.factory??new Yv(this._api.getEntityRegistryManager()),this._store=t?.store??new Kv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=l_(e?.cameras_global),dg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,N_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await Jg(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new qv(N_("error.no_camera_engine"),l_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await Jg(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=F_(e.getConfig());if(!t)throw await r(),new qv(N_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new qv(N_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Wv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Wv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Wv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Ug(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jv.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):Jv.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):Jv.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Wv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=Xv(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Bd(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=qg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jv.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):Jv.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):Jv.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):Jv.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(rf);return new W_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=H_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class ny{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ay=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class iy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await Sv(e,ay,{type:"config/device_registry/list"})}catch(e){return void Zg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const ry=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),oy=ry.array();class sy{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await Sv(e,ry,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Zg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await Sv(e,oy,{type:"config/entity_registry/list"})}catch(e){return void Zg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class cy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class ly{constructor(){this._cache=new cy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const dy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await Sv(e,zs,i)}catch(e){Zg(e)}return n&&r&&n.set(t,r),r};class uy{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class hy extends uy{}class py extends hy{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class my extends hy{async execute(e){e.getCameraURLManager().openURL()}}class gy extends hy{async execute(e){await e.getViewManager().setViewDefaultWithNewQuery()}}class fy extends hy{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class _y extends hy{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class vy extends hy{async execute(e){e.getExpandManager().toggleExpanded()}}class yy extends hy{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class by extends uy{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class wy extends hy{async execute(e){console[this._action.level](this._action.message)}}const xy=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,Cy=e=>xy(e)!==e.camera,My=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class ky extends hy{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,xy(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class Sy extends hy{async execute(e){e.getCardElementManager().toggleMenu()}}class Ey extends hy{async execute(e){await e.getMicrophoneManager().connect()}}class $y extends hy{async execute(e){e.getMicrophoneManager().disconnect()}}class Ay extends hy{async execute(e){e.getMicrophoneManager().mute()}}class Iy extends hy{async execute(e){await e.getMicrophoneManager().unmute()}}class zy extends hy{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Ty extends hy{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class jy extends hy{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Oy=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=xy(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Dy(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Dy=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ry=lg((function(e,t,n){Km(e,t,n)}));const Py=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Ly=(e,t,n,a)=>{Ry(t,{[n]:{[e]:{inProgressAction:a}}})};class Ny extends hy{constructor(){super(...arguments),this._timer=new bf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Oy(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Py(n,this._context.ptz),Ly(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Py(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Fy extends hy{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function Vy(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=wg(n))==n?n:0),void 0!==t&&(t=(t=wg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(wg(e),t,n)}const Hy=50,By=50,qy=1,Uy=4,Wy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Zy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Qy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Gy=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Zy(Qy(n,{observed:e.detail}))]})};class Yy extends hy{constructor(){super(...arguments),this._timer=new bf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Qy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Oy(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Py(n,this._context.ptzDigital),Ly(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Py(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:Vy(t+i,1,10),pan:{x:Vy(n+r,0,100),y:Vy(a+o,0,100)}}}}class Ky extends hy{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Dy(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Oy(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Ny(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Yy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class Xy extends hy{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class Jy extends hy{async execute(e){var t;await tf((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class eb extends hy{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class tb{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class nb extends hy{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new tb]})}}class ab{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=xy(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;My(e,t[i])}}class ib extends hy{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab(e)]})}}class rb{constructor(e){this._substreamID=e}modify(e){My(e,this._substreamID)}}class ob extends hy{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(this._action.camera)]})}}class sb extends hy{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class cb extends hy{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class lb{createAction(e,t,n){const a=hf(t);if("fire-dom-event"!==t.action||!a)return new by(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new gy(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new cb(e,a,n?.config);case"sleep":return new Jy(e,a,n?.config);case"download":return new _y(e,a,n?.config);case"camera_ui":return new my(e,a,n?.config);case"expand":return new vy(e,a,n?.config);case"fullscreen":return new yy(e,a,n?.config);case"menu_toggle":return new Sy(e,a,n?.config);case"camera_select":return new py(e,a,n?.config);case"live_substream_select":return new ob(e,a,n?.config);case"live_substream_off":return new nb(e,a,n?.config);case"live_substream_on":return new ib(e,a,n?.config);case"media_player":return new ky(e,a,n?.config);case"microphone_connect":return new Ey(e,a,n?.config);case"microphone_disconnect":return new $y(e,a,n?.config);case"microphone_mute":return new Ay(e,a,n?.config);case"microphone_unmute":return new Iy(e,a,n?.config);case"mute":return new zy(e,a,n?.config);case"unmute":return new sb(e,a,n?.config);case"play":return new jy(e,a,n?.config);case"pause":return new Ty(e,a,n?.config);case"screenshot":return new Xy(e,a,n?.config);case"display_mode_select":return new fy(e,a,n?.config);case"ptz":return new Ny(e,a,n?.config);case"ptz_digital":return new Yy(e,a,n?.config);case"ptz_multi":return new Ky(e,a,n?.config);case"ptz_controls":return new Fy(e,a,n?.config);case"log":return new wy(e,a,n?.config);case"status_bar":return new eb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class db{constructor(e,t,n){this._actions=[],this._factory=new lb,this._stopped=!1,this._context=e;for(const a of qg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const ub=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),hb=ba.object({detail:ub});class pb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=hb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=_f(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new db(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class mb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:N_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class gb{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const fb=()=>!!navigator.userAgent.match(/CrKey\//),_b=(e,t)=>!!((e.attributes.supported_features??0)&t),vb=e=>(e=>_b(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,yb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},bb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},wb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},xb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Cb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},Mb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},kb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?Mb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Cb[a]},Sb=e=>{const t=e?.attributes.device_class;if(t&&t in xb)return xb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return kb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},Eb="mdi:bookmark",$b={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function Ab(e,t,n,a){switch(e){case"alarm_control_panel":return yb(n);case"binary_sensor":return bb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return wb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Sb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?$b[e]:"mdi:weather-night";case"update":return"on"===t?.state?vb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in $b?$b[e]:a??Eb}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await Sv(e,Ts,a);return i?e.hassUrl(i.path):null}function zb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function Tb(e,t,n,a){return!!zb(e,t,n,{...a,firstOnly:!0}).length}function jb(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Ob(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Db(e){return{color:Ob(e),filter:jb(e)}}function Rb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Db(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Lb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Pb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Lb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:Ab(Ye(t),a,a?.state,n)}const Nb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Fb=e=>!!e&&["on","open"].includes(e),Vb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Hb(e){return!!e?.startsWith("/")}function Bb(e,t){return Hb(t)?e.hassUrl(t):t??null}class qb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await Jg(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Ub;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Ub||(Ub={}));class Wb{constructor(e,t){this._initializationQueue=new y_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new qb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Ub.LANGUAGES,Ub.SIDE_LOAD_ELEMENTS,Ub.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Ub.MICROPHONE_CONNECT]:[],Ub.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Ub.LANGUAGES]:async()=>await(async e=>{const t=L_(e);return"ca"===t?R_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?R_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?R_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?R_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(R_[t]=await import("./lang-fr-ea16daba.js")),t&&(P_=t),!0})(e),[Ub.SIDE_LOAD_ELEMENTS]:async()=>await Nb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Ub.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Ub.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Ub.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Zb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),af(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),af(this._element,fb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){af(this._element,!1,"panel"),af(this._element,!1,"tabindex"),af(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Ub.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Qb(e,t,n){return null==e?e:function(e,t,n,a){if(!dh(e))return e;for(var i=-1,r=(t=rv(t,e)).length,o=r-1,s=e;null!=s&&++i{Qb(e,t,n)},Kb=(e,t,n)=>mv(e,t,n),Xb=(e,t)=>{!function(e,t){null==e||Gb(e,t)}(e,t)},Jb=e=>l_(e),ew=(e,t)=>e.replace("#",`[${t.toString()}]`),tw=function(e){let t=!1;for(let n=0;n{const i=Kb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&jv(i,r)||(null===r?a?.keepOriginal||(Xb(e,t),0):void 0===r||(a?.keepOriginal||Xb(e,t),Yb(e,n,r),0)))})(a,e,t,n)}},iw=function(e,t,n){return function(a){let i=aw(e,t,n)(a);return i=sw(vs,aw(e,t,n),(e=>e.overrides))(a)||i,i}},rw=function(e,t){return iw(e,e,{transform:t})},ow=function(e){return iw(e,e,{transform:e=>null})},sw=function(e,t,n){return function(a){let i=!1;const r=Kb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},cw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},lw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),dw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},uw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),pw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),mw=[sw(vs,lw,(e=>e.conditions)),e=>cw(lw,(e=>e.conditions))("object"==typeof e&&e?e[Ai]:{}),iw("event_gallery",ir),iw("menu.buttons.frigate_ui",ns),e=>cw(pw)("object"==typeof e&&e?e:{}),sw(wa,rw("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),iw("live.jsmpeg",Ci),iw("live.image",wi),iw("live.webrtc_card",Mi),sw(wa,iw("frigate.zone","frigate.zones",{transform:e=>qg(e)})),sw(wa,iw("frigate.label","frigate.labels",{transform:e=>qg(e)})),e=>cw(hw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ai in e)||!Array.isArray(e[Ai]))return!1;let t=!1;const n=n=>{if(!t){if(!mv(e,"live.controls.ptz")){const{type:t,...a}=n;Qb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ai]);return t&&(i.length?e[Ai]=i:delete e[Ai]),t},iw("view.timeout_seconds",Oi),rw("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qg(e))),rw("live.auto_play",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qg(e))),rw("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:qg(e))),rw("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:qg(e))),iw("live.controls.thumbnails.media",no),iw("timeline.media",Fo),iw("live.controls.timeline.media",uo),iw("media_viewer.controls.timeline.media",Or),iw("view.scan",Yi),iw("view.triggers.enabled",tr,{transform:e=>!0===e?"live":null,keepOriginal:!0}),iw("view.triggers.enabled",Xi,{transform:e=>!0!==e&&null}),iw("view.triggers.untrigger_reset",nr,{transform:e=>e?"default":null}),iw("live.layout",Ei),ow("media_viewer.layout"),ow("image.layout"),sw(vs,dw),e=>cw(dw)("object"==typeof e&&e?e[Ai]:{}),e=>cw(dw)("object"==typeof e&&e?e.automations:{}),sw(wa,iw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),iw("performance.profile",Ss,{transform:e=>"low"===e?["low-performance"]:null}),sw(vs,aw("overrides","merge")),iw("live.controls.ptz",$i,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),rw("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),iw("view.update_cycle_camera",qi),iw("view.update_force",Wi,{transform:e=>!0===e?"all":null}),iw("view.update_seconds",Zi),iw("view.update_entities",Qi),aw("live.controls.title",cs,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),ow("live.controls.title"),ow("media_viewer.controls.title"),e=>cw(uw)("object"==typeof e&&e?e:{}),iw("dimensions.max_height",_s),ow("dimensions.min_height")];class gw extends $s{}class fw extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function _w(e,t,n){let a=Jb(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Xb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Yb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Yb(a,e,Ry({},Kb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=df(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new gw(N_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class vw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=fl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>jv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const yw={casting:{[Wr]:!1,[Mr]:!1,[Xo]:"none",[`${is}.enabled`]:!0,[`${rs}.enabled`]:!0,[`${as}.enabled`]:!1,[`${os}.enabled`]:!1,[Ur]:["selected","visible"],[fs]:"static",[gs]:"16:9",[Si]:1,[So]:!0},"low-performance":{[ao]:"none",[Er]:"none",[Bo]:"none",[mo]:!1,[Pr]:!1,[Vo]:!1,[qr]:[],[hr]:[],[pr]:[],[mr]:[],[Co]:["unselected","hidden"],[wo]:!1,[br]:!1,[ko]:"none",[Cr]:"none",[So]:!1,[kr]:"chevrons",[ds]:"none",[Xo]:"outside",[`${ts}.enabled`]:!1,[`${ss}.enabled`]:!1,[`${ss}.enabled`]:!1,[`${os}.enabled`]:!1,[sr]:!1,[cr]:!1,[lr]:!1,[or]:!1,[oo]:!1,[so]:!1,[co]:!1,[ro]:!1,[Ar]:!1,[Ir]:!1,[zr]:!1,[$r]:!1,[Wo]:!1,[Zo]:!1,[Qo]:!1,[Uo]:!1,[bs]:!1,[ws]:10,[ks]:!1,[Ms]:!1,[xr]:!1,[ki]:!1,[xi]:"image",[Si]:10,[tr]:"none",[xs]:1},scrubbing:{[ho]:"below",[go]:"ribbon",[po]:"seek",[Dr]:"below",[Lr]:"ribbon",[Rr]:"seek"}},bw=(e,t,n)=>{const a=js(Pd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in yw&&Object.entries(yw[e]).forEach((([e,n])=>{return r=n,void(void 0===Kb(i,a=e)&&Yb(t,a,r));var a,r}));return t},ww=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},xw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=ww(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[ff({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[ff({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[ff()],tag:e}),n};class Cw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(N_("error.invalid_configuration"));const t=Pd.safeParse(e);if(!t.success){const n=nw(e),a=Ds(t.error);let i="";throw n&&(i=`${N_("error.upgrade_available")}. `),new Error(i+`${N_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):N_("error.invalid_configuration_no_hint")))}const n=bw(e,t.data,t.data.profiles);var a;(this._rawConfig=e,jv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Ub.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=xw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=_w(e,this._config,{configOverrides:this._config.overrides,schema:Pd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(jv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||jv(n?.cameras,this._overriddenConfig?.cameras)&&jv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Ub.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Ub.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class Mw{constructor(e){this._timer=new bf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){jv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[pf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const kw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Sw=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new $s(N_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Zg(e)}if(!t)throw new $s(N_("error.download_sign_failed"));i=t}kw(i)},Ew=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class $w{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Sw(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&kw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${qu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class Aw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],zw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),Tw={change:zw.fullscreenchange,error:zw.fullscreenerror};let jw={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{jw.off("change",i),n()};jw.on("change",i);const r=e[zw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!jw.isFullscreen)return void e();const n=()=>{jw.off("change",n),e()};jw.on("change",n);const a=document[zw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>jw.isFullscreen?jw.exit():jw.request(e,t),onchange(e){jw.on("change",e)},onerror(e){jw.on("error",e)},on(e,t){const n=Tw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=Tw[e];n&&document.removeEventListener(n,t,!1)},raw:zw};Object.defineProperties(jw,{isFullscreen:{get:()=>Boolean(document[zw.fullscreenElement])},element:{enumerable:!0,get:()=>document[zw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[zw.fullscreenEnabled])}}),zw||(jw={isEnabled:!1});var Ow=jw;class Dw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Ow.isEnabled&&Ow.on("change",this._fullscreenHandler)}disconnect(){Ow.isEnabled&&Ow.off("change",this._fullscreenHandler)}isInFullscreen(){return Ow.isEnabled&&Ow.isFullscreen}toggleFullscreen(){Ow.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Ow.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Rw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=zb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Pw{constructor(e){this._hass=null,this._stateWatcher=new Rw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:N_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Lw=function(){return Ju.Date.now()},Nw="Expected a function",Fw=Math.max,Vw=Math.min;function Hw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Nw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Lw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Vw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Lw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=wg(t)||0,dh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Fw(wg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Lw())},_}function Bw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return dh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Hw(e,t,{leading:a,maxWait:t,trailing:i})}class qw{constructor(e){this._timer=new bf,this.reportInteraction=Bw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Uw{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};jv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Ww(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Zw(e,t,n){const a=Ww(t,n);a&&Qw(e,a)}function Qw(e,t){Vg(e,"media:loaded",t)}function Gw(e){Vg(e,"media:unloaded")}function Yw(e){Vg(e,"media:volumechange")}function Kw(e){Vg(e,"media:play")}function Xw(e){Vg(e,"media:pause")}class Jw{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class ex{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class tx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&_b(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Zg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(_b(n,4096))a="media_stop";else{if(!_b(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:N_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:ex.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class nx{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Zg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof $s&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?As[this._message.type]:0,n=As[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class ix{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=mf(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=pf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class rx{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!jv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class ox{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);af(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return lf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return lf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return lf({defaultStatic:!0})}}class sx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=Bw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=kv([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;jv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new bf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function cx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Fg(e,void 0,t):[]}class lx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return l_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Ug(e)}))),this._queries=cx(t,jv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class dx extends lx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class ux extends lx{}class hx{static areEventQueries(e){return e instanceof dx}static areRecordingQueries(e){return e instanceof ux}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const px=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},mx=(e,t)=>Ry({},e,t);class gx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new gx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new gx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=mx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const fx=(e,t)=>{t?.forEach((t=>t.modify(e)))};class _x extends $s{}class vx extends $s{}class yx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...px(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=px(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new _x(N_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Ws)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new vx(N_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Ws}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new gx(o);return fx(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!px(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class bx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class wx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const xx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Cx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Cx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class kx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new dx(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new ux(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new Mx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>xx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Sx{constructor(e,t){this._api=e,this._executor=t??new kx(e)}async getExistingQueryModifiers(e,t){return e.query?[new wx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new wx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Zy({timeline:{window:{start:Wu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new bx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Zy({mediaViewer:{seek:e}})]:[new bx("mediaViewer","seek")]}}class Ex{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new yx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Sx(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),fx(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=hx.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!px(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&xy(e)!==xy(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class $x{constructor(e,t,n,a){this._deviceRegistryManager=new iy(new ny((e=>e.id))),this._entityRegistryManager=new sy(new ny((e=>e.entity_id))),this._resolvedMediaCache=new ly,this._actionsManager=new pb(this),this._automationsManager=new mb(this),this._cameraManager=new ty(this),this._cameraURLManager=new gb(this),this._configManager=new Cw(this),this._defaultManager=new Mw(this),this._downloadManager=new $w(this),this._expandManager=new Aw(this),this._fullscreenManager=new Dw(this),this._hassManager=new Pw(this),this._initializationManager=new Wb(this),this._interactionManager=new qw(this),this._keyboardStateManager=new Uw(this),this._mediaLoadedInfoManager=new Jw(this),this._mediaPlayerManager=new tx(this),this._messageManager=new nx(this),this._microphoneManager=new ax(this),this._queryStringManager=new ix(this),this._statusBarItemManager=new rx(this),this._styleManager=new ox(this),this._triggersManager=new sx(this),this._viewManager=new Ex(this),e.addController(this),this._conditionsManager=new vw(this,a),this._cardElementManager=new Zb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-539261f9.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class Ax{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(rf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?pf("menu_toggle"):pf("default"),hold_action:pf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=mf("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=xy(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:N_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:pf(Cy(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=mf("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:N_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:pf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:pf("clips"),hold_action:pf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:pf("snapshots"),hold_action:pf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:pf("recordings"),hold_action:pf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:pf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:pf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!fb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.download"),tap_action:pf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.camera_ui"),tap_action:pf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:pf("microphone_unmute"),end_tap_action:pf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:pf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.expand"),tap_action:pf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return fb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.fullscreen"),tap_action:pf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Pb(e,t)||t,a=e.states[t],i=gf(t,"play"),r=gf(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Lb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.play"),tap_action:pf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.mute"),tap_action:pf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.screenshot"),tap_action:pf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?px(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Oy(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Oy(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_home"),tap_action:ff({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Us.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var zx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Px(e,t){return Tx.repeat(" ",t-e.length)+e}var Lx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Rx(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=Tx.repeat(" ",t.indent)+Px((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Rx(e.buffer,i[o],r[o],e.position,u),l+=Tx.repeat(" ",t.indent)+Px((e.line+1).toString(),d)+" | "+c.str+"\n",l+=Tx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Rx(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=Tx.repeat(" ",t.indent)+Px((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Nx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Fx=["scalar","sequence","mapping"];var Vx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Nx.indexOf(t))throw new Dx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Fx.indexOf(this.kind))throw new Dx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Hx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function Bx(e){return this.extend(e)}Bx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Vx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Dx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Vx))throw new Dx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Dx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Dx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Vx))throw new Dx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Bx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Hx(a,"implicit"),a.compiledExplicit=Hx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),tC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var nC=/^[-+]?[0-9]+e/;var aC=new Vx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!tC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||Tx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Tx.isNegativeZero(e))return"-0.0";return n=e.toString(10),nC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),iC=Qx.extend({implicit:[Gx,Yx,eC,aC]}),rC=iC,oC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var cC=new Vx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==oC.exec(e)||null!==sC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=oC.exec(e))&&(t=sC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var lC=new Vx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),dC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var uC=new Vx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=dC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=dC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=dC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),hC=Object.prototype.hasOwnProperty,pC=Object.prototype.toString;var mC=new Vx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var BC=new Array(256),qC=new Array(256),UC=0;UC<256;UC++)BC[UC]=VC(UC)?1:0,qC[UC]=VC(UC);function WC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||yC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function ZC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Lx(n),new Dx(t,n)}function QC(e,t){throw ZC(e,t)}function GC(e,t){e.onWarning&&e.onWarning.call(null,ZC(e,t))}var YC={YAML:function(e,t,n){var a,i,r;null!==e.version&&QC(e,"duplication of %YAML directive"),1!==n.length&&QC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&QC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&QC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&GC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&QC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],zC.test(a)||QC(e,"ill-formed tag handle (first argument) of the TAG directive"),bC.call(e.tagMap,a)&&QC(e,'there is a previously declared suffix for "'+a+'" tag handle'),TC.test(i)||QC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){QC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function KC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=Tx.repeat("\n",t-1))}function iM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,QC(e,"tab characters must not be used in indentation")),45===a)&&RC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,tM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,sM(e,t,CC,!1,!0),o.push(e.result),tM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)QC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),sM(e,t,MC,!0,i)&&(_?g=e.result:f=e.result),_||(JC(e,h,p,m,g,f,o,s,c),m=g=f=null),tM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)QC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?QC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?QC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(DC(r)){do{r=e.input.charCodeAt(++e.position)}while(DC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!OC(r)&&0!==r)}for(;0!==r;){for(eM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),OC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=LC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:QC(e,"expected hexadecimal character");e.result+=HC(r),e.position++}else QC(e,"unknown escape sequence");n=a=e.position}else OC(s)?(KC(e,n,a,!0),aM(e,tM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&nM(e)?QC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}QC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!RC(a)&&!PC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&QC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),bC.call(e.anchorMap,n)||QC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],tM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(RC(d=e.input.charCodeAt(e.position))||PC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(RC(a=e.input.charCodeAt(e.position+1))||n&&PC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(RC(a=e.input.charCodeAt(e.position+1))||n&&PC(a))break}else if(35===d){if(RC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&nM(e)||n&&PC(d))break;if(OC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,tM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(KC(e,i,r,!1),aM(e,e.line-s),i=r=e.position,o=!1),DC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return KC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,wC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||QC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&iM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&QC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&QC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):QC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function cM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(tM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!RC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&QC(e,"directive name must not be less than one character in length");0!==i;){for(;DC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!OC(i));break}if(OC(i))break;for(t=e.position;0!==i&&!RC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&eM(e),bC.call(YC,n)?YC[n](e,n,a):GC(e,'unknown document directive "'+n+'"')}tM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,tM(e,!0,-1)):o&&QC(e,"directives end mark is expected"),sM(e,e.lineIndent-1,MC,!1,!0),tM(e,!0,-1),e.checkLineBreaks&&AC.test(e.input.slice(r,e.position))&&GC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&nM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,tM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function XM(e){return/^\n* /.test(e)}var JM=1,ek=2,tk=3,nk=4,ak=5;function ik(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return QM(e)&&e!==pM&&!ZM(e)&&e!==SM&&e!==IM&&e!==EM&&e!==kM&&e!==TM&&e!==jM&&e!==DM&&e!==PM&&e!==bM&&e!==xM&&e!==MM&&e!==vM&&e!==RM&&e!==$M&&e!==AM&&e!==CM&&e!==yM&&e!==wM&&e!==zM&&e!==OM}(KM(e,0))&&function(e){return!ZM(e)&&e!==EM}(KM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!QM(l=KM(e,c)))return ak;g=g&&YM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=KM(e,c))===gM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!QM(l))return ak;g=g&&YM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&XM(e)?ak:o?r===BM?ak:ek:h?nk:tk:!g||o||i(e)?r===BM?ak:ek:JM}function rk(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===BM?'""':"''";if(!e.noCompatMode&&(-1!==NM.indexOf(t)||FM.test(t)))return e.quotingType===BM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(ik(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+ok(t,e.indent)+sk(UM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,ck(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+ck(l,t),o=n}return r}(t,o),r));case ak:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=KM(e,i),!(t=LM[a])&&QM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||VM(a);return n}(t)+'"';default:throw new Dx("impossible error: invalid scalar style")}}()}function ok(e,t){var n=XM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function sk(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function ck(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function lk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function uk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,dk(e,n,!1)||dk(e,n,!0);var s,c=uM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Dx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&gM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=WM(e,t)),uk(e,t+1,s,!0,c)&&(e.dump&&gM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),uk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?lk(e,t-1,e.dump,i):lk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function hk(e,t){var n,a,i=[],r=[];for(pk(e,i,r),n=0,a=r.length;nq`
${gk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(fk)}};e([he({attribute:!1})],_k.prototype,"message",void 0),e([he({attribute:!1})],_k.prototype,"context",void 0),e([he({attribute:!1})],_k.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],_k.prototype,"dotdotdot",void 0),_k=e([le("frigate-card-message")],_k);let vk=class extends se{render(){if(this.message)return q` ${N_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(fk)}};e([he({attribute:!1})],vk.prototype,"message",void 0),vk=e([le("frigate-card-error-message")],vk);let yk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(fk)}};function bk(e){return"error"===e?.type?q` `:e?q` `:q``}function wk(e){return q` + + + `}function xk(e,t,n){!function(e,t,n,a){Vg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}(e,t,"error",{context:n?.context})}function Ck(e,t){t instanceof Error&&xk(e,t.message,{...t instanceof $s&&{context:t.context}})}e([he({attribute:!1})],yk.prototype,"message",void 0),e([he({attribute:!1})],yk.prototype,"animated",void 0),e([he({attribute:!1})],yk.prototype,"size",void 0),yk=e([le("frigate-card-progress-indicator")],yk);let Mk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(N_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Zg(e,console.error),new $s(N_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return Ck(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Mk.prototype,"elements",void 0),e([he({attribute:!1})],Mk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Mk.prototype,"hass",void 0),Mk=e([le("frigate-card-elements-core")],Mk);let kk=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Vg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Vg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],kk.prototype,"hass",void 0),e([he({attribute:!1})],kk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],kk.prototype,"elements",void 0),kk=e([le("frigate-card-elements")],kk);let Sk=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new fw(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-conditional")],Sk);class Ek extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Vg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Vg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ek.prototype,"_config",void 0);class $k extends Ek{constructor(){super("menu")}}let Ak=class extends $k{};Ak=e([le("frigate-card-menu-icon")],Ak);let Ik=class extends $k{};Ik=e([le("frigate-card-menu-state-icon")],Ik);let zk=class extends $k{};zk=e([le("frigate-card-menu-submenu")],zk);let Tk=class extends $k{};Tk=e([le("frigate-card-menu-submenu-select")],Tk);class jk extends Ek{constructor(){super("status-bar")}}let Ok=class extends jk{};Ok=e([le("frigate-card-status-bar-icon")],Ok);let Dk=class extends jk{};Dk=e([le("frigate-card-status-bar-image")],Dk);let Rk=class extends jk{};Rk=e([le("frigate-card-status-bar-string")],Rk);let Pk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Pk=e([le("frigate-card-loading")],Pk);const Lk=(e,t)=>{Vg(e,"action:execution-request",t)};class Nk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,af(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=_f(n,t);if(!a)return;const i=qg(a);let r=!1;const o=i.filter((e=>rf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Lk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=_f("hold",t),a=_f("double_tap",t),i=_f("tap",t),r=_f("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Rb(e,n):n}_sortButtons(){this._buttons=kv(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Bs:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=hf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Fk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Vk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Bk=e=>{switch(e){case"frigate":return Fk;case"motioneye":return Vk;case"reolink":return Hk;default:return null}};const qk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Uk=class extends se{_renderItem(e){if(!this.hass)return;const t=Rb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${Cf({hasHold:vf(e.hold_action),hasDoubleClick:vf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Bk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>yf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Uk.prototype,"hass",void 0),e([he({attribute:!1})],Uk.prototype,"submenu",void 0),Uk=e([le("frigate-card-submenu")],Uk);let Wk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||Tb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=qk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:Ab("select"),...Rb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Wk.prototype,"hass",void 0),e([he({attribute:!1})],Wk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Wk.prototype,"entityRegistryManager",void 0),e([pe()],Wk.prototype,"_optionTitles",void 0),Wk=e([le("frigate-card-submenu-select")],Wk);let Zk=class extends se{constructor(){super(...arguments),this._controller=new Nk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Bk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n overflow: visible;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Zk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Zk.prototype,"hass",void 0),Zk=e([le("frigate-card-menu")],Zk);let Qk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Qk=e([le("frigate-card-overlay")],Qk);class Gk{constructor(e){this._config=null,this._popupTimer=new bf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=kv(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||jv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=_f(e.detail.action,t);n&&Lk(this._host,{action:qg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){af(this._host,!1,"hide")}_hide(){af(this._host,!0,"hide")}}let Yk=class extends se{constructor(){super(...arguments),this._controller=new Gk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=Cf({hasHold:vf(e.actions?.hold_action),hasDoubleClick:vf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Bk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Yk.prototype,"items",void 0),e([he({attribute:!1})],Yk.prototype,"config",void 0),Yk=e([le("frigate-card-status-bar")],Yk);function Kk(e){return"number"==typeof e}function Xk(e){return"string"==typeof e}function Jk(e){return"boolean"==typeof e}function eS(e){return"[object Object]"===Object.prototype.toString.call(e)}function tS(e){return Math.abs(e)}function nS(e){return Math.sign(e)}function aS(e,t){return tS(e-t)}function iS(e){return lS(e).map(Number)}function rS(e){return e[oS(e)]}function oS(e){return Math.max(0,e.length-1)}function sS(e,t){return t===oS(e)}function cS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function lS(e){return Object.keys(e)}function dS(e,t){return[e,t].reduce(((e,t)=>(lS(t).forEach((n=>{const a=e[n],i=t[n],r=eS(a)&&eS(i);e[n]=r?dS(a,i):i})),e)),{})}function uS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function hS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function pS(e,t,n,a){const i=hS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function mS(e=0,t=0){const n=tS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function gS(e,t,n){const{constrain:a}=mS(0,e),i=e+1;let r=o(t);function o(e){return n?tS((i+e)%i):a(e)}function s(){return r}function c(){return gS(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function fS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=hS(),M=hS(),k=mS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,I=0,z=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!uS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=aS(t,I),c=aS(n,z);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*nS(e)),a=d.byDistance(e,!m).distance;return m||tS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),I=r.readPoint(e),z=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function _S(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(uS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&tS(c)>.1?c:0},readPoint:r}}function vS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(Jk(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(tS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function yS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=mS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=tS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&tS(u)e.add(i)))}};return c}function wS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>tS(e)-tS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>nS(e)===a));return r.length?c(r):rS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>tS(e.diff)-tS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function xS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(Jk(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Kk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function CS(e){let t=e;function n(e){return Kk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function MS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function kS(e,t,n,a,i,r,o,s,c){const l=.5,d=iS(i),u=iS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:CS(-1),translate:MS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function SS(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(Jk(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function ES(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return lS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function $S(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Kk(n);const p={groupSlides:function(e){return h?function(e,t){return iS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?iS(e).reduce(((n,h,p)=>{const m=rS(n)||0,g=0===m,f=h===oS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=tS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function AS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return Xk(e)?n[e](a):e(t,a,i)}};return i}(s,E),I=!u&&!!v,z=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return tS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(rS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=sS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(tS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,z,i),R=$S(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>rS(e)[o]-e[0][r])).map(tS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-tS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-rS(P)+rS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=mS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=sS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=rS(o);return mS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return aS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=I?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:mS(n?a-e:rS(t),a)}}(N,H,u),q=gS(oS(H),d,u),U=q.clone(),W=iS(n),Z=pS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=CS(Q),Y=CS(Q),K=CS(Q),X=CS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=nS(p),u=d,m},settled:function(){return tS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=wS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=hS(),ie=ES(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=sS(n,t);return a?cS(rS(n[0])+1):i?cS(oS(r)-rS(n)[0]+1,rS(n)[0]):e}))}()}}(I,v,H,V,R,W),oe=xS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:fS(S,e,a,i,X,_S(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:vS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:yS(B,K,X,J,$),scrollLooper:bS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:kS(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:SS(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:MS(S,t)};return se}const IS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function zS(e){function t(e,t){return dS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=lS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>lS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function TS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=zS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=hS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(IS,TS.globalOptions),x=l(w),C=[];function M(t){const n=AS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=Xk(t)?e.querySelector(t):t;v=a||e.children[0];const i=Xk(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(I),f.eventHandler.init(I),f.resizeHandler.init(I),f.slidesHandler.init(I),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(I),_=o.init(I,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const I={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),I}function jS(){return jS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=DS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===BS?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(DS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=HS&&e>=VS},b=function(){if(l.accelerationFactors.length>=qS){if(d&&(d=!1,RS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*qS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=ZS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return PS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),PS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var GS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function YS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(GS,YS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=QS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}YS.globalOptions=void 0;class KS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=sf(this._parent);!jv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._textDirection=n?.textDirection??"ltr",this._carousel=this._createCarousel(sf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Vg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=TS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable,direction:this._textDirection},[...this._plugins,...e.length>1?[YS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Vg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}const XS=e=>"rtl"===getComputedStyle(e).direction?"rtl":"ltr";let JS=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=Ie(),this._refRoot=Ie(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new KS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins,textDirection:XS(this)}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],JS.prototype,"direction",void 0),e([he({attribute:!0})],JS.prototype,"transitionEffect",void 0),e([he({attribute:!1})],JS.prototype,"loop",void 0),e([he({attribute:!1})],JS.prototype,"dragFree",void 0),e([he({attribute:!1})],JS.prototype,"dragEnabled",void 0),e([he({attribute:!1})],JS.prototype,"plugins",void 0),e([he({attribute:!1})],JS.prototype,"selected",void 0),JS=e([le("frigate-card-carousel")],JS); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const eE=window,tE=eE.ShadowRoot&&(void 0===eE.ShadyCSS||eE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nE=Symbol(),aE=new WeakMap;let iE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==nE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(tE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=aE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&aE.set(t,e))}return e}toString(){return this.cssText}};const rE=(e,t)=>{tE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=eE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},oE=tE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new iE("string"==typeof e?e:e+"",void 0,nE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var sE;const cE=window,lE=cE.trustedTypes,dE=lE?lE.emptyScript:"",uE=cE.reactiveElementPolyfillSupport,hE={toAttribute(e,t){switch(t){case Boolean:e=e?dE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},pE=(e,t)=>t!==e&&(t==t||e==e),mE={attribute:!0,type:String,converter:hE,reflect:!1,hasChanged:pE},gE="finalized";class fE extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=mE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||mE}static finalize(){if(this.hasOwnProperty(gE))return!1;this[gE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(oE(e))}else void 0!==e&&t.push(oE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return rE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=mE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:hE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:hE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||pE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}fE[gE]=!0,fE.elementProperties=new Map,fE.elementStyles=[],fE.shadowRootOptions={mode:"open"},null==uE||uE({ReactiveElement:fE}),(null!==(sE=cE.reactiveElementVersions)&&void 0!==sE?sE:cE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const _E=0,vE=Symbol();class yE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===vE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>pE(e,t[n]))):e!==t}}class bE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var wE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const xE=(e,t,n)=>{const a={...n?.cardWideConfig&&{cardWideConfig:n.cardWideConfig}};return q` ${e.render({initial:()=>n?.inProgressFunc?.()??wk(a),pending:()=>n?.inProgressFunc?.()??wk(a),error:e=>{Zg(e),n?.errorFunc&&n.errorFunc(e)},complete:t})}`},CE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,ME=(e,t,n,a=!0)=>new yE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(CE)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})).catch((e=>a(e))):a()})):null)(a,n):null},autoRun:a}),kE=300;let SE=class extends se{constructor(){super(),this._thumbnailError=!1,this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=ME(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===_E&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return!this._embedThumbnailTask||this._thumbnailError?e:q`${this.thumbnail?xE(this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e,errorFunc:()=>{this._thumbnailError=!0}}):e} `}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],SE.prototype,"thumbnail",void 0),e([he({attribute:!1})],SE.prototype,"hass",void 0),e([pe()],SE.prototype,"_thumbnailError",void 0),SE=e([le("frigate-card-thumbnail-feature-thumbnail")],SE);let EE=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${qu(this.date,"HH:mm")}
+
${qu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],EE.prototype,"date",void 0),e([he({attribute:!1})],EE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],EE.prototype,"showCameraTitle",void 0),EE=e([le("frigate-card-thumbnail-feature-text")],EE);let $E=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Gg(n):null,i=this.media.getEndTime(),r=n&&i?Xg(n,i):null,o=this.media.inProgress()?N_("event.in_progress"):null,s=Hg(this.media.getWhat()?.join(", "))??null,c=Hg(this.media.getWhere()?.join(", "))??null,l=Hg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?qu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(wE)}};e([he({attribute:!1})],$E.prototype,"media",void 0),e([he({attribute:!1})],$E.prototype,"seek",void 0),e([he({attribute:!1})],$E.prototype,"cameraTitle",void 0),$E=e([le("frigate-card-thumbnail-details-event")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Gg(e):null,n=this.media.getEndTime(),a=e&&n?Xg(e,n):null,i=this.media.inProgress()?N_("recording.in_progress"):null,r=this.seek?qu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(wE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-recording")],AE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!ex.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${ex.isEvent(this.media)&&e?q``:ex.isEvent(this.media)||ex.isRecording(this.media)?q``:q``} + ${r?q` {if(yf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Zg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&ex.isEvent(this.media)?q``:this.details&&ex.isRecording(this.media)?q``:q``} + ${a?q`{yf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new bE(["timeline"])]})}} + >`:""} + ${o?q` {if(yf(e),this.hass&&this.cameraManager&&this.media)try{await Sw(this.hass,this.cameraManager,this.media)}catch(e){Ck(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let zE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Vg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),yf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],zE.prototype,"hass",void 0),e([he({attribute:!1})],zE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],zE.prototype,"cameraManager",void 0),e([he({attribute:!1})],zE.prototype,"config",void 0),e([he({attribute:!1})],zE.prototype,"fadeThumbnails",void 0),zE=e([le("frigate-card-thumbnail-carousel")],zE);var TE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const jE=document.createElement("template");jE.innerHTML='\n
\n
\n';class OE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(jE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",OE);let DE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=Ie(),this._refSlot=Ie(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Qg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?sf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?sf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{yf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],DE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],DE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],DE.prototype,"open",void 0),e([he({attribute:!1})],DE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],DE.prototype,"empty",void 0),DE=e([le("frigate-card-drawer")],DE);let RE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=Ie(),this._refDrawerRight=Ie(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],RE.prototype,"drawerIcons",void 0),RE=e([le("frigate-card-surround-basic")],RE);let PE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-b6287e9c.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Vg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new bE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(TE)}};e([he({attribute:!1})],PE.prototype,"hass",void 0),e([he({attribute:!1})],PE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Wg})],PE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Wg})],PE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],PE.prototype,"cameraManager",void 0),e([he({attribute:!1})],PE.prototype,"cardWideConfig",void 0),PE=e([le("frigate-card-surround")],PE);var LE="Tue, 17 Dec 2024 02:53:00 GMT",NE="86439af",FE="Mon, 16 Dec 2024 18:51:46 -0800";const VE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),HE="hass_web_proxy",BE=(e,t)=>`/api/${HE}/v${t??0}/?url=${encodeURIComponent(e)}`,qE=(e,t,n="media")=>(e=>e.config.components.includes(HE))(e)&&!!t[n];async function UE(e,t,n){await e.callService(HE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const WE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await Sv(e,VE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let ZE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.13",browser:navigator.userAgent,date:new Date,lang:L_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:NE,build_date:LE,commit_date:FE},...e&&{ha_version:e.config.version},custom_integrations:{frigate:{...await WE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await WE(HE,e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return bk({message:N_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(TE)}};e([he({attribute:!1})],ZE.prototype,"hass",void 0),e([he({attribute:!1})],ZE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],ZE.prototype,"rawConfig",void 0),e([pe()],ZE.prototype,"_diagnostics",void 0),ZE=e([le("frigate-card-diagnostics")],ZE);let QE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-ffb1be06.js"),e?.isGalleryView()?import("./gallery-2c34cd79.js"):e?.isViewerView()?import("./index-7484e0d9.js"):e?.is("image")?import("./image-a1f2dfcd.js"):e?.is("timeline")&&import("./timeline-1b8cb550.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],QE.prototype,"cameraManager",void 0),e([he({attribute:!1})],QE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],QE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],QE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([he({attribute:!1})],QE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],QE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],QE.prototype,"hide",void 0),e([he({attribute:!1})],QE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],QE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),QE=e([le("frigate-card-views")],QE);console.info(`%c FRIGATE-HASS-CARD \n%c ${N_("common.version")} 6.0.13`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:N_("common.frigate_card"),description:N_("common.frigate_card_description"),preview:!0,documentationURL:"https://github.com/dermotduffy/frigate-hass-card"});let GE=class extends se{constructor(){super(...arguments),this._controller=new $x(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new Ax,this._refMenu=Ie(),this._refOverlay=Ie(),this._refMain=Ie(),this._refElements=Ie(),this._refViews=Ie()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await $x.getConfigElement()}static getStubConfig(e,t){return $x.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${bk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};GE=e([le("frigate-card")],GE);export{Al as $,Ji as A,er as B,Ui as C,tr as D,nr as E,ar as F,Di as G,Ri as H,Pi as I,Li as J,Ni as K,Fi as L,Vi as M,Hi as N,Bi as O,ps as P,qs as Q,es as R,Bs as S,Ho as T,Lo as U,No as V,Fo as W,Vo as X,Vs as Y,$l as Z,e as _,se as a,cr as a$,F_ as a0,ew as a1,et as a2,tw as a3,Ss as a4,ji as a5,zi as a6,Ti as a7,Oi as a8,qi as a9,Qr as aA,io as aB,ro as aC,so as aD,co as aE,oo as aF,to as aG,no as aH,ao as aI,ho as aJ,go as aK,fo as aL,lo as aM,uo as aN,mo as aO,po as aP,Xr as aQ,eo as aR,Jr as aS,Yr as aT,Kr as aU,Gr as aV,Eo as aW,Ao as aX,$o as aY,dr as aZ,or as a_,Xo as aa,Ko as ab,Yo as ac,Jo as ad,ds as ae,ls as af,hs as ag,Hs as ah,us as ai,Mo as aj,wo as ak,Io as al,xo as am,Co as an,Hr as ao,Br as ap,qr as aq,Ur as ar,ko as as,So as at,_o as au,bo as av,vo as aw,yo as ax,Wr as ay,Zr as az,pe as b,za as b$,lr as b0,sr as b1,rr as b2,hr as b3,pr as b4,mr as b5,gr as b6,br as b7,Fr as b8,wr as b9,Do as bA,qo as bB,Uo as bC,Zo as bD,Qo as bE,Wo as bF,Bo as bG,fs as bH,gs as bI,_s as bJ,bs as bK,ws as bL,Es as bM,xs as bN,ks as bO,Ms as bP,Xb as bQ,Yb as bR,Bk as bS,Bg as bT,xa as bU,Ka as bV,Qa as bW,Ra as bX,Pa as bY,Ca as bZ,Ta as b_,Cr as ba,xr as bb,fr as bc,yr as bd,_r as be,vr as bf,Mr as bg,kr as bh,Sr as bi,Tr as bj,$r as bk,Ir as bl,zr as bm,Ar as bn,Er as bo,Dr as bp,Lr as bq,Nr as br,jr as bs,Or as bt,Pr as bu,Rr as bv,Oo as bw,Ro as bx,To as by,jo as bz,Jb as c,Nd as c$,ja as c0,Ia as c1,Za as c2,Ba as c3,qa as c4,Ua as c5,Wa as c6,gi as c7,mi as c8,Oa as c9,ti as cA,ni as cB,Ma as cC,ka as cD,ui as cE,di as cF,pi as cG,hi as cH,Ld as cI,wa as cJ,Cs as cK,Qw as cL,Ie as cM,Gw as cN,cf as cO,bk as cP,je as cQ,Wg as cR,_w as cS,Jl as cT,Ck as cU,Gy as cV,XS as cW,yf as cX,xy as cY,ve as cZ,TE as c_,Da as ca,Fa as cb,Ha as cc,La as cd,Na as ce,Va as cf,Ga as cg,Ya as ch,Ja as ci,Xa as cj,_i as ck,fi as cl,vi as cm,yi as cn,Sa as co,Ea as cp,$a as cq,Aa as cr,ei as cs,ai as ct,ii as cu,ri as cv,oi as cw,si as cx,ci as cy,li as cz,nw as d,$s as d$,eu as d0,c as d1,dx as d2,Wv as d3,ux as d4,cx as d5,hx as d6,Zg as d7,kv as d8,qu as d9,bf as dA,Hw as dB,ME as dC,xE as dD,_f as dE,Lk as dF,ff as dG,Cf as dH,vf as dI,u_ as dJ,d_ as dK,Dv as dL,Rv as dM,Bd as dN,Nv as dO,Qg as dP,Gg as dQ,xx as dR,Zy as dS,mx as dT,ru as dU,rf as dV,Lv as dW,Fg as dX,ba as dY,ef as dZ,Sv as d_,Yg as da,Wu as db,Vg as dc,Bw as dd,tf as de,kE as df,Mx as dg,wk as dh,Ew as di,ex as dj,dy as dk,Hb as dl,Bb as dm,qE as dn,UE as dp,Ib as dq,BE as dr,Zw as ds,Yw as dt,Kw as du,Xw as dv,bx as dw,ge as dx,fe as dy,U as dz,_e as e,Gv as e0,qv as e1,U_ as e2,W_ as e3,Qv as e4,Kg as e5,Jg as e6,Zv as e7,Fk as e8,Fv as e9,Lb as eA,sf as eB,Hy as eC,By as eD,qy as eE,uf as eF,Wy as eG,Og as eH,Uy as eI,s as eJ,Ae as eK,ye as eL,W as eM,Ww as eN,yE as eO,me as eP,be as eQ,xe as eR,Tb as eS,nf as ea,Iv as eb,Vk as ec,Av as ed,$v as ee,zv as ef,Hk as eg,Yd as eh,Fd as ei,Zd as ej,Wd as ek,Qd as el,fu as em,Kd as en,Xd as eo,_u as ep,gu as eq,Vd as er,tu as es,pu as et,Tu as eu,Pu as ev,Lu as ew,Ru as ex,Fb as ey,Uv as ez,bw as f,Nb as g,Kb as h,jv as i,Pb as j,Hg as k,N_ as l,Gi as m,he as n,Zi as o,Rd as p,Wi as q,o as r,af as s,le as t,Qi as u,Vb as v,Yi as w,q as x,Xi as y,Ki as z}; diff --git a/www/community/frigate-hass-card/card-19444f74.js.gz b/www/community/frigate-hass-card/card-19444f74.js.gz new file mode 100644 index 00000000..ef3895a1 Binary files /dev/null and b/www/community/frigate-hass-card/card-19444f74.js.gz differ diff --git a/www/community/frigate-hass-card/card-320adb66.js b/www/community/frigate-hass-card/card-320adb66.js new file mode 100644 index 00000000..28d66bb8 --- /dev/null +++ b/www/community/frigate-hass-card/card-320adb66.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,y=_?_.emptyScript:"",v=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?y:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,v?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,I="?"+A,z=`<${I}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+z:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ye=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ve=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Ie=()=>new ze;let ze=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,yt=e=>"dirty"===e.status,vt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(vt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const It=/^c[^\s-]{8,}$/i,zt=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof vn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((yt(e)||yt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class yn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new yn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new yn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new yn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class vn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}vn.create=(e,t)=>new vn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!vt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>vt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class In extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}In.create=e=>new In({typeName:Pn.ZodNaN,...$t(e)});const zn=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(vt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=In.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=yn.create,ca=vn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,ya={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},va=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:yt,isValid:vt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:yn,ZodLazy:vn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:In,BRAND:zn,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:ya,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:va,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="cameras",xa=`${wa}.#.camera_entity`,Ca=`${wa}.#.frigate.camera_name`,Ma=`${wa}.#.capabilities.disable`,ka=`${wa}.#.capabilities.disable_except`,Sa=`${wa}.#.cast.method`,Ea=`${wa}.#.cast.dashboard.dashboard_path`,$a=`${wa}.#.cast.dashboard.view_path`,Aa=`${wa}.#.dimensions.aspect_ratio`,Ia=`${wa}.#.frigate.client_id`,za=`${wa}.#.frigate.labels`,Ta=`${wa}.#.frigate.url`,ja=`${wa}.#.frigate.zones`,Oa=`${wa}.#.go2rtc.modes`,Da=`${wa}.#.go2rtc.stream`,Ra=`${wa}.#.icon`,Pa=`${wa}.#.id`,La=`${wa}.#.image.entity`,Na=`${wa}.#.image.entity_parameters`,Fa=`${wa}.#.image.mode`,Va=`${wa}.#.image.refresh_seconds`,Ha=`${wa}.#.image.url`,Ba=`${wa}.#.motioneye.images.directory_pattern`,qa=`${wa}.#.motioneye.images.file_pattern`,Ua=`${wa}.#.motioneye.movies.directory_pattern`,Wa=`${wa}.#.motioneye.movies.file_pattern`,Za=`${wa}.#.motioneye.url`,Qa=`${wa}.#.title`,Ga=`${wa}.#.webrtc_card.entity`,Ya=`${wa}.#.webrtc_card.url`,Ka=`${wa}.#.live_provider`,Xa=`${wa}.#.dependencies.cameras`,Ja=`${wa}.#.dependencies.all_cameras`,ei=`${wa}.#.dimensions.layout.fit`,ti=`${wa}.#.dimensions.layout.pan.x`,ni=`${wa}.#.dimensions.layout.pan.y`,ai=`${wa}.#.dimensions.layout.position.x`,ii=`${wa}.#.dimensions.layout.position.y`,ri=`${wa}.#.dimensions.layout.view_box.top`,oi=`${wa}.#.dimensions.layout.view_box.bottom`,si=`${wa}.#.dimensions.layout.view_box.left`,ci=`${wa}.#.dimensions.layout.view_box.right`,li=`${wa}.#.dimensions.layout.zoom`,di=`${wa}.#.proxy.dynamic`,ui=`${wa}.#.proxy.media`,hi=`${wa}.#.proxy.ssl_ciphers`,pi=`${wa}.#.proxy.ssl_verification`,mi=`${wa}.#.reolink.media_resolution`,gi=`${wa}.#.reolink.url`,fi=`${wa}.#.triggers.motion`,_i=`${wa}.#.triggers.occupancy`,yi=`${wa}.#.triggers.entities`,vi=`${wa}.#.triggers.events`,bi="cameras_global",wi=`${bi}.image`,xi=`${bi}.live_provider`,Ci=`${bi}.jsmpeg`,Mi=`${bi}.webrtc_card`,ki=`${bi}.triggers.occupancy`,Si=`${bi}.image.refresh_seconds`,Ei=`${bi}.dimensions.layout`,$i=`${bi}.ptz`,Ai="elements",Ii="view",zi=`${Ii}.camera_select`,Ti=`${Ii}.dark_mode`,ji=`${Ii}.default`,Oi=`${Ii}.interaction_seconds`,Di=`${Ii}.keyboard_shortcuts`,Ri=`${Ii}.keyboard_shortcuts.enabled`,Pi=`${Di}.ptz_left`,Li=`${Di}.ptz_right`,Ni=`${Di}.ptz_up`,Fi=`${Di}.ptz_down`,Vi=`${Di}.ptz_zoom_in`,Hi=`${Di}.ptz_zoom_out`,Bi=`${Di}.ptz_home`,qi=`${Ii}.default_cycle_camera`,Ui=`${Ii}.default_reset`,Wi=`${Ui}.interaction_mode`,Zi=`${Ui}.every_seconds`,Qi=`${Ui}.entities`,Gi=`${Ui}.after_interaction`,Yi=`${Ii}.triggers`,Ki=`${Yi}.show_trigger_status`,Xi=`${Yi}.filter_selected_camera`,Ji=`${Yi}.untrigger_seconds`,er=`${Yi}.actions`,tr=`${er}.trigger`,nr=`${er}.untrigger`,ar=`${er}.interaction_mode`,ir="media_gallery",rr=`${ir}.controls.filter.mode`,or=`${ir}.controls.thumbnails.show_details`,sr=`${ir}.controls.thumbnails.show_download_control`,cr=`${ir}.controls.thumbnails.show_favorite_control`,lr=`${ir}.controls.thumbnails.show_timeline_control`,dr=`${ir}.controls.thumbnails.size`,ur="media_viewer",hr=`${ur}.auto_play`,pr=`${ur}.auto_pause`,mr=`${ur}.auto_mute`,gr=`${ur}.auto_unmute`,fr=`${ur}.display.mode`,_r=`${ur}.display.grid_columns`,yr=`${ur}.display.grid_max_columns`,vr=`${ur}.display.grid_selected_width_factor`,br=`${ur}.draggable`,wr=`${ur}.lazy_load`,xr=`${ur}.snapshot_click_plays_clip`,Cr=`${ur}.transition_effect`,Mr=`${ur}.controls.builtin`,kr=`${ur}.controls.next_previous.style`,Sr=`${ur}.controls.next_previous.size`,Er=`${ur}.controls.thumbnails.mode`,$r=`${ur}.controls.thumbnails.show_details`,Ar=`${ur}.controls.thumbnails.show_download_control`,Ir=`${ur}.controls.thumbnails.show_favorite_control`,zr=`${ur}.controls.thumbnails.show_timeline_control`,Tr=`${ur}.controls.thumbnails.size`,jr=`${ur}.controls.timeline.clustering_threshold`,Or=`${ur}.controls.timeline.events_media_type`,Dr=`${ur}.controls.timeline.mode`,Rr=`${ur}.controls.timeline.pan_mode`,Pr=`${ur}.controls.timeline.show_recordings`,Lr=`${ur}.controls.timeline.style`,Nr=`${ur}.controls.timeline.window_seconds`,Fr=`${ur}.zoomable`,Vr="live",Hr=`${Vr}.auto_play`,Br=`${Vr}.auto_pause`,qr=`${Vr}.auto_mute`,Ur=`${Vr}.auto_unmute`,Wr=`${Vr}.controls.builtin`,Zr=`${Vr}.controls.next_previous.style`,Qr=`${Vr}.controls.next_previous.size`,Gr=`${Vr}.controls.ptz.hide_home`,Yr=`${Vr}.controls.ptz.hide_pan_tilt`,Kr=`${Vr}.controls.ptz.hide_zoom`,Xr=`${Vr}.controls.ptz.mode`,Jr=`${Vr}.controls.ptz.orientation`,eo=`${Vr}.controls.ptz.position`,to=`${Vr}.controls.thumbnails.media_type`,no=`${Vr}.controls.thumbnails.events_media_type`,ao=`${Vr}.controls.thumbnails.mode`,io=`${Vr}.controls.thumbnails.size`,ro=`${Vr}.controls.thumbnails.show_details`,oo=`${Vr}.controls.thumbnails.show_download_control`,so=`${Vr}.controls.thumbnails.show_favorite_control`,co=`${Vr}.controls.thumbnails.show_timeline_control`,lo=`${Vr}.controls.timeline.clustering_threshold`,uo=`${Vr}.controls.timeline.events_media_type`,ho=`${Vr}.controls.timeline.mode`,po=`${Vr}.controls.timeline.pan_mode`,mo=`${Vr}.controls.timeline.show_recordings`,go=`${Vr}.controls.timeline.style`,fo=`${Vr}.controls.timeline.window_seconds`,_o=`${Vr}.display.mode`,yo=`${Vr}.display.grid_columns`,vo=`${Vr}.display.grid_max_columns`,bo=`${Vr}.display.grid_selected_width_factor`,wo=`${Vr}.draggable`,xo=`${Vr}.lazy_load`,Co=`${Vr}.lazy_unload`,Mo=`${Vr}.preload`,ko=`${Vr}.transition_effect`,So=`${Vr}.show_image_during_load`,Eo=`${Vr}.microphone.disconnect_seconds`,$o=`${Vr}.microphone.mute_after_microphone_mute_seconds`,Ao=`${Vr}.microphone.always_connected`,Io=`${Vr}.zoomable`,zo="image",To=`${zo}.entity`,jo=`${zo}.entity_parameters`,Oo=`${zo}.mode`,Do=`${zo}.refresh_seconds`,Ro=`${zo}.url`,Po="timeline",Lo=`${Po}.window_seconds`,No=`${Po}.clustering_threshold`,Fo=`${Po}.events_media_type`,Vo=`${Po}.show_recordings`,Ho=`${Po}.style`,Bo=`${Po}.controls.thumbnails.mode`,qo=`${Po}.controls.thumbnails.size`,Uo=`${Po}.controls.thumbnails.show_details`,Wo=`${Po}.controls.thumbnails.show_download_control`,Zo=`${Po}.controls.thumbnails.show_favorite_control`,Qo=`${Po}.controls.thumbnails.show_timeline_control`,Go="menu",Yo=`${Go}.alignment`,Ko=`${Go}.position`,Xo=`${Go}.style`,Jo=`${Go}.button_size`,es=`${Go}.buttons`,ts=`${es}.frigate`,ns=`${es}.camera_ui`,as=`${es}.fullscreen`,is=`${es}.play`,rs=`${es}.mute`,os=`${es}.media_player`,ss=`${es}.timeline`,cs="status_bar",ls=`${cs}.position`,ds=`${cs}.style`,us=`${cs}.popup_seconds`,hs=`${cs}.height`,ps=`${cs}.items`,ms="dimensions",gs=`${ms}.aspect_ratio`,fs=`${ms}.aspect_ratio_mode`,_s=`${ms}.height`,ys="overrides",vs="performance",bs=`${vs}.features.animated_progress_indicator`,ws=`${vs}.features.media_chunk_size`,xs=`${vs}.features.max_simultaneous_engine_requests`,Cs=`${vs}.profile`,Ms=`${vs}.style.box_shadow`,ks=`${vs}.style.border_radius`,Ss="profiles",Es=1e3;class $s extends Error{constructor(e,t){super(e),this.context=t}}const As={info:10,error:20,connection:30,diagnostics:40},Is=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],zs=ba.object({url:ba.string(),mime_type:ba.string()}),Ts=ba.object({path:ba.string()});function js(e){if(e instanceof ba.ZodDefault)return js(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(js(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(js(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(js(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(js(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>js(e)))):e}function Os(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ds=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ds(n).forEach(t.add,t)}else t.add(Rs(n.path));return t},Rs=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(Js,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),gc=mc.extend({frigate_card_action:ba.enum(Us)}),fc=mc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),_c=mc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),yc=mc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),vc=mc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),bc=mc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:nc}),wc=mc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional(),ptz_preset:ba.string().optional()}),xc=mc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:tc.optional(),pan:ec.optional()}).optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional()}),Cc=mc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Fs).optional(),ptz_phase:ba.enum(Ks).optional(),ptz_preset:ba.string().optional()}),Mc=mc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),kc=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),Sc=mc.extend({frigate_card_action:ba.literal("sleep"),duration:kc.optional().default({s:1})}),Ec=mc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>il)).array().optional()}),$c=mc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ac=ba.union([_c,fc,yc,$c,vc,wc,xc,Cc,Mc,gc,bc,Sc,Ec]),Ic=ba.union([rc,cc,sc,lc,dc,uc,pc,hc,Ac]),zc=ba.object({tap_action:Ic.or(Ic.array()).optional(),hold_action:Ic.or(Ic.array()).optional(),double_tap_action:Ic.or(Ic.array()).optional(),start_tap_action:Ic.or(Ic.array()).optional(),end_tap_action:Ic.or(Ic.array()).optional()}).passthrough(),Tc=ba.object({actions:zc.optional()}),jc=zc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Oc=jc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Dc=jc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Rc=jc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Pc=jc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Lc=jc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Nc=jc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Fc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Vc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),Hc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Bc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),qc=ba.discriminatedUnion("condition",[Fc,Vc,Hc,Bc]),Uc=ba.object({type:ba.literal("conditional"),conditions:qc.array(),elements:ba.lazy((()=>_l))}),Wc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Zc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Bs).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Qc=Zc.merge(Lc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Gc=Zc.merge(Dc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Zc),Yc=jc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Kc=Zc.merge(Lc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Yc.array()}),Xc=Zc.merge(Dc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Yc.deepPartial()).optional()}),Jc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),el=Jc.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:zc.optional()}),tl=el.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),nl=el.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),al=el.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),il=ba.union([tl,nl,al]),rl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),ol=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),sl=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),cl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ll=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),dl=ba.object({condition:ba.literal("display_mode"),display_mode:nc}),ul=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),hl=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),pl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),ml=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),gl=ba.discriminatedUnion("condition",[Fc,Vc,Hc,Bc,rl,ol,sl,cl,ll,dl,ul,hl,pl,ml]),fl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:gl.array(),elements:ba.lazy((()=>_l))}),_l=ba.union([Uc,Wc,fl,Lc,Nc,Qc,Gc,Kc,Xc,Pc,Oc,Dc,Rc,tl,nl,al]).array().optional(),yl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:ec.optional(),zoom:tc.optional()}),vl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),bl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},wl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},xl=ba.preprocess(wl("actions_"),ba.object({actions_left:sc.optional(),actions_left_start:sc.optional(),actions_left_stop:sc.optional(),actions_right:sc.optional(),actions_right_start:sc.optional(),actions_right_stop:sc.optional(),actions_up:sc.optional(),actions_up_start:sc.optional(),actions_up_stop:sc.optional(),actions_down:sc.optional(),actions_down_start:sc.optional(),actions_down_stop:sc.optional(),actions_zoom_in:sc.optional(),actions_zoom_in_start:sc.optional(),actions_zoom_in_stop:sc.optional(),actions_zoom_out:sc.optional(),actions_zoom_out_start:sc.optional(),actions_zoom_out_stop:sc.optional(),r2c_delay_between_calls_seconds:ba.number().default(bl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(bl.c2r_delay_between_calls_seconds),presets:ba.preprocess(wl(""),ba.union([ba.record(sc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),Cl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Ml=ba.object({mode:ba.enum(["off","auto","on"]).default(Cl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(Cl.position),orientation:ba.enum(["vertical","horizontal"]).default(Cl.orientation),hide_pan_tilt:ba.boolean().default(Cl.hide_pan_tilt),hide_zoom:ba.boolean().default(Cl.hide_zoom),hide_home:ba.boolean().default(Cl.hide_home),style:ba.object({}).passthrough().optional()}),kl={mode:"auto",refresh_seconds:1},Sl=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(kl.mode),refresh_seconds:ba.number().min(0).default(kl.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),El=Sl.merge(Tc).default(kl),$l=75,Al=300,Il={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},zl=ba.object({size:ba.number().min(75).max(300).default(Il.size),show_details:ba.boolean().default(Il.show_details),show_favorite_control:ba.boolean().default(Il.show_favorite_control),show_timeline_control:ba.boolean().default(Il.show_timeline_control),show_download_control:ba.boolean().default(Il.show_download_control)}),Tl={...Il,mode:"right"},jl=zl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Tl.mode)}),Ol=ba.enum(["all","clips","snapshots"]),Dl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Rl=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Pl=ba.object({clustering_threshold:ba.number().optional().default(Dl.clustering_threshold),events_media_type:Ol.optional().default(Dl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Dl.window_seconds),show_recordings:ba.boolean().optional().default(Dl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Dl.style),pan_mode:Rl.optional().default(Dl.pan_mode)}),Ll={...Dl,mode:"none",style:"ribbon"},Nl=Pl.extend({mode:ba.enum(["none","above","below"]).default(Ll.mode),style:Pl.shape.style.default(Ll.style)}),Fl={...Dl,controls:{thumbnails:Tl}},Vl=Pl.extend({controls:ba.object({thumbnails:jl.default(Fl.controls.thumbnails)}).default(Fl.controls)}).default(Fl),Hl=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Bl=ba.enum(["none","slide"]),ql={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Ul=ba.object({always_connected:ba.boolean().default(ql.always_connected),disconnect_seconds:ba.number().min(0).default(ql.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(ql.mute_after_microphone_mute_seconds)}).default(ql),Wl=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Zl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Ql=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Gl={...Tl,media_type:"events",events_media_type:"all"},Yl={auto_play:[...Qs],auto_pause:[],auto_mute:[...Ys],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:Cl,thumbnails:Gl,timeline:Ll},microphone:{...ql}},Kl=jl.extend({media_type:ba.enum(["events","recordings"]).default(Yl.controls.thumbnails.media_type),events_media_type:Ol.default(Yl.controls.thumbnails.events_media_type)}),Xl=ba.object({auto_pause:ba.enum(Zs).array().default(Yl.auto_pause),auto_play:ba.enum(Qs).array().default(Yl.auto_play),auto_mute:ba.enum(Ys).array().default(Yl.auto_mute),auto_unmute:ba.enum(Gs).array().default(Yl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Yl.controls.builtin),next_previous:Hl.extend({style:ba.enum(["none","chevrons","icons"]).default(Yl.controls.next_previous.style),size:Hl.shape.size.default(Yl.controls.next_previous.size)}).default(Yl.controls.next_previous),ptz:Ml.default(Yl.controls.ptz),thumbnails:Kl.default(Yl.controls.thumbnails),timeline:Nl.default(Yl.controls.timeline)}).default(Yl.controls),display:ac,draggable:ba.boolean().default(Yl.draggable),lazy_load:ba.boolean().default(Yl.lazy_load),lazy_unload:ba.enum(Zs).array().default(Yl.lazy_unload),microphone:Ul.default(Yl.microphone),preload:ba.boolean().default(Yl.preload),show_image_during_load:ba.boolean().default(Yl.show_image_during_load),transition_effect:Bl.default(Yl.transition_effect),zoomable:ba.boolean().default(Yl.zoomable)}).merge(Tc).default(Yl),Jl=ba.object({live:Xl}),ed=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),td={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:bl,triggers:{motion:!1,occupancy:!1,events:[...Xs],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"},always_error_if_entity_unavailable:!1},nd=ba.object({media:ba.boolean().or(ba.literal("auto")).default(td.proxy.media),dynamic:ba.boolean().default(td.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(td.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(td.proxy.ssl_ciphers)}),ad=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Is).array().optional(),disable_except:ba.enum(Is).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(td.dependencies.all_cameras),cameras:ba.string().array().default(td.dependencies.cameras)}).default(td.dependencies),triggers:ba.object({motion:ba.boolean().default(td.triggers.motion),occupancy:ba.boolean().default(td.triggers.occupancy),entities:ba.string().array().default(td.triggers.entities),events:ba.enum(Xs).array().default(td.triggers.events)}).default(td.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(td.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(td.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(td.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(td.motioneye.images.file_pattern)}).default(td.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(td.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(td.motioneye.movies.file_pattern)}).default(td.motioneye.movies)}).default(td.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(td.reolink.media_resolution)}).default(td.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(td.live_provider),go2rtc:Wl.optional(),image:Sl.optional().default(kl),jsmpeg:Ql.optional(),webrtc_card:Zl.optional(),cast:ed.optional(),ptz:xl.default(td.ptz),dimensions:ba.object({aspect_ratio:vl.optional(),layout:yl.optional()}).optional(),proxy:nd.default(td.proxy),always_error_if_entity_unavailable:ba.boolean().default(td.always_error_if_entity_unavailable)}).default(td),id=ad.array().min(1),rd={default:Ws,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Ls},od=ba.enum(["all","inactive","active"]).default("inactive"),sd=ba.object({actions:ba.object({interaction_mode:od,trigger:ba.enum(["default","live","media","none","update"]).default(rd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(rd.triggers.actions.untrigger)}).default(rd.triggers.actions),filter_selected_camera:ba.boolean().default(rd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(rd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(rd.triggers.untrigger_seconds)}),cd=ba.object({default:ba.enum(Us).default(rd.default),camera_select:ba.enum([...Us,"current"]).default(rd.camera_select),interaction_seconds:ba.number().default(rd.interaction_seconds),default_cycle_camera:ba.boolean().default(rd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(rd.default_reset.after_interaction),every_seconds:ba.number().default(rd.default_reset.every_seconds),entities:ba.string().array().default(rd.default_reset.entities),interaction_mode:od.default(rd.default_reset.interaction_mode)}).default(rd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:sd.default(rd.triggers),keyboard_shortcuts:Ns.default(rd.keyboard_shortcuts)}).merge(Tc).default(rd),ld=["left","right","top","bottom"],dd=ld,ud={priority:50,enabled:!0},hd={priority:50,enabled:!1},pd={alignment:"left",button_size:40,buttons:{camera_ui:ud,cameras:ud,clips:ud,ptz_home:hd,display_mode:ud,download:ud,expand:hd,frigate:ud,fullscreen:ud,image:hd,live:ud,media_player:ud,microphone:{...hd,type:"momentary"},mute:hd,play:hd,ptz_controls:hd,recordings:hd,screenshot:hd,snapshots:ud,substreams:ud,timeline:ud},position:"top",style:"hidden"},md=Zc.extend({enabled:Zc.shape.enabled.default(ud.enabled),priority:Zc.shape.priority.default(ud.priority)}),gd=Zc.extend({enabled:Zc.shape.enabled.default(hd.enabled),priority:Zc.shape.priority.default(hd.priority)}),fd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(pd.style),position:ba.enum(ld).default(pd.position),alignment:ba.enum(dd).default(pd.alignment),buttons:ba.object({camera_ui:md.default(pd.buttons.camera_ui),cameras:md.default(pd.buttons.cameras),clips:md.default(pd.buttons.clips),ptz_home:gd.default(pd.buttons.ptz_home),display_mode:md.default(pd.buttons.display_mode),download:md.default(pd.buttons.download),expand:gd.default(pd.buttons.expand),frigate:md.default(pd.buttons.frigate),fullscreen:md.default(pd.buttons.fullscreen),image:gd.default(pd.buttons.image),live:md.default(pd.buttons.live),media_player:md.default(pd.buttons.media_player),microphone:gd.extend({type:ba.enum(["momentary","toggle"]).default(pd.buttons.microphone.type)}).default(pd.buttons.microphone),mute:gd.default(pd.buttons.mute),play:gd.default(pd.buttons.play),ptz_controls:gd.default(pd.buttons.ptz_controls),recordings:gd.default(pd.buttons.recordings),screenshot:gd.default(pd.buttons.screenshot),snapshots:md.default(pd.buttons.snapshots),substreams:md.default(pd.buttons.substreams),timeline:md.default(pd.buttons.timeline)}).default(pd.buttons),button_size:ba.number().min(20).default(pd.button_size)}).default(pd),_d={priority:50,enabled:!0},yd={height:46,items:{engine:_d,resolution:_d,technology:_d,title:_d},position:"bottom",style:"popup",popup_seconds:3},vd=ba.object({position:ba.enum(["top","bottom"]).default(yd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(yd.style),popup_seconds:ba.number().min(0).max(60).default(yd.popup_seconds),height:ba.number().min(20).default(yd.height),items:ba.object({engine:Jc.default(yd.items.engine),technology:Jc.default(yd.items.technology),resolution:Jc.default(yd.items.resolution),title:Jc.default(yd.items.title)}).default(yd.items)}).default(yd),bd={auto_play:[...Qs],auto_pause:[...Zs],auto_mute:[...Zs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Tl,timeline:Ll,ptz:{...Cl,mode:"off"}}},wd=Hl.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(bd.controls.next_previous.style),size:Hl.shape.size.default(bd.controls.next_previous.size)}),xd=ba.object({auto_play:ba.enum(Qs).array().default(bd.auto_play),auto_pause:ba.enum(Zs).array().default(bd.auto_pause),auto_mute:ba.enum(Zs).array().default(bd.auto_mute),auto_unmute:ba.enum(Qs).array().default(bd.auto_unmute),lazy_load:ba.boolean().default(bd.lazy_load),draggable:ba.boolean().default(bd.draggable),zoomable:ba.boolean().default(bd.zoomable),transition_effect:Bl.default(bd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(bd.snapshot_click_plays_clip),display:ac,controls:ba.object({builtin:ba.boolean().default(bd.controls.builtin),next_previous:wd.default(bd.controls.next_previous),ptz:Ml.extend({mode:ba.enum(["off","on"]).default(bd.controls.ptz.mode)}).default(bd.controls.ptz),thumbnails:jl.default(bd.controls.thumbnails),timeline:Nl.default(bd.controls.timeline)}).default(bd.controls)}).merge(Tc).default(bd),Cd={...Tl,show_details:!1},Md={controls:{thumbnails:Cd,filter:{mode:"right"}}},kd=jl.extend({show_details:ba.boolean().default(Cd.show_details)}),Sd=ba.object({controls:ba.object({thumbnails:kd.default(Md.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Md.controls.filter.mode)}).default(Md.controls.filter)}).default(Md.controls)}).merge(Tc).default(Md),Ed={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},$d=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ed.aspect_ratio_mode),aspect_ratio:vl.default(Ed.aspect_ratio),height:ba.string().default(Ed.height)}).default(Ed),Ad=ba.object({conditions:gl.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Id=Ic.array(),zd=ba.object({conditions:gl.array(),actions:Id.optional(),actions_not:Id.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Td={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},jd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Td.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Td.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Td.features),style:ba.object({border_radius:ba.boolean().default(Td.style.border_radius),box_shadow:ba.boolean().default(Td.style.box_shadow)}).default(Td.style)}).default(Td),Od={logging:!1},Dd=ba.object({logging:ba.boolean().default(Od.logging)}).default(Od),Rd=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Pd=ba.object({cameras:js(id),cameras_global:ad,view:cd,menu:fd,status_bar:vd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,elements:_l,dimensions:$d,timeline:Vl,performance:jd,debug:Dd,automations:zd.optional(),profiles:Rd,overrides:Ad,card_mod:ba.unknown(),card_id:ba.string().regex(Js).optional(),type:ba.string()}),Ld={cameras:td,view:rd,menu:pd,status_bar:yd,live:Yl,media_gallery:Md,media_viewer:bd,image:kl,timeline:Fl,performance:Td,debug:Od};function Nd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Fd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Vd(e,t){const n=Nd(e);return isNaN(t)?Fd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function Hd(e,t){const n=Nd(e);if(isNaN(t))return Fd(e,NaN);if(!t)return n;const a=n.getDate(),i=Fd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Bd(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Nd(e),d=a||n?Hd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Fd(e,(r||i?Vd(d,r+7*i):d).getTime()+u)}const qd=6048e5,Ud=864e5,Wd=6e4,Zd=36e5,Qd=1e3;let Gd={};function Yd(){return Gd}function Kd(e,t){const n=Yd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Nd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function eu(e){const t=Nd(e);return t.setHours(0,0,0,0),t}function tu(e){const t=Nd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function nu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Nd(e);return!isNaN(Number(n))}function au(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function iu(e,t){return+Nd(e)-+Nd(t)}function ru(e,t,n){const a=iu(e,t)/1e3;return au(n?.roundingMethod)(a)}const ou={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function su(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const cu={date:su({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:su({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:su({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},lu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function du(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function uu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var hu;const pu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=ou[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:cu,formatRelative:(e,t,n,a)=>lu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:du({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:du({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:du({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:du({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:du({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(hu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(hu.matchPattern);if(!n)return null;const a=n[0],i=e.match(hu.parsePattern);if(!i)return null;let r=hu.valueCallback?hu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:uu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:uu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:uu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:uu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:uu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function mu(e){const t=Nd(e),n=function(e,t){const n=eu(e),a=eu(t),i=+n-tu(n),r=+a-tu(a);return Math.round((i-r)/Ud)}(t,function(e){const t=Nd(e),n=Fd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function gu(e){const t=Nd(e),n=+Xd(t)-+function(e){const t=Jd(e),n=Fd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Xd(n)}(t);return Math.round(n/qd)+1}function fu(e,t){const n=Nd(e),a=n.getFullYear(),i=Yd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Fd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Kd(o,t),c=Fd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Kd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function _u(e,t){const n=Nd(e),a=+Kd(n,t)-+function(e,t){const n=Yd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=fu(e,t),r=Fd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Kd(r,t)}(n,t);return Math.round(a/qd)+1}function yu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const vu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return yu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):yu(n+1,2)},d:(e,t)=>yu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>yu(e.getHours()%12||12,t.length),H:(e,t)=>yu(e.getHours(),t.length),m:(e,t)=>yu(e.getMinutes(),t.length),s:(e,t)=>yu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return yu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},bu="midnight",wu="noon",xu="morning",Cu="afternoon",Mu="evening",ku="night",Su={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return vu.y(e,t)},Y:function(e,t,n,a){const i=fu(e,a),r=i>0?i:1-i;if("YY"===t){return yu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):yu(r,t.length)},R:function(e,t){return yu(Jd(e),t.length)},u:function(e,t){return yu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return yu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return yu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return vu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return yu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=_u(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):yu(i,t.length)},I:function(e,t,n){const a=gu(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):yu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):vu.d(e,t)},D:function(e,t,n){const a=mu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):yu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return yu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return yu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return yu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?wu:0===a?bu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Mu:a>=12?Cu:a>=4?xu:ku,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return vu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):vu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):yu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):yu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):vu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):vu.s(e,t)},S:function(e,t){return vu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return $u(a);case"XXXX":case"XX":return Au(a);default:return Au(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return $u(a);case"xxxx":case"xx":return Au(a);default:return Au(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Eu(a,":");default:return"GMT"+Au(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Eu(a,":");default:return"GMT"+Au(a,":")}},t:function(e,t,n){return yu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return yu(e.getTime(),t.length)}};function Eu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+yu(r,2)}function $u(e,t){if(e%60==0){return(e>0?"-":"+")+yu(Math.abs(e)/60,2)}return Au(e,t)}function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+yu(Math.trunc(a/60),2)+t+yu(a%60,2)}const Iu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},zu=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Tu={p:zu,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Iu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Iu(a,t)).replace("{{time}}",zu(i,t))}},ju=/^D+$/,Ou=/^Y+$/,Du=["D","DD","YY","YYYY"];function Ru(e){return ju.test(e)}function Pu(e){return Ou.test(e)}function Lu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Du.includes(e))throw new RangeError(a)}const Nu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Fu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vu=/^'([^]*?)'?$/,Hu=/''/g,Bu=/[a-zA-Z]/;function qu(e,t,n){const a=Yd(),i=n?.locale??a.locale??pu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Nd(e);if(!nu(s))throw new RangeError("Invalid time value");let c=t.match(Fu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Tu[t])(e,i.formatLong)}return e})).join("").match(Nu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Uu(e)};if(Su[t])return{isToken:!0,value:e};if(t.match(Bu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Pu(r)||!n?.useAdditionalDayOfYearTokens&&Ru(r))&&Lu(r,t,String(e));return(0,Su[r[0]])(s,r,i.localize,l)})).join("")}function Uu(e){const t=e.match(Vu);return t?t[1].replace(Hu,"'"):e}function Wu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return Hd(e,-t)}(e,a+12*n),d=function(e,t){return Vd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Fd(e,d.getTime()-u)}function Zu(e,t){return e===t||e!=e&&t!=t}function Qu(e,t){for(var n=e.length;n--;)if(Zu(e[n][0],t))return n;return-1}var Gu=Array.prototype.splice;function Yu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Yu.prototype.set=function(e,t){var n=this.__data__,a=Qu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ku="object"==typeof global&&global&&global.Object===Object&&global,Xu="object"==typeof self&&self&&self.Object===Object&&self,Ju=Ku||Xu||Function("return this")(),eh=Ju.Symbol,th=Object.prototype,nh=th.hasOwnProperty,ah=th.toString,ih=eh?eh.toStringTag:void 0;var rh=Object.prototype.toString;var oh="[object Null]",sh="[object Undefined]",ch=eh?eh.toStringTag:void 0;function lh(e){return null==e?void 0===e?sh:oh:ch&&ch in Object(e)?function(e){var t=nh.call(e,ih),n=e[ih];try{e[ih]=void 0;var a=!0}catch(e){}var i=ah.call(e);return a&&(t?e[ih]=n:delete e[ih]),i}(e):function(e){return rh.call(e)}(e)}function dh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var uh="[object AsyncFunction]",hh="[object Function]",ph="[object GeneratorFunction]",mh="[object Proxy]";function gh(e){if(!dh(e))return!1;var t=lh(e);return t==hh||t==ph||t==uh||t==mh}var fh,_h=Ju["__core-js_shared__"],yh=(fh=/[^.]+$/.exec(_h&&_h.keys&&_h.keys.IE_PROTO||""))?"Symbol(src)_1."+fh:"";var vh=Function.prototype.toString;function bh(e){if(null!=e){try{return vh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var wh=/^\[object .+?Constructor\]$/,xh=Function.prototype,Ch=Object.prototype,Mh=xh.toString,kh=Ch.hasOwnProperty,Sh=RegExp("^"+Mh.call(kh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Eh(e){return!(!dh(e)||(t=e,yh&&yh in t))&&(gh(e)?Sh:wh).test(bh(e));var t}function $h(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Eh(n)?n:void 0}var Ah=$h(Ju,"Map"),Ih=$h(Object,"create");var zh=Object.prototype.hasOwnProperty;var Th=Object.prototype.hasOwnProperty;function jh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Vh?new Ph:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ep}var Ap={};function Ip(e){return function(t){return e(t)}}Ap["[object Float32Array]"]=Ap["[object Float64Array]"]=Ap["[object Int8Array]"]=Ap["[object Int16Array]"]=Ap["[object Int32Array]"]=Ap["[object Uint8Array]"]=Ap["[object Uint8ClampedArray]"]=Ap["[object Uint16Array]"]=Ap["[object Uint32Array]"]=!0,Ap["[object Arguments]"]=Ap["[object Array]"]=Ap["[object ArrayBuffer]"]=Ap["[object Boolean]"]=Ap["[object DataView]"]=Ap["[object Date]"]=Ap["[object Error]"]=Ap["[object Function]"]=Ap["[object Map]"]=Ap["[object Number]"]=Ap["[object Object]"]=Ap["[object RegExp]"]=Ap["[object Set]"]=Ap["[object String]"]=Ap["[object WeakMap]"]=!1;var zp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Tp=zp&&"object"==typeof module&&module&&!module.nodeType&&module,jp=Tp&&Tp.exports===zp&&Ku.process,Op=function(){try{var e=Tp&&Tp.require&&Tp.require("util").types;return e||jp&&jp.binding&&jp.binding("util")}catch(e){}}(),Dp=Op,Rp=Dp&&Dp.isTypedArray,Pp=Rp?Ip(Rp):function(e){return mp(e)&&$p(e.length)&&!!Ap[lh(e)]},Lp=Object.prototype.hasOwnProperty;function Np(e,t){var n=cp(e),a=!n&&vp(e),i=!n&&!a&&Cp(e),r=!n&&!a&&!i&&Pp(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++ig>=800)return arguments[0]}else ig=0;return ag.apply(void 0,arguments)});function sg(e,t){return og(function(e,t,n){return t=Jm(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=Jm(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&cg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Pg(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Ng){var l=t?null:Lg(e);if(l)return Uh(l);o=!1,i=Nh,c=new Ph}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Bg(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const qg=e=>Array.isArray(e)?e:[e],Ug=e=>e instanceof Set?e:new Set(qg(e));function Wg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?ym(e,t,void 0,n):!!a}(e,t,n)}function Zg(e,t=console.warn){e instanceof $s&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Qg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Gg=(e,t)=>qu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Yg=e=>qu(e,"yyyy-MM-dd"),Kg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function Xg(e,t){const n=function(e,t,n){const a=iu(e,t)/Zd;return au(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=iu(e,t)/Wd;return au(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${ru(t,e)-60*n*60-60*a}s`,i}const Jg=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),ef=e=>new Date(`${e}T00:00:00`),tf=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},nf=e=>!isNaN(e.getTime()),af=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},rf=e=>!!e,of=e=>e instanceof HTMLElement,sf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(of),cf=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",lf=e=>({"aspect-ratio":cf(e)}),df=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>df(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=df(e[n]);return t}return e},uf=(e,t,n)=>Og(e,n)===Og(t,n);function hf(e){if(!e)return null;const t=Ac.safeParse(e);return t.success?t.data:null}function pf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function mf(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function gf(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function ff(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function _f(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const yf=e=>qg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),vf=e=>{e.stopPropagation()};class bf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class wf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new bf,this.doubleClickTimer=new bf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||vf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",wf);const xf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},Cf=ge(class extends fe{update(e,[t]){return xf(e.element,t),U}render(e){}});var Mf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)sp(t,pp(e)),e=Dm(e);return t}:dp;function kf(e){return lp(e,Gm,Mf)}var Sf=Object.prototype.hasOwnProperty;var Ef=/\w*$/;var $f=eh?eh.prototype:void 0,Af=$f?$f.valueOf:void 0;var If="[object Boolean]",zf="[object Date]",Tf="[object Map]",jf="[object Number]",Of="[object RegExp]",Df="[object Set]",Rf="[object String]",Pf="[object Symbol]",Lf="[object ArrayBuffer]",Nf="[object DataView]",Ff="[object Float32Array]",Vf="[object Float64Array]",Hf="[object Int8Array]",Bf="[object Int16Array]",qf="[object Int32Array]",Uf="[object Uint8Array]",Wf="[object Uint8ClampedArray]",Zf="[object Uint16Array]",Qf="[object Uint32Array]";function Gf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Lf:return Im(e);case If:case zf:return new o(+e);case Nf:return function(e,t){var n=t?Im(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Ff:case Vf:case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:return zm(e,n);case Tf:return new o;case jf:case Rf:return new o(e);case Of:return(r=new(i=e).constructor(i.source,Ef.exec(i))).lastIndex=i.lastIndex,r;case Df:return new o;case Pf:return a=e,Af?Object(Af.call(a)):{}}}var Yf=Dp&&Dp.isMap,Kf=Yf?Ip(Yf):function(e){return mp(e)&&"[object Map]"==um(e)};var Xf=Dp&&Dp.isSet,Jf=Xf?Ip(Xf):function(e){return mp(e)&&"[object Set]"==um(e)},e_=1,t_=2,n_=4,a_="[object Arguments]",i_="[object Function]",r_="[object GeneratorFunction]",o_="[object Object]",s_={};function c_(e,t,n,a,i,r){var o,s=t&e_,c=t&t_,l=t&n_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!dh(e))return e;var d=cp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Sf.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Tm(e,o)}else{var u=um(e),h=u==i_||u==r_;if(Cp(e))return Am(e,s);if(u==o_||u==a_||h&&!i){if(o=c||h?{}:Rm(e),!s)return c?function(e,t){return Wm(e,Mf(e),t)}(e,function(e,t){return e&&Wm(t,Gm(t),e)}(o,e)):function(e,t){return Wm(e,pp(e),t)}(e,function(e,t){return e&&Wm(t,Wp(t),e)}(o,e))}else{if(!s_[u])return i?e:{};o=Gf(e,u,s)}}r||(r=new Rh);var p=r.get(e);if(p)return p;r.set(e,o),Jf(e)?e.forEach((function(a){o.add(c_(a,t,n,a,e,r))})):Kf(e)&&e.forEach((function(a,i){o.set(i,c_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?kf:Zp:c?Gm:Wp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new g_(e):new DOMException(e),__=e=>{const t=void 0===e.reason?f_("This operation was aborted."):e.reason;return t instanceof Error?t:f_(t)};class y_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class v_ extends p_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:y_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#y()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#v()}),this.#r),this.#o=Date.now()+this.#r)}#v(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(__(e)),e.addEventListener("abort",(()=>{c(__(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new m_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof m_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var b_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},w_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},x_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},C_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},M_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},k_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},S_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},E_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},$_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},A_={unseekable:"Seek time not found in media"},I_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},z_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},T_={select_date:"Choose date"},j_={common:b_,config:w_,display_modes:x_,editor:C_,elements:M_,error:k_,event:S_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:I_,thumbnail:z_,timeline:T_},O_=Object.freeze({__proto__:null,common:b_,config:w_,default:j_,display_modes:x_,editor:C_,elements:M_,error:k_,event:S_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:I_,thumbnail:z_,timeline:T_});const D_="en",R_={[D_]:O_};let P_;function L_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in R_)return n}return D_}function N_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),R_[P_??D_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),R_[D_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function F_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const V_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},H_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,B_=(e,t,n)=>!!H_(e,t,n),q_=(e,t)=>{const n=B_(e,t,{phase:"start"})&&B_(e,t,{phase:"stop"}),a=B_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},U_=e=>{const t=q_(e,"left"),n=q_(e,"right"),a=q_(e,"up"),i=q_(e,"down"),r=q_(e,"zoom_in"),o=q_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class W_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Is)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function Z_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function ky(e,t,n,a){return null==e?[]:(cp(t)||(t=null==t?[]:[t]),cp(n=a?void 0:n)||(n=null==n?[]:[n]),My(e,t,n))}async function Sy(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new $s(N_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new $s(N_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new $s(N_("error.invalid_response"),{request:n,response:i,invalid_keys:Os(r.error)});return r.data}const Ey=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Ey).nullable().optional()}))),$y="video",Ay="image",Iy=60,zy=e=>ky(e,(e=>e._metadata?.startDate),"desc");class Ty{async walkBrowseMedias(e,t,n){return t&&t.length?(await Jg(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?cg(e,t,n):void 0===t)?1:G_(Mg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Q_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await Sy(e,Ey,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Bd(new Date,{seconds:60})),o}}function jy(e,t){return ym(e,t)}function Oy(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nPy(t,e)))}add(e){this._ranges.push(e),this._ranges=Ny(this._ranges)}clear(){this._ranges=[]}}class Ry{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Ly=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Ny=(e,t=0)=>{const n=[];e=ky(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Fy{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return jy(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class By{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new Hy((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class qy extends $s{}class Uy extends $s{}var Wy,Zy,Qy;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Wy||(Wy={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Zy||(Zy={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Qy||(Qy={}));const Gy=e=>e.camera_entity??e.webrtc_card?.entity??null;class Yy{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Qy.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-39deaa91.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Qy.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-69a32a9e.js");n=new a(this._entityRegistryManager,t.stateWatcher,new By,new Vy,t.eventCallback);break;case Qy.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-205f9ce6.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ty,t.resolvedMediaCache,new Vy,t.eventCallback);break;case Qy.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-0f6e3569.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ty,t.resolvedMediaCache,new Vy,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Qy.Frigate;else if("motioneye"===t.engine)n=Qy.MotionEye;else if("generic"===t.engine)n=Qy.Generic;else if("reolink"===t.engine)n=Qy.Reolink;else{const a=Gy(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Qy.Generic;throw new qy(N_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Qy.Frigate;break;case"motioneye":n=Qy.MotionEye;break;case"reolink":n=Qy.Reolink;break;default:n=Qy.Generic}}else t.frigate.camera_name?n=Qy.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Qy.Generic)}return n}}class Ky{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await Jg(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const Xy=e=>{return ky((n=e=>e.getID()??e,(t=e)&&t.length?Fg(t,by(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class Jy{static isEventQuery(e){return e.type===Wy.Event}static isRecordingQuery(e){return e.type===Wy.Recording}static isRecordingSegmentsQuery(e){return e.type===Wy.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Wy.MediaMetadata}}class ev{static isEventQueryResult(e){return e.type===Zy.Event}static isRecordingQueryResult(e){return e.type===Zy.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Zy.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Zy.MediaMetadata}}class tv{constructor(e,t){this._requestLimit=new v_,this._api=e,this._engineFactory=t?.factory??new Yy(this._api.getEntityRegistryManager()),this._store=t?.store??new Ky}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=l_(e?.cameras_global),dg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,N_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await Jg(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new qy(N_("error.no_camera_engine"),l_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await Jg(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=F_(e.getConfig());if(!t)throw await r(),new qy(N_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new qy(N_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Ug(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jy.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):Jy.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):Jy.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Wy.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=Xy(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Bd(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=qg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jy.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):Jy.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):Jy.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):Jy.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(rf);return new W_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=H_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class nv{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const av=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class iv{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await Sy(e,av,{type:"config/device_registry/list"})}catch(e){return void Zg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const rv=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),ov=rv.array();class sv{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await Sy(e,rv,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Zg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await Sy(e,ov,{type:"config/entity_registry/list"})}catch(e){return void Zg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class cv extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class lv{constructor(){this._cache=new cv({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const dv=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await Sy(e,zs,i)}catch(e){Zg(e)}return n&&r&&n.set(t,r),r};class uv{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class hv extends uv{}class pv extends hv{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class mv extends hv{async execute(e){e.getCameraURLManager().openURL()}}class gv extends hv{async execute(e){await e.getViewManager().setViewDefaultWithNewQuery()}}class fv extends hv{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class _v extends hv{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class yv extends hv{async execute(e){e.getExpandManager().toggleExpanded()}}class vv extends hv{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class bv extends uv{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class wv extends hv{async execute(e){console[this._action.level](this._action.message)}}const xv=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,Cv=e=>xv(e)!==e.camera,Mv=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class kv extends hv{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,xv(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class Sv extends hv{async execute(e){e.getCardElementManager().toggleMenu()}}class Ev extends hv{async execute(e){await e.getMicrophoneManager().connect()}}class $v extends hv{async execute(e){e.getMicrophoneManager().disconnect()}}class Av extends hv{async execute(e){e.getMicrophoneManager().mute()}}class Iv extends hv{async execute(e){await e.getMicrophoneManager().unmute()}}class zv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Tv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class jv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ov=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=xv(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Dv(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Dv=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Rv=lg((function(e,t,n){Km(e,t,n)}));const Pv=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Lv=(e,t,n,a)=>{Rv(t,{[n]:{[e]:{inProgressAction:a}}})};class Nv extends hv{constructor(){super(...arguments),this._timer=new bf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ov(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Pv(n,this._context.ptz),Lv(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Pv(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Fv extends hv{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function Vv(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=wg(n))==n?n:0),void 0!==t&&(t=(t=wg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(wg(e),t,n)}const Hv=50,Bv=50,qv=1,Uv=4,Wv=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Zv{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Qv=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Gv=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Zv(Qv(n,{observed:e.detail}))]})};class Yv extends hv{constructor(){super(...arguments),this._timer=new bf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Qv(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ov(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Pv(n,this._context.ptzDigital),Lv(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Pv(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:Vv(t+i,1,10),pan:{x:Vv(n+r,0,100),y:Vv(a+o,0,100)}}}}class Kv extends hv{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Dv(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ov(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Nv(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Yv(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class Xv extends hv{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class Jv extends hv{async execute(e){var t;await tf((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class eb extends hv{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class tb{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class nb extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new tb]})}}class ab{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=xv(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Mv(e,t[i])}}class ib extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab(e)]})}}class rb{constructor(e){this._substreamID=e}modify(e){Mv(e,this._substreamID)}}class ob extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(this._action.camera)]})}}class sb extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class cb extends hv{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class lb{createAction(e,t,n){const a=hf(t);if("fire-dom-event"!==t.action||!a)return new bv(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new gv(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new cb(e,a,n?.config);case"sleep":return new Jv(e,a,n?.config);case"download":return new _v(e,a,n?.config);case"camera_ui":return new mv(e,a,n?.config);case"expand":return new yv(e,a,n?.config);case"fullscreen":return new vv(e,a,n?.config);case"menu_toggle":return new Sv(e,a,n?.config);case"camera_select":return new pv(e,a,n?.config);case"live_substream_select":return new ob(e,a,n?.config);case"live_substream_off":return new nb(e,a,n?.config);case"live_substream_on":return new ib(e,a,n?.config);case"media_player":return new kv(e,a,n?.config);case"microphone_connect":return new Ev(e,a,n?.config);case"microphone_disconnect":return new $v(e,a,n?.config);case"microphone_mute":return new Av(e,a,n?.config);case"microphone_unmute":return new Iv(e,a,n?.config);case"mute":return new zv(e,a,n?.config);case"unmute":return new sb(e,a,n?.config);case"play":return new jv(e,a,n?.config);case"pause":return new Tv(e,a,n?.config);case"screenshot":return new Xv(e,a,n?.config);case"display_mode_select":return new fv(e,a,n?.config);case"ptz":return new Nv(e,a,n?.config);case"ptz_digital":return new Yv(e,a,n?.config);case"ptz_multi":return new Kv(e,a,n?.config);case"ptz_controls":return new Fv(e,a,n?.config);case"log":return new wv(e,a,n?.config);case"status_bar":return new eb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class db{constructor(e,t,n){this._actions=[],this._factory=new lb,this._stopped=!1,this._context=e;for(const a of qg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const ub=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),hb=ba.object({detail:ub});class pb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=hb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=_f(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new db(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class mb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:N_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class gb{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const fb=()=>!!navigator.userAgent.match(/CrKey\//),_b=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>_b(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,vb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},bb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},wb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},xb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Cb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},Mb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},kb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?Mb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Cb[a]},Sb=e=>{const t=e?.attributes.device_class;if(t&&t in xb)return xb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return kb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},Eb="mdi:bookmark",$b={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function Ab(e,t,n,a){switch(e){case"alarm_control_panel":return vb(n);case"binary_sensor":return bb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return wb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Sb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?$b[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in $b?$b[e]:a??Eb}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await Sy(e,Ts,a);return i?e.hassUrl(i.path):null}function zb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function Tb(e,t,n,a){return!!zb(e,t,n,{...a,firstOnly:!0}).length}function jb(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Ob(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Db(e){return{color:Ob(e),filter:jb(e)}}function Rb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Db(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Lb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Pb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Lb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:Ab(Ye(t),a,a?.state,n)}const Nb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Fb=e=>!!e&&["on","open"].includes(e),Vb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Hb(e){return!!e?.startsWith("/")}function Bb(e,t){return Hb(t)?e.hassUrl(t):t??null}class qb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await Jg(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Ub;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Ub||(Ub={}));class Wb{constructor(e,t){this._initializationQueue=new v_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new qb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Ub.LANGUAGES,Ub.SIDE_LOAD_ELEMENTS,Ub.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Ub.MICROPHONE_CONNECT]:[],Ub.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Ub.LANGUAGES]:async()=>await(async e=>{const t=L_(e);return"ca"===t?R_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?R_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?R_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?R_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(R_[t]=await import("./lang-fr-ea16daba.js")),t&&(P_=t),!0})(e),[Ub.SIDE_LOAD_ELEMENTS]:async()=>await Nb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Ub.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Ub.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Ub.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Zb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),af(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),af(this._element,fb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){af(this._element,!1,"panel"),af(this._element,!1,"tabindex"),af(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Ub.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Qb(e,t,n){return null==e?e:function(e,t,n,a){if(!dh(e))return e;for(var i=-1,r=(t=ry(t,e)).length,o=r-1,s=e;null!=s&&++i{Qb(e,t,n)},Kb=(e,t,n)=>my(e,t,n),Xb=(e,t)=>{!function(e,t){null==e||Gb(e,t)}(e,t)},Jb=e=>l_(e),ew=(e,t)=>e.replace("#",`[${t.toString()}]`),tw=function(e){let t=!1;for(let n=0;n{const i=Kb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&jy(i,r)||(null===r?a?.keepOriginal||(Xb(e,t),0):void 0===r||(a?.keepOriginal||Xb(e,t),Yb(e,n,r),0)))})(a,e,t,n)}},iw=function(e,t,n){return function(a){let i=aw(e,t,n)(a);return i=sw(ys,aw(e,t,n),(e=>e.overrides))(a)||i,i}},rw=function(e,t){return iw(e,e,{transform:t})},ow=function(e){return iw(e,e,{transform:e=>null})},sw=function(e,t,n){return function(a){let i=!1;const r=Kb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},cw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},lw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),dw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},uw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),pw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),mw=[sw(ys,lw,(e=>e.conditions)),e=>cw(lw,(e=>e.conditions))("object"==typeof e&&e?e[Ai]:{}),iw("event_gallery",ir),iw("menu.buttons.frigate_ui",ns),e=>cw(pw)("object"==typeof e&&e?e:{}),sw(wa,rw("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),iw("live.jsmpeg",Ci),iw("live.image",wi),iw("live.webrtc_card",Mi),sw(wa,iw("frigate.zone","frigate.zones",{transform:e=>qg(e)})),sw(wa,iw("frigate.label","frigate.labels",{transform:e=>qg(e)})),e=>cw(hw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ai in e)||!Array.isArray(e[Ai]))return!1;let t=!1;const n=n=>{if(!t){if(!my(e,"live.controls.ptz")){const{type:t,...a}=n;Qb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ai]);return t&&(i.length?e[Ai]=i:delete e[Ai]),t},iw("view.timeout_seconds",Oi),rw("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qg(e))),rw("live.auto_play",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qg(e))),rw("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:qg(e))),rw("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:qg(e))),rw("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:qg(e))),iw("live.controls.thumbnails.media",no),iw("timeline.media",Fo),iw("live.controls.timeline.media",uo),iw("media_viewer.controls.timeline.media",Or),iw("view.scan",Yi),iw("view.triggers.enabled",tr,{transform:e=>!0===e?"live":null,keepOriginal:!0}),iw("view.triggers.enabled",Xi,{transform:e=>!0!==e&&null}),iw("view.triggers.untrigger_reset",nr,{transform:e=>e?"default":null}),iw("live.layout",Ei),ow("media_viewer.layout"),ow("image.layout"),sw(ys,dw),e=>cw(dw)("object"==typeof e&&e?e[Ai]:{}),e=>cw(dw)("object"==typeof e&&e?e.automations:{}),sw(wa,iw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),iw("performance.profile",Ss,{transform:e=>"low"===e?["low-performance"]:null}),sw(ys,aw("overrides","merge")),iw("live.controls.ptz",$i,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),rw("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),iw("view.update_cycle_camera",qi),iw("view.update_force",Wi,{transform:e=>!0===e?"all":null}),iw("view.update_seconds",Zi),iw("view.update_entities",Qi),aw("live.controls.title",cs,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),ow("live.controls.title"),ow("media_viewer.controls.title"),e=>cw(uw)("object"==typeof e&&e?e:{}),iw("dimensions.max_height",_s),ow("dimensions.min_height")];class gw extends $s{}class fw extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function _w(e,t,n){let a=Jb(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Xb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Yb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Yb(a,e,Rv({},Kb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=df(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new gw(N_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=fl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>jy(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const vw={casting:{[Wr]:!1,[Mr]:!1,[Xo]:"none",[`${is}.enabled`]:!0,[`${rs}.enabled`]:!0,[`${as}.enabled`]:!1,[`${os}.enabled`]:!1,[Ur]:["selected","visible"],[fs]:"static",[gs]:"16:9",[Si]:1,[So]:!0},"low-performance":{[ao]:"none",[Er]:"none",[Bo]:"none",[mo]:!1,[Pr]:!1,[Vo]:!1,[qr]:[],[hr]:[],[pr]:[],[mr]:[],[Co]:["unselected","hidden"],[wo]:!1,[br]:!1,[ko]:"none",[Cr]:"none",[So]:!1,[kr]:"chevrons",[ds]:"none",[Xo]:"outside",[`${ts}.enabled`]:!1,[`${ss}.enabled`]:!1,[`${ss}.enabled`]:!1,[`${os}.enabled`]:!1,[sr]:!1,[cr]:!1,[lr]:!1,[or]:!1,[oo]:!1,[so]:!1,[co]:!1,[ro]:!1,[Ar]:!1,[Ir]:!1,[zr]:!1,[$r]:!1,[Wo]:!1,[Zo]:!1,[Qo]:!1,[Uo]:!1,[bs]:!1,[ws]:10,[ks]:!1,[Ms]:!1,[xr]:!1,[ki]:!1,[xi]:"image",[Si]:10,[tr]:"none",[xs]:1},scrubbing:{[ho]:"below",[go]:"ribbon",[po]:"seek",[Dr]:"below",[Lr]:"ribbon",[Rr]:"seek"}},bw=(e,t,n)=>{const a=js(Pd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in vw&&Object.entries(vw[e]).forEach((([e,n])=>{return r=n,void(void 0===Kb(i,a=e)&&Yb(t,a,r));var a,r}));return t},ww=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},xw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=ww(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[ff({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[ff({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[ff()],tag:e}),n};class Cw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(N_("error.invalid_configuration"));const t=Pd.safeParse(e);if(!t.success){const n=nw(e),a=Ds(t.error);let i="";throw n&&(i=`${N_("error.upgrade_available")}. `),new Error(i+`${N_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):N_("error.invalid_configuration_no_hint")))}const n=bw(e,t.data,t.data.profiles);var a;(this._rawConfig=e,jy(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Ub.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=xw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=_w(e,this._config,{configOverrides:this._config.overrides,schema:Pd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(jy(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||jy(n?.cameras,this._overriddenConfig?.cameras)&&jy(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Ub.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Ub.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class Mw{constructor(e){this._timer=new bf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){jy(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[pf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const kw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Sw=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new $s(N_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Zg(e)}if(!t)throw new $s(N_("error.download_sign_failed"));i=t}kw(i)},Ew=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class $w{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Sw(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&kw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${qu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class Aw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],zw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),Tw={change:zw.fullscreenchange,error:zw.fullscreenerror};let jw={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{jw.off("change",i),n()};jw.on("change",i);const r=e[zw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!jw.isFullscreen)return void e();const n=()=>{jw.off("change",n),e()};jw.on("change",n);const a=document[zw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>jw.isFullscreen?jw.exit():jw.request(e,t),onchange(e){jw.on("change",e)},onerror(e){jw.on("error",e)},on(e,t){const n=Tw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=Tw[e];n&&document.removeEventListener(n,t,!1)},raw:zw};Object.defineProperties(jw,{isFullscreen:{get:()=>Boolean(document[zw.fullscreenElement])},element:{enumerable:!0,get:()=>document[zw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[zw.fullscreenEnabled])}}),zw||(jw={isEnabled:!1});var Ow=jw;class Dw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Ow.isEnabled&&Ow.on("change",this._fullscreenHandler)}disconnect(){Ow.isEnabled&&Ow.off("change",this._fullscreenHandler)}isInFullscreen(){return Ow.isEnabled&&Ow.isFullscreen}toggleFullscreen(){Ow.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Ow.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Rw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=zb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Pw{constructor(e){this._hass=null,this._stateWatcher=new Rw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:N_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Lw=function(){return Ju.Date.now()},Nw="Expected a function",Fw=Math.max,Vw=Math.min;function Hw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Nw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Lw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Vw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Lw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=wg(t)||0,dh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Fw(wg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Lw())},_}function Bw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return dh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Hw(e,t,{leading:a,maxWait:t,trailing:i})}class qw{constructor(e){this._timer=new bf,this.reportInteraction=Bw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Uw{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};jy(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Ww(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Zw(e,t,n){const a=Ww(t,n);a&&Qw(e,a)}function Qw(e,t){Vg(e,"media:loaded",t)}function Gw(e){Vg(e,"media:unloaded")}function Yw(e){Vg(e,"media:volumechange")}function Kw(e){Vg(e,"media:play")}function Xw(e){Vg(e,"media:pause")}class Jw{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class ex{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class tx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&_b(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Zg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(_b(n,4096))a="media_stop";else{if(!_b(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:N_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:ex.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class nx{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Zg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof $s&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?As[this._message.type]:0,n=As[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class ix{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=mf(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=pf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class rx{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!jy(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class ox{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);af(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return lf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return lf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return lf({defaultStatic:!0})}}class sx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=Bw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=ky([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;jy(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new bf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function cx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Fg(e,void 0,t):[]}class lx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return l_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Ug(e)}))),this._queries=cx(t,jy),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class dx extends lx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class ux extends lx{}class hx{static areEventQueries(e){return e instanceof dx}static areRecordingQueries(e){return e instanceof ux}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const px=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},mx=(e,t)=>Rv({},e,t);class gx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new gx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new gx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=mx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const fx=(e,t)=>{t?.forEach((t=>t.modify(e)))};class _x extends $s{}class yx extends $s{}class vx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...px(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=px(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new _x(N_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Ws)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(N_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Ws}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new gx(o);return fx(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!px(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class bx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class wx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const xx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Cx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Cx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class kx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new dx(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new ux(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new Mx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>xx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Sx{constructor(e,t){this._api=e,this._executor=t??new kx(e)}async getExistingQueryModifiers(e,t){return e.query?[new wx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new wx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Zv({timeline:{window:{start:Wu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new bx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Zv({mediaViewer:{seek:e}})]:[new bx("mediaViewer","seek")]}}class Ex{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new vx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Sx(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),fx(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=hx.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!px(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&xv(e)!==xv(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class $x{constructor(e,t,n,a){this._deviceRegistryManager=new iv(new nv((e=>e.id))),this._entityRegistryManager=new sv(new nv((e=>e.entity_id))),this._resolvedMediaCache=new lv,this._actionsManager=new pb(this),this._automationsManager=new mb(this),this._cameraManager=new tv(this),this._cameraURLManager=new gb(this),this._configManager=new Cw(this),this._defaultManager=new Mw(this),this._downloadManager=new $w(this),this._expandManager=new Aw(this),this._fullscreenManager=new Dw(this),this._hassManager=new Pw(this),this._initializationManager=new Wb(this),this._interactionManager=new qw(this),this._keyboardStateManager=new Uw(this),this._mediaLoadedInfoManager=new Jw(this),this._mediaPlayerManager=new tx(this),this._messageManager=new nx(this),this._microphoneManager=new ax(this),this._queryStringManager=new ix(this),this._statusBarItemManager=new rx(this),this._styleManager=new ox(this),this._triggersManager=new sx(this),this._viewManager=new Ex(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Zb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-0c0425c2.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class Ax{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(rf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?pf("menu_toggle"):pf("default"),hold_action:pf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=mf("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=xv(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:N_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:pf(Cv(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=mf("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:N_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:pf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:pf("clips"),hold_action:pf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:pf("snapshots"),hold_action:pf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:pf("recordings"),hold_action:pf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:pf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:pf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!fb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.download"),tap_action:pf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.camera_ui"),tap_action:pf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:pf("microphone_unmute"),end_tap_action:pf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:pf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.expand"),tap_action:pf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return fb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.fullscreen"),tap_action:pf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Pb(e,t)||t,a=e.states[t],i=gf(t,"play"),r=gf(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Lb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.play"),tap_action:pf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.mute"),tap_action:pf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.screenshot"),tap_action:pf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?px(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ov(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ov(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_home"),tap_action:ff({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Us.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var zx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Px(e,t){return Tx.repeat(" ",t-e.length)+e}var Lx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Rx(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=Tx.repeat(" ",t.indent)+Px((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Rx(e.buffer,i[o],r[o],e.position,u),l+=Tx.repeat(" ",t.indent)+Px((e.line+1).toString(),d)+" | "+c.str+"\n",l+=Tx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Rx(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=Tx.repeat(" ",t.indent)+Px((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Nx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Fx=["scalar","sequence","mapping"];var Vx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Nx.indexOf(t))throw new Dx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Fx.indexOf(this.kind))throw new Dx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Hx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function Bx(e){return this.extend(e)}Bx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Vx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Dx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Vx))throw new Dx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Dx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Dx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Vx))throw new Dx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Bx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Hx(a,"implicit"),a.compiledExplicit=Hx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),tC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var nC=/^[-+]?[0-9]+e/;var aC=new Vx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!tC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||Tx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Tx.isNegativeZero(e))return"-0.0";return n=e.toString(10),nC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),iC=Qx.extend({implicit:[Gx,Yx,eC,aC]}),rC=iC,oC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var cC=new Vx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==oC.exec(e)||null!==sC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=oC.exec(e))&&(t=sC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var lC=new Vx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),dC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var uC=new Vx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=dC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=dC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=dC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),hC=Object.prototype.hasOwnProperty,pC=Object.prototype.toString;var mC=new Vx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var BC=new Array(256),qC=new Array(256),UC=0;UC<256;UC++)BC[UC]=VC(UC)?1:0,qC[UC]=VC(UC);function WC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||vC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function ZC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Lx(n),new Dx(t,n)}function QC(e,t){throw ZC(e,t)}function GC(e,t){e.onWarning&&e.onWarning.call(null,ZC(e,t))}var YC={YAML:function(e,t,n){var a,i,r;null!==e.version&&QC(e,"duplication of %YAML directive"),1!==n.length&&QC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&QC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&QC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&GC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&QC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],zC.test(a)||QC(e,"ill-formed tag handle (first argument) of the TAG directive"),bC.call(e.tagMap,a)&&QC(e,'there is a previously declared suffix for "'+a+'" tag handle'),TC.test(i)||QC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){QC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function KC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=Tx.repeat("\n",t-1))}function iM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,QC(e,"tab characters must not be used in indentation")),45===a)&&RC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,tM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,sM(e,t,CC,!1,!0),o.push(e.result),tM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)QC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),sM(e,t,MC,!0,i)&&(_?g=e.result:f=e.result),_||(JC(e,h,p,m,g,f,o,s,c),m=g=f=null),tM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)QC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?QC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?QC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(DC(r)){do{r=e.input.charCodeAt(++e.position)}while(DC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!OC(r)&&0!==r)}for(;0!==r;){for(eM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),OC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=LC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:QC(e,"expected hexadecimal character");e.result+=HC(r),e.position++}else QC(e,"unknown escape sequence");n=a=e.position}else OC(s)?(KC(e,n,a,!0),aM(e,tM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&nM(e)?QC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}QC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!RC(a)&&!PC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&QC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),bC.call(e.anchorMap,n)||QC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],tM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(RC(d=e.input.charCodeAt(e.position))||PC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(RC(a=e.input.charCodeAt(e.position+1))||n&&PC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(RC(a=e.input.charCodeAt(e.position+1))||n&&PC(a))break}else if(35===d){if(RC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&nM(e)||n&&PC(d))break;if(OC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,tM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(KC(e,i,r,!1),aM(e,e.line-s),i=r=e.position,o=!1),DC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return KC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,wC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||QC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&iM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&QC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&QC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):QC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function cM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(tM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!RC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&QC(e,"directive name must not be less than one character in length");0!==i;){for(;DC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!OC(i));break}if(OC(i))break;for(t=e.position;0!==i&&!RC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&eM(e),bC.call(YC,n)?YC[n](e,n,a):GC(e,'unknown document directive "'+n+'"')}tM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,tM(e,!0,-1)):o&&QC(e,"directives end mark is expected"),sM(e,e.lineIndent-1,MC,!1,!0),tM(e,!0,-1),e.checkLineBreaks&&AC.test(e.input.slice(r,e.position))&&GC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&nM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,tM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function XM(e){return/^\n* /.test(e)}var JM=1,ek=2,tk=3,nk=4,ak=5;function ik(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return QM(e)&&e!==pM&&!ZM(e)&&e!==SM&&e!==IM&&e!==EM&&e!==kM&&e!==TM&&e!==jM&&e!==DM&&e!==PM&&e!==bM&&e!==xM&&e!==MM&&e!==yM&&e!==RM&&e!==$M&&e!==AM&&e!==CM&&e!==vM&&e!==wM&&e!==zM&&e!==OM}(KM(e,0))&&function(e){return!ZM(e)&&e!==EM}(KM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!QM(l=KM(e,c)))return ak;g=g&&YM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=KM(e,c))===gM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!QM(l))return ak;g=g&&YM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&XM(e)?ak:o?r===BM?ak:ek:h?nk:tk:!g||o||i(e)?r===BM?ak:ek:JM}function rk(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===BM?'""':"''";if(!e.noCompatMode&&(-1!==NM.indexOf(t)||FM.test(t)))return e.quotingType===BM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(ik(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+ok(t,e.indent)+sk(UM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,ck(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+ck(l,t),o=n}return r}(t,o),r));case ak:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=KM(e,i),!(t=LM[a])&&QM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||VM(a);return n}(t)+'"';default:throw new Dx("impossible error: invalid scalar style")}}()}function ok(e,t){var n=XM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function sk(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function ck(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function lk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function uk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,dk(e,n,!1)||dk(e,n,!0);var s,c=uM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Dx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&gM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=WM(e,t)),uk(e,t+1,s,!0,c)&&(e.dump&&gM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),uk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?lk(e,t-1,e.dump,i):lk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function hk(e,t){var n,a,i=[],r=[];for(pk(e,i,r),n=0,a=r.length;nq`
${gk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(fk)}};e([he({attribute:!1})],_k.prototype,"message",void 0),e([he({attribute:!1})],_k.prototype,"context",void 0),e([he({attribute:!1})],_k.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],_k.prototype,"dotdotdot",void 0),_k=e([le("frigate-card-message")],_k);let yk=class extends se{render(){if(this.message)return q` ${N_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(fk)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let vk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(fk)}};function bk(e){return"error"===e?.type?q` `:e?q` `:q``}function wk(e){return q` + + + `}function xk(e,t,n){!function(e,t,n,a){Vg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}(e,t,"error",{context:n?.context})}function Ck(e,t){t instanceof Error&&xk(e,t.message,{...t instanceof $s&&{context:t.context}})}e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"animated",void 0),e([he({attribute:!1})],vk.prototype,"size",void 0),vk=e([le("frigate-card-progress-indicator")],vk);let Mk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(N_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Zg(e,console.error),new $s(N_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return Ck(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Mk.prototype,"elements",void 0),e([he({attribute:!1})],Mk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Mk.prototype,"hass",void 0),Mk=e([le("frigate-card-elements-core")],Mk);let kk=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Vg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Vg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],kk.prototype,"hass",void 0),e([he({attribute:!1})],kk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],kk.prototype,"elements",void 0),kk=e([le("frigate-card-elements")],kk);let Sk=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new fw(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-conditional")],Sk);class Ek extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Vg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Vg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ek.prototype,"_config",void 0);class $k extends Ek{constructor(){super("menu")}}let Ak=class extends $k{};Ak=e([le("frigate-card-menu-icon")],Ak);let Ik=class extends $k{};Ik=e([le("frigate-card-menu-state-icon")],Ik);let zk=class extends $k{};zk=e([le("frigate-card-menu-submenu")],zk);let Tk=class extends $k{};Tk=e([le("frigate-card-menu-submenu-select")],Tk);class jk extends Ek{constructor(){super("status-bar")}}let Ok=class extends jk{};Ok=e([le("frigate-card-status-bar-icon")],Ok);let Dk=class extends jk{};Dk=e([le("frigate-card-status-bar-image")],Dk);let Rk=class extends jk{};Rk=e([le("frigate-card-status-bar-string")],Rk);let Pk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Pk=e([le("frigate-card-loading")],Pk);const Lk=(e,t)=>{Vg(e,"action:execution-request",t)};class Nk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,af(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=_f(n,t);if(!a)return;const i=qg(a);let r=!1;const o=i.filter((e=>rf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Lk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=_f("hold",t),a=_f("double_tap",t),i=_f("tap",t),r=_f("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Rb(e,n):n}_sortButtons(){this._buttons=ky(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Bs:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=hf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Fk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Vk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Bk=e=>{switch(e){case"frigate":return Fk;case"motioneye":return Vk;case"reolink":return Hk;default:return null}};const qk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Uk=class extends se{_renderItem(e){if(!this.hass)return;const t=Rb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${Cf({hasHold:yf(e.hold_action),hasDoubleClick:yf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Bk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>vf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Uk.prototype,"hass",void 0),e([he({attribute:!1})],Uk.prototype,"submenu",void 0),Uk=e([le("frigate-card-submenu")],Uk);let Wk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||Tb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=qk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:Ab("select"),...Rb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Wk.prototype,"hass",void 0),e([he({attribute:!1})],Wk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Wk.prototype,"entityRegistryManager",void 0),e([pe()],Wk.prototype,"_optionTitles",void 0),Wk=e([le("frigate-card-submenu-select")],Wk);let Zk=class extends se{constructor(){super(...arguments),this._controller=new Nk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Bk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n overflow: visible;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Zk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Zk.prototype,"hass",void 0),Zk=e([le("frigate-card-menu")],Zk);let Qk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Qk=e([le("frigate-card-overlay")],Qk);class Gk{constructor(e){this._config=null,this._popupTimer=new bf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=ky(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||jy(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=_f(e.detail.action,t);n&&Lk(this._host,{action:qg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){af(this._host,!1,"hide")}_hide(){af(this._host,!0,"hide")}}let Yk=class extends se{constructor(){super(...arguments),this._controller=new Gk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=Cf({hasHold:yf(e.actions?.hold_action),hasDoubleClick:yf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Bk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Yk.prototype,"items",void 0),e([he({attribute:!1})],Yk.prototype,"config",void 0),Yk=e([le("frigate-card-status-bar")],Yk);function Kk(e){return"number"==typeof e}function Xk(e){return"string"==typeof e}function Jk(e){return"boolean"==typeof e}function eS(e){return"[object Object]"===Object.prototype.toString.call(e)}function tS(e){return Math.abs(e)}function nS(e){return Math.sign(e)}function aS(e,t){return tS(e-t)}function iS(e){return lS(e).map(Number)}function rS(e){return e[oS(e)]}function oS(e){return Math.max(0,e.length-1)}function sS(e,t){return t===oS(e)}function cS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function lS(e){return Object.keys(e)}function dS(e,t){return[e,t].reduce(((e,t)=>(lS(t).forEach((n=>{const a=e[n],i=t[n],r=eS(a)&&eS(i);e[n]=r?dS(a,i):i})),e)),{})}function uS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function hS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function pS(e,t,n,a){const i=hS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function mS(e=0,t=0){const n=tS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function gS(e,t,n){const{constrain:a}=mS(0,e),i=e+1;let r=o(t);function o(e){return n?tS((i+e)%i):a(e)}function s(){return r}function c(){return gS(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function fS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,y){const{cross:v,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=hS(),M=hS(),k=mS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,I=0,z=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!uS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,v),o=aS(t,I),c=aS(n,z);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*nS(e)),a=d.byDistance(e,!m).distance;return m||tS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),I=r.readPoint(e),z=r.readPoint(e,v),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function _S(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(uS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&tS(c)>.1?c:0},readPoint:r}}function yS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(Jk(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(tS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function vS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=mS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=tS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&tS(u)e.add(i)))}};return c}function wS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>tS(e)-tS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>nS(e)===a));return r.length?c(r):rS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>tS(e.diff)-tS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function xS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(Jk(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Kk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function CS(e){let t=e;function n(e){return Kk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function MS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function kS(e,t,n,a,i,r,o,s,c){const l=.5,d=iS(i),u=iS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:CS(-1),translate:MS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function SS(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(Jk(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function ES(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return lS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function $S(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Kk(n);const p={groupSlides:function(e){return h?function(e,t){return iS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?iS(e).reduce(((n,h,p)=>{const m=rS(n)||0,g=0===m,f=h===oS(e),_=i[l]-r[m][l],y=i[l]-r[h][d],v=!a&&g?u(o):0,b=tS(y-(!a&&f?u(s):0)-(_+v));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function AS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:y,watchResize:v,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return Xk(e)?n[e](a):e(t,a,i)}};return i}(s,E),I=!u&&!!y,z=u||!!y,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return tS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(rS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=sS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(tS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,z,i),R=$S(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>rS(e)[o]-e[0][r])).map(tS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-tS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-rS(P)+rS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=mS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=sS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=rS(o);return mS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return aS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,y,2),H=I?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:mS(n?a-e:rS(t),a)}}(N,H,u),q=gS(oS(H),d,u),U=q.clone(),W=iS(n),Z=pS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=CS(Q),Y=CS(Q),K=CS(Q),X=CS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=nS(p),u=d,m},settled:function(){return tS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=wS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=hS(),ie=ES(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=sS(n,t);return a?cS(rS(n[0])+1):i?cS(oS(r)-rS(n)[0]+1,rS(n)[0]):e}))}()}}(I,y,H,V,R,W),oe=xS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:fS(S,e,a,i,X,_S(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:yS(t,o,i,n,S,v,C),scrollBody:J,scrollBounds:vS(B,K,X,J,$),scrollLooper:bS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:kS(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:SS(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:MS(S,t)};return se}const IS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function zS(e){function t(e,t){return dS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=lS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>lS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function TS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=zS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=hS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,y,v,b=!1,w=l(IS,TS.globalOptions),x=l(w),C=[];function M(t){const n=AS(e,y,v,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=Xk(t)?e.querySelector(t):t;y=a||e.children[0];const i=Xk(n)?y.querySelectorAll(n):n;v=[].slice.call(i||y.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(I),f.eventHandler.init(I),f.resizeHandler.init(I),f.slidesHandler.init(I),f.options.loop&&f.slideLooper.loop(),y.offsetParent&&v.length&&f.dragHandler.init(I),_=o.init(I,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const I={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return y},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return v},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),I}function jS(){return jS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=DS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===BS?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(DS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),y(a)}}},y=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},v=function(e){return 0===e||e<=HS&&e>=VS},b=function(){if(l.accelerationFactors.length>=qS){if(d&&(d=!1,RS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*qS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(v).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=ZS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return PS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),PS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var GS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function YS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(GS,YS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=QS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!y&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}y=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!y)return;l?function(e){y=!1,x(w("mouseup",e)),v(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),y=!1;function v(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){y&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),v()}},destroy:function(){return n()}};return a}YS.globalOptions=void 0;class KS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=sf(this._parent);!jy(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._textDirection=n?.textDirection??"ltr",this._carousel=this._createCarousel(sf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Vg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=TS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable,direction:this._textDirection},[...this._plugins,...e.length>1?[YS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Vg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}const XS=e=>"rtl"===getComputedStyle(e).direction?"rtl":"ltr";let JS=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=Ie(),this._refRoot=Ie(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new KS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins,textDirection:XS(this)}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],JS.prototype,"direction",void 0),e([he({attribute:!0})],JS.prototype,"transitionEffect",void 0),e([he({attribute:!1})],JS.prototype,"loop",void 0),e([he({attribute:!1})],JS.prototype,"dragFree",void 0),e([he({attribute:!1})],JS.prototype,"dragEnabled",void 0),e([he({attribute:!1})],JS.prototype,"plugins",void 0),e([he({attribute:!1})],JS.prototype,"selected",void 0),JS=e([le("frigate-card-carousel")],JS); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const eE=window,tE=eE.ShadowRoot&&(void 0===eE.ShadyCSS||eE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,nE=Symbol(),aE=new WeakMap;let iE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==nE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(tE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=aE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&aE.set(t,e))}return e}toString(){return this.cssText}};const rE=(e,t)=>{tE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=eE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},oE=tE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new iE("string"==typeof e?e:e+"",void 0,nE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var sE;const cE=window,lE=cE.trustedTypes,dE=lE?lE.emptyScript:"",uE=cE.reactiveElementPolyfillSupport,hE={toAttribute(e,t){switch(t){case Boolean:e=e?dE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},pE=(e,t)=>t!==e&&(t==t||e==e),mE={attribute:!0,type:String,converter:hE,reflect:!1,hasChanged:pE},gE="finalized";class fE extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=mE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||mE}static finalize(){if(this.hasOwnProperty(gE))return!1;this[gE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(oE(e))}else void 0!==e&&t.push(oE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return rE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=mE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:hE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:hE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||pE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}fE[gE]=!0,fE.elementProperties=new Map,fE.elementStyles=[],fE.shadowRootOptions={mode:"open"},null==uE||uE({ReactiveElement:fE}),(null!==(sE=cE.reactiveElementVersions)&&void 0!==sE?sE:cE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const _E=0,yE=Symbol();class vE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>pE(e,t[n]))):e!==t}}class bE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var wE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const xE=(e,t,n)=>{const a={...n?.cardWideConfig&&{cardWideConfig:n.cardWideConfig}};return q` ${e.render({initial:()=>n?.inProgressFunc?.()??wk(a),pending:()=>n?.inProgressFunc?.()??wk(a),error:e=>{Zg(e),n?.errorFunc&&n.errorFunc(e)},complete:t})}`},CE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,ME=(e,t,n,a=!0)=>new vE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(CE)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})).catch((e=>a(e))):a()})):null)(a,n):null},autoRun:a}),kE=300;let SE=class extends se{constructor(){super(),this._thumbnailError=!1,this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=ME(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===_E&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return!this._embedThumbnailTask||this._thumbnailError?e:q`${this.thumbnail?xE(this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e,errorFunc:()=>{this._thumbnailError=!0}}):e} `}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],SE.prototype,"thumbnail",void 0),e([he({attribute:!1})],SE.prototype,"hass",void 0),e([pe()],SE.prototype,"_thumbnailError",void 0),SE=e([le("frigate-card-thumbnail-feature-thumbnail")],SE);let EE=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${qu(this.date,"HH:mm")}
+
${qu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],EE.prototype,"date",void 0),e([he({attribute:!1})],EE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],EE.prototype,"showCameraTitle",void 0),EE=e([le("frigate-card-thumbnail-feature-text")],EE);let $E=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Gg(n):null,i=this.media.getEndTime(),r=n&&i?Xg(n,i):null,o=this.media.inProgress()?N_("event.in_progress"):null,s=Hg(this.media.getWhat()?.join(", "))??null,c=Hg(this.media.getWhere()?.join(", "))??null,l=Hg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?qu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(wE)}};e([he({attribute:!1})],$E.prototype,"media",void 0),e([he({attribute:!1})],$E.prototype,"seek",void 0),e([he({attribute:!1})],$E.prototype,"cameraTitle",void 0),$E=e([le("frigate-card-thumbnail-details-event")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Gg(e):null,n=this.media.getEndTime(),a=e&&n?Xg(e,n):null,i=this.media.inProgress()?N_("recording.in_progress"):null,r=this.seek?qu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(wE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-recording")],AE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!ex.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${ex.isEvent(this.media)&&e?q``:ex.isEvent(this.media)||ex.isRecording(this.media)?q``:q``} + ${r?q` {if(vf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Zg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&ex.isEvent(this.media)?q``:this.details&&ex.isRecording(this.media)?q``:q``} + ${a?q`{vf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new bE(["timeline"])]})}} + >`:""} + ${o?q` {if(vf(e),this.hass&&this.cameraManager&&this.media)try{await Sw(this.hass,this.cameraManager,this.media)}catch(e){Ck(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let zE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Vg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),vf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],zE.prototype,"hass",void 0),e([he({attribute:!1})],zE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],zE.prototype,"cameraManager",void 0),e([he({attribute:!1})],zE.prototype,"config",void 0),e([he({attribute:!1})],zE.prototype,"fadeThumbnails",void 0),zE=e([le("frigate-card-thumbnail-carousel")],zE);var TE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const jE=document.createElement("template");jE.innerHTML='\n
\n
\n';class OE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(jE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",OE);let DE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=Ie(),this._refSlot=Ie(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Qg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?sf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?sf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{vf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],DE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],DE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],DE.prototype,"open",void 0),e([he({attribute:!1})],DE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],DE.prototype,"empty",void 0),DE=e([le("frigate-card-drawer")],DE);let RE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=Ie(),this._refDrawerRight=Ie(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],RE.prototype,"drawerIcons",void 0),RE=e([le("frigate-card-surround-basic")],RE);let PE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-9cf72087.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Vg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new bE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(TE)}};e([he({attribute:!1})],PE.prototype,"hass",void 0),e([he({attribute:!1})],PE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Wg})],PE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Wg})],PE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],PE.prototype,"cameraManager",void 0),e([he({attribute:!1})],PE.prototype,"cardWideConfig",void 0),PE=e([le("frigate-card-surround")],PE);var LE="Tue, 17 Dec 2024 05:06:29 GMT",NE="0b68140",FE="Mon, 16 Dec 2024 21:05:17 -0800";const VE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),HE="hass_web_proxy",BE=(e,t)=>`/api/${HE}/v${t??0}/?url=${encodeURIComponent(e)}`,qE=(e,t,n="media")=>(e=>e.config.components.includes(HE))(e)&&!!t[n];async function UE(e,t,n){await e.callService(HE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const WE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await Sy(e,VE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let ZE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.1.0",browser:navigator.userAgent,date:new Date,lang:L_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:NE,build_date:LE,commit_date:FE},...e&&{ha_version:e.config.version},custom_integrations:{frigate:{...await WE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await WE(HE,e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return bk({message:N_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(TE)}};e([he({attribute:!1})],ZE.prototype,"hass",void 0),e([he({attribute:!1})],ZE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],ZE.prototype,"rawConfig",void 0),e([pe()],ZE.prototype,"_diagnostics",void 0),ZE=e([le("frigate-card-diagnostics")],ZE);let QE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-33db4eee.js"),e?.isGalleryView()?import("./gallery-bf3892f1.js"):e?.isViewerView()?import("./index-5de5f421.js"):e?.is("image")?import("./image-88fcb8ac.js"):e?.is("timeline")&&import("./timeline-3c6e5e5d.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],QE.prototype,"cameraManager",void 0),e([he({attribute:!1})],QE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],QE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],QE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([he({attribute:!1})],QE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],QE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],QE.prototype,"hide",void 0),e([he({attribute:!1})],QE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],QE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),QE=e([le("frigate-card-views")],QE);console.info(`%c FRIGATE-HASS-CARD \n%c ${N_("common.version")} 6.1.0`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:N_("common.frigate_card"),description:N_("common.frigate_card_description"),preview:!0,documentationURL:"https://github.com/dermotduffy/frigate-hass-card"});let GE=class extends se{constructor(){super(...arguments),this._controller=new $x(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new Ax,this._refMenu=Ie(),this._refOverlay=Ie(),this._refMain=Ie(),this._refElements=Ie(),this._refViews=Ie()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await $x.getConfigElement()}static getStubConfig(e,t){return $x.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${bk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};GE=e([le("frigate-card")],GE);export{Al as $,Ji as A,er as B,Ui as C,tr as D,nr as E,ar as F,Di as G,Ri as H,Pi as I,Li as J,Ni as K,Fi as L,Vi as M,Hi as N,Bi as O,ps as P,qs as Q,es as R,Bs as S,Ho as T,Lo as U,No as V,Fo as W,Vo as X,Vs as Y,$l as Z,e as _,se as a,cr as a$,F_ as a0,ew as a1,et as a2,tw as a3,Ss as a4,ji as a5,zi as a6,Ti as a7,Oi as a8,qi as a9,Qr as aA,io as aB,ro as aC,so as aD,co as aE,oo as aF,to as aG,no as aH,ao as aI,ho as aJ,go as aK,fo as aL,lo as aM,uo as aN,mo as aO,po as aP,Xr as aQ,eo as aR,Jr as aS,Yr as aT,Kr as aU,Gr as aV,Eo as aW,Ao as aX,$o as aY,dr as aZ,or as a_,Xo as aa,Ko as ab,Yo as ac,Jo as ad,ds as ae,ls as af,hs as ag,Hs as ah,us as ai,Mo as aj,wo as ak,Io as al,xo as am,Co as an,Hr as ao,Br as ap,qr as aq,Ur as ar,ko as as,So as at,_o as au,bo as av,yo as aw,vo as ax,Wr as ay,Zr as az,pe as b,za as b$,lr as b0,sr as b1,rr as b2,hr as b3,pr as b4,mr as b5,gr as b6,br as b7,Fr as b8,wr as b9,Do as bA,qo as bB,Uo as bC,Zo as bD,Qo as bE,Wo as bF,Bo as bG,fs as bH,gs as bI,_s as bJ,bs as bK,ws as bL,Es as bM,xs as bN,ks as bO,Ms as bP,Xb as bQ,Yb as bR,Bk as bS,Bg as bT,xa as bU,Ka as bV,Qa as bW,Ra as bX,Pa as bY,Ca as bZ,Ta as b_,Cr as ba,xr as bb,fr as bc,vr as bd,_r as be,yr as bf,Mr as bg,kr as bh,Sr as bi,Tr as bj,$r as bk,Ir as bl,zr as bm,Ar as bn,Er as bo,Dr as bp,Lr as bq,Nr as br,jr as bs,Or as bt,Pr as bu,Rr as bv,Oo as bw,Ro as bx,To as by,jo as bz,Jb as c,Nd as c$,ja as c0,Ia as c1,Za as c2,Ba as c3,qa as c4,Ua as c5,Wa as c6,gi as c7,mi as c8,Oa as c9,ti as cA,ni as cB,Ma as cC,ka as cD,ui as cE,di as cF,pi as cG,hi as cH,Ld as cI,wa as cJ,Cs as cK,Qw as cL,Ie as cM,Gw as cN,cf as cO,bk as cP,je as cQ,Wg as cR,_w as cS,Jl as cT,Ck as cU,Gv as cV,XS as cW,vf as cX,xv as cY,ye as cZ,TE as c_,Da as ca,Fa as cb,Ha as cc,La as cd,Na as ce,Va as cf,Ga as cg,Ya as ch,Ja as ci,Xa as cj,_i as ck,fi as cl,yi as cm,vi as cn,Sa as co,Ea as cp,$a as cq,Aa as cr,ei as cs,ai as ct,ii as cu,ri as cv,oi as cw,si as cx,ci as cy,li as cz,nw as d,$s as d$,eu as d0,c as d1,dx as d2,Wy as d3,ux as d4,cx as d5,hx as d6,Zg as d7,ky as d8,qu as d9,bf as dA,Hw as dB,ME as dC,xE as dD,_f as dE,Lk as dF,ff as dG,Cf as dH,yf as dI,u_ as dJ,d_ as dK,Dy as dL,Ry as dM,Bd as dN,Ny as dO,Qg as dP,Gg as dQ,xx as dR,Zv as dS,mx as dT,ru as dU,rf as dV,Ly as dW,Fg as dX,ba as dY,ef as dZ,Sy as d_,Yg as da,Wu as db,Vg as dc,Bw as dd,tf as de,kE as df,Mx as dg,wk as dh,Ew as di,ex as dj,dv as dk,Hb as dl,Bb as dm,qE as dn,UE as dp,Ib as dq,BE as dr,Zw as ds,Yw as dt,Kw as du,Xw as dv,bx as dw,ge as dx,fe as dy,U as dz,_e as e,Gy as e0,qy as e1,U_ as e2,W_ as e3,Qy as e4,Kg as e5,Jg as e6,Zy as e7,Fk as e8,Fy as e9,Lb as eA,sf as eB,Hv as eC,Bv as eD,qv as eE,uf as eF,Wv as eG,Og as eH,Uv as eI,s as eJ,Ae as eK,ve as eL,W as eM,Ww as eN,vE as eO,me as eP,be as eQ,xe as eR,Tb as eS,nf as ea,Iy as eb,Vk as ec,Ay as ed,$y as ee,zy as ef,Hk as eg,Yd as eh,Fd as ei,Zd as ej,Wd as ek,Qd as el,fu as em,Kd as en,Xd as eo,_u as ep,gu as eq,Vd as er,tu as es,pu as et,Tu as eu,Pu as ev,Lu as ew,Ru as ex,Fb as ey,Uy as ez,bw as f,Nb as g,Kb as h,jy as i,Pb as j,Hg as k,N_ as l,Gi as m,he as n,Zi as o,Rd as p,Wi as q,o as r,af as s,le as t,Qi as u,Vb as v,Yi as w,q as x,Xi as y,Ki as z}; diff --git a/www/community/frigate-hass-card/card-320adb66.js.gz b/www/community/frigate-hass-card/card-320adb66.js.gz new file mode 100644 index 00000000..429b1080 Binary files /dev/null and b/www/community/frigate-hass-card/card-320adb66.js.gz differ diff --git a/www/community/frigate-hass-card/card-45855f1f.js b/www/community/frigate-hass-card/card-45855f1f.js new file mode 100644 index 00000000..5ca7880a --- /dev/null +++ b/www/community/frigate-hass-card/card-45855f1f.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,matcher:t.matcher,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-31c14ad9.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-3f150159.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-fa799851.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-5d642010.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>vb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,bb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},wb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},xb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Cb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Mb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},kb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Sb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?kb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Mb[a]},Eb=e=>{const t=e?.attributes.device_class;if(t&&t in Cb)return Cb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Sb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},$b="mdi:bookmark",Ab={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function zb(e,t,n,a){switch(e){case"alarm_control_panel":return bb(n);case"binary_sensor":return wb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return xb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Eb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?Ab[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in Ab?Ab[e]:a??$b}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function Tb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function jb(e,t,n,a){return!!Tb(e,t,n,{...a,firstOnly:!0}).length}function Ob(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Db(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Rb(e){return{color:Db(e),filter:Ob(e)}}function Pb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Rb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Nb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Lb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Nb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:zb(Ye(t),a,a?.state,n)}const Fb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Vb=e=>!!e&&["on","open"].includes(e),Hb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Bb(e){return!!e?.startsWith("/")}function qb(e,t){return Bb(t)?e.hassUrl(t):t??null}class Ub{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Wb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Wb||(Wb={}));class Zb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Ub}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Wb.LANGUAGES,Wb.SIDE_LOAD_ELEMENTS,Wb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Wb.MICROPHONE_CONNECT]:[],Wb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Wb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Wb.SIDE_LOAD_ELEMENTS]:async()=>await Fb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Wb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Wb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Wb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Qb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,!0,"tabindex","0"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Wb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Gb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Gb(e,t,n)},Xb=(e,t,n)=>fv(e,t,n),Jb=(e,t)=>{!function(e,t){null==e||Yb(e,t)}(e,t)},ew=e=>u_(e),tw=(e,t)=>e.replace("#",`[${t.toString()}]`),nw=function(e){let t=!1;for(let n=0;n{const i=Xb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(Jb(e,t),0):void 0===r||(a?.keepOriginal||Jb(e,t),Kb(e,n,r),0)))})(a,e,t,n)}},rw=function(e,t,n){return function(a){let i=iw(e,t,n)(a);return i=cw(bs,iw(e,t,n),(e=>e.overrides))(a)||i,i}},ow=function(e,t){return rw(e,e,{transform:t})},sw=function(e){return rw(e,e,{transform:e=>null})},cw=function(e,t,n){return function(a){let i=!1;const r=Xb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},lw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},dw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),uw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),mw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),gw=[cw(bs,dw,(e=>e.conditions)),e=>lw(dw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),rw("event_gallery",or),rw("menu.buttons.frigate_ui",is),e=>lw(mw)("object"==typeof e&&e?e:{}),cw(Ca,ow("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),rw("live.jsmpeg",ki),rw("live.image",Ci),rw("live.webrtc_card",Si),cw(Ca,rw("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),cw(Ca,rw("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>lw(pw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Gb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},rw("view.timeout_seconds",Ri),ow("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),ow("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),rw("live.controls.thumbnails.media",io),rw("timeline.media",Ho),rw("live.controls.timeline.media",po),rw("media_viewer.controls.timeline.media",Rr),rw("view.scan",Xi),rw("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),rw("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),rw("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),rw("live.layout",Ai),sw("media_viewer.layout"),sw("image.layout"),cw(bs,uw),e=>lw(uw)("object"==typeof e&&e?e[Ii]:{}),e=>lw(uw)("object"==typeof e&&e?e.automations:{}),cw(Ca,rw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),rw("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),cw(bs,iw("overrides","merge")),rw("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),ow("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),rw("view.update_cycle_camera",Wi),rw("view.update_force",Qi,{transform:e=>!0===e?"all":null}),rw("view.update_seconds",Gi),rw("view.update_entities",Yi),iw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),sw("live.controls.title"),sw("media_viewer.controls.title"),e=>lw(hw)("object"==typeof e&&e?e:{}),rw("dimensions.max_height",ys),sw("dimensions.min_height")];class fw extends zs{}class _w extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function vw(e,t,n){let a=ew(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Jb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Kb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Kb(a,e,Ly({},Xb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new fw(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const bw={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},ww=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in bw&&Object.entries(bw[e]).forEach((([e,n])=>{return r=n,void(void 0===Xb(i,a=e)&&Kb(t,a,r));var a,r}));return t},xw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Cw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=xw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class Mw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=aw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=ww(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Wb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Cw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=vw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Wb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Wb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class kw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Sw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Ew=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Sw(i)},$w=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class Aw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Ew(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Sw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class zw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Tw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),jw={change:Tw.fullscreenchange,error:Tw.fullscreenerror};let Ow={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Ow.off("change",i),n()};Ow.on("change",i);const r=e[Tw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Ow.isFullscreen)return void e();const n=()=>{Ow.off("change",n),e()};Ow.on("change",n);const a=document[Tw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Ow.isFullscreen?Ow.exit():Ow.request(e,t),onchange(e){Ow.on("change",e)},onerror(e){Ow.on("error",e)},on(e,t){const n=jw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=jw[e];n&&document.removeEventListener(n,t,!1)},raw:Tw};Object.defineProperties(Ow,{isFullscreen:{get:()=>Boolean(document[Tw.fullscreenElement])},element:{enumerable:!0,get:()=>document[Tw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[Tw.fullscreenEnabled])}}),Tw||(Ow={isEnabled:!1});var Dw=Ow;class Rw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Dw.isEnabled&&Dw.on("change",this._fullscreenHandler)}disconnect(){Dw.isEnabled&&Dw.off("change",this._fullscreenHandler)}isInFullscreen(){return Dw.isEnabled&&Dw.isFullscreen}toggleFullscreen(){Dw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Dw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Pw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=Tb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Lw{constructor(e){this._hass=null,this._stateWatcher=new Pw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Nw=function(){return th.Date.now()},Fw="Expected a function",Vw=Math.max,Hw=Math.min;function Bw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Fw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Nw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Hw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Nw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Vw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Nw())},_}function qw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Bw(e,t,{leading:a,maxWait:t,trailing:i})}class Uw{constructor(e){this._timer=new xf,this.reportInteraction=qw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Ww{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Zw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Qw(e,t,n){const a=Zw(t,n);a&&Gw(e,a)}function Gw(e,t){Bg(e,"media:loaded",t)}function Yw(e){Bg(e,"media:unloaded")}function Kw(e){Bg(e,"media:volumechange")}function Xw(e){Bg(e,"media:play")}function Jw(e){Bg(e,"media:pause")}class ex{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class tx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class nx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&vb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(vb(n,4096))a="media_stop";else{if(!vb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:tx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ax{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class rx{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class ox{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class sx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class cx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=qw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function lx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class dx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=lx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class ux extends dx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class hx extends dx{}class px{static areEventQueries(e){return e instanceof ux}static areRecordingQueries(e){return e instanceof hx}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const mx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},gx=(e,t)=>Ly({},e,t);class fx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new fx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new fx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=gx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const _x=(e,t)=>{t?.forEach((t=>t.modify(e)))};class vx extends zs{}class yx extends zs{}class bx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...mx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=mx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new vx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new fx(o);return _x(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class wx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class xx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Cx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Mx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Mx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Sx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new ux(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new hx(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new kx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Cx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Ex{constructor(e,t){this._api=e,this._executor=t??new Sx(e)}async getExistingQueryModifiers(e,t){return e.query?[new xx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new xx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new wx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new wx("mediaViewer","seek")]}}class $x{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new bx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Ex(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),_x(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=px.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class Ax{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new Mw(this),this._defaultManager=new kw(this),this._downloadManager=new Aw(this),this._expandManager=new zw(this),this._fullscreenManager=new Rw(this),this._hassManager=new Lw(this),this._initializationManager=new Zb(this),this._interactionManager=new Uw(this),this._keyboardStateManager=new Ww(this),this._mediaLoadedInfoManager=new ex(this),this._mediaPlayerManager=new nx(this),this._messageManager=new ax(this),this._microphoneManager=new ix(this),this._queryStringManager=new rx(this),this._statusBarItemManager=new ox(this),this._styleManager=new sx(this),this._triggersManager=new cx(this),this._viewManager=new $x(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Qb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-5368ad86.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class zx{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!this._isBeingCasted()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return this._isBeingCasted()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Lb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Nb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?mx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}_isBeingCasted(){return!!navigator.userAgent.match(/CrKey\//)}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var Tx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Lx(e,t){return jx.repeat(" ",t-e.length)+e}var Nx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Px(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=jx.repeat(" ",t.indent)+Lx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Px(e.buffer,i[o],r[o],e.position,u),l+=jx.repeat(" ",t.indent)+Lx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=jx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Px(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=jx.repeat(" ",t.indent)+Lx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Fx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Vx=["scalar","sequence","mapping"];var Hx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Fx.indexOf(t))throw new Rx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Vx.indexOf(this.kind))throw new Rx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Bx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function qx(e){return this.extend(e)}qx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Hx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Rx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Rx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Rx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(qx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Bx(a,"implicit"),a.compiledExplicit=Bx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),nC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var aC=/^[-+]?[0-9]+e/;var iC=new Hx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!nC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||jx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(jx.isNegativeZero(e))return"-0.0";return n=e.toString(10),aC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),rC=Gx.extend({implicit:[Yx,Kx,tC,iC]}),oC=rC,sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var lC=new Hx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==sC.exec(e)||null!==cC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=sC.exec(e))&&(t=cC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var dC=new Hx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),uC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var hC=new Hx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=uC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=uC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=uC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),pC=Object.prototype.hasOwnProperty,mC=Object.prototype.toString;var gC=new Hx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var qC=new Array(256),UC=new Array(256),WC=0;WC<256;WC++)qC[WC]=HC(WC)?1:0,UC[WC]=HC(WC);function ZC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||bC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function QC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Nx(n),new Rx(t,n)}function GC(e,t){throw QC(e,t)}function YC(e,t){e.onWarning&&e.onWarning.call(null,QC(e,t))}var KC={YAML:function(e,t,n){var a,i,r;null!==e.version&&GC(e,"duplication of %YAML directive"),1!==n.length&&GC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&GC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&GC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&YC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&GC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],TC.test(a)||GC(e,"ill-formed tag handle (first argument) of the TAG directive"),wC.call(e.tagMap,a)&&GC(e,'there is a previously declared suffix for "'+a+'" tag handle'),jC.test(i)||GC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){GC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function XC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=jx.repeat("\n",t-1))}function rM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,GC(e,"tab characters must not be used in indentation")),45===a)&&PC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,nM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,cM(e,t,MC,!1,!0),o.push(e.result),nM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)GC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),cM(e,t,kC,!0,i)&&(_?g=e.result:f=e.result),_||(eM(e,h,p,m,g,f,o,s,c),m=g=f=null),nM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)GC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?GC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?GC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(RC(r)){do{r=e.input.charCodeAt(++e.position)}while(RC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!DC(r)&&0!==r)}for(;0!==r;){for(tM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),DC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=NC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:GC(e,"expected hexadecimal character");e.result+=BC(r),e.position++}else GC(e,"unknown escape sequence");n=a=e.position}else DC(s)?(XC(e,n,a,!0),iM(e,nM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&aM(e)?GC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}GC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!PC(a)&&!LC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&GC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),wC.call(e.anchorMap,n)||GC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],nM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(PC(d=e.input.charCodeAt(e.position))||LC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a))break}else if(35===d){if(PC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&aM(e)||n&&LC(d))break;if(DC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,nM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(XC(e,i,r,!1),iM(e,e.line-s),i=r=e.position,o=!1),RC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return XC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,xC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||GC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&rM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&GC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&GC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):GC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function lM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(nM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&GC(e,"directive name must not be less than one character in length");0!==i;){for(;RC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!DC(i));break}if(DC(i))break;for(t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&tM(e),wC.call(KC,n)?KC[n](e,n,a):YC(e,'unknown document directive "'+n+'"')}nM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,nM(e,!0,-1)):o&&GC(e,"directives end mark is expected"),cM(e,e.lineIndent-1,kC,!1,!0),nM(e,!0,-1),e.checkLineBreaks&&zC.test(e.input.slice(r,e.position))&&YC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&aM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,nM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function JM(e){return/^\n* /.test(e)}var ek=1,tk=2,nk=3,ak=4,ik=5;function rk(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return GM(e)&&e!==mM&&!QM(e)&&e!==EM&&e!==IM&&e!==$M&&e!==SM&&e!==jM&&e!==OM&&e!==RM&&e!==LM&&e!==wM&&e!==CM&&e!==kM&&e!==yM&&e!==PM&&e!==AM&&e!==zM&&e!==MM&&e!==bM&&e!==xM&&e!==TM&&e!==DM}(XM(e,0))&&function(e){return!QM(e)&&e!==$M}(XM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!GM(l=XM(e,c)))return ik;g=g&&KM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=XM(e,c))===fM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!GM(l))return ik;g=g&&KM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&JM(e)?ik:o?r===qM?ik:tk:h?ak:nk:!g||o||i(e)?r===qM?ik:tk:ek}function ok(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===qM?'""':"''";if(!e.noCompatMode&&(-1!==FM.indexOf(t)||VM.test(t)))return e.quotingType===qM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(rk(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+sk(t,e.indent)+ck(WM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,lk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+lk(l,t),o=n}return r}(t,o),r));case ik:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=XM(e,i),!(t=NM[a])&&GM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||HM(a);return n}(t)+'"';default:throw new Rx("impossible error: invalid scalar style")}}()}function sk(e,t){var n=JM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function ck(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function lk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function dk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function hk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,uk(e,n,!1)||uk(e,n,!0);var s,c=hM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Rx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=ZM(e,t)),hk(e,t+1,s,!0,c)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),hk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?dk(e,t-1,e.dump,i):dk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function pk(e,t){var n,a,i=[],r=[];for(mk(e,i,r),n=0,a=r.length;nq`
${fk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(_k)}};e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"context",void 0),e([he({attribute:!1})],vk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],vk.prototype,"dotdotdot",void 0),vk=e([le("frigate-card-message")],vk);let yk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(_k)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let bk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(_k)}};function wk(e){return"error"===e?.type?q` `:e?q` `:q``}function xk(e){return q` + + + `}function Ck(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function Mk(e,t,n){Ck(e,t,"error",{context:n?.context})}function kk(e,t){t instanceof Error&&Mk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],bk.prototype,"message",void 0),e([he({attribute:!1})],bk.prototype,"animated",void 0),e([he({attribute:!1})],bk.prototype,"size",void 0),bk=e([le("frigate-card-progress-indicator")],bk);let Sk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return kk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Sk.prototype,"elements",void 0),e([he({attribute:!1})],Sk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-elements-core")],Sk);let Ek=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],Ek.prototype,"hass",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"elements",void 0),Ek=e([le("frigate-card-elements")],Ek);let $k=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new _w(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],$k.prototype,"hass",void 0),$k=e([le("frigate-card-conditional")],$k);class Ak extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ak.prototype,"_config",void 0);class zk extends Ak{constructor(){super("menu")}}let Ik=class extends zk{};Ik=e([le("frigate-card-menu-icon")],Ik);let Tk=class extends zk{};Tk=e([le("frigate-card-menu-state-icon")],Tk);let jk=class extends zk{};jk=e([le("frigate-card-menu-submenu")],jk);let Ok=class extends zk{};Ok=e([le("frigate-card-menu-submenu-select")],Ok);class Dk extends Ak{constructor(){super("status-bar")}}let Rk=class extends Dk{};Rk=e([le("frigate-card-status-bar-icon")],Rk);let Pk=class extends Dk{};Pk=e([le("frigate-card-status-bar-image")],Pk);let Lk=class extends Dk{};Lk=e([le("frigate-card-status-bar-string")],Lk);let Nk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Nk=e([le("frigate-card-loading")],Nk);const Fk=(e,t)=>{Bg(e,"action:execution-request",t)};class Vk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Fk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Pb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Uk=e=>{switch(e){case"frigate":return Hk;case"motioneye":return Bk;case"reolink":return qk;default:return null}};const Wk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Zk=class extends se{_renderItem(e){if(!this.hass)return;const t=Pb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Uk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Zk.prototype,"hass",void 0),e([he({attribute:!1})],Zk.prototype,"submenu",void 0),Zk=e([le("frigate-card-submenu")],Zk);let Qk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||jb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Wk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:zb("select"),...Pb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Qk.prototype,"entityRegistryManager",void 0),e([pe()],Qk.prototype,"_optionTitles",void 0),Qk=e([le("frigate-card-submenu-select")],Qk);let Gk=class extends se{constructor(){super(...arguments),this._controller=new Vk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Uk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Gk.prototype,"hass",void 0),Gk=e([le("frigate-card-menu")],Gk);let Yk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Yk=e([le("frigate-card-overlay")],Yk);class Kk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Fk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Xk=class extends se{constructor(){super(...arguments),this._controller=new Kk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Uk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Xk.prototype,"items",void 0),e([he({attribute:!1})],Xk.prototype,"config",void 0),Xk=e([le("frigate-card-status-bar")],Xk);function Jk(e){return"number"==typeof e}function eS(e){return"string"==typeof e}function tS(e){return"boolean"==typeof e}function nS(e){return"[object Object]"===Object.prototype.toString.call(e)}function aS(e){return Math.abs(e)}function iS(e){return Math.sign(e)}function rS(e,t){return aS(e-t)}function oS(e){return uS(e).map(Number)}function sS(e){return e[cS(e)]}function cS(e){return Math.max(0,e.length-1)}function lS(e,t){return t===cS(e)}function dS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function uS(e){return Object.keys(e)}function hS(e,t){return[e,t].reduce(((e,t)=>(uS(t).forEach((n=>{const a=e[n],i=t[n],r=nS(a)&&nS(i);e[n]=r?hS(a,i):i})),e)),{})}function pS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function mS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function gS(e,t,n,a){const i=mS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function fS(e=0,t=0){const n=aS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function _S(e,t,n){const{constrain:a}=fS(0,e),i=e+1;let r=o(t);function o(e){return n?aS((i+e)%i):a(e)}function s(){return r}function c(){return _S(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function vS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=mS(),M=mS(),k=fS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!pS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=rS(t,z),c=rS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*iS(e)),a=d.byDistance(e,!m).distance;return m||aS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function yS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(pS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&aS(c)>.1?c:0},readPoint:r}}function bS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(tS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(aS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function wS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=fS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=aS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&aS(u)e.add(i)))}};return c}function CS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>aS(e)-aS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>iS(e)===a));return r.length?c(r):sS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>aS(e.diff)-aS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function MS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(tS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Jk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function kS(e){let t=e;function n(e){return Jk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function SS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function ES(e,t,n,a,i,r,o,s,c){const l=.5,d=oS(i),u=oS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:kS(-1),translate:SS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function $S(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(tS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function AS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return uS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function zS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Jk(n);const p={groupSlides:function(e){return h?function(e,t){return oS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?oS(e).reduce(((n,h,p)=>{const m=sS(n)||0,g=0===m,f=h===cS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=aS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function IS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return eS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return aS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(sS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(aS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=zS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>sS(e)[o]-e[0][r])).map(aS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-aS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-sS(P)+sS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=fS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=lS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=sS(o);return fS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return rS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:fS(n?a-e:sS(t),a)}}(N,H,u),q=_S(cS(H),d,u),U=q.clone(),W=oS(n),Z=gS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=kS(Q),Y=kS(Q),K=kS(Q),X=kS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=iS(p),u=d,m},settled:function(){return aS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=CS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=mS(),ie=AS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?dS(sS(n[0])+1):i?dS(cS(r)-sS(n)[0]+1,sS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=MS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:vS(S,e,a,i,X,yS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:bS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:wS(B,K,X,J,$),scrollLooper:xS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:ES(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:$S(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:SS(S,t)};return se}const TS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function jS(e){function t(e,t){return hS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=uS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>uS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function OS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=jS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=mS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(TS,OS.globalOptions),x=l(w),C=[];function M(t){const n=IS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=eS(t)?e.querySelector(t):t;v=a||e.children[0];const i=eS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function DS(){return DS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=PS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===US?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(PS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=qS&&e>=BS},b=function(){if(l.accelerationFactors.length>=WS){if(d&&(d=!1,LS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*WS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=GS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return NS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),NS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var KS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function XS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(KS,XS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=YS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}XS.globalOptions=void 0;class JS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=OS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[XS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let eE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new JS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],eE.prototype,"direction",void 0),e([he({attribute:!0})],eE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],eE.prototype,"loop",void 0),e([he({attribute:!1})],eE.prototype,"dragFree",void 0),e([he({attribute:!1})],eE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],eE.prototype,"plugins",void 0),e([he({attribute:!1})],eE.prototype,"selected",void 0),eE=e([le("frigate-card-carousel")],eE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const tE=window,nE=tE.ShadowRoot&&(void 0===tE.ShadyCSS||tE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,aE=Symbol(),iE=new WeakMap;let rE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==aE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(nE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=iE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&iE.set(t,e))}return e}toString(){return this.cssText}};const oE=(e,t)=>{nE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=tE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},sE=nE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new rE("string"==typeof e?e:e+"",void 0,aE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var cE;const lE=window,dE=lE.trustedTypes,uE=dE?dE.emptyScript:"",hE=lE.reactiveElementPolyfillSupport,pE={toAttribute(e,t){switch(t){case Boolean:e=e?uE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},mE=(e,t)=>t!==e&&(t==t||e==e),gE={attribute:!0,type:String,converter:pE,reflect:!1,hasChanged:mE},fE="finalized";class _E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=gE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||gE}static finalize(){if(this.hasOwnProperty(fE))return!1;this[fE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(sE(e))}else void 0!==e&&t.push(sE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return oE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=gE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:pE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:pE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||mE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}_E[fE]=!0,_E.elementProperties=new Map,_E.elementStyles=[],_E.shadowRootOptions={mode:"open"},null==hE||hE({ReactiveElement:_E}),(null!==(cE=lE.reactiveElementVersions)&&void 0!==cE?cE:lE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const vE=0,yE=Symbol();class bE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>mE(e,t[n]))):e!==t}}class wE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var xE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const CE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??xk(i),pending:()=>a?.inProgressFunc?.()??xk(i),error:t=>{Gg(t),kk(e,t)},complete:n})}`},ME=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,kE=(e,t,n,a=!0)=>new bE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(ME)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),SE=300;let EE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=kE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===vE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?CE(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],EE.prototype,"thumbnail",void 0),e([he({attribute:!1})],EE.prototype,"hass",void 0),EE=e([le("frigate-card-thumbnail-feature-thumbnail")],EE);let $E=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],$E.prototype,"date",void 0),e([he({attribute:!1})],$E.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],$E.prototype,"showCameraTitle",void 0),$E=e([le("frigate-card-thumbnail-feature-text")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-event")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-recording")],zE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!tx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${tx.isEvent(this.media)&&e?q``:tx.isEvent(this.media)||tx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&tx.isEvent(this.media)?q``:this.details&&tx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new wE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await Ew(this.hass,this.cameraManager,this.media)}catch(e){kk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let TE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],TE.prototype,"hass",void 0),e([he({attribute:!1})],TE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"config",void 0),e([he({attribute:!1})],TE.prototype,"fadeThumbnails",void 0),TE=e([le("frigate-card-thumbnail-carousel")],TE);var jE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const OE=document.createElement("template");OE.innerHTML='\n
\n
\n';class DE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(OE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",DE);let RE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],RE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],RE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"open",void 0),e([he({attribute:!1})],RE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"empty",void 0),RE=e([le("frigate-card-drawer")],RE);let PE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],PE.prototype,"drawerIcons",void 0),PE=e([le("frigate-card-surround-basic")],PE);let LE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-91693473.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new wE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(jE)}};e([he({attribute:!1})],LE.prototype,"hass",void 0),e([he({attribute:!1})],LE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],LE.prototype,"cameraManager",void 0),e([he({attribute:!1})],LE.prototype,"cardWideConfig",void 0),LE=e([le("frigate-card-surround")],LE);var NE="Tue, 10 Dec 2024 02:14:31 GMT",FE="216ded2",VE="Mon, 9 Dec 2024 18:13:23 -0800";const HE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),BE="hass_web_proxy",qE=(e,t)=>`/api/${BE}/v${t??0}/?url=${encodeURIComponent(e)}`,UE=(e,t,n="media")=>(e=>e.config.components.includes(BE))(e)&&!!t[n];async function WE(e,t,n){await e.callService(BE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const ZE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,HE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let QE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.2",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:FE,build_date:NE,commit_date:VE},...e&&{ha_version:e.config.version},integrations:{reolink:await ZE("reolink",e),frigate:{...await ZE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await ZE(BE,e),motioneye:await ZE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return wk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(jE)}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([pe()],QE.prototype,"_diagnostics",void 0),QE=e([le("frigate-card-diagnostics")],QE);let GE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-9bf80040.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-1de615c4.js"):e?.isViewerView()?import("./index-25c40d01.js"):e?.is("image")?import("./image-1e2a0a79.js"):e?.is("timeline")&&import("./timeline-c30d9341.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"cameraManager",void 0),e([he({attribute:!1})],GE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([he({attribute:!1})],GE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],GE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"hide",void 0),e([he({attribute:!1})],GE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],GE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),GE=e([le("frigate-card-views")],GE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.2`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let YE=class extends se{constructor(){super(...arguments),this._controller=new Ax(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new zx,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await Ax.getConfigElement()}static getStubConfig(e,t){return Ax.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${wk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};YE=e([le("frigate-card")],YE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,tw as a1,et as a2,nw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,Jb as bQ,Kb as bR,Uk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,ew as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Gw as cP,Mk as cQ,ze as cR,Yw as cS,df as cT,wk as cU,je as cV,Qg as cW,vw as cX,td as cY,kk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,aw as d,ba as d$,My as d0,ve as d1,jE as d2,Vd as d3,nu as d4,c as d5,ux as d6,Qv as d7,hx as d8,lx as d9,wx as dA,Ck as dB,U as dC,xf as dD,Bw as dE,kE as dF,CE as dG,yf as dH,Fk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Cx as dU,Gy as dV,gx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,px as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,qw as dh,af as di,SE as dj,kx as dk,xk as dl,$w as dm,tx as dn,hy as dp,Bb as dq,qb as dr,UE as ds,WE as dt,Ib as du,qE as dv,Qw as dw,Kw as dx,Xw as dy,Jw as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Vb as eB,Zv as eC,Nb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,bE as eP,me as eQ,be as eR,jb as eS,Zw as eT,Gv as ea,Hk as eb,Hv as ec,rf as ed,Tv as ee,Bk as ef,Iv as eg,zv as eh,jv as ei,qk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,ww as f,Fb as g,Xb as h,Dv as i,Lb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Hb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/www/community/frigate-hass-card/card-45855f1f.js.gz b/www/community/frigate-hass-card/card-45855f1f.js.gz new file mode 100644 index 00000000..a46cc70d Binary files /dev/null and b/www/community/frigate-hass-card/card-45855f1f.js.gz differ diff --git a/www/community/frigate-hass-card/card-4e88bdfb.js b/www/community/frigate-hass-card/card-4e88bdfb.js new file mode 100644 index 00000000..e23f56a3 --- /dev/null +++ b/www/community/frigate-hass-card/card-4e88bdfb.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-16943492.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-f4a9d103.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-becc05fc.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-b5a59dfe.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=()=>!!navigator.userAgent.match(/CrKey\//),yb=(e,t)=>!!((e.attributes.supported_features??0)&t),bb=e=>(e=>yb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,wb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},xb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},Cb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Mb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},kb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},Sb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Eb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?Sb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":kb[a]},$b=e=>{const t=e?.attributes.device_class;if(t&&t in Mb)return Mb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Eb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},Ab="mdi:bookmark",zb={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function Ib(e,t,n,a){switch(e){case"alarm_control_panel":return wb(n);case"binary_sensor":return xb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return Cb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=$b(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?zb[e]:"mdi:weather-night";case"update":return"on"===t?.state?bb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in zb?zb[e]:a??Ab}async function Tb(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function jb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function Ob(e,t,n,a){return!!jb(e,t,n,{...a,firstOnly:!0}).length}function Db(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Rb(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Pb(e){return{color:Rb(e),filter:Db(e)}}function Lb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Pb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Fb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Nb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Fb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:Ib(Ye(t),a,a?.state,n)}const Vb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Hb=e=>!!e&&["on","open"].includes(e),Bb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function qb(e){return!!e?.startsWith("/")}function Ub(e,t){return qb(t)?e.hassUrl(t):t??null}class Wb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Zb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Zb||(Zb={}));class Qb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Wb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Zb.LANGUAGES,Zb.SIDE_LOAD_ELEMENTS,Zb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Zb.MICROPHONE_CONNECT]:[],Zb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Zb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-ea16daba.js")),t&&(N_=t),!0})(e),[Zb.SIDE_LOAD_ELEMENTS]:async()=>await Vb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Zb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Zb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Zb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Gb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,vb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),of(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Zb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Yb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Yb(e,t,n)},Jb=(e,t,n)=>fv(e,t,n),ew=(e,t)=>{!function(e,t){null==e||Kb(e,t)}(e,t)},tw=e=>u_(e),nw=(e,t)=>e.replace("#",`[${t.toString()}]`),aw=function(e){let t=!1;for(let n=0;n{const i=Jb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(ew(e,t),0):void 0===r||(a?.keepOriginal||ew(e,t),Xb(e,n,r),0)))})(a,e,t,n)}},ow=function(e,t,n){return function(a){let i=rw(e,t,n)(a);return i=lw(bs,rw(e,t,n),(e=>e.overrides))(a)||i,i}},sw=function(e,t){return ow(e,e,{transform:t})},cw=function(e){return ow(e,e,{transform:e=>null})},lw=function(e,t,n){return function(a){let i=!1;const r=Jb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},dw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},uw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),hw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),mw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),gw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),fw=[lw(bs,uw,(e=>e.conditions)),e=>dw(uw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),ow("event_gallery",or),ow("menu.buttons.frigate_ui",is),e=>dw(gw)("object"==typeof e&&e?e:{}),lw(Ca,sw("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),ow("live.jsmpeg",ki),ow("live.image",Ci),ow("live.webrtc_card",Si),lw(Ca,ow("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),lw(Ca,ow("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>dw(mw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Yb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},ow("view.timeout_seconds",Ri),sw("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),sw("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),sw("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),sw("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),sw("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),ow("live.controls.thumbnails.media",io),ow("timeline.media",Ho),ow("live.controls.timeline.media",po),ow("media_viewer.controls.timeline.media",Rr),ow("view.scan",Xi),ow("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),ow("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),ow("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),ow("live.layout",Ai),cw("media_viewer.layout"),cw("image.layout"),lw(bs,hw),e=>dw(hw)("object"==typeof e&&e?e[Ii]:{}),e=>dw(hw)("object"==typeof e&&e?e.automations:{}),lw(Ca,ow("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),ow("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),lw(bs,rw("overrides","merge")),ow("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),sw("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),ow("view.update_cycle_camera",Wi),ow("view.update_force",Qi,{transform:e=>!0===e?"all":null}),ow("view.update_seconds",Gi),ow("view.update_entities",Yi),rw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),cw("live.controls.title"),cw("media_viewer.controls.title"),e=>dw(pw)("object"==typeof e&&e?e:{}),ow("dimensions.max_height",ys),cw("dimensions.min_height")];class _w extends zs{}class vw extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function yw(e,t,n){let a=tw(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{ew(a,e)})),Object.keys(t.set??{}).forEach((e=>{Xb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Xb(a,e,Ly({},Jb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new _w(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class bw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const ww={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},xw=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in ww&&Object.entries(ww[e]).forEach((([e,n])=>{return r=n,void(void 0===Jb(i,a=e)&&Xb(t,a,r));var a,r}));return t},Cw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Mw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=Cw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class kw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=iw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=xw(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Zb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Mw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=yw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Zb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Zb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class Sw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Ew=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},$w=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Tb(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Ew(i)},Aw=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class zw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await $w(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Ew(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class Iw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Tw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],jw=(()=>{if("undefined"==typeof document)return!1;const e=Tw[0],t={};for(const n of Tw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),Ow={change:jw.fullscreenchange,error:jw.fullscreenerror};let Dw={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Dw.off("change",i),n()};Dw.on("change",i);const r=e[jw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Dw.isFullscreen)return void e();const n=()=>{Dw.off("change",n),e()};Dw.on("change",n);const a=document[jw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Dw.isFullscreen?Dw.exit():Dw.request(e,t),onchange(e){Dw.on("change",e)},onerror(e){Dw.on("error",e)},on(e,t){const n=Ow[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=Ow[e];n&&document.removeEventListener(n,t,!1)},raw:jw};Object.defineProperties(Dw,{isFullscreen:{get:()=>Boolean(document[jw.fullscreenElement])},element:{enumerable:!0,get:()=>document[jw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[jw.fullscreenEnabled])}}),jw||(Dw={isEnabled:!1});var Rw=Dw;class Pw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Rw.isEnabled&&Rw.on("change",this._fullscreenHandler)}disconnect(){Rw.isEnabled&&Rw.off("change",this._fullscreenHandler)}isInFullscreen(){return Rw.isEnabled&&Rw.isFullscreen}toggleFullscreen(){Rw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Rw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Lw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=jb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Nw{constructor(e){this._hass=null,this._stateWatcher=new Lw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Fw=function(){return th.Date.now()},Vw="Expected a function",Hw=Math.max,Bw=Math.min;function qw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Vw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Fw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Bw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Fw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Hw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Fw())},_}function Uw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),qw(e,t,{leading:a,maxWait:t,trailing:i})}class Ww{constructor(e){this._timer=new xf,this.reportInteraction=Uw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Zw{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Qw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Gw(e,t,n){const a=Qw(t,n);a&&Yw(e,a)}function Yw(e,t){Bg(e,"media:loaded",t)}function Kw(e){Bg(e,"media:unloaded")}function Xw(e){Bg(e,"media:volumechange")}function Jw(e){Bg(e,"media:play")}function ex(e){Bg(e,"media:pause")}class tx{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class nx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class ax{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&yb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(yb(n,4096))a="media_stop";else{if(!yb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:nx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ix{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class ox{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class sx{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class cx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class lx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=Uw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function dx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class ux{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=dx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class hx extends ux{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class px extends ux{}class mx{static areEventQueries(e){return e instanceof hx}static areRecordingQueries(e){return e instanceof px}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const gx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},fx=(e,t)=>Ly({},e,t);class _x{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new _x({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new _x({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=fx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const vx=(e,t)=>{t?.forEach((t=>t.modify(e)))};class yx extends zs{}class bx extends zs{}class wx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...gx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=gx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new yx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new bx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new _x(o);return vx(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!gx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class xx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class Cx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Mx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class kx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new kx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Ex{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new hx(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new px(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new Sx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Mx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class $x{constructor(e,t){this._api=e,this._executor=t??new Ex(e)}async getExistingQueryModifiers(e,t){return e.query?[new Cx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new Cx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new xx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new xx("mediaViewer","seek")]}}class Ax{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new wx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new $x(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),vx(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=mx.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!gx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class zx{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new kw(this),this._defaultManager=new Sw(this),this._downloadManager=new zw(this),this._expandManager=new Iw(this),this._fullscreenManager=new Pw(this),this._hassManager=new Nw(this),this._initializationManager=new Qb(this),this._interactionManager=new Ww(this),this._keyboardStateManager=new Zw(this),this._mediaLoadedInfoManager=new tx(this),this._mediaPlayerManager=new ax(this),this._messageManager=new ix(this),this._microphoneManager=new rx(this),this._queryStringManager=new ox(this),this._statusBarItemManager=new sx(this),this._styleManager=new cx(this),this._triggersManager=new lx(this),this._viewManager=new Ax(this),e.addController(this),this._conditionsManager=new bw(this,a),this._cardElementManager=new Gb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-4ae2085a.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class Ix{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!vb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return vb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Nb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Fb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?gx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Tx(e){return null==e}var jx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Nx(e,t){return Ox.repeat(" ",t-e.length)+e}var Fx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Lx(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=Ox.repeat(" ",t.indent)+Nx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Lx(e.buffer,i[o],r[o],e.position,u),l+=Ox.repeat(" ",t.indent)+Nx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=Ox.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Lx(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=Ox.repeat(" ",t.indent)+Nx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Vx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Hx=["scalar","sequence","mapping"];var Bx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Vx.indexOf(t))throw new Px('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Hx.indexOf(this.kind))throw new Px('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function qx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function Ux(e){return this.extend(e)}Ux.prototype.extend=function(e){var t=[],n=[];if(e instanceof Bx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Px("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Bx))throw new Px("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Px("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Px("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Bx))throw new Px("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Ux.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=qx(a,"implicit"),a.compiledExplicit=qx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),aC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var iC=/^[-+]?[0-9]+e/;var rC=new Bx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!aC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||Ox.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Ox.isNegativeZero(e))return"-0.0";return n=e.toString(10),iC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),oC=Yx.extend({implicit:[Kx,Xx,nC,rC]}),sC=oC,cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),lC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var dC=new Bx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==cC.exec(e)||null!==lC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=cC.exec(e))&&(t=lC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var uC=new Bx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),hC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var pC=new Bx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=hC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=hC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=hC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),mC=Object.prototype.hasOwnProperty,gC=Object.prototype.toString;var fC=new Bx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var UC=new Array(256),WC=new Array(256),ZC=0;ZC<256;ZC++)UC[ZC]=BC(ZC)?1:0,WC[ZC]=BC(ZC);function QC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||wC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function GC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Fx(n),new Px(t,n)}function YC(e,t){throw GC(e,t)}function KC(e,t){e.onWarning&&e.onWarning.call(null,GC(e,t))}var XC={YAML:function(e,t,n){var a,i,r;null!==e.version&&YC(e,"duplication of %YAML directive"),1!==n.length&&YC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&YC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&YC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&KC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&YC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],jC.test(a)||YC(e,"ill-formed tag handle (first argument) of the TAG directive"),xC.call(e.tagMap,a)&&YC(e,'there is a previously declared suffix for "'+a+'" tag handle'),OC.test(i)||YC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){YC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function JC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=Ox.repeat("\n",t-1))}function oM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,YC(e,"tab characters must not be used in indentation")),45===a)&&LC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,aM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,lM(e,t,kC,!1,!0),o.push(e.result),aM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)YC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),lM(e,t,SC,!0,i)&&(_?g=e.result:f=e.result),_||(tM(e,h,p,m,g,f,o,s,c),m=g=f=null),aM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)YC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?YC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?YC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(PC(r)){do{r=e.input.charCodeAt(++e.position)}while(PC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!RC(r)&&0!==r)}for(;0!==r;){for(nM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),RC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=FC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:YC(e,"expected hexadecimal character");e.result+=qC(r),e.position++}else YC(e,"unknown escape sequence");n=a=e.position}else RC(s)?(JC(e,n,a,!0),rM(e,aM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&iM(e)?YC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}YC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!LC(a)&&!NC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&YC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),xC.call(e.anchorMap,n)||YC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],aM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(LC(d=e.input.charCodeAt(e.position))||NC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(LC(a=e.input.charCodeAt(e.position+1))||n&&NC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(LC(a=e.input.charCodeAt(e.position+1))||n&&NC(a))break}else if(35===d){if(LC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&iM(e)||n&&NC(d))break;if(RC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,aM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(JC(e,i,r,!1),rM(e,e.line-s),i=r=e.position,o=!1),PC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return JC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,CC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||YC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&oM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&YC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&YC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):YC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function dM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(aM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!LC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&YC(e,"directive name must not be less than one character in length");0!==i;){for(;PC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!RC(i));break}if(RC(i))break;for(t=e.position;0!==i&&!LC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&nM(e),xC.call(XC,n)?XC[n](e,n,a):KC(e,'unknown document directive "'+n+'"')}aM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,aM(e,!0,-1)):o&&YC(e,"directives end mark is expected"),lM(e,e.lineIndent-1,SC,!1,!0),aM(e,!0,-1),e.checkLineBreaks&&IC.test(e.input.slice(r,e.position))&&KC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&iM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,aM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function ek(e){return/^\n* /.test(e)}var tk=1,nk=2,ak=3,ik=4,rk=5;function ok(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return YM(e)&&e!==gM&&!GM(e)&&e!==$M&&e!==TM&&e!==AM&&e!==EM&&e!==OM&&e!==DM&&e!==PM&&e!==NM&&e!==xM&&e!==MM&&e!==SM&&e!==bM&&e!==LM&&e!==zM&&e!==IM&&e!==kM&&e!==wM&&e!==CM&&e!==jM&&e!==RM}(JM(e,0))&&function(e){return!GM(e)&&e!==AM}(JM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!YM(l=JM(e,c)))return rk;g=g&&XM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=JM(e,c))===_M)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!YM(l))return rk;g=g&&XM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&ek(e)?rk:o?r===UM?rk:nk:h?ik:ak:!g||o||i(e)?r===UM?rk:nk:tk}function sk(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===UM?'""':"''";if(!e.noCompatMode&&(-1!==VM.indexOf(t)||HM.test(t)))return e.quotingType===UM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(ok(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+ck(t,e.indent)+lk(ZM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,dk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+dk(l,t),o=n}return r}(t,o),r));case rk:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=JM(e,i),!(t=FM[a])&&YM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||BM(a);return n}(t)+'"';default:throw new Px("impossible error: invalid scalar style")}}()}function ck(e,t){var n=ek(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function lk(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function dk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function uk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function pk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,hk(e,n,!1)||hk(e,n,!0);var s,c=pM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Px("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&_M===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=QM(e,t)),pk(e,t+1,s,!0,c)&&(e.dump&&_M===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),pk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?uk(e,t-1,e.dump,i):uk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function mk(e,t){var n,a,i=[],r=[];for(gk(e,i,r),n=0,a=r.length;nq`
${_k.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(vk)}};e([he({attribute:!1})],yk.prototype,"message",void 0),e([he({attribute:!1})],yk.prototype,"context",void 0),e([he({attribute:!1})],yk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],yk.prototype,"dotdotdot",void 0),yk=e([le("frigate-card-message")],yk);let bk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(vk)}};e([he({attribute:!1})],bk.prototype,"message",void 0),bk=e([le("frigate-card-error-message")],bk);let wk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(vk)}};function xk(e){return"error"===e?.type?q` `:e?q` `:q``}function Ck(e){return q` + + + `}function Mk(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function kk(e,t,n){Mk(e,t,"error",{context:n?.context})}function Sk(e,t){t instanceof Error&&kk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],wk.prototype,"message",void 0),e([he({attribute:!1})],wk.prototype,"animated",void 0),e([he({attribute:!1})],wk.prototype,"size",void 0),wk=e([le("frigate-card-progress-indicator")],wk);let Ek=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return Sk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Ek.prototype,"elements",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"hass",void 0),Ek=e([le("frigate-card-elements-core")],Ek);let $k=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],$k.prototype,"hass",void 0),e([he({attribute:!1})],$k.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],$k.prototype,"elements",void 0),$k=e([le("frigate-card-elements")],$k);let Ak=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new vw(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],Ak.prototype,"hass",void 0),Ak=e([le("frigate-card-conditional")],Ak);class zk extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],zk.prototype,"_config",void 0);class Ik extends zk{constructor(){super("menu")}}let Tk=class extends Ik{};Tk=e([le("frigate-card-menu-icon")],Tk);let jk=class extends Ik{};jk=e([le("frigate-card-menu-state-icon")],jk);let Ok=class extends Ik{};Ok=e([le("frigate-card-menu-submenu")],Ok);let Dk=class extends Ik{};Dk=e([le("frigate-card-menu-submenu-select")],Dk);class Rk extends zk{constructor(){super("status-bar")}}let Pk=class extends Rk{};Pk=e([le("frigate-card-status-bar-icon")],Pk);let Lk=class extends Rk{};Lk=e([le("frigate-card-status-bar-image")],Lk);let Nk=class extends Rk{};Nk=e([le("frigate-card-status-bar-string")],Nk);let Fk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Fk=e([le("frigate-card-loading")],Fk);const Vk=(e,t)=>{Bg(e,"action:execution-request",t)};class Hk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Vk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Lb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Uk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Wk=e=>{switch(e){case"frigate":return Bk;case"motioneye":return qk;case"reolink":return Uk;default:return null}};const Zk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Qk=class extends se{_renderItem(e){if(!this.hass)return;const t=Lb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Wk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenu",void 0),Qk=e([le("frigate-card-submenu")],Qk);let Gk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||Ob(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Zk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:Ib("select"),...Lb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Gk.prototype,"hass",void 0),e([he({attribute:!1})],Gk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([pe()],Gk.prototype,"_optionTitles",void 0),Gk=e([le("frigate-card-submenu-select")],Gk);let Yk=class extends se{constructor(){super(...arguments),this._controller=new Hk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Wk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Yk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Yk.prototype,"hass",void 0),Yk=e([le("frigate-card-menu")],Yk);let Kk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Kk=e([le("frigate-card-overlay")],Kk);class Xk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Vk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Jk=class extends se{constructor(){super(...arguments),this._controller=new Xk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Wk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Jk.prototype,"items",void 0),e([he({attribute:!1})],Jk.prototype,"config",void 0),Jk=e([le("frigate-card-status-bar")],Jk);function eS(e){return"number"==typeof e}function tS(e){return"string"==typeof e}function nS(e){return"boolean"==typeof e}function aS(e){return"[object Object]"===Object.prototype.toString.call(e)}function iS(e){return Math.abs(e)}function rS(e){return Math.sign(e)}function oS(e,t){return iS(e-t)}function sS(e){return hS(e).map(Number)}function cS(e){return e[lS(e)]}function lS(e){return Math.max(0,e.length-1)}function dS(e,t){return t===lS(e)}function uS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function hS(e){return Object.keys(e)}function pS(e,t){return[e,t].reduce(((e,t)=>(hS(t).forEach((n=>{const a=e[n],i=t[n],r=aS(a)&&aS(i);e[n]=r?pS(a,i):i})),e)),{})}function mS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function gS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function fS(e,t,n,a){const i=gS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function _S(e=0,t=0){const n=iS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function vS(e,t,n){const{constrain:a}=_S(0,e),i=e+1;let r=o(t);function o(e){return n?iS((i+e)%i):a(e)}function s(){return r}function c(){return vS(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function yS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=gS(),M=gS(),k=_S(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!mS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=oS(t,z),c=oS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*rS(e)),a=d.byDistance(e,!m).distance;return m||iS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function bS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(mS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&iS(c)>.1?c:0},readPoint:r}}function wS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(nS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(iS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function xS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=_S(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=iS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&iS(u)e.add(i)))}};return c}function MS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>iS(e)-iS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>rS(e)===a));return r.length?c(r):cS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>iS(e.diff)-iS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function kS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(nS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));eS(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function SS(e){let t=e;function n(e){return eS(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function ES(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function $S(e,t,n,a,i,r,o,s,c){const l=.5,d=sS(i),u=sS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:SS(-1),translate:ES(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function AS(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(nS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function zS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return hS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function IS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=eS(n);const p={groupSlides:function(e){return h?function(e,t){return sS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?sS(e).reduce(((n,h,p)=>{const m=cS(n)||0,g=0===m,f=h===lS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=iS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function TS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return tS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return iS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(cS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=dS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(iS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=IS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>cS(e)[o]-e[0][r])).map(iS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-iS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-cS(P)+cS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=_S(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=dS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=cS(o);return _S(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return oS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:_S(n?a-e:cS(t),a)}}(N,H,u),q=vS(lS(H),d,u),U=q.clone(),W=sS(n),Z=fS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=SS(Q),Y=SS(Q),K=SS(Q),X=SS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=rS(p),u=d,m},settled:function(){return iS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=MS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=gS(),ie=zS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=dS(n,t);return a?uS(cS(n[0])+1):i?uS(lS(r)-cS(n)[0]+1,cS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=kS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:yS(S,e,a,i,X,bS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:wS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:xS(B,K,X,J,$),scrollLooper:CS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:$S(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:AS(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:ES(S,t)};return se}const jS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function OS(e){function t(e,t){return pS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=hS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>hS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function DS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=OS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=gS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(jS,DS.globalOptions),x=l(w),C=[];function M(t){const n=TS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=tS(t)?e.querySelector(t):t;v=a||e.children[0];const i=tS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function RS(){return RS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=LS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===WS?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(LS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=US&&e>=qS},b=function(){if(l.accelerationFactors.length>=ZS){if(d&&(d=!1,NS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*ZS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=YS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return FS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),FS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var XS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function JS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(XS,JS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=KS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}JS.globalOptions=void 0;class eE{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._textDirection=n?.textDirection??"ltr",this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=DS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable,direction:this._textDirection},[...this._plugins,...e.length>1?[JS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}const tE=e=>"rtl"===getComputedStyle(e).direction?"rtl":"ltr";let nE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new eE(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins,textDirection:tE(this)}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],nE.prototype,"direction",void 0),e([he({attribute:!0})],nE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],nE.prototype,"loop",void 0),e([he({attribute:!1})],nE.prototype,"dragFree",void 0),e([he({attribute:!1})],nE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],nE.prototype,"plugins",void 0),e([he({attribute:!1})],nE.prototype,"selected",void 0),nE=e([le("frigate-card-carousel")],nE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const aE=window,iE=aE.ShadowRoot&&(void 0===aE.ShadyCSS||aE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rE=Symbol(),oE=new WeakMap;let sE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==rE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(iE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=oE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&oE.set(t,e))}return e}toString(){return this.cssText}};const cE=(e,t)=>{iE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=aE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},lE=iE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new sE("string"==typeof e?e:e+"",void 0,rE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var dE;const uE=window,hE=uE.trustedTypes,pE=hE?hE.emptyScript:"",mE=uE.reactiveElementPolyfillSupport,gE={toAttribute(e,t){switch(t){case Boolean:e=e?pE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},fE=(e,t)=>t!==e&&(t==t||e==e),_E={attribute:!0,type:String,converter:gE,reflect:!1,hasChanged:fE},vE="finalized";class yE extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=_E){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||_E}static finalize(){if(this.hasOwnProperty(vE))return!1;this[vE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(lE(e))}else void 0!==e&&t.push(lE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return cE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=_E){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:gE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:gE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||fE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}yE[vE]=!0,yE.elementProperties=new Map,yE.elementStyles=[],yE.shadowRootOptions={mode:"open"},null==mE||mE({ReactiveElement:yE}),(null!==(dE=uE.reactiveElementVersions)&&void 0!==dE?dE:uE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const bE=0,wE=Symbol();class xE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===wE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>fE(e,t[n]))):e!==t}}class CE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var ME=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const kE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??Ck(i),pending:()=>a?.inProgressFunc?.()??Ck(i),error:t=>{Gg(t),Sk(e,t)},complete:n})}`},SE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,EE=(e,t,n,a=!0)=>new xE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(SE)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),$E=300;let AE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=EE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===bE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?kE(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],AE.prototype,"thumbnail",void 0),e([he({attribute:!1})],AE.prototype,"hass",void 0),AE=e([le("frigate-card-thumbnail-feature-thumbnail")],AE);let zE=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],zE.prototype,"date",void 0),e([he({attribute:!1})],zE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],zE.prototype,"showCameraTitle",void 0),zE=e([le("frigate-card-thumbnail-feature-text")],zE);let IE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(ME)}};e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),e([he({attribute:!1})],IE.prototype,"cameraTitle",void 0),IE=e([le("frigate-card-thumbnail-details-event")],IE);let TE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(ME)}};e([he({attribute:!1})],TE.prototype,"media",void 0),e([he({attribute:!1})],TE.prototype,"seek",void 0),e([he({attribute:!1})],TE.prototype,"cameraTitle",void 0),TE=e([le("frigate-card-thumbnail-details-recording")],TE);let jE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!nx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${nx.isEvent(this.media)&&e?q``:nx.isEvent(this.media)||nx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&nx.isEvent(this.media)?q``:this.details&&nx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new CE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await $w(this.hass,this.cameraManager,this.media)}catch(e){Sk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],jE.prototype,"cameraManager",void 0),e([he({attribute:!1})],jE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],jE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],jE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],jE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],jE.prototype,"show_download_control",void 0),e([he({attribute:!1})],jE.prototype,"seek",void 0),jE=e([le("frigate-card-thumbnail")],jE);let OE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],OE.prototype,"hass",void 0),e([he({attribute:!1})],OE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],OE.prototype,"cameraManager",void 0),e([he({attribute:!1})],OE.prototype,"config",void 0),e([he({attribute:!1})],OE.prototype,"fadeThumbnails",void 0),OE=e([le("frigate-card-thumbnail-carousel")],OE);var DE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const RE=document.createElement("template");RE.innerHTML='\n
\n
\n';class PE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(RE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",PE);let LE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],LE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],LE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],LE.prototype,"open",void 0),e([he({attribute:!1})],LE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],LE.prototype,"empty",void 0),LE=e([le("frigate-card-drawer")],LE);let NE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],NE.prototype,"drawerIcons",void 0),NE=e([le("frigate-card-surround-basic")],NE);let FE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-43eabd8b.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new CE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(DE)}};e([he({attribute:!1})],FE.prototype,"hass",void 0),e([he({attribute:!1})],FE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],FE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],FE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],FE.prototype,"cameraManager",void 0),e([he({attribute:!1})],FE.prototype,"cardWideConfig",void 0),FE=e([le("frigate-card-surround")],FE);var VE="Sun, 15 Dec 2024 00:55:11 GMT",HE="67f03fb",BE="Sat, 14 Dec 2024 16:53:58 -0800";const qE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),UE="hass_web_proxy",WE=(e,t)=>`/api/${UE}/v${t??0}/?url=${encodeURIComponent(e)}`,ZE=(e,t,n="media")=>(e=>e.config.components.includes(UE))(e)&&!!t[n];async function QE(e,t,n){await e.callService(UE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const GE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,qE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let YE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.8",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:HE,build_date:VE,commit_date:BE},...e&&{ha_version:e.config.version},integrations:{reolink:await GE("reolink",e),frigate:{...await GE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await GE(UE,e),motioneye:await GE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return xk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(DE)}};e([he({attribute:!1})],YE.prototype,"hass",void 0),e([he({attribute:!1})],YE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],YE.prototype,"rawConfig",void 0),e([pe()],YE.prototype,"_diagnostics",void 0),YE=e([le("frigate-card-diagnostics")],YE);let KE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-add135a5.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-82bf4b2b.js"):e?.isViewerView()?import("./index-0b99d370.js"):e?.is("image")?import("./image-a9fe0a34.js"):e?.is("timeline")&&import("./timeline-74f80c68.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],KE.prototype,"hass",void 0),e([he({attribute:!1})],KE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],KE.prototype,"cameraManager",void 0),e([he({attribute:!1})],KE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],KE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],KE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],KE.prototype,"rawConfig",void 0),e([he({attribute:!1})],KE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],KE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],KE.prototype,"hide",void 0),e([he({attribute:!1})],KE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],KE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],KE.prototype,"deviceRegistryManager",void 0),KE=e([le("frigate-card-views")],KE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.8`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let XE=class extends se{constructor(){super(...arguments),this._controller=new zx(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new Ix,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await zx.getConfigElement()}static getStubConfig(e,t){return zx.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${xk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};XE=e([le("frigate-card")],XE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,nw as a1,et as a2,aw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,ew as bQ,Xb as bR,Wk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,tw as c,tE as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Yw as cP,kk as cQ,ze as cR,Kw as cS,df as cT,xk as cU,je as cV,Qg as cW,yw as cX,td as cY,Sk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,iw as d,Hg as d$,wf as d0,My as d1,ve as d2,DE as d3,Vd as d4,nu as d5,c as d6,hx as d7,Qv as d8,px as d9,ex as dA,xx as dB,Mk as dC,U as dD,xf as dE,qw as dF,EE as dG,kE as dH,yf as dI,Vk as dJ,vf as dK,kf as dL,bf as dM,p_ as dN,h_ as dO,Pv as dP,Lv as dQ,Ud as dR,Vv as dS,Yg as dT,Kg as dU,Mx as dV,Gy as dW,fx as dX,su as dY,sf as dZ,Fv as d_,dx as da,mx as db,Gg as dc,Ev as dd,Wu as de,Xg as df,Qu as dg,Bg as dh,Uw as di,af as dj,$E as dk,Sx as dl,Ck as dm,Aw as dn,nx as dp,hy as dq,qb as dr,Ub as ds,ZE as dt,QE as du,Tb as dv,WE as dw,Gw as dx,Xw as dy,Jw as dz,_e as e,ba as e0,nf as e1,$v as e2,zs as e3,Kv as e4,Wv as e5,Z_ as e6,Q_ as e7,Yv as e8,Jg as e9,Fu as eA,Lu as eB,Hb as eC,Zv as eD,Fb as eE,lf as eF,qy as eG,Uy as eH,Wy as eI,pf as eJ,Qy as eK,Rg as eL,Zy as eM,s as eN,Ae as eO,ye as eP,Qw as eQ,xE as eR,me as eS,be as eT,Ob as eU,tf as ea,Gv as eb,Bk as ec,Hv as ed,rf as ee,Tv as ef,qk as eg,Iv as eh,zv as ei,jv as ej,Uk as ek,Xd as el,Hd as em,Gd as en,Qd as eo,Yd as ep,vu as eq,Jd as er,eu as es,yu as et,_u as eu,Bd as ev,au as ew,gu as ex,Ou as ey,Nu as ez,xw as f,Vb as g,Jb as h,Dv as i,Nb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Bb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/www/community/frigate-hass-card/card-4e88bdfb.js.gz b/www/community/frigate-hass-card/card-4e88bdfb.js.gz new file mode 100644 index 00000000..bf14d747 Binary files /dev/null and b/www/community/frigate-hass-card/card-4e88bdfb.js.gz differ diff --git a/www/community/frigate-hass-card/card-7cd05290.js b/www/community/frigate-hass-card/card-7cd05290.js new file mode 100644 index 00000000..624bc399 --- /dev/null +++ b/www/community/frigate-hass-card/card-7cd05290.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,matcher:t.matcher,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-96b32038.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-a6e3bd9e.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-d04d1919.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-ec1b4246.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>vb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,bb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},wb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},xb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Cb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Mb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},kb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Sb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?kb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Mb[a]},Eb=e=>{const t=e?.attributes.device_class;if(t&&t in Cb)return Cb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Sb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},$b="mdi:bookmark",Ab={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function zb(e,t,n,a){switch(e){case"alarm_control_panel":return bb(n);case"binary_sensor":return wb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return xb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Eb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?Ab[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in Ab?Ab[e]:a??$b}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function Tb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function jb(e,t,n,a){return!!Tb(e,t,n,{...a,firstOnly:!0}).length}function Ob(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Db(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Rb(e){return{color:Db(e),filter:Ob(e)}}function Pb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Rb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Nb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Lb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Nb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:zb(Ye(t),a,a?.state,n)}const Fb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Vb=e=>!!e&&["on","open"].includes(e),Hb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Bb(e){return!!e?.startsWith("/")}function qb(e,t){return Bb(t)?e.hassUrl(t):t??null}class Ub{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Wb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Wb||(Wb={}));class Zb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Ub}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Wb.LANGUAGES,Wb.SIDE_LOAD_ELEMENTS,Wb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Wb.MICROPHONE_CONNECT]:[],Wb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Wb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Wb.SIDE_LOAD_ELEMENTS]:async()=>await Fb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Wb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Wb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Wb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Qb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,!0,"tabindex","0"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Wb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Gb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Gb(e,t,n)},Xb=(e,t,n)=>fv(e,t,n),Jb=(e,t)=>{!function(e,t){null==e||Yb(e,t)}(e,t)},ew=e=>u_(e),tw=(e,t)=>e.replace("#",`[${t.toString()}]`),nw=function(e){let t=!1;for(let n=0;n{const i=Xb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(Jb(e,t),0):void 0===r||(a?.keepOriginal||Jb(e,t),Kb(e,n,r),0)))})(a,e,t,n)}},rw=function(e,t,n){return function(a){let i=iw(e,t,n)(a);return i=cw(bs,iw(e,t,n),(e=>e.overrides))(a)||i,i}},ow=function(e,t){return rw(e,e,{transform:t})},sw=function(e){return rw(e,e,{transform:e=>null})},cw=function(e,t,n){return function(a){let i=!1;const r=Xb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},lw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},dw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),uw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),mw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),gw=[cw(bs,dw,(e=>e.conditions)),e=>lw(dw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),rw("event_gallery",or),rw("menu.buttons.frigate_ui",is),e=>lw(mw)("object"==typeof e&&e?e:{}),cw(Ca,ow("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),rw("live.jsmpeg",ki),rw("live.image",Ci),rw("live.webrtc_card",Si),cw(Ca,rw("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),cw(Ca,rw("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>lw(pw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Gb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},rw("view.timeout_seconds",Ri),ow("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),ow("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),rw("live.controls.thumbnails.media",io),rw("timeline.media",Ho),rw("live.controls.timeline.media",po),rw("media_viewer.controls.timeline.media",Rr),rw("view.scan",Xi),rw("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),rw("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),rw("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),rw("live.layout",Ai),sw("media_viewer.layout"),sw("image.layout"),cw(bs,uw),e=>lw(uw)("object"==typeof e&&e?e[Ii]:{}),e=>lw(uw)("object"==typeof e&&e?e.automations:{}),cw(Ca,rw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),rw("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),cw(bs,iw("overrides","merge")),rw("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),ow("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),rw("view.update_cycle_camera",Wi),rw("view.update_force",Qi,{transform:e=>!0===e?"all":null}),rw("view.update_seconds",Gi),rw("view.update_entities",Yi),iw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),sw("live.controls.title"),sw("media_viewer.controls.title"),e=>lw(hw)("object"==typeof e&&e?e:{}),rw("dimensions.max_height",ys),sw("dimensions.min_height")];class fw extends zs{}class _w extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function vw(e,t,n){let a=ew(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Jb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Kb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Kb(a,e,Ly({},Xb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new fw(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const bw={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},ww=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in bw&&Object.entries(bw[e]).forEach((([e,n])=>{return r=n,void(void 0===Xb(i,a=e)&&Kb(t,a,r));var a,r}));return t},xw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Cw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=xw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class Mw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=aw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=ww(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Wb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Cw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=vw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Wb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Wb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class kw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Sw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Ew=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Sw(i)},$w=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class Aw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Ew(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Sw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class zw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Tw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),jw={change:Tw.fullscreenchange,error:Tw.fullscreenerror};let Ow={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Ow.off("change",i),n()};Ow.on("change",i);const r=e[Tw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Ow.isFullscreen)return void e();const n=()=>{Ow.off("change",n),e()};Ow.on("change",n);const a=document[Tw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Ow.isFullscreen?Ow.exit():Ow.request(e,t),onchange(e){Ow.on("change",e)},onerror(e){Ow.on("error",e)},on(e,t){const n=jw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=jw[e];n&&document.removeEventListener(n,t,!1)},raw:Tw};Object.defineProperties(Ow,{isFullscreen:{get:()=>Boolean(document[Tw.fullscreenElement])},element:{enumerable:!0,get:()=>document[Tw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[Tw.fullscreenEnabled])}}),Tw||(Ow={isEnabled:!1});var Dw=Ow;class Rw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Dw.isEnabled&&Dw.on("change",this._fullscreenHandler)}disconnect(){Dw.isEnabled&&Dw.off("change",this._fullscreenHandler)}isInFullscreen(){return Dw.isEnabled&&Dw.isFullscreen}toggleFullscreen(){Dw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Dw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Pw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=Tb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Lw{constructor(e){this._hass=null,this._stateWatcher=new Pw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Nw=function(){return th.Date.now()},Fw="Expected a function",Vw=Math.max,Hw=Math.min;function Bw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Fw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Nw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Hw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Nw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Vw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Nw())},_}function qw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Bw(e,t,{leading:a,maxWait:t,trailing:i})}class Uw{constructor(e){this._timer=new xf,this.reportInteraction=qw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Ww{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Zw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Qw(e,t,n){const a=Zw(t,n);a&&Gw(e,a)}function Gw(e,t){Bg(e,"media:loaded",t)}function Yw(e){Bg(e,"media:unloaded")}function Kw(e){Bg(e,"media:volumechange")}function Xw(e){Bg(e,"media:play")}function Jw(e){Bg(e,"media:pause")}class ex{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class tx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class nx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&vb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(vb(n,4096))a="media_stop";else{if(!vb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:tx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ax{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class rx{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class ox{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class sx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class cx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=qw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function lx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class dx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=lx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class ux extends dx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class hx extends dx{}class px{static areEventQueries(e){return e instanceof ux}static areRecordingQueries(e){return e instanceof hx}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const mx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},gx=(e,t)=>Ly({},e,t);class fx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new fx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new fx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=gx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const _x=(e,t)=>{t?.forEach((t=>t.modify(e)))};class vx extends zs{}class yx extends zs{}class bx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...mx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=mx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new vx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new fx(o);return _x(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class wx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class xx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Cx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Mx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Mx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Sx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new ux(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new hx(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new kx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Cx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Ex{constructor(e,t){this._api=e,this._executor=t??new Sx(e)}async getExistingQueryModifiers(e,t){return e.query?[new xx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new xx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new wx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new wx("mediaViewer","seek")]}}class $x{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new bx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Ex(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),_x(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=px.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class Ax{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new Mw(this),this._defaultManager=new kw(this),this._downloadManager=new Aw(this),this._expandManager=new zw(this),this._fullscreenManager=new Rw(this),this._hassManager=new Lw(this),this._initializationManager=new Zb(this),this._interactionManager=new Uw(this),this._keyboardStateManager=new Ww(this),this._mediaLoadedInfoManager=new ex(this),this._mediaPlayerManager=new nx(this),this._messageManager=new ax(this),this._microphoneManager=new ix(this),this._queryStringManager=new rx(this),this._statusBarItemManager=new ox(this),this._styleManager=new sx(this),this._triggersManager=new cx(this),this._viewManager=new $x(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Qb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-ce460dd0.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class zx{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!this._isBeingCasted()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return this._isBeingCasted()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Lb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Nb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?mx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}_isBeingCasted(){return!!navigator.userAgent.match(/CrKey\//)}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var Tx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Lx(e,t){return jx.repeat(" ",t-e.length)+e}var Nx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Px(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=jx.repeat(" ",t.indent)+Lx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Px(e.buffer,i[o],r[o],e.position,u),l+=jx.repeat(" ",t.indent)+Lx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=jx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Px(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=jx.repeat(" ",t.indent)+Lx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Fx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Vx=["scalar","sequence","mapping"];var Hx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Fx.indexOf(t))throw new Rx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Vx.indexOf(this.kind))throw new Rx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Bx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function qx(e){return this.extend(e)}qx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Hx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Rx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Rx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Rx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(qx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Bx(a,"implicit"),a.compiledExplicit=Bx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),nC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var aC=/^[-+]?[0-9]+e/;var iC=new Hx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!nC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||jx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(jx.isNegativeZero(e))return"-0.0";return n=e.toString(10),aC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),rC=Gx.extend({implicit:[Yx,Kx,tC,iC]}),oC=rC,sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var lC=new Hx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==sC.exec(e)||null!==cC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=sC.exec(e))&&(t=cC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var dC=new Hx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),uC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var hC=new Hx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=uC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=uC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=uC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),pC=Object.prototype.hasOwnProperty,mC=Object.prototype.toString;var gC=new Hx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var qC=new Array(256),UC=new Array(256),WC=0;WC<256;WC++)qC[WC]=HC(WC)?1:0,UC[WC]=HC(WC);function ZC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||bC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function QC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Nx(n),new Rx(t,n)}function GC(e,t){throw QC(e,t)}function YC(e,t){e.onWarning&&e.onWarning.call(null,QC(e,t))}var KC={YAML:function(e,t,n){var a,i,r;null!==e.version&&GC(e,"duplication of %YAML directive"),1!==n.length&&GC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&GC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&GC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&YC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&GC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],TC.test(a)||GC(e,"ill-formed tag handle (first argument) of the TAG directive"),wC.call(e.tagMap,a)&&GC(e,'there is a previously declared suffix for "'+a+'" tag handle'),jC.test(i)||GC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){GC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function XC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=jx.repeat("\n",t-1))}function rM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,GC(e,"tab characters must not be used in indentation")),45===a)&&PC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,nM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,cM(e,t,MC,!1,!0),o.push(e.result),nM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)GC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),cM(e,t,kC,!0,i)&&(_?g=e.result:f=e.result),_||(eM(e,h,p,m,g,f,o,s,c),m=g=f=null),nM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)GC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?GC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?GC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(RC(r)){do{r=e.input.charCodeAt(++e.position)}while(RC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!DC(r)&&0!==r)}for(;0!==r;){for(tM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),DC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=NC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:GC(e,"expected hexadecimal character");e.result+=BC(r),e.position++}else GC(e,"unknown escape sequence");n=a=e.position}else DC(s)?(XC(e,n,a,!0),iM(e,nM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&aM(e)?GC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}GC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!PC(a)&&!LC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&GC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),wC.call(e.anchorMap,n)||GC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],nM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(PC(d=e.input.charCodeAt(e.position))||LC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a))break}else if(35===d){if(PC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&aM(e)||n&&LC(d))break;if(DC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,nM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(XC(e,i,r,!1),iM(e,e.line-s),i=r=e.position,o=!1),RC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return XC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,xC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||GC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&rM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&GC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&GC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):GC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function lM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(nM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&GC(e,"directive name must not be less than one character in length");0!==i;){for(;RC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!DC(i));break}if(DC(i))break;for(t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&tM(e),wC.call(KC,n)?KC[n](e,n,a):YC(e,'unknown document directive "'+n+'"')}nM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,nM(e,!0,-1)):o&&GC(e,"directives end mark is expected"),cM(e,e.lineIndent-1,kC,!1,!0),nM(e,!0,-1),e.checkLineBreaks&&zC.test(e.input.slice(r,e.position))&&YC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&aM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,nM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function JM(e){return/^\n* /.test(e)}var ek=1,tk=2,nk=3,ak=4,ik=5;function rk(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return GM(e)&&e!==mM&&!QM(e)&&e!==EM&&e!==IM&&e!==$M&&e!==SM&&e!==jM&&e!==OM&&e!==RM&&e!==LM&&e!==wM&&e!==CM&&e!==kM&&e!==yM&&e!==PM&&e!==AM&&e!==zM&&e!==MM&&e!==bM&&e!==xM&&e!==TM&&e!==DM}(XM(e,0))&&function(e){return!QM(e)&&e!==$M}(XM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!GM(l=XM(e,c)))return ik;g=g&&KM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=XM(e,c))===fM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!GM(l))return ik;g=g&&KM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&JM(e)?ik:o?r===qM?ik:tk:h?ak:nk:!g||o||i(e)?r===qM?ik:tk:ek}function ok(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===qM?'""':"''";if(!e.noCompatMode&&(-1!==FM.indexOf(t)||VM.test(t)))return e.quotingType===qM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(rk(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+sk(t,e.indent)+ck(WM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,lk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+lk(l,t),o=n}return r}(t,o),r));case ik:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=XM(e,i),!(t=NM[a])&&GM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||HM(a);return n}(t)+'"';default:throw new Rx("impossible error: invalid scalar style")}}()}function sk(e,t){var n=JM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function ck(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function lk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function dk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function hk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,uk(e,n,!1)||uk(e,n,!0);var s,c=hM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Rx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=ZM(e,t)),hk(e,t+1,s,!0,c)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),hk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?dk(e,t-1,e.dump,i):dk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function pk(e,t){var n,a,i=[],r=[];for(mk(e,i,r),n=0,a=r.length;nq`
${fk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(_k)}};e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"context",void 0),e([he({attribute:!1})],vk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],vk.prototype,"dotdotdot",void 0),vk=e([le("frigate-card-message")],vk);let yk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(_k)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let bk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(_k)}};function wk(e){return"error"===e?.type?q` `:e?q` `:q``}function xk(e){return q` + + + `}function Ck(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function Mk(e,t,n){Ck(e,t,"error",{context:n?.context})}function kk(e,t){t instanceof Error&&Mk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],bk.prototype,"message",void 0),e([he({attribute:!1})],bk.prototype,"animated",void 0),e([he({attribute:!1})],bk.prototype,"size",void 0),bk=e([le("frigate-card-progress-indicator")],bk);let Sk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return kk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Sk.prototype,"elements",void 0),e([he({attribute:!1})],Sk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-elements-core")],Sk);let Ek=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],Ek.prototype,"hass",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"elements",void 0),Ek=e([le("frigate-card-elements")],Ek);let $k=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new _w(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],$k.prototype,"hass",void 0),$k=e([le("frigate-card-conditional")],$k);class Ak extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ak.prototype,"_config",void 0);class zk extends Ak{constructor(){super("menu")}}let Ik=class extends zk{};Ik=e([le("frigate-card-menu-icon")],Ik);let Tk=class extends zk{};Tk=e([le("frigate-card-menu-state-icon")],Tk);let jk=class extends zk{};jk=e([le("frigate-card-menu-submenu")],jk);let Ok=class extends zk{};Ok=e([le("frigate-card-menu-submenu-select")],Ok);class Dk extends Ak{constructor(){super("status-bar")}}let Rk=class extends Dk{};Rk=e([le("frigate-card-status-bar-icon")],Rk);let Pk=class extends Dk{};Pk=e([le("frigate-card-status-bar-image")],Pk);let Lk=class extends Dk{};Lk=e([le("frigate-card-status-bar-string")],Lk);let Nk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Nk=e([le("frigate-card-loading")],Nk);const Fk=(e,t)=>{Bg(e,"action:execution-request",t)};class Vk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Fk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Pb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Uk=e=>{switch(e){case"frigate":return Hk;case"motioneye":return Bk;case"reolink":return qk;default:return null}};const Wk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Zk=class extends se{_renderItem(e){if(!this.hass)return;const t=Pb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Uk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Zk.prototype,"hass",void 0),e([he({attribute:!1})],Zk.prototype,"submenu",void 0),Zk=e([le("frigate-card-submenu")],Zk);let Qk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||jb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Wk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:zb("select"),...Pb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Qk.prototype,"entityRegistryManager",void 0),e([pe()],Qk.prototype,"_optionTitles",void 0),Qk=e([le("frigate-card-submenu-select")],Qk);let Gk=class extends se{constructor(){super(...arguments),this._controller=new Vk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Uk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Gk.prototype,"hass",void 0),Gk=e([le("frigate-card-menu")],Gk);let Yk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Yk=e([le("frigate-card-overlay")],Yk);class Kk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Fk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Xk=class extends se{constructor(){super(...arguments),this._controller=new Kk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Uk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Xk.prototype,"items",void 0),e([he({attribute:!1})],Xk.prototype,"config",void 0),Xk=e([le("frigate-card-status-bar")],Xk);function Jk(e){return"number"==typeof e}function eS(e){return"string"==typeof e}function tS(e){return"boolean"==typeof e}function nS(e){return"[object Object]"===Object.prototype.toString.call(e)}function aS(e){return Math.abs(e)}function iS(e){return Math.sign(e)}function rS(e,t){return aS(e-t)}function oS(e){return uS(e).map(Number)}function sS(e){return e[cS(e)]}function cS(e){return Math.max(0,e.length-1)}function lS(e,t){return t===cS(e)}function dS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function uS(e){return Object.keys(e)}function hS(e,t){return[e,t].reduce(((e,t)=>(uS(t).forEach((n=>{const a=e[n],i=t[n],r=nS(a)&&nS(i);e[n]=r?hS(a,i):i})),e)),{})}function pS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function mS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function gS(e,t,n,a){const i=mS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function fS(e=0,t=0){const n=aS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function _S(e,t,n){const{constrain:a}=fS(0,e),i=e+1;let r=o(t);function o(e){return n?aS((i+e)%i):a(e)}function s(){return r}function c(){return _S(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function vS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=mS(),M=mS(),k=fS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!pS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=rS(t,z),c=rS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*iS(e)),a=d.byDistance(e,!m).distance;return m||aS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function yS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(pS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&aS(c)>.1?c:0},readPoint:r}}function bS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(tS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(aS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function wS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=fS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=aS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&aS(u)e.add(i)))}};return c}function CS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>aS(e)-aS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>iS(e)===a));return r.length?c(r):sS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>aS(e.diff)-aS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function MS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(tS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Jk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function kS(e){let t=e;function n(e){return Jk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function SS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function ES(e,t,n,a,i,r,o,s,c){const l=.5,d=oS(i),u=oS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:kS(-1),translate:SS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function $S(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(tS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function AS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return uS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function zS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Jk(n);const p={groupSlides:function(e){return h?function(e,t){return oS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?oS(e).reduce(((n,h,p)=>{const m=sS(n)||0,g=0===m,f=h===cS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=aS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function IS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return eS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return aS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(sS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(aS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=zS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>sS(e)[o]-e[0][r])).map(aS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-aS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-sS(P)+sS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=fS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=lS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=sS(o);return fS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return rS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:fS(n?a-e:sS(t),a)}}(N,H,u),q=_S(cS(H),d,u),U=q.clone(),W=oS(n),Z=gS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=kS(Q),Y=kS(Q),K=kS(Q),X=kS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=iS(p),u=d,m},settled:function(){return aS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=CS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=mS(),ie=AS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?dS(sS(n[0])+1):i?dS(cS(r)-sS(n)[0]+1,sS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=MS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:vS(S,e,a,i,X,yS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:bS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:wS(B,K,X,J,$),scrollLooper:xS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:ES(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:$S(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:SS(S,t)};return se}const TS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function jS(e){function t(e,t){return hS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=uS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>uS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function OS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=jS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=mS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(TS,OS.globalOptions),x=l(w),C=[];function M(t){const n=IS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=eS(t)?e.querySelector(t):t;v=a||e.children[0];const i=eS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function DS(){return DS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=PS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===US?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(PS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=qS&&e>=BS},b=function(){if(l.accelerationFactors.length>=WS){if(d&&(d=!1,LS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*WS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=GS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return NS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),NS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var KS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function XS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(KS,XS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=YS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}XS.globalOptions=void 0;class JS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=OS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[XS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let eE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new JS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],eE.prototype,"direction",void 0),e([he({attribute:!0})],eE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],eE.prototype,"loop",void 0),e([he({attribute:!1})],eE.prototype,"dragFree",void 0),e([he({attribute:!1})],eE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],eE.prototype,"plugins",void 0),e([he({attribute:!1})],eE.prototype,"selected",void 0),eE=e([le("frigate-card-carousel")],eE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const tE=window,nE=tE.ShadowRoot&&(void 0===tE.ShadyCSS||tE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,aE=Symbol(),iE=new WeakMap;let rE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==aE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(nE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=iE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&iE.set(t,e))}return e}toString(){return this.cssText}};const oE=(e,t)=>{nE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=tE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},sE=nE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new rE("string"==typeof e?e:e+"",void 0,aE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var cE;const lE=window,dE=lE.trustedTypes,uE=dE?dE.emptyScript:"",hE=lE.reactiveElementPolyfillSupport,pE={toAttribute(e,t){switch(t){case Boolean:e=e?uE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},mE=(e,t)=>t!==e&&(t==t||e==e),gE={attribute:!0,type:String,converter:pE,reflect:!1,hasChanged:mE},fE="finalized";class _E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=gE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||gE}static finalize(){if(this.hasOwnProperty(fE))return!1;this[fE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(sE(e))}else void 0!==e&&t.push(sE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return oE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=gE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:pE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:pE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||mE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}_E[fE]=!0,_E.elementProperties=new Map,_E.elementStyles=[],_E.shadowRootOptions={mode:"open"},null==hE||hE({ReactiveElement:_E}),(null!==(cE=lE.reactiveElementVersions)&&void 0!==cE?cE:lE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const vE=0,yE=Symbol();class bE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>mE(e,t[n]))):e!==t}}class wE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var xE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const CE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??xk(i),pending:()=>a?.inProgressFunc?.()??xk(i),error:t=>{Gg(t),kk(e,t)},complete:n})}`},ME=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,kE=(e,t,n,a=!0)=>new bE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(ME)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),SE=300;let EE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=kE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===vE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?CE(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],EE.prototype,"thumbnail",void 0),e([he({attribute:!1})],EE.prototype,"hass",void 0),EE=e([le("frigate-card-thumbnail-feature-thumbnail")],EE);let $E=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],$E.prototype,"date",void 0),e([he({attribute:!1})],$E.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],$E.prototype,"showCameraTitle",void 0),$E=e([le("frigate-card-thumbnail-feature-text")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-event")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-recording")],zE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!tx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${tx.isEvent(this.media)&&e?q``:tx.isEvent(this.media)||tx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&tx.isEvent(this.media)?q``:this.details&&tx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new wE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await Ew(this.hass,this.cameraManager,this.media)}catch(e){kk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let TE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],TE.prototype,"hass",void 0),e([he({attribute:!1})],TE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"config",void 0),e([he({attribute:!1})],TE.prototype,"fadeThumbnails",void 0),TE=e([le("frigate-card-thumbnail-carousel")],TE);var jE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const OE=document.createElement("template");OE.innerHTML='\n
\n
\n';class DE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(OE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",DE);let RE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],RE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],RE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"open",void 0),e([he({attribute:!1})],RE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"empty",void 0),RE=e([le("frigate-card-drawer")],RE);let PE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],PE.prototype,"drawerIcons",void 0),PE=e([le("frigate-card-surround-basic")],PE);let LE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-99ac5d81.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new wE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(jE)}};e([he({attribute:!1})],LE.prototype,"hass",void 0),e([he({attribute:!1})],LE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],LE.prototype,"cameraManager",void 0),e([he({attribute:!1})],LE.prototype,"cardWideConfig",void 0),LE=e([le("frigate-card-surround")],LE);var NE="6.0.0",FE="Mon, 09 Dec 2024 00:16:17 GMT",VE="4590558",HE="Sun, 8 Dec 2024 16:05:13 -0800";const BE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),qE="hass_web_proxy",UE=(e,t)=>`/api/${qE}/v${t??0}/?url=${encodeURIComponent(e)}`,WE=(e,t,n="media")=>(e=>e.config.components.includes(qE))(e)&&!!t[n];async function ZE(e,t,n){await e.callService(qE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const QE=()=>NE,GE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,BE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let YE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:QE(),browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:VE,build_date:FE,commit_date:HE},...e&&{ha_version:e.config.version},integrations:{reolink:await GE("reolink",e),frigate:{...await GE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await GE(qE,e),motioneye:await GE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return wk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(jE)}};e([he({attribute:!1})],YE.prototype,"hass",void 0),e([he({attribute:!1})],YE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],YE.prototype,"rawConfig",void 0),e([pe()],YE.prototype,"_diagnostics",void 0),YE=e([le("frigate-card-diagnostics")],YE);let KE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-3c9b9749.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-149d4f41.js"):e?.isViewerView()?import("./index-961f10b9.js"):e?.is("image")?import("./image-5371a090.js"):e?.is("timeline")&&import("./timeline-dfcd5e4d.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],KE.prototype,"hass",void 0),e([he({attribute:!1})],KE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],KE.prototype,"cameraManager",void 0),e([he({attribute:!1})],KE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],KE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],KE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],KE.prototype,"rawConfig",void 0),e([he({attribute:!1})],KE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],KE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],KE.prototype,"hide",void 0),e([he({attribute:!1})],KE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],KE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],KE.prototype,"deviceRegistryManager",void 0),KE=e([le("frigate-card-views")],KE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} `+QE(),"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let XE=class extends se{constructor(){super(...arguments),this._controller=new Ax(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new zx,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await Ax.getConfigElement()}static getStubConfig(e,t){return Ax.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${wk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\n.main:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\n.main:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};XE=e([le("frigate-card")],XE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,tw as a1,et as a2,nw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,Jb as bQ,Kb as bR,Uk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,ew as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Gw as cP,Mk as cQ,ze as cR,Yw as cS,df as cT,wk as cU,je as cV,Qg as cW,vw as cX,td as cY,kk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,aw as d,ba as d$,My as d0,ve as d1,jE as d2,Vd as d3,nu as d4,c as d5,ux as d6,Qv as d7,hx as d8,lx as d9,wx as dA,Ck as dB,U as dC,xf as dD,Bw as dE,kE as dF,CE as dG,yf as dH,Fk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Cx as dU,Gy as dV,gx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,px as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,qw as dh,af as di,SE as dj,kx as dk,xk as dl,$w as dm,tx as dn,hy as dp,Bb as dq,qb as dr,WE as ds,ZE as dt,Ib as du,UE as dv,Qw as dw,Kw as dx,Xw as dy,Jw as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Vb as eB,Zv as eC,Nb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,bE as eP,me as eQ,be as eR,jb as eS,Zw as eT,Gv as ea,Hk as eb,Hv as ec,rf as ed,Tv as ee,Bk as ef,Iv as eg,zv as eh,jv as ei,qk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,ww as f,Fb as g,Xb as h,Dv as i,Lb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Hb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/www/community/frigate-hass-card/card-7cd05290.js.gz b/www/community/frigate-hass-card/card-7cd05290.js.gz new file mode 100644 index 00000000..10c5815f Binary files /dev/null and b/www/community/frigate-hass-card/card-7cd05290.js.gz differ diff --git a/www/community/frigate-hass-card/card-c642ee74.js b/www/community/frigate-hass-card/card-c642ee74.js new file mode 100644 index 00000000..a52d5fd4 --- /dev/null +++ b/www/community/frigate-hass-card/card-c642ee74.js @@ -0,0 +1,650 @@ +function e(e,t,n,a){var i,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(r<3?i(o):r>3?i(t,n,o):i(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),i=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=i.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&i.set(t,e))}return e}toString(){return this.cssText}};const o=e=>new r("string"==typeof e?e:e+"",void 0,a),s=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[a+1]),e[0]);return new r(n,e,a)},c=(e,a)=>{if(n)e.adoptedStyleSheets=a.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of a){const a=document.createElement("style"),i=t.litNonce;void 0!==i&&a.setAttribute("nonce",i),a.textContent=n.cssText,e.appendChild(a)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return o(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,f=globalThis,_=f.trustedTypes,v=_?_.emptyScript:"",y=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&u(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return a?.call(this)},set(t){const r=a?.call(this);i.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...m(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const i=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(a):this.setAttribute(a,i),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=a,this[a]=i.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,y?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const k=globalThis,S=k.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,z="?"+A,I=`<${z}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,a=[];let i,r=2===t?"":"",o=P;for(let t=0;t"===c[0]?(o=i??P,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=void 0===c[3]?F:'"'===c[3]?H:V):o===H||o===V?o=F:o===L||o===N?o=P:(o=F,i=void 0);const u=o===F&&e[t+1].startsWith("/>")?" ":"";r+=o===P?n+I:l>=0?(a.push(s),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),a]};class K{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let i=0,r=0;const o=e.length-1,s=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Q.nextNode())&&s.length0){a.textContent=S?S.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new J(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const i of e)a===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[a],n._$AI(i),a++;a2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,a){const i=this.strings;let r=!1;if(void 0===i)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const a=e;let o,s;for(e=i[0],o=0;o{const a=n?.renderBefore??t;let i=a._$litPart$;if(void 0===i){const e=n?.renderBefore??null;a._$litPart$=i=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};se._$litElement$=!0,se.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:se});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:se}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:a,metadata:i}=n;let r=globalThis.litPropertyMetadata.get(i);if(void 0===r&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const i=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,i,e)},init(t){return void 0!==t&&this.P(a,void 0,e),t}}}if("setter"===a){const{name:a}=n;return function(n){const i=this[a];t.call(this,n),this.requestUpdate(a,i,e)}}throw Error("Unsupported decorator location: "+a)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,a?{...e,wrapped:!0}:e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const me={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ge=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const a=!!t[e];a===this.st.has(e)||this.nt?.has(e)||(a?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ve=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ye=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},ke=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Se(e){void 0!==this._$AN?(Me(this),this._$AM=e,ke(this)):this._$AM=e}function Ee(e,t=!1,n=0){const a=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(t)if(Array.isArray(a))for(let e=n;e{e.type==me.CHILD&&(e._$AP??=Ee,e._$AQ??=Se)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ke(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ze=()=>new Ie;let Ie=class{};const Te=new WeakMap,je=ge(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=ge(class extends fe{constructor(e){if(super(e),e.type!==me.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const a=e[n];return null==a?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const a=t[e];if(null!=a){this.ft.add(e);const t="string"==typeof a&&a.endsWith(De);e.includes("-")||t?n.setProperty(e,t?a.slice(0,-11):a,t?Oe:""):n[e]=a}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,a=20,i=0){let r=[];if(i>=a)return r;const o=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,a,i+1):[]},s=Array.from(e.children||[]);for(const e of s)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,a,i+1)):"SLOT"===e.tagName?r.push(...o(e)):r.push(...Pe(e,t,n,a,i+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const a=Fe.get(n);null!=a&&window.clearTimeout(a),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,a){a=a||{},n=null==n?{}:n;var i=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return i.detail=n,e.dispatchEvent(i),i},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var a,i=Ye(t),r="group"===i?"homeassistant":i;switch(i){case"lock":a=n?"unlock":"lock";break;case"cover":a=n?"open_cover":"close_cover";break;default:a=n?"turn_on":"turn_off"}return e.callService(r,a,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},at=function(e,t,n,a){if(a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?")))switch(a.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":a.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,a.navigation_path);break;case"url":a.url_path&&window.open(a.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!a.perform_action)return void tt("failure");var i=a.perform_action.split(".",2);t.callService(i[0],i[1],a.data,a.target),tt("success");break;case"call-service":if(!a.service)return void tt("failure");var r=a.service.split(".",2);t.callService(r[0],r[1],a.data,a.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",a)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of n)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const it=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:null===e?it.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?it.promise:"undefined"!=typeof Map&&e instanceof Map?it.map:"undefined"!=typeof Set&&e instanceof Set?it.set:"undefined"!=typeof Date&&e instanceof Date?it.date:it.object;default:return it.unknown}},ot=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class st extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,a=0;for(;ae.message)){const t={},n=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}st.create=e=>new st(e);const ct=(e,t)=>{let n;switch(e.code){case ot.invalid_type:n=e.received===it.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ot.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ot.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:a,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:r,message:s}};function ht(e,t){const n=dt(),a=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(a)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return mt;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,a=await e.value;n.push({key:t,value:a})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:i}=a;if("aborted"===t.status)return mt;if("aborted"===i.status)return mt;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!a.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const mt=Object.freeze({status:"aborted"}),gt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,vt=e=>"dirty"===e.status,yt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function xt(e,t,n,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}var Ct,Mt,kt;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class St{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(yt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new st(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:i}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:a)&&void 0!==r?r:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parseSync({data:e,path:a.path,parent:a});return Et(a,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(bt(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const i=e(t),r=()=>a.addIssue({code:ot.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,t){return this._refinement(((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1)))}_refinement(e){return new kn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Sn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return on.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new kn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const zt=/^c[^\s-]{8,}$/i,It=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==it.string){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.string,received:t.parsedType}),mt}const t=new pt;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.lengtha.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const i=e.data.length>a.value,r=e.data.lengthe.test(t)),{validation:t,code:ot.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuea?n:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==it.number){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.number,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("int"===a.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==Zt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_finite,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==it.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.bigint,received:t.parsedType}),mt}let t;const n=new pt;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.dataa.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:ot.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):Ke.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,a){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(a)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==it.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.boolean,received:t.parsedType}),mt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==it.date){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.date,received:t.parsedType}),mt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:ot.invalid_date}),mt}const t=new pt;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()a.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:ot.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Ke.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==it.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.symbol,received:t.parsedType}),mt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.undefined,received:t.parsedType}),mt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==it.null){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.null,received:t.parsedType}),mt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.never,received:t.parsedType}),mt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==it.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.void,received:t.parsedType}),mt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class on extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==it.array)return ht(t,{code:ot.invalid_type,expected:it.array,received:t.parsedType}),mt;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.lengtha.maxLength.value&&(ht(t,{code:ot.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new St(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>a.type._parseSync(new St(t,e,t.path,n))));return pt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new on({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new on({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new on({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function sn(e){if(e instanceof cn){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Sn.create(sn(a))}return new cn({...e._def,shape:()=>t})}return e instanceof on?new on({...e._def,type:sn(e.element)}):e instanceof Sn?Sn.create(sn(e.unwrap())):e instanceof En?En.create(sn(e.unwrap())):e instanceof mn?mn.create(e.items.map((e=>sn(e)))):e}on.create=(e,t)=>new on({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||r.push(e);const o=[];for(const e of i){const t=a[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new St(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:ot.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new St(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,i,r,o;const s=null!==(r=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Ct.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return sn(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Sn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new st(e.ctx.common.issues)));return ht(t,{code:ot.invalid_union,unionErrors:n}),mt}));{let e;const a=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=a.map((e=>new st(e)));return ht(t,{code:ot.invalid_union,unionErrors:i}),mt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof yn?dn(e.schema):e instanceof kn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof Sn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return ht(t,{code:ot.invalid_type,expected:it.object,received:t.parsedType}),mt;const n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:ot.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),mt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const a=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...$t(n)})}}function hn(e,t){const n=rt(e),a=rt(t);if(e===t)return{valid:!0,data:e};if(n===it.object&&a===it.object){const n=Ke.objectKeys(t),a=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of a){const a=hn(e[n],t[n]);if(!a.valid)return{valid:!1};i[n]=a.data}return{valid:!0,data:i}}if(n===it.array&&a===it.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a{if(_t(e)||_t(a))return mt;const i=hn(e.value,a.value);return i.valid?((vt(e)||vt(a))&&t.dirty(),{status:t.value,value:i.data}):(ht(n,{code:ot.invalid_intersection_types}),mt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class mn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.array)return ht(n,{code:ot.invalid_type,expected:it.array,received:n.parsedType}),mt;if(n.data.lengththis._def.items.length&&(ht(n,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new St(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new mn({...this._def,rest:e})}}mn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class gn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return ht(n,{code:ot.invalid_type,expected:it.object,received:n.parsedType}),mt;const a=[],i=this._def.keyType,r=this._def.valueType;for(const e in n.data)a.push({key:i._parse(new St(n,e,n.path,e)),value:r._parse(new St(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,a):pt.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new gn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.map)return ht(n,{code:ot.invalid_type,expected:it.map,received:n.parsedType}),mt;const a=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:a._parse(new St(n,e,n.path,[r,"key"])),value:i._parse(new St(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const a=await n.key,i=await n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const a=n.key,i=n.value;if("aborted"===a.status||"aborted"===i.status)return mt;"dirty"!==a.status&&"dirty"!==i.status||t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==it.set)return ht(n,{code:ot.invalid_type,expected:it.set,received:n.parsedType}),mt;const a=this._def;null!==a.minSize&&n.data.sizea.maxSize.value&&(ht(n,{code:ot.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const a of e){if("aborted"===a.status)return mt;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new St(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class vn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return ht(t,{code:ot.invalid_type,expected:it.function,received:t.parsedType}),mt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_arguments,argumentsError:n}})}function a(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:ot.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const o=new st([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),c=await Reflect.apply(r,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw o.addIssue(a(c,e)),o}));return l}))}{const e=this;return ft((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new st([n(t,o.error)]);const s=Reflect.apply(r,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new st([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new vn({...this._def,args:mn.create(e).rest(nn.create())})}returns(e){return new vn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new vn({args:e||mn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class yn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}yn.create=(e,t)=>new yn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:ot.invalid_literal,expected:this._def.value}),mt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:ot.invalid_type}),mt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:ot.invalid_enum_value,options:n}),mt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),kt.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==it.string&&n.parsedType!==it.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:ot.invalid_type}),mt}if(wt(this,kt,"f")||xt(this,kt,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,kt,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:ot.invalid_enum_value,options:e}),mt}return ft(e.data)}get enum(){return this._def.values}}kt=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&!1===t.common.async)return ht(t,{code:ot.invalid_type,expected:it.promise,received:t.parsedType}),mt;const n=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class kn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){const e=a.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return mt;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}));{if("aborted"===t.value)return mt;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?mt:"dirty"===a.status||"dirty"===t.value?gt(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?mt:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?mt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yt(e))return e;const r=a.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>yt(e)?Promise.resolve(a.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(a)}}kn.create=(e,t,n)=>new kn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),kn.createWithPreprocess=(e,t,n)=>new kn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class Sn extends At{_parse(e){return this._getType(e)===it.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(e,t)=>new Sn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===it.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===it.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new st(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class zn extends At{_parse(e){if(this._getType(e)!==it.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:ot.invalid_type,expected:it.nan,received:t.parsedType}),mt}return{status:"valid",value:e.data}}}zn.create=e=>new zn({typeName:Pn.ZodNaN,...$t(e)});const In=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),gt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?mt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(yt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((a,i)=>{var r,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:s})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=zn.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=on.create,Xn=cn.create,Jn=cn.strictCreate,ea=ln.create,ta=un.create,na=pn.create,aa=mn.create,ia=gn.create,ra=fn.create,oa=_n.create,sa=vn.create,ca=yn.create,la=bn.create,da=xn.create,ua=Cn.create,ha=Mn.create,pa=kn.create,ma=Sn.create,ga=En.create,fa=kn.createWithPreprocess,_a=jn.create,va={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},ya=mt;var ba=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:mt,DIRTY:gt,OK:ft,isAborted:_t,isDirty:vt,isValid:yt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:it,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:on,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:mn,ZodRecord:gn,ZodMap:fn,ZodSet:_n,ZodFunction:vn,ZodLazy:yn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:kn,ZodTransformer:kn,ZodOptional:Sn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:zn,BRAND:In,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:va,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ta,effect:pa,enum:da,function:sa,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:na,lazy:ca,literal:la,map:ra,nan:Fn,nativeEnum:ua,never:Gn,null:Wn,nullable:ga,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:ma,ostring:()=>Ln().optional(),pipeline:_a,preprocess:fa,promise:ha,record:ia,set:oa,strictObject:Jn,string:Ln,symbol:qn,transformer:pa,tuple:aa,undefined:Un,union:ea,unknown:Qn,void:Yn,NEVER:ya,ZodIssueCode:ot,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:st});const wa="https://github.com/dermotduffy/frigate-hass-card",xa=`${wa}#troubleshooting`,Ca="cameras",Ma=`${Ca}.#.camera_entity`,ka=`${Ca}.#.frigate.camera_name`,Sa=`${Ca}.#.capabilities.disable`,Ea=`${Ca}.#.capabilities.disable_except`,$a=`${Ca}.#.cast.method`,Aa=`${Ca}.#.cast.dashboard.dashboard_path`,za=`${Ca}.#.cast.dashboard.view_path`,Ia=`${Ca}.#.dimensions.aspect_ratio`,Ta=`${Ca}.#.frigate.client_id`,ja=`${Ca}.#.frigate.labels`,Oa=`${Ca}.#.frigate.url`,Da=`${Ca}.#.frigate.zones`,Ra=`${Ca}.#.go2rtc.modes`,Pa=`${Ca}.#.go2rtc.stream`,La=`${Ca}.#.icon`,Na=`${Ca}.#.id`,Fa=`${Ca}.#.image.entity`,Va=`${Ca}.#.image.entity_parameters`,Ha=`${Ca}.#.image.mode`,Ba=`${Ca}.#.image.refresh_seconds`,qa=`${Ca}.#.image.url`,Ua=`${Ca}.#.motioneye.images.directory_pattern`,Wa=`${Ca}.#.motioneye.images.file_pattern`,Za=`${Ca}.#.motioneye.movies.directory_pattern`,Qa=`${Ca}.#.motioneye.movies.file_pattern`,Ga=`${Ca}.#.motioneye.url`,Ya=`${Ca}.#.title`,Ka=`${Ca}.#.webrtc_card.entity`,Xa=`${Ca}.#.webrtc_card.url`,Ja=`${Ca}.#.live_provider`,ei=`${Ca}.#.dependencies.cameras`,ti=`${Ca}.#.dependencies.all_cameras`,ni=`${Ca}.#.dimensions.layout.fit`,ai=`${Ca}.#.dimensions.layout.pan.x`,ii=`${Ca}.#.dimensions.layout.pan.y`,ri=`${Ca}.#.dimensions.layout.position.x`,oi=`${Ca}.#.dimensions.layout.position.y`,si=`${Ca}.#.dimensions.layout.view_box.top`,ci=`${Ca}.#.dimensions.layout.view_box.bottom`,li=`${Ca}.#.dimensions.layout.view_box.left`,di=`${Ca}.#.dimensions.layout.view_box.right`,ui=`${Ca}.#.dimensions.layout.zoom`,hi=`${Ca}.#.proxy.dynamic`,pi=`${Ca}.#.proxy.media`,mi=`${Ca}.#.proxy.ssl_ciphers`,gi=`${Ca}.#.proxy.ssl_verification`,fi=`${Ca}.#.reolink.media_resolution`,_i=`${Ca}.#.reolink.url`,vi=`${Ca}.#.triggers.motion`,yi=`${Ca}.#.triggers.occupancy`,bi=`${Ca}.#.triggers.entities`,wi=`${Ca}.#.triggers.events`,xi="cameras_global",Ci=`${xi}.image`,Mi=`${xi}.live_provider`,ki=`${xi}.jsmpeg`,Si=`${xi}.webrtc_card`,Ei=`${xi}.triggers.occupancy`,$i=`${xi}.image.refresh_seconds`,Ai=`${xi}.dimensions.layout`,zi=`${xi}.ptz`,Ii="elements",Ti="view",ji=`${Ti}.camera_select`,Oi=`${Ti}.dark_mode`,Di=`${Ti}.default`,Ri=`${Ti}.interaction_seconds`,Pi=`${Ti}.keyboard_shortcuts`,Li=`${Ti}.keyboard_shortcuts.enabled`,Ni=`${Pi}.ptz_left`,Fi=`${Pi}.ptz_right`,Vi=`${Pi}.ptz_up`,Hi=`${Pi}.ptz_down`,Bi=`${Pi}.ptz_zoom_in`,qi=`${Pi}.ptz_zoom_out`,Ui=`${Pi}.ptz_home`,Wi=`${Ti}.default_cycle_camera`,Zi=`${Ti}.default_reset`,Qi=`${Zi}.interaction_mode`,Gi=`${Zi}.every_seconds`,Yi=`${Zi}.entities`,Ki=`${Zi}.after_interaction`,Xi=`${Ti}.triggers`,Ji=`${Xi}.show_trigger_status`,er=`${Xi}.filter_selected_camera`,tr=`${Xi}.untrigger_seconds`,nr=`${Xi}.actions`,ar=`${nr}.trigger`,ir=`${nr}.untrigger`,rr=`${nr}.interaction_mode`,or="media_gallery",sr=`${or}.controls.filter.mode`,cr=`${or}.controls.thumbnails.show_details`,lr=`${or}.controls.thumbnails.show_download_control`,dr=`${or}.controls.thumbnails.show_favorite_control`,ur=`${or}.controls.thumbnails.show_timeline_control`,hr=`${or}.controls.thumbnails.size`,pr="media_viewer",mr=`${pr}.auto_play`,gr=`${pr}.auto_pause`,fr=`${pr}.auto_mute`,_r=`${pr}.auto_unmute`,vr=`${pr}.display.mode`,yr=`${pr}.display.grid_columns`,br=`${pr}.display.grid_max_columns`,wr=`${pr}.display.grid_selected_width_factor`,xr=`${pr}.draggable`,Cr=`${pr}.lazy_load`,Mr=`${pr}.snapshot_click_plays_clip`,kr=`${pr}.transition_effect`,Sr=`${pr}.controls.builtin`,Er=`${pr}.controls.next_previous.style`,$r=`${pr}.controls.next_previous.size`,Ar=`${pr}.controls.thumbnails.mode`,zr=`${pr}.controls.thumbnails.show_details`,Ir=`${pr}.controls.thumbnails.show_download_control`,Tr=`${pr}.controls.thumbnails.show_favorite_control`,jr=`${pr}.controls.thumbnails.show_timeline_control`,Or=`${pr}.controls.thumbnails.size`,Dr=`${pr}.controls.timeline.clustering_threshold`,Rr=`${pr}.controls.timeline.events_media_type`,Pr=`${pr}.controls.timeline.mode`,Lr=`${pr}.controls.timeline.pan_mode`,Nr=`${pr}.controls.timeline.show_recordings`,Fr=`${pr}.controls.timeline.style`,Vr=`${pr}.controls.timeline.window_seconds`,Hr=`${pr}.zoomable`,Br="live",qr=`${Br}.auto_play`,Ur=`${Br}.auto_pause`,Wr=`${Br}.auto_mute`,Zr=`${Br}.auto_unmute`,Qr=`${Br}.controls.builtin`,Gr=`${Br}.controls.next_previous.style`,Yr=`${Br}.controls.next_previous.size`,Kr=`${Br}.controls.ptz.hide_home`,Xr=`${Br}.controls.ptz.hide_pan_tilt`,Jr=`${Br}.controls.ptz.hide_zoom`,eo=`${Br}.controls.ptz.mode`,to=`${Br}.controls.ptz.orientation`,no=`${Br}.controls.ptz.position`,ao=`${Br}.controls.thumbnails.media_type`,io=`${Br}.controls.thumbnails.events_media_type`,ro=`${Br}.controls.thumbnails.mode`,oo=`${Br}.controls.thumbnails.size`,so=`${Br}.controls.thumbnails.show_details`,co=`${Br}.controls.thumbnails.show_download_control`,lo=`${Br}.controls.thumbnails.show_favorite_control`,uo=`${Br}.controls.thumbnails.show_timeline_control`,ho=`${Br}.controls.timeline.clustering_threshold`,po=`${Br}.controls.timeline.events_media_type`,mo=`${Br}.controls.timeline.mode`,go=`${Br}.controls.timeline.pan_mode`,fo=`${Br}.controls.timeline.show_recordings`,_o=`${Br}.controls.timeline.style`,vo=`${Br}.controls.timeline.window_seconds`,yo=`${Br}.display.mode`,bo=`${Br}.display.grid_columns`,wo=`${Br}.display.grid_max_columns`,xo=`${Br}.display.grid_selected_width_factor`,Co=`${Br}.draggable`,Mo=`${Br}.lazy_load`,ko=`${Br}.lazy_unload`,So=`${Br}.preload`,Eo=`${Br}.transition_effect`,$o=`${Br}.show_image_during_load`,Ao=`${Br}.microphone.disconnect_seconds`,zo=`${Br}.microphone.mute_after_microphone_mute_seconds`,Io=`${Br}.microphone.always_connected`,To=`${Br}.zoomable`,jo="image",Oo=`${jo}.entity`,Do=`${jo}.entity_parameters`,Ro=`${jo}.mode`,Po=`${jo}.refresh_seconds`,Lo=`${jo}.url`,No="timeline",Fo=`${No}.window_seconds`,Vo=`${No}.clustering_threshold`,Ho=`${No}.events_media_type`,Bo=`${No}.show_recordings`,qo=`${No}.style`,Uo=`${No}.controls.thumbnails.mode`,Wo=`${No}.controls.thumbnails.size`,Zo=`${No}.controls.thumbnails.show_details`,Qo=`${No}.controls.thumbnails.show_download_control`,Go=`${No}.controls.thumbnails.show_favorite_control`,Yo=`${No}.controls.thumbnails.show_timeline_control`,Ko="menu",Xo=`${Ko}.alignment`,Jo=`${Ko}.position`,es=`${Ko}.style`,ts=`${Ko}.button_size`,ns=`${Ko}.buttons`,as=`${ns}.frigate`,is=`${ns}.camera_ui`,rs=`${ns}.fullscreen`,os=`${ns}.play`,ss=`${ns}.mute`,cs=`${ns}.media_player`,ls=`${ns}.timeline`,ds="status_bar",us=`${ds}.position`,hs=`${ds}.style`,ps=`${ds}.popup_seconds`,ms=`${ds}.height`,gs=`${ds}.items`,fs="dimensions",_s=`${fs}.aspect_ratio`,vs=`${fs}.aspect_ratio_mode`,ys=`${fs}.height`,bs="overrides",ws="performance",xs=`${ws}.features.animated_progress_indicator`,Cs=`${ws}.features.media_chunk_size`,Ms=`${ws}.features.max_simultaneous_engine_requests`,ks=`${ws}.profile`,Ss=`${ws}.style.box_shadow`,Es=`${ws}.style.border_radius`,$s="profiles",As=1e3;class zs extends Error{constructor(e,t){super(e),this.context=t}}const Is={info:10,error:20,connection:30,diagnostics:40},Ts=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],js=ba.object({url:ba.string(),mime_type:ba.string()}),Os=ba.object({path:ba.string()});function Ds(e){if(e instanceof ba.ZodDefault)return Ds(e.removeDefault());if(e instanceof ba.ZodObject){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=ba.ZodOptional.create(Ds(a))}return new ba.ZodObject({...e._def,shape:()=>t})}return e instanceof ba.ZodArray?ba.ZodArray.create(Ds(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof ba.ZodOptional?ba.ZodOptional.create(Ds(e.unwrap())):e instanceof ba.ZodNullable?ba.ZodNullable.create(Ds(e.unwrap())):e instanceof ba.ZodTuple?ba.ZodTuple.create(e.items.map((e=>Ds(e)))):e}function Rs(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Ps=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Ps(n).forEach(t.add,t)}else t.add(Ls(n.path));return t},Ls=e=>{let t="";for(let n=0;n"fire-dom-event")).or(ba.literal("fire-dom-event")),card_id:ba.string().regex(tc,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),_c=fc.extend({frigate_card_action:ba.enum(Zs)}),vc=fc.extend({frigate_card_action:ba.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),yc=fc.extend({frigate_card_action:ba.literal("camera_select"),camera:ba.string().optional(),triggered:ba.boolean().optional()}),bc=fc.extend({frigate_card_action:ba.literal("live_substream_select"),camera:ba.string()}),wc=fc.extend({frigate_card_action:ba.literal("media_player"),media_player:ba.string(),media_player_action:ba.enum(["play","stop"])}),xc=fc.extend({frigate_card_action:ba.literal("display_mode_select"),display_mode:ic}),Cc=fc.extend({frigate_card_action:ba.literal("ptz"),camera:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Mc=fc.extend({frigate_card_action:ba.literal("ptz_digital"),target_id:ba.string().optional(),absolute:ba.object({zoom:ac.optional(),pan:nc.optional()}).optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional()}),kc=fc.extend({frigate_card_action:ba.literal("ptz_multi"),target_id:ba.string().optional(),ptz_action:ba.enum(Hs).optional(),ptz_phase:ba.enum(Js).optional(),ptz_preset:ba.string().optional()}),Sc=fc.extend({frigate_card_action:ba.literal("ptz_controls"),enabled:ba.boolean()}),Ec=ba.object({ms:ba.number().optional(),s:ba.number().optional(),m:ba.number().optional(),h:ba.number().optional()}),$c=fc.extend({frigate_card_action:ba.literal("sleep"),duration:Ec.optional().default({s:1})}),Ac=fc.extend({frigate_card_action:ba.literal("status_bar"),status_bar_action:ba.enum(["add","remove","reset"]),items:ba.lazy((()=>ol)).array().optional()}),zc=fc.extend({frigate_card_action:ba.literal("log"),message:ba.string(),level:ba.enum(["debug","info","warn","error"]).default("info")}),Ic=ba.union([yc,vc,bc,zc,wc,Cc,Mc,kc,Sc,_c,xc,$c,Ac]),Tc=ba.union([sc,dc,lc,uc,hc,pc,gc,mc,Ic]),jc=ba.object({tap_action:Tc.or(Tc.array()).optional(),hold_action:Tc.or(Tc.array()).optional(),double_tap_action:Tc.or(Tc.array()).optional(),start_tap_action:Tc.or(Tc.array()).optional(),end_tap_action:Tc.or(Tc.array()).optional()}).passthrough(),Oc=ba.object({actions:jc.optional()}),Dc=jc.extend({style:ba.record(ba.string().nullable().or(ba.undefined()).or(ba.number())).optional(),title:ba.string().nullable().optional()}),Rc=Dc.extend({type:ba.literal("state-badge"),entity:ba.string()}),Pc=Dc.extend({type:ba.literal("state-icon"),entity:ba.string(),icon:ba.string().optional(),state_color:ba.boolean().default(!0)}),Lc=Dc.extend({type:ba.literal("state-label"),entity:ba.string(),attribute:ba.string().optional(),prefix:ba.string().optional(),suffix:ba.string().optional()}),Nc=Dc.extend({type:ba.literal("service-button"),title:ba.string(),service:ba.string(),service_data:ba.object({}).passthrough().optional()}),Fc=Dc.extend({type:ba.literal("icon"),icon:ba.string(),entity:ba.string().optional()}),Vc=Dc.extend({type:ba.literal("image"),entity:ba.string().optional(),image:ba.string().optional(),camera_image:ba.string().optional(),camera_view:ba.string().optional(),state_image:ba.object({}).passthrough().optional(),filter:ba.string().optional(),state_filter:ba.object({}).passthrough().optional(),aspect_ratio:ba.string().optional()}),Hc=ba.object({condition:ba.literal("state").optional(),entity:ba.string(),state:ba.string().or(ba.string().array()).optional(),state_not:ba.string().or(ba.string().array()).optional()}),Bc=ba.object({condition:ba.literal("numeric_state"),entity:ba.string(),above:ba.number().optional(),below:ba.number().optional()}),qc=ba.object({condition:ba.literal("screen"),media_query:ba.string()}),Uc=ba.object({condition:ba.literal("user"),users:ba.string().array().min(1)}),Wc=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc]),Zc=ba.object({type:ba.literal("conditional"),conditions:Wc.array(),elements:ba.lazy((()=>yl))}),Qc=ba.object({type:ba.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:ba.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Gc=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(Us).default(50).optional(),alignment:ba.enum(["matching","opposing"]).default("matching").optional(),icon:ba.string().optional(),permanent:ba.boolean().default(!1).optional()}),Yc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-icon")}),Kc=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-state-icon")}).merge(Gc),Xc=Dc.extend({entity:ba.string().optional(),icon:ba.string().optional(),state_color:ba.boolean().default(!0),selected:ba.boolean().default(!1),subtitle:ba.string().optional(),enabled:ba.boolean().default(!0)}),Jc=Gc.merge(Fc).extend({type:ba.literal("custom:frigate-card-menu-submenu"),items:Xc.array()}),el=Gc.merge(Pc).extend({type:ba.literal("custom:frigate-card-menu-submenu-select"),options:ba.record(Xc.deepPartial()).optional()}),tl=ba.object({enabled:ba.boolean().default(!0).optional(),priority:ba.number().min(0).max(100).default(50).optional()}),nl=tl.extend({sufficient:ba.boolean().default(!1).optional(),exclusive:ba.boolean().default(!1).optional(),expand:ba.boolean().default(!1).optional(),actions:jc.optional()}),al=nl.extend({type:ba.literal("custom:frigate-card-status-bar-icon"),icon:ba.string()}),il=nl.extend({type:ba.literal("custom:frigate-card-status-bar-image"),image:ba.string()}),rl=nl.extend({type:ba.literal("custom:frigate-card-status-bar-string"),string:ba.string()}),ol=ba.union([al,il,rl]),sl=ba.object({condition:ba.literal("view"),views:ba.string().array()}),cl=ba.object({condition:ba.literal("fullscreen"),fullscreen:ba.boolean()}),ll=ba.object({condition:ba.literal("expand"),expand:ba.boolean()}),dl=ba.object({condition:ba.literal("camera"),cameras:ba.string().array()}),ul=ba.object({condition:ba.literal("media_loaded"),media_loaded:ba.boolean()}),hl=ba.object({condition:ba.literal("display_mode"),display_mode:ic}),pl=ba.object({condition:ba.literal("triggered"),triggered:ba.string().array()}),ml=ba.object({condition:ba.literal("interaction"),interaction:ba.boolean()}),gl=ba.object({condition:ba.literal("microphone"),connected:ba.boolean().optional(),muted:ba.boolean().optional()}),fl=ba.object({condition:ba.literal("key"),key:ba.string(),state:ba.enum(["down","up"]).optional(),ctrl:ba.boolean().optional(),shift:ba.boolean().optional(),alt:ba.boolean().optional(),meta:ba.boolean().optional()}),_l=ba.discriminatedUnion("condition",[Hc,Bc,qc,Uc,sl,cl,ll,dl,ul,hl,pl,ml,gl,fl]),vl=ba.object({type:ba.literal("custom:frigate-card-conditional"),conditions:_l.array(),elements:ba.lazy((()=>yl))}),yl=ba.union([Zc,Qc,vl,Fc,Vc,Yc,Kc,Jc,el,Nc,Rc,Pc,Lc,al,il,rl]).array().optional(),bl=ba.object({fit:ba.enum(["contain","cover","fill"]).optional(),position:ba.object({x:ba.number().min(0).max(100).optional(),y:ba.number().min(0).max(100).optional()}).optional(),view_box:ba.object({bottom:ba.number().min(0).max(100).optional().default(0),left:ba.number().min(0).max(100).optional().default(0),right:ba.number().min(0).max(100).optional().default(0),top:ba.number().min(0).max(100).optional().default(0)}).optional(),pan:nc.optional(),zoom:ac.optional()}),wl=ba.number().array().length(2).or(ba.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),xl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},Cl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((a=>{const i=a.match(/^data_(.+)$/),r=i?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[a]},delete n[a],delete n.service)})),n}},Ml=ba.preprocess(Cl("actions_"),ba.object({actions_left:lc.optional(),actions_left_start:lc.optional(),actions_left_stop:lc.optional(),actions_right:lc.optional(),actions_right_start:lc.optional(),actions_right_stop:lc.optional(),actions_up:lc.optional(),actions_up_start:lc.optional(),actions_up_stop:lc.optional(),actions_down:lc.optional(),actions_down_start:lc.optional(),actions_down_stop:lc.optional(),actions_zoom_in:lc.optional(),actions_zoom_in_start:lc.optional(),actions_zoom_in_stop:lc.optional(),actions_zoom_out:lc.optional(),actions_zoom_out_start:lc.optional(),actions_zoom_out_stop:lc.optional(),r2c_delay_between_calls_seconds:ba.number().default(xl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:ba.number().default(xl.c2r_delay_between_calls_seconds),presets:ba.preprocess(Cl(""),ba.union([ba.record(lc),ba.object({service:ba.string().optional()})])).optional(),service:ba.string().optional()}).passthrough()),kl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Sl=ba.object({mode:ba.enum(["off","auto","on"]).default(kl.mode),position:ba.enum(["top-left","top-right","bottom-left","bottom-right"]).default(kl.position),orientation:ba.enum(["vertical","horizontal"]).default(kl.orientation),hide_pan_tilt:ba.boolean().default(kl.hide_pan_tilt),hide_zoom:ba.boolean().default(kl.hide_zoom),hide_home:ba.boolean().default(kl.hide_home),style:ba.object({}).passthrough().optional()}),El={mode:"auto",refresh_seconds:1},$l=ba.object({mode:ba.enum(["auto","camera","entity","screensaver","url"]).default(El.mode),refresh_seconds:ba.number().min(0).default(El.refresh_seconds),url:ba.string().optional(),entity:ba.string().optional(),entity_parameters:ba.string().optional()}),Al=$l.merge(Oc).default(El),zl=75,Il=300,Tl={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},jl=ba.object({size:ba.number().min(75).max(300).default(Tl.size),show_details:ba.boolean().default(Tl.show_details),show_favorite_control:ba.boolean().default(Tl.show_favorite_control),show_timeline_control:ba.boolean().default(Tl.show_timeline_control),show_download_control:ba.boolean().default(Tl.show_download_control)}),Ol={...Tl,mode:"right"},Dl=jl.extend({mode:ba.enum(["none","above","below","left","right"]).default(Ol.mode)}),Rl=ba.enum(["all","clips","snapshots"]),Pl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Ll=ba.enum(["pan","seek","seek-in-media","seek-in-camera"]),Nl=ba.object({clustering_threshold:ba.number().optional().default(Pl.clustering_threshold),events_media_type:Rl.optional().default(Pl.events_media_type),window_seconds:ba.number().min(60).max(86400).optional().default(Pl.window_seconds),show_recordings:ba.boolean().optional().default(Pl.show_recordings),style:ba.enum(["stack","ribbon"]).optional().default(Pl.style),pan_mode:Ll.optional().default(Pl.pan_mode)}),Fl={...Pl,mode:"none",style:"ribbon"},Vl=Nl.extend({mode:ba.enum(["none","above","below"]).default(Fl.mode),style:Nl.shape.style.default(Fl.style)}),Hl={...Pl,controls:{thumbnails:Ol}},Bl=Nl.extend({controls:ba.object({thumbnails:Dl.default(Hl.controls.thumbnails)}).default(Hl.controls)}).default(Hl),ql=ba.object({style:ba.enum(["none","chevrons","icons","thumbnails"]),size:ba.number().min(20)}),Ul=ba.enum(["none","slide"]),Wl={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Zl=ba.object({always_connected:ba.boolean().default(Wl.always_connected),disconnect_seconds:ba.number().min(0).default(Wl.disconnect_seconds),mute_after_microphone_mute_seconds:ba.number().min(0).default(Wl.mute_after_microphone_mute_seconds)}).default(Wl),Ql=ba.object({url:ba.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:ba.string().optional(),modes:ba.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:ba.string().optional()}),Gl=ba.object({entity:ba.string().optional(),url:ba.string().optional()}).passthrough(),Yl=ba.object({options:ba.object({audio:ba.boolean().optional(),video:ba.boolean().optional(),pauseWhenHidden:ba.boolean().optional(),disableGl:ba.boolean().optional(),disableWebAssembly:ba.boolean().optional(),preserveDrawingBuffer:ba.boolean().optional(),progressive:ba.boolean().optional(),throttled:ba.boolean().optional(),chunkSize:ba.number().optional(),maxAudioLag:ba.number().optional(),videoBufferSize:ba.number().optional(),audioBufferSize:ba.number().optional()}).optional()}),Kl={...Ol,media_type:"events",events_media_type:"all"},Xl={auto_play:[...Ys],auto_pause:[],auto_mute:[...Xs],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:kl,thumbnails:Kl,timeline:Fl},microphone:{...Wl}},Jl=Dl.extend({media_type:ba.enum(["events","recordings"]).default(Xl.controls.thumbnails.media_type),events_media_type:Rl.default(Xl.controls.thumbnails.events_media_type)}),ed=ba.object({auto_pause:ba.enum(Gs).array().default(Xl.auto_pause),auto_play:ba.enum(Ys).array().default(Xl.auto_play),auto_mute:ba.enum(Xs).array().default(Xl.auto_mute),auto_unmute:ba.enum(Ks).array().default(Xl.auto_unmute),controls:ba.object({builtin:ba.boolean().default(Xl.controls.builtin),next_previous:ql.extend({style:ba.enum(["none","chevrons","icons"]).default(Xl.controls.next_previous.style),size:ql.shape.size.default(Xl.controls.next_previous.size)}).default(Xl.controls.next_previous),ptz:Sl.default(Xl.controls.ptz),thumbnails:Jl.default(Xl.controls.thumbnails),timeline:Vl.default(Xl.controls.timeline)}).default(Xl.controls),display:rc,draggable:ba.boolean().default(Xl.draggable),lazy_load:ba.boolean().default(Xl.lazy_load),lazy_unload:ba.enum(Gs).array().default(Xl.lazy_unload),microphone:Zl.default(Xl.microphone),preload:ba.boolean().default(Xl.preload),show_image_during_load:ba.boolean().default(Xl.show_image_during_load),transition_effect:Ul.default(Xl.transition_effect),zoomable:ba.boolean().default(Xl.zoomable)}).merge(Oc).default(Xl),td=ba.object({live:ed}),nd=ba.object({method:ba.enum(["standard","dashboard"]).default("standard").optional(),dashboard:ba.object({dashboard_path:ba.string().optional(),view_path:ba.string().optional()}).optional()}),ad={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:xl,triggers:{motion:!1,occupancy:!1,events:[...ec],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"}},id=ba.object({media:ba.boolean().or(ba.literal("auto")).default(ad.proxy.media),dynamic:ba.boolean().default(ad.proxy.dynamic),ssl_verification:ba.boolean().or(ba.literal("auto")).default(ad.proxy.ssl_verification),ssl_ciphers:ba.enum(["default","insecure","intermediate","modern"]).or(ba.literal("auto")).default(ad.proxy.ssl_ciphers)}),rd=ba.object({camera_entity:ba.string().optional(),icon:ba.string().optional(),title:ba.string().optional(),capabilities:ba.object({disable:ba.enum(Ts).array().optional(),disable_except:ba.enum(Ts).array().optional()}).optional(),id:ba.string().optional(),dependencies:ba.object({all_cameras:ba.boolean().default(ad.dependencies.all_cameras),cameras:ba.string().array().default(ad.dependencies.cameras)}).default(ad.dependencies),triggers:ba.object({motion:ba.boolean().default(ad.triggers.motion),occupancy:ba.boolean().default(ad.triggers.occupancy),entities:ba.string().array().default(ad.triggers.entities),events:ba.enum(ec).array().default(ad.triggers.events)}).default(ad.triggers),engine:ba.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:ba.object({url:ba.string().optional(),client_id:ba.string().default(ad.frigate.client_id),camera_name:ba.string().optional(),labels:ba.string().array().optional(),zones:ba.string().array().optional()}).default(ad.frigate),motioneye:ba.object({url:ba.string().optional(),images:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.images.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.images.file_pattern)}).default(ad.motioneye.images),movies:ba.object({directory_pattern:ba.string().includes("%").default(ad.motioneye.movies.directory_pattern),file_pattern:ba.string().includes("%").default(ad.motioneye.movies.file_pattern)}).default(ad.motioneye.movies)}).default(ad.motioneye),reolink:ba.object({url:ba.string().optional(),media_resolution:ba.enum(["high","low"]).default(ad.reolink.media_resolution)}).default(ad.reolink),live_provider:ba.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(ad.live_provider),go2rtc:Ql.optional(),image:$l.optional().default(El),jsmpeg:Yl.optional(),webrtc_card:Gl.optional(),cast:nd.optional(),ptz:Ml.default(ad.ptz),dimensions:ba.object({aspect_ratio:wl.optional(),layout:bl.optional()}).optional(),proxy:id.default(ad.proxy)}).default(ad),od=rd.array().min(1),sd={default:Qs,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Fs},cd=ba.enum(["all","inactive","active"]).default("inactive"),ld=ba.object({actions:ba.object({interaction_mode:cd,trigger:ba.enum(["default","live","media","none","update"]).default(sd.triggers.actions.trigger),untrigger:ba.enum(["default","none"]).default(sd.triggers.actions.untrigger)}).default(sd.triggers.actions),filter_selected_camera:ba.boolean().default(sd.triggers.filter_selected_camera),show_trigger_status:ba.boolean().default(sd.triggers.show_trigger_status),untrigger_seconds:ba.number().default(sd.triggers.untrigger_seconds)}),dd=ba.object({default:ba.enum(Zs).default(sd.default),camera_select:ba.enum([...Zs,"current"]).default(sd.camera_select),interaction_seconds:ba.number().default(sd.interaction_seconds),default_cycle_camera:ba.boolean().default(sd.default_cycle_camera),default_reset:ba.object({after_interaction:ba.boolean().default(sd.default_reset.after_interaction),every_seconds:ba.number().default(sd.default_reset.every_seconds),entities:ba.string().array().default(sd.default_reset.entities),interaction_mode:cd.default(sd.default_reset.interaction_mode)}).default(sd.default_reset),render_entities:ba.string().array().optional(),dark_mode:ba.enum(["on","off","auto"]).optional(),triggers:ld.default(sd.triggers),keyboard_shortcuts:Vs.default(sd.keyboard_shortcuts)}).merge(Oc).default(sd),ud=["left","right","top","bottom"],hd=ud,pd={priority:50,enabled:!0},md={priority:50,enabled:!1},gd={alignment:"left",button_size:40,buttons:{camera_ui:pd,cameras:pd,clips:pd,ptz_home:md,display_mode:pd,download:pd,expand:md,frigate:pd,fullscreen:pd,image:md,live:pd,media_player:pd,microphone:{...md,type:"momentary"},mute:md,play:md,ptz_controls:md,recordings:md,screenshot:md,snapshots:pd,substreams:pd,timeline:pd},position:"top",style:"hidden"},fd=Gc.extend({enabled:Gc.shape.enabled.default(pd.enabled),priority:Gc.shape.priority.default(pd.priority)}),_d=Gc.extend({enabled:Gc.shape.enabled.default(md.enabled),priority:Gc.shape.priority.default(md.priority)}),vd=ba.object({style:ba.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(gd.style),position:ba.enum(ud).default(gd.position),alignment:ba.enum(hd).default(gd.alignment),buttons:ba.object({camera_ui:fd.default(gd.buttons.camera_ui),cameras:fd.default(gd.buttons.cameras),clips:fd.default(gd.buttons.clips),ptz_home:_d.default(gd.buttons.ptz_home),display_mode:fd.default(gd.buttons.display_mode),download:fd.default(gd.buttons.download),expand:_d.default(gd.buttons.expand),frigate:fd.default(gd.buttons.frigate),fullscreen:fd.default(gd.buttons.fullscreen),image:_d.default(gd.buttons.image),live:fd.default(gd.buttons.live),media_player:fd.default(gd.buttons.media_player),microphone:_d.extend({type:ba.enum(["momentary","toggle"]).default(gd.buttons.microphone.type)}).default(gd.buttons.microphone),mute:_d.default(gd.buttons.mute),play:_d.default(gd.buttons.play),ptz_controls:_d.default(gd.buttons.ptz_controls),recordings:_d.default(gd.buttons.recordings),screenshot:_d.default(gd.buttons.screenshot),snapshots:fd.default(gd.buttons.snapshots),substreams:fd.default(gd.buttons.substreams),timeline:fd.default(gd.buttons.timeline)}).default(gd.buttons),button_size:ba.number().min(20).default(gd.button_size)}).default(gd),yd={priority:50,enabled:!0},bd={height:46,items:{engine:yd,resolution:yd,technology:yd,title:yd},position:"bottom",style:"popup",popup_seconds:3},wd=ba.object({position:ba.enum(["top","bottom"]).default(bd.position),style:ba.enum(["none","overlay","hover","hover-card","outside","popup"]).default(bd.style),popup_seconds:ba.number().min(0).max(60).default(bd.popup_seconds),height:ba.number().min(20).default(bd.height),items:ba.object({engine:tl.default(bd.items.engine),technology:tl.default(bd.items.technology),resolution:tl.default(bd.items.resolution),title:tl.default(bd.items.title)}).default(bd.items)}).default(bd),xd={auto_play:[...Ys],auto_pause:[...Gs],auto_mute:[...Gs],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Ol,timeline:Fl,ptz:{...kl,mode:"off"}}},Cd=ql.extend({style:ba.enum(["none","thumbnails","chevrons"]).default(xd.controls.next_previous.style),size:ql.shape.size.default(xd.controls.next_previous.size)}),Md=ba.object({auto_play:ba.enum(Ys).array().default(xd.auto_play),auto_pause:ba.enum(Gs).array().default(xd.auto_pause),auto_mute:ba.enum(Gs).array().default(xd.auto_mute),auto_unmute:ba.enum(Ys).array().default(xd.auto_unmute),lazy_load:ba.boolean().default(xd.lazy_load),draggable:ba.boolean().default(xd.draggable),zoomable:ba.boolean().default(xd.zoomable),transition_effect:Ul.default(xd.transition_effect),snapshot_click_plays_clip:ba.boolean().default(xd.snapshot_click_plays_clip),display:rc,controls:ba.object({builtin:ba.boolean().default(xd.controls.builtin),next_previous:Cd.default(xd.controls.next_previous),ptz:Sl.extend({mode:ba.enum(["off","on"]).default(xd.controls.ptz.mode)}).default(xd.controls.ptz),thumbnails:Dl.default(xd.controls.thumbnails),timeline:Vl.default(xd.controls.timeline)}).default(xd.controls)}).merge(Oc).default(xd),kd={...Ol,show_details:!1},Sd={controls:{thumbnails:kd,filter:{mode:"right"}}},Ed=Dl.extend({show_details:ba.boolean().default(kd.show_details)}),$d=ba.object({controls:ba.object({thumbnails:Ed.default(Sd.controls.thumbnails),filter:ba.object({mode:ba.enum(["none","left","right"]).default(Sd.controls.filter.mode)}).default(Sd.controls.filter)}).default(Sd.controls)}).merge(Oc).default(Sd),Ad={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},zd=ba.object({aspect_ratio_mode:ba.enum(["dynamic","static","unconstrained"]).default(Ad.aspect_ratio_mode),aspect_ratio:wl.default(Ad.aspect_ratio),height:ba.string().default(Ad.height)}).default(Ad),Id=ba.object({conditions:_l.array(),merge:ba.object({}).passthrough().optional(),set:ba.object({}).passthrough().optional(),delete:ba.string().array().optional()}).array().optional(),Td=Tc.array(),jd=ba.object({conditions:_l.array(),actions:Td.optional(),actions_not:Td.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Od={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},Dd=ba.object({features:ba.object({animated_progress_indicator:ba.boolean().default(Od.features.animated_progress_indicator),media_chunk_size:ba.number().min(0).max(1e3).default(Od.features.media_chunk_size),max_simultaneous_engine_requests:ba.number().min(1).optional()}).default(Od.features),style:ba.object({border_radius:ba.boolean().default(Od.style.border_radius),box_shadow:ba.boolean().default(Od.style.box_shadow)}).default(Od.style)}).default(Od),Rd={logging:!1},Pd=ba.object({logging:ba.boolean().default(Rd.logging)}).default(Rd),Ld=ba.enum(["casting","low-performance","scrubbing"]).array().optional(),Nd=ba.object({cameras:Ds(od),cameras_global:rd,view:dd,menu:vd,status_bar:wd,live:ed,media_gallery:$d,media_viewer:Md,image:Al,elements:yl,dimensions:zd,timeline:Bl,performance:Dd,debug:Pd,automations:jd.optional(),profiles:Ld,overrides:Id,card_mod:ba.unknown(),card_id:ba.string().regex(tc).optional(),type:ba.string()}),Fd={cameras:ad,view:sd,menu:gd,status_bar:bd,live:Xl,media_gallery:Sd,media_viewer:xd,image:El,timeline:Hl,performance:Od,debug:Rd};function Vd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Hd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Bd(e,t){const n=Vd(e);return isNaN(t)?Hd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function qd(e,t){const n=Vd(e);if(isNaN(t))return Hd(e,NaN);if(!t)return n;const a=n.getDate(),i=Hd(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);return a>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}function Ud(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=Vd(e),d=a||n?qd(l,a+12*n):l,u=1e3*(c+60*(s+60*o));return Hd(e,(r||i?Bd(d,r+7*i):d).getTime()+u)}const Wd=6048e5,Zd=864e5,Qd=6e4,Gd=36e5,Yd=1e3;let Kd={};function Xd(){return Kd}function Jd(e,t){const n=Xd(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Vd(e),r=i.getDay(),o=(r=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function nu(e){const t=Vd(e);return t.setHours(0,0,0,0),t}function au(e){const t=Vd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Vd(e);return!isNaN(Number(n))}function ru(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function ou(e,t){return+Vd(e)-+Vd(t)}function su(e,t,n){const a=ou(e,t)/1e3;return ru(n?.roundingMethod)(a)}const cu={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function lu(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const du={date:lu({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:lu({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:lu({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},uu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function hu(e){return(t,n)=>{let a;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):t;a=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[t]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function pu(e){return(t,n={})=>{const a=n.width,i=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],r=t.match(i);if(!r)return null;const o=r[0],s=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?function(e,t){for(let n=0;ne.test(o))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(s,(e=>e.test(o)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(o.length)}}}var mu;const gu={code:"en-US",formatDistance:(e,t,n)=>{let a;const i=cu[e];return a="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:du,formatRelative:(e,t,n,a)=>uu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:hu({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:hu({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:hu({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:hu({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:hu({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(mu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(mu.matchPattern);if(!n)return null;const a=n[0],i=e.match(mu.parsePattern);if(!i)return null;let r=mu.valueCallback?mu.valueCallback(i[0]):i[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(a.length)}}),era:pu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:pu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:pu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:pu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:pu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function fu(e){const t=Vd(e),n=function(e,t){const n=nu(e),a=nu(t),i=+n-au(n),r=+a-au(a);return Math.round((i-r)/Zd)}(t,function(e){const t=Vd(e),n=Hd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function _u(e){const t=Vd(e),n=+eu(t)-+function(e){const t=tu(e),n=Hd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),eu(n)}(t);return Math.round(n/Wd)+1}function vu(e,t){const n=Vd(e),a=n.getFullYear(),i=Xd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Hd(e,0);o.setFullYear(a+1,0,r),o.setHours(0,0,0,0);const s=Jd(o,t),c=Hd(e,0);c.setFullYear(a,0,r),c.setHours(0,0,0,0);const l=Jd(c,t);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function yu(e,t){const n=Vd(e),a=+Jd(n,t)-+function(e,t){const n=Xd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=vu(e,t),r=Hd(e,0);return r.setFullYear(i,0,a),r.setHours(0,0,0,0),Jd(r,t)}(n,t);return Math.round(a/Wd)+1}function bu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const wu={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return bu("yy"===t?a%100:a,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):bu(n+1,2)},d:(e,t)=>bu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>bu(e.getHours()%12||12,t.length),H:(e,t)=>bu(e.getHours(),t.length),m:(e,t)=>bu(e.getMinutes(),t.length),s:(e,t)=>bu(e.getSeconds(),t.length),S(e,t){const n=t.length,a=e.getMilliseconds();return bu(Math.trunc(a*Math.pow(10,n-3)),t.length)}},xu="midnight",Cu="noon",Mu="morning",ku="afternoon",Su="evening",Eu="night",$u={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),a=t>0?t:1-t;return n.ordinalNumber(a,{unit:"year"})}return wu.y(e,t)},Y:function(e,t,n,a){const i=vu(e,a),r=i>0?i:1-i;if("YY"===t){return bu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):bu(r,t.length)},R:function(e,t){return bu(tu(e),t.length)},u:function(e,t){return bu(e.getFullYear(),t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return bu(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return bu(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return wu.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return bu(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const i=yu(e,a);return"wo"===t?n.ordinalNumber(i,{unit:"week"}):bu(i,t.length)},I:function(e,t,n){const a=_u(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):bu(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):wu.d(e,t)},D:function(e,t,n){const a=fu(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):bu(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return bu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const i=e.getDay(),r=(i-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return bu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),i=0===a?7:a;switch(t){case"i":return String(i);case"ii":return bu(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let i;switch(i=12===a?Cu:0===a?xu:a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let i;switch(i=a>=17?Su:a>=12?ku:a>=4?Mu:Eu,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return wu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):wu.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},k:function(e,t,n){let a=e.getHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):bu(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wu.s(e,t)},S:function(e,t){return wu.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(0===a)return"Z";switch(t){case"X":return zu(a);case"XXXX":case"XX":return Iu(a);default:return Iu(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return zu(a);case"xxxx":case"xx":return Iu(a);default:return Iu(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Au(a,":");default:return"GMT"+Iu(a,":")}},t:function(e,t,n){return bu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return bu(e.getTime(),t.length)}};function Au(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),i=Math.trunc(a/60),r=a%60;return 0===r?n+String(i):n+String(i)+t+bu(r,2)}function zu(e,t){if(e%60==0){return(e>0?"-":"+")+bu(Math.abs(e)/60,2)}return Iu(e,t)}function Iu(e,t=""){const n=e>0?"-":"+",a=Math.abs(e);return n+bu(Math.trunc(a/60),2)+t+bu(a%60,2)}const Tu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},ju=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Ou={p:ju,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],i=n[2];if(!i)return Tu(e,t);let r;switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Tu(a,t)).replace("{{time}}",ju(i,t))}},Du=/^D+$/,Ru=/^Y+$/,Pu=["D","DD","YY","YYYY"];function Lu(e){return Du.test(e)}function Nu(e){return Ru.test(e)}function Fu(e,t,n){const a=function(e,t,n){const a="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(a),Pu.includes(e))throw new RangeError(a)}const Vu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bu=/^'([^]*?)'?$/,qu=/''/g,Uu=/[a-zA-Z]/;function Wu(e,t,n){const a=Xd(),i=n?.locale??a.locale??gu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=Vd(e);if(!iu(s))throw new RangeError("Invalid time value");let c=t.match(Hu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Ou[t])(e,i.formatLong)}return e})).join("").match(Vu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Zu(e)};if($u[t])return{isToken:!0,value:e};if(t.match(Uu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const l={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return c.map((a=>{if(!a.isToken)return a.value;const r=a.value;(!n?.useAdditionalWeekYearTokens&&Nu(r)||!n?.useAdditionalDayOfYearTokens&&Lu(r))&&Fu(r,t,String(e));return(0,$u[r[0]])(s,r,i.localize,l)})).join("")}function Zu(e){const t=e.match(Bu);return t?t[1].replace(qu,"'"):e}function Qu(e,t){const{years:n=0,months:a=0,weeks:i=0,days:r=0,hours:o=0,minutes:s=0,seconds:c=0}=t,l=function(e,t){return qd(e,-t)}(e,a+12*n),d=function(e,t){return Bd(e,-t)}(l,r+7*i),u=1e3*(c+60*(s+60*o));return Hd(e,d.getTime()-u)}function Gu(e,t){return e===t||e!=e&&t!=t}function Yu(e,t){for(var n=e.length;n--;)if(Gu(e[n][0],t))return n;return-1}var Ku=Array.prototype.splice;function Xu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Xu.prototype.set=function(e,t){var n=this.__data__,a=Yu(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this};var Ju="object"==typeof global&&global&&global.Object===Object&&global,eh="object"==typeof self&&self&&self.Object===Object&&self,th=Ju||eh||Function("return this")(),nh=th.Symbol,ah=Object.prototype,ih=ah.hasOwnProperty,rh=ah.toString,oh=nh?nh.toStringTag:void 0;var sh=Object.prototype.toString;var ch="[object Null]",lh="[object Undefined]",dh=nh?nh.toStringTag:void 0;function uh(e){return null==e?void 0===e?lh:ch:dh&&dh in Object(e)?function(e){var t=ih.call(e,oh),n=e[oh];try{e[oh]=void 0;var a=!0}catch(e){}var i=rh.call(e);return a&&(t?e[oh]=n:delete e[oh]),i}(e):function(e){return sh.call(e)}(e)}function hh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ph="[object AsyncFunction]",mh="[object Function]",gh="[object GeneratorFunction]",fh="[object Proxy]";function _h(e){if(!hh(e))return!1;var t=uh(e);return t==mh||t==gh||t==ph||t==fh}var vh,yh=th["__core-js_shared__"],bh=(vh=/[^.]+$/.exec(yh&&yh.keys&&yh.keys.IE_PROTO||""))?"Symbol(src)_1."+vh:"";var wh=Function.prototype.toString;function xh(e){if(null!=e){try{return wh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ch=/^\[object .+?Constructor\]$/,Mh=Function.prototype,kh=Object.prototype,Sh=Mh.toString,Eh=kh.hasOwnProperty,$h=RegExp("^"+Sh.call(Eh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(e){return!(!hh(e)||(t=e,bh&&bh in t))&&(_h(e)?$h:Ch).test(xh(e));var t}function zh(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ah(n)?n:void 0}var Ih=zh(th,"Map"),Th=zh(Object,"create");var jh=Object.prototype.hasOwnProperty;var Oh=Object.prototype.hasOwnProperty;function Dh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++ts))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Bh?new Nh:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ap}var Ip={};function Tp(e){return function(t){return e(t)}}Ip["[object Float32Array]"]=Ip["[object Float64Array]"]=Ip["[object Int8Array]"]=Ip["[object Int16Array]"]=Ip["[object Int32Array]"]=Ip["[object Uint8Array]"]=Ip["[object Uint8ClampedArray]"]=Ip["[object Uint16Array]"]=Ip["[object Uint32Array]"]=!0,Ip["[object Arguments]"]=Ip["[object Array]"]=Ip["[object ArrayBuffer]"]=Ip["[object Boolean]"]=Ip["[object DataView]"]=Ip["[object Date]"]=Ip["[object Error]"]=Ip["[object Function]"]=Ip["[object Map]"]=Ip["[object Number]"]=Ip["[object Object]"]=Ip["[object RegExp]"]=Ip["[object Set]"]=Ip["[object String]"]=Ip["[object WeakMap]"]=!1;var jp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Op=jp&&"object"==typeof module&&module&&!module.nodeType&&module,Dp=Op&&Op.exports===jp&&Ju.process,Rp=function(){try{var e=Op&&Op.require&&Op.require("util").types;return e||Dp&&Dp.binding&&Dp.binding("util")}catch(e){}}(),Pp=Rp,Lp=Pp&&Pp.isTypedArray,Np=Lp?Tp(Lp):function(e){return fp(e)&&zp(e.length)&&!!Ip[uh(e)]},Fp=Object.prototype.hasOwnProperty;function Vp(e,t){var n=dp(e),a=!n&&wp(e),i=!n&&!a&&kp(e),r=!n&&!a&&!i&&Np(e),o=n||a||i||r,s=o?function(e,t){for(var n=-1,a=Array(e);++n0){if(++og>=800)return arguments[0]}else og=0;return rg.apply(void 0,arguments)});function lg(e,t){return cg(function(e,t,n){return t=tg(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=tg(a.length-t,0),o=Array(r);++i1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,o&&dg(n[0],n[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++a-1}function Ng(e,t,n){for(var a=-1,i=null==e?0:e.length;++a=Vg){var l=t?null:Fg(e);if(l)return Zh(l);o=!1,i=Vh,c=new Nh}else c=t?[]:s;e:for(;++ae[0].toUpperCase()+e.substring(1))).join(" ")}function Ug(e,t,n){const a=e[t];return e.splice(t,1),e.splice(n,0,a),e}const Wg=e=>Array.isArray(e)?e:[e],Zg=e=>e instanceof Set?e:new Set(Wg(e));function Qg(e,t,n){return!function(e,t,n){var a=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===a?bm(e,t,void 0,n):!!a}(e,t,n)}function Gg(e,t=console.warn){e instanceof zs&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Yg=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Kg=(e,t)=>Wu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Xg=e=>Wu(e,"yyyy-MM-dd"),Jg=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function ef(e,t){const n=function(e,t,n){const a=ou(e,t)/Gd;return ru(n?.roundingMethod)(a)}(t,e),a=function(e,t,n){const a=ou(e,t)/Qd;return ru(n?.roundingMethod)(a)}(t,e)-60*n;let i="";return n&&(i+=`${n}h `),a&&(i+=`${a}m `),i+=`${su(t,e)-60*n*60-60*a}s`,i}const tf=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),nf=e=>new Date(`${e}T00:00:00`),af=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},rf=e=>!isNaN(e.getTime()),of=(e,t,n,a)=>{t?e.setAttribute(n,a??""):e.removeAttribute(n)},sf=e=>!!e,cf=e=>e instanceof HTMLElement,lf=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(cf),df=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",uf=e=>({"aspect-ratio":df(e)}),hf=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>hf(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=hf(e[n]);return t}return e},pf=(e,t,n)=>Rg(e,n)===Rg(t,n);function mf(e){if(!e)return null;const t=Ic.safeParse(e);return t.success?t.data:null}function gf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function ff(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function _f(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function vf(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function yf(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const bf=e=>Wg(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),wf=e=>{e.stopPropagation()};class xf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class Cf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new xf,this.doubleClickTimer=new xf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},a=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},i=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||wf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(a(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",i),e.addEventListener("touchcancel",i),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",i),e.addEventListener("keyup",(e=>{"Enter"===e.key&&i(e)})),e.addEventListener("mouseleave",a)}}customElements.define("action-handler-frigate-card",Cf);const Mf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},kf=ge(class extends fe{update(e,[t]){return Mf(e.element,t),U}render(e){}});var Sf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)lp(t,gp(e)),e=Pm(e);return t}:hp;function Ef(e){return up(e,Km,Sf)}var $f=Object.prototype.hasOwnProperty;var Af=/\w*$/;var zf=nh?nh.prototype:void 0,If=zf?zf.valueOf:void 0;var Tf="[object Boolean]",jf="[object Date]",Of="[object Map]",Df="[object Number]",Rf="[object RegExp]",Pf="[object Set]",Lf="[object String]",Nf="[object Symbol]",Ff="[object ArrayBuffer]",Vf="[object DataView]",Hf="[object Float32Array]",Bf="[object Float64Array]",qf="[object Int8Array]",Uf="[object Int16Array]",Wf="[object Int32Array]",Zf="[object Uint8Array]",Qf="[object Uint8ClampedArray]",Gf="[object Uint16Array]",Yf="[object Uint32Array]";function Kf(e,t,n){var a,i,r,o=e.constructor;switch(t){case Ff:return Tm(e);case Tf:case jf:return new o(+e);case Vf:return function(e,t){var n=t?Tm(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:case Gf:case Yf:return jm(e,n);case Of:return new o;case Df:case Lf:return new o(e);case Rf:return(r=new(i=e).constructor(i.source,Af.exec(i))).lastIndex=i.lastIndex,r;case Pf:return new o;case Nf:return a=e,If?Object(If.call(a)):{}}}var Xf=Pp&&Pp.isMap,Jf=Xf?Tp(Xf):function(e){return fp(e)&&"[object Map]"==pm(e)};var e_=Pp&&Pp.isSet,t_=e_?Tp(e_):function(e){return fp(e)&&"[object Set]"==pm(e)},n_=1,a_=2,i_=4,r_="[object Arguments]",o_="[object Function]",s_="[object GeneratorFunction]",c_="[object Object]",l_={};function d_(e,t,n,a,i,r){var o,s=t&n_,c=t&a_,l=t&i_;if(n&&(o=i?n(e,a,i,r):n(e)),void 0!==o)return o;if(!hh(e))return e;var d=dp(e);if(d){if(o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&$f.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Om(e,o)}else{var u=pm(e),h=u==o_||u==s_;if(kp(e))return Im(e,s);if(u==c_||u==r_||h&&!i){if(o=c||h?{}:Lm(e),!s)return c?function(e,t){return Qm(e,Sf(e),t)}(e,function(e,t){return e&&Qm(t,Km(t),e)}(o,e)):function(e,t){return Qm(e,gp(e),t)}(e,function(e,t){return e&&Qm(t,Qp(t),e)}(o,e))}else{if(!l_[u])return i?e:{};o=Kf(e,u,s)}}r||(r=new Lh);var p=r.get(e);if(p)return p;r.set(e,o),t_(e)?e.forEach((function(a){o.add(d_(a,t,n,a,e,r))})):Jf(e)&&e.forEach((function(a,i){o.set(i,d_(a,t,n,i,e,r))}));var m=d?void 0:(l?c?Ef:Gp:c?Km:Qp)(e);return function(e,t){for(var n=-1,a=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new __(e):new DOMException(e),y_=e=>{const t=void 0===e.reason?v_("This operation was aborted."):e.reason;return t instanceof Error?t:v_(t)};class b_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const a=function(e,t,n){let a=0,i=e.length;for(;i>0;){const r=Math.trunc(i/2);let o=a+r;n(e[o],t)<=0?(a=++o,i-=r+1):i=r}return a}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(a,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class w_ extends g_{#t;#n;#a=0;#i;#r;#o=0;#s;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:b_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#i=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#m(){return this.#n||this.#a{this.#v()}),t)),!0;this.#a=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#m&&this.#g){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#s||(this.#s=setInterval((()=>{this.#y()}),this.#r),this.#o=Date.now()+this.#r)}#y(){0===this.#a&&0===this.#d&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#a=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,a)=>{this.#e.enqueue((async()=>{this.#d++,this.#a++;try{t.signal?.throwIfAborted();let a=e({signal:t.signal});t.timeout&&(a=function(e,t){const{milliseconds:n,fallback:a,message:i,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let o;const s=new Promise(((s,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(y_(e)),e.addEventListener("abort",(()=>{c(y_(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(s,c);const l=new f_;o=r.setTimeout.call(void 0,(()=>{if(a)try{s(a())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===i?s():i instanceof Error?c(i):(l.message=i??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{s(await e)}catch(e){c(e)}})()})),c=s.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,o),o=void 0},c}(Promise.resolve(a),{milliseconds:t.timeout})),t.signal&&(a=Promise.race([a,this.#C(t.signal)]));const i=await a;n(i),this.emit("completed",i)}catch(e){if(e instanceof f_&&!t.throwOnTimeout)return void n();a(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const a=()=>{t&&!t()||(this.off(e,a),n())};this.on(e,a)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var x_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},C_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},M_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},k_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},S_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},E_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},$_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},A_={assign:"Assign",assigning:"Assigning",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},z_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},I_={unseekable:"Seek time not found in media"},T_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},j_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},O_={select_date:"Choose date"},D_={common:x_,config:C_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_},R_=Object.freeze({__proto__:null,common:x_,config:C_,default:D_,display_modes:M_,editor:k_,elements:S_,error:E_,event:$_,key_assigner:A_,media_filter:z_,media_viewer:I_,recording:T_,thumbnail:j_,timeline:O_});const P_="en",L_={[P_]:R_};let N_;function F_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const a=localStorage.getItem("selectedLanguage");if(a){const e=JSON.parse(a);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in L_)return n}return P_}function V_(e,t="",n=""){let a="";try{a=e.split(".").reduce(((e,t)=>e[t]),L_[N_??P_])}catch(e){}return a||(a=e.split(".").reduce(((e,t)=>e[t]),L_[P_])),""!==t&&""!==n&&(a=a.replace(t,n)),a}function H_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const B_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},q_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,U_=(e,t,n)=>!!q_(e,t,n),W_=(e,t)=>{const n=U_(e,t,{phase:"start"})&&U_(e,t,{phase:"stop"}),a=U_(e,t);return n||a?[...n?["continuous"]:[],...a?["relative"]:[]]:null},Z_=e=>{const t=W_(e,"left"),n=W_(e,"right"),a=W_(e,"up"),i=W_(e,"down"),r=W_(e,"zoom_in"),o=W_(e,"zoom_out"),s=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||a?.length||i?.length||r?.length||o?.length||s?.length?{...t?{left:t}:{},...n?{right:n}:{},...a?{up:a}:{},...i?{down:i}:{},...r?{zoomIn:r}:{},...o?{zoomOut:o}:{},...s?{presets:s}:{}}:null};class Q_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Ts)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function G_(e,t,n){var a=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(i);++at||r&&o&&c&&!s&&!l||a&&o&&c||!n&&c||!i)return 1;if(!a&&!r&&!l&&e=s?c:c*("desc"==n[a]?-1:1)}return e.index-t.index}(e,t,n)}))}function Ev(e,t,n,a){return null==e?[]:(dp(t)||(t=null==t?[]:[t]),dp(n=a?void 0:n)||(n=null==n?[]:[n]),Sv(e,t,n))}async function $v(e,t,n,a=!1){let i;try{i=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new zs(V_("error.failed_response"),{request:n,response:e});throw e}if(!i)throw new zs(V_("error.empty_response"),{request:n});const r=a?t.safeParse(JSON.parse(i)):t.safeParse(i);if(!r.success)throw new zs(V_("error.invalid_response"),{request:n,response:i,invalid_keys:Rs(r.error)});return r.data}const Av=ba.lazy((()=>ba.object({title:ba.string(),media_class:ba.string(),media_content_type:ba.string(),media_content_id:ba.string(),can_play:ba.boolean(),can_expand:ba.boolean(),children_media_class:ba.string().nullable().optional(),thumbnail:ba.string().nullable(),children:ba.array(Av).nullable().optional()}))),zv="video",Iv="image",Tv=60,jv=e=>Ev(e,(e=>e._metadata?.startDate),"desc");class Ov{async walkBrowseMedias(e,t,n){return t&&t.length?(await tf(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let a=[];for(const i of function(e,t,n){t=(n?dg(e,t,n):void 0===t)?1:K_(Sg(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,r=0,o=Array(Y_(a/t));iawait this._browseMedia(e,a,{cache:n?.cache,matcher:t.matcher,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&a.push(n);if(t.sorter&&(a=t.sorter(a)),t.earlyExit&&t.earlyExit(a))break}const i=t.advance?t.advance(a):null;return i?.length?await this.walkBrowseMedias(e,i,n):a}async _browseMedia(e,t,n){const a="object"==typeof t?t.media_content_id:t,i=n?.cache?n.cache.get(a):null;if(i)return i;const r={type:"media_source/browse_media",media_content_id:a},o=await $v(e,Av,r);if(n?.metadataGenerator)for(const e of o.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(a,o,Ud(new Date,{seconds:60})),o}}function Dv(e,t){return bm(e,t)}function Rv(e,t){return e&&e.length?function(e,t){for(var n=-1,a=e.length,i=0,r=[];++nNv(t,e)))}add(e){this._ranges.push(e),this._ranges=Vv(this._ranges)}clear(){this._ranges=[]}}class Lv{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Fv=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Vv=(e,t=0)=>{const n=[];e=Ev(e,(e=>e.start),"asc");let a=null;for(const i of e){const e=i.start instanceof Date?i.start.getTime():i.start;if(!a){a={...i};continue}(a.end instanceof Date?a.end.getTime():a.end)+1e3*t>=e?i.end>a.end&&(a.end=i.end):(n.push(a),a={...i})}return a&&n.push(a),n};class Hv{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return Dv(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(a>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class Uv{constructor(){this._segments=new Map}add(e,t,n){let a=this._segments.get(e);a||(a=new qv((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,a)),a.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class Wv extends zs{}class Zv extends zs{}var Qv,Gv,Yv;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Qv||(Qv={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Gv||(Gv={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Yv||(Yv={}));const Kv=e=>e.camera_entity??e.webrtc_card?.entity??null;class Xv{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Yv.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-bb62ddef.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Yv.Frigate:const{FrigateCameraManagerEngine:a}=await import("./engine-frigate-1cc4bb56.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Uv,new Bv,t.eventCallback);break;case Yv.MotionEye:const{MotionEyeCameraManagerEngine:i}=await import("./engine-motioneye-381004ee.js");n=new i(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback);break;case Yv.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-72a91bc6.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ov,t.resolvedMediaCache,new Bv,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Yv.Frigate;else if("motioneye"===t.engine)n=Yv.MotionEye;else if("generic"===t.engine)n=Yv.Generic;else if("reolink"===t.engine)n=Yv.Reolink;else{const a=Kv(t);if(a){const i=await this._entityRegistryManager.getEntity(e,a);if(!i){if(e.states[a])return Yv.Generic;throw new Wv(V_("error.no_camera_entity"),t)}switch(i?.platform){case"frigate":n=Yv.Frigate;break;case"motioneye":n=Yv.MotionEye;break;case"reolink":n=Yv.Reolink;break;default:n=Yv.Generic}}else t.frigate.camera_name?n=Yv.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Yv.Generic)}return n}}class Jv{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await tf(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,a=new Set,i=e=>{n.add(e);const r=this.getCamera(e),o=r?.getConfig();if(r&&o){t&&!r.getCapabilities()?.matches(t)||a.add(e);const s=new Set;o.dependencies.cameras.forEach((e=>s.add(e))),o.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>s.add(e)));for(const e of s)n.has(e)||i(e)}};return i(e),a}}const ey=e=>{return Ev((n=e=>e.getID()??e,(t=e)&&t.length?Hg(t,xv(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class ty{static isEventQuery(e){return e.type===Qv.Event}static isRecordingQuery(e){return e.type===Qv.Recording}static isRecordingSegmentsQuery(e){return e.type===Qv.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Qv.MediaMetadata}}class ny{static isEventQueryResult(e){return e.type===Gv.Event}static isRecordingQueryResult(e){return e.type===Gv.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Gv.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Gv.MediaMetadata}}class ay{constructor(e,t){this._requestLimit=new w_,this._api=e,this._engineFactory=t?.factory??new Xv(this._api.getEntityRegistryManager()),this._store=t?.store??new Jv}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},a=u_(e?.cameras_global),hg(n,a,t,((e,t)=>Array.isArray(t)?t:void 0));var n,a}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,V_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,a=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!a)return t;const i=await(async e=>await tf(e,(e=>this._engineFactory.getEngineForCamera(a,e))))(e);for(const[a,r]of e.entries()){const e=i[a],o=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!o||!e)throw new Wv(V_("error.no_camera_engine"),u_(r));n.set(e,o),t.set(r,o)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const a=await this._getEnginesForCameras(e),i=await tf(a.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{i.forEach((e=>e.destroy()))},o=new Set;for(const e of i){const t=H_(e.getConfig());if(!t)throw await r(),new Wv(V_("error.no_camera_id"),e.getConfig());if(o.has(t))throw await r(),new Wv(V_("error.duplicate_camera_id"),e.getConfig());e.setID(t),o.add(t)}await this._store.setCameras(i),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Qv.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],a=Zg(e),i=this._store.getEnginesForCameraIDs(a);if(!i)return null;for(const[e,a]of i){let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(t)?i=e.generateDefaultEventQuery(this._store,a,t):ty.isRecordingQuery(t)?i=e.generateDefaultRecordingQuery(this._store,a,t):ty.isRecordingSegmentsQuery(t)&&(i=e.generateDefaultRecordingSegmentsQuery(this._store,a,t));for(const e of i??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,a=new Set,i={type:Qv.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(i);for(const i of r.values())i.metadata.tags&&i.metadata.tags.forEach(e.add,e),i.metadata.what&&i.metadata.what.forEach(t.add,t),i.metadata.where&&i.metadata.where.forEach(n.add,n),i.metadata.days&&i.metadata.days.forEach(a.add,a);return t.size||n.size||a.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...a.size&&{days:a}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,a){if(!this._api.getHASSManager().getHASS())return null;const i=e=>{let n=null;for(const a of t){const t=a.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,o=[],s=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=i("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=i("earliest");t&&(e.end=t,delete e.start)}e.limit=r,s.push({...t,limit:(t.limit??0)+r}),o.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(o,a));if(!c.length)return null;const l=ey(t.concat(c));return l.length===t.length?null:{queries:s,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();return t&&n&&a?await n.getMediaDownloadPath(a,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),a=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();if(!n||!a||!i)return;const r=new Date;await this._requestLimit.add((()=>a.favoriteMedia(i,n,e,t))),B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const a of e){const e=this._store.getEnginesForCameraIDs(a.cameraIDs);for(const[i,r]of e??[]){const e=i.getQueryResultMaxAge({...a,cameraIDs:r});if(null!==e&&Ud(t,{seconds:e})a?null:await this._requestLimit.add((()=>i.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=Wg(e),a=new Map,i=new Date,r=this._api.getHASSManager().getHASS();if(!r)return a;const o=async(e,n)=>{let i=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */ty.isEventQuery(n)?i=await e.getEvents(r,this._store,n,t):ty.isRecordingQuery(n)?i=await e.getRecordings(r,this._store,n,t):ty.isRecordingSegmentsQuery(n)?i=await e.getRecordingSegments(r,this._store,n,t):ty.isMediaMetadataQuery(n)&&(i=await e.getMediaMetadata(r,this._store,n,t)),i?.forEach(((e,t)=>a.set(t,e)))},s=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>o(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>s(e))));const c=(l=Array.from(a.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,a=-1,i=e.length;++athis._store.getCamera(e))).filter(sf);return new Q_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const a=this._store.getCameraConfig(e);if(!a)return;const i=q_(a,t,n);if(i)return await this._api.getActionsManager().executeActions(i);const r=this._api.getHASSManager().getHASS(),o=this._store.getEngineForCameraID(e);return o&&r?await this._requestLimit.add((()=>o.executePTZAction(r,a,t,n))):void 0}}class iy{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const ry=ba.object({id:ba.string(),model:ba.string().nullable(),config_entries:ba.string().array(),manufacturer:ba.string().nullable()}).array();class oy{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await $v(e,ry,{type:"config/device_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const sy=ba.object({config_entry_id:ba.string().nullable(),device_id:ba.string().nullable(),disabled_by:ba.string().nullable(),entity_id:ba.string(),hidden_by:ba.string().nullable(),platform:ba.string(),translation_key:ba.string().nullable(),unique_id:ba.string().or(ba.number()).optional()}),cy=sy.array();class ly{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let a=null;try{a=await $v(e,sy,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Gg(e),null}return this._cache.add(a),a}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const a=await this.getEntity(e,t);a&&n.set(t,a)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await $v(e,cy,{type:"config/entity_registry/list"})}catch(e){return void Gg(e)}this._cache.add(t),this._fetchedEntityList=!0}}class dy extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const a="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:a}):this._set(e,{value:t,expiry:a}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[a,i]=n;if(!this.cache.has(a)){!1===this._deleteIfExpired(a,i)&&(yield[a,i.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,a]of this.entriesAscending())e.call(t,a,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class uy{constructor(){this._cache=new dy({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const hy=async(e,t,n)=>{const a=n?n.get(t):void 0;if(a)return a;const i={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await $v(e,js,i)}catch(e){Gg(e)}return n&&r&&n.set(t,r),r};class py{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class my extends py{}class gy extends my{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),a=e.getConfigManager().getConfig();if(t&&n){const i=a?.view.camera_select??"current",r="current"===i?n.view:i;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class fy extends my{async execute(e){e.getCameraURLManager().openURL()}}class _y extends my{async execute(e){e.getViewManager().setViewDefault()}}class vy extends my{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class yy extends my{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class by extends my{async execute(e){e.getExpandManager().toggleExpanded()}}class wy extends my{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class xy extends py{async execute(e){const t=e.getHASSManager().getHASS();t&&at(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class Cy extends my{async execute(e){console[this._action.level](this._action.message)}}const My=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,ky=e=>My(e)!==e.camera,Sy=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Ey extends my{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),a=e.getViewManager().getView(),i=a?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):a?.is("live")?await n.playLive(t,My(a)):a?.isViewerView()&&i&&await n.playMedia(t,i)}}class $y extends my{async execute(e){e.getCardElementManager().toggleMenu()}}class Ay extends my{async execute(e){await e.getMicrophoneManager().connect()}}class zy extends my{async execute(e){e.getMicrophoneManager().disconnect()}}class Iy extends my{async execute(e){e.getMicrophoneManager().mute()}}class Ty extends my{async execute(e){await e.getMicrophoneManager().unmute()}}class jy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Oy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class Dy extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ry=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=My(e);let a="digital";return"digital"!==t?.type&&t?.cameraManager&&(Py(t.cameraManager,n)&&(a="ptz"),"ptz"!==a&&"ptz"===t?.type)?null:{targetID:n,type:a}}return null},Py=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Ly=ug((function(e,t,n){Jm(e,t,n)}));const Ny=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Fy=(e,t,n,a)=>{Ly(t,{[n]:{[e]:{inProgressAction:a}}})};class Vy extends my{constructor(){super(...arguments),this._timer=new xf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ry(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,a=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,i=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!a||!i)return;if(!this._action.ptz_action)return void(a.presets&&a.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:a.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&a[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Ny(n,this._context.ptz),Fy(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(i.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Ny(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(i.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Hy extends my{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function By(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=Cg(n))==n?n:0),void 0!==t&&(t=(t=Cg(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(Cg(e),t,n)}const qy=50,Uy=50,Wy=1,Zy=4,Qy=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Gy{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Yy=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Ky=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Gy(Yy(n,{observed:e.detail}))]})};class Xy extends my{constructor(){super(...arguments),this._timer=new xf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Yy(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ry(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Ny(n,this._context.ptzDigital),Fy(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Ny(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,a=e?.pan?.y??50,i="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,o="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:By(t+i,1,10),pan:{x:By(n+r,0,100),y:By(a+o,0,100)}}}}class Jy extends my{async execute(e){const t=e.getViewManager().getView();let n=null,a=null;if(this._action.target_id)n=this._action.target_id,a=Py(e.getCameraManager(),n)?"ptz":"digital";else if(t){const i=Ry(t,{cameraManager:e.getCameraManager()});n=i?.targetID??null,a=i?.type??null}n&&null!==a&&("ptz"===a?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Vy(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Xy(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class eb extends my{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class tb extends my{async execute(e){var t;await af((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class nb extends my{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class ab{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class ib extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ab]})}}class rb{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=My(e),a=t.indexOf(n),i=a<0?0:(a+1)%t.length;Sy(e,t[i])}}class ob extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(e)]})}}class sb{constructor(e){this._substreamID=e}modify(e){Sy(e,this._substreamID)}}class cb extends my{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new sb(this._action.camera)]})}}class lb extends my{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class db extends my{async execute(e){e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class ub{createAction(e,t,n){const a=mf(t);if("fire-dom-event"!==t.action||!a)return new xy(e,t,n?.config);if(a.card_id&&a.card_id!==n?.cardID)return null;switch(a.frigate_card_action){case"default":return new _y(e,a,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new db(e,a,n?.config);case"sleep":return new tb(e,a,n?.config);case"download":return new yy(e,a,n?.config);case"camera_ui":return new fy(e,a,n?.config);case"expand":return new by(e,a,n?.config);case"fullscreen":return new wy(e,a,n?.config);case"menu_toggle":return new $y(e,a,n?.config);case"camera_select":return new gy(e,a,n?.config);case"live_substream_select":return new cb(e,a,n?.config);case"live_substream_off":return new ib(e,a,n?.config);case"live_substream_on":return new ob(e,a,n?.config);case"media_player":return new Ey(e,a,n?.config);case"microphone_connect":return new Ay(e,a,n?.config);case"microphone_disconnect":return new zy(e,a,n?.config);case"microphone_mute":return new Iy(e,a,n?.config);case"microphone_unmute":return new Ty(e,a,n?.config);case"mute":return new jy(e,a,n?.config);case"unmute":return new lb(e,a,n?.config);case"play":return new Dy(e,a,n?.config);case"pause":return new Oy(e,a,n?.config);case"screenshot":return new eb(e,a,n?.config);case"display_mode_select":return new vy(e,a,n?.config);case"ptz":return new Vy(e,a,n?.config);case"ptz_digital":return new Xy(e,a,n?.config);case"ptz_multi":return new Jy(e,a,n?.config);case"ptz_controls":return new Hy(e,a,n?.config);case"log":return new Cy(e,a,n?.config);case"status_bar":return new nb(e,a,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${a.frigate_card_action}`),null}}class hb{constructor(e,t,n){this._actions=[],this._factory=new ub,this._stopped=!1,this._context=e;for(const a of Wg(t)){const t=this._factory.createAction(e,a,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const pb=ba.object({action:ba.enum(["tap","double_tap","hold","start_tap","end_tap"])}),mb=ba.object({detail:pb});class gb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=mb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,a=this.getMergedActions(),i=yf(n,a);a&&n&&i&&this.executeActions(i,a)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new hb(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class fb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),a=n?t.actions:t.actions_not,i=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==i&&a&&e.push(...a)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:V_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class _b{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const vb=(e,t)=>!!((e.attributes.supported_features??0)&t),yb=e=>(e=>vb(e,4)&&"number"==typeof e.attributes.in_progress)(e)||!!e.attributes.in_progress,bb=e=>{switch(e){case"armed_away":return"mdi:shield-lock";case"armed_vacation":return"mdi:shield-airplane";case"armed_home":return"mdi:shield-home";case"armed_night":return"mdi:shield-moon";case"armed_custom_bypass":return"mdi:security";case"pending":case"arming":return"mdi:shield-sync";case"triggered":return"mdi:bell-ring";case"disarmed":return"mdi:shield-off";default:return"mdi:shield"}},wb=(e,t)=>{const n="off"===e;switch(t?.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:close-network-outline":"mdi:check-network-outline";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:motion-sensor-off":"mdi:motion-sensor";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},xb=(e,t)=>{const n="closed"!==e;switch(t?.attributes.device_class){case"garage":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:garage";default:return"mdi:garage-open"}case"gate":switch(e){case"opening":case"closing":return"mdi:gate-arrow-right";case"closed":return"mdi:gate";default:return"mdi:gate-open"}case"door":return n?"mdi:door-open":"mdi:door-closed";case"damper":return n?"md:circle":"mdi:circle-slice-8";case"shutter":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-shutter";default:return"mdi:window-shutter-open"}case"curtain":switch(e){case"opening":return"mdi:arrow-split-vertical";case"closing":return"mdi:arrow-collapse-horizontal";case"closed":return"mdi:curtains-closed";default:return"mdi:curtains"}case"blind":case"shade":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:blinds";default:return"mdi:blinds-open"}case"window":switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}}switch(e){case"opening":return"mdi:arrow-up-box";case"closing":return"mdi:arrow-down-box";case"closed":return"mdi:window-closed";default:return"mdi:window-open"}},Cb={apparent_power:"mdi:flash",aqi:"mdi:air-filter",carbon_dioxide:"mdi:molecule-co2",carbon_monoxide:"mdi:molecule-co",current:"mdi:current-ac",date:"mdi:calendar",energy:"mdi:lightning-bolt",frequency:"mdi:sine-wave",gas:"mdi:gas-cylinder",humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",monetary:"mdi:cash",nitrogen_dioxide:"mdi:molecule",nitrogen_monoxide:"mdi:molecule",nitrous_oxide:"mdi:molecule",ozone:"mdi:molecule",pm1:"mdi:molecule",pm10:"mdi:molecule",pm25:"mdi:molecule",power:"mdi:flash",power_factor:"mdi:angle-acute",pressure:"mdi:gauge",reactive_power:"mdi:flash",signal_strength:"mdi:wifi",sulphur_dioxide:"mdi:molecule",temperature:"mdi:thermometer",timestamp:"mdi:clock",volatile_organic_compounds:"mdi:molecule",voltage:"mdi:sine-wave"},Mb={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},kb={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},Sb=(e,t)=>{const n=Number(e);if(isNaN(n))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const a=10*Math.round(n/10);return t&&n>=10?kb[a]:t?"mdi:battery-charging-outline":n<=5?"mdi:battery-alert-variant-outline":Mb[a]},Eb=e=>{const t=e?.attributes.device_class;if(t&&t in Cb)return Cb[t];if("battery"===t)return e?((e,t)=>{const n=e.state;return Sb(n,"on"===t?.state)})(e):"mdi:battery";const n=e?.attributes.unit_of_measurement;return"°C"===n||"°F"===n?"mdi:thermometer":void 0},$b="mdi:bookmark",Ab={alert:"mdi:alert",air_quality:"mdi:air-filter",automation:"mdi:robot",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:cog",conversation:"mdi:text-to-speech",counter:"mdi:counter",fan:"mdi:fan",google_assistant:"mdi:google-assistant",group:"mdi:google-circles-communities",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_button:"mdi:gesture-tap-button",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:form-textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",number:"mdi:ray-vertex",persistent_notification:"mdi:bell",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:palette",script:"mdi:script-text",select:"mdi:format-list-bulleted",sensor:"mdi:eye",siren:"mdi:bullhorn",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",timer:"mdi:timer-outline",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weather:"mdi:weather-cloudy",zone:"mdi:map-marker-radius"};function zb(e,t,n,a){switch(e){case"alarm_control_panel":return bb(n);case"binary_sensor":return wb(n,t);case"button":switch(t?.attributes.device_class){case"restart":return"mdi:restart";case"update":return"mdi:package-up";default:return"mdi:gesture-tap-button"}case"cover":return xb(n,t);case"device_tracker":return"router"===t?.attributes.source_type?"home"===n?"mdi:lan-connect":"mdi:lan-disconnect":["bluetooth","bluetooth_le"].includes(t?.attributes.source_type)?"home"===n?"mdi:bluetooth-connect":"mdi:bluetooth":"not_home"===n?"mdi:account-arrow-right":"mdi:account";case"humidifier":return n&&"off"===n?"mdi:air-humidifier-off":"mdi:air-humidifier";case"input_boolean":return"on"===n?"mdi:check-circle-outline":"mdi:close-circle-outline";case"lock":switch(n){case"unlocked":return"mdi:lock-open";case"jammed":return"mdi:lock-alert";case"locking":case"unlocking":return"mdi:lock-clock";default:return"mdi:lock"}case"media_player":switch(t?.attributes.device_class){case"speaker":switch(n){case"playing":return"mdi:speaker-play";case"paused":return"mdi:speaker-pause";case"off":return"mdi:speaker-off";default:return"mdi:speaker"}case"tv":switch(n){case"playing":return"mdi:television-play";case"paused":return"mdi:television-pause";case"off":return"mdi:television-off";default:return"mdi:television"}default:switch(n){case"playing":case"paused":return"mdi:cast-connected";case"off":return"mdi:cast-off";default:return"mdi:cast"}}case"switch":switch(t?.attributes.device_class){case"outlet":return"on"===n?"mdi:power-plug":"mdi:power-plug-off";case"switch":return"on"===n?"mdi:toggle-switch":"mdi:toggle-switch-off";default:return"mdi:flash"}case"zwave":switch(n){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}case"sensor":{const e=Eb(t);if(e)return e;break}case"input_datetime":if(!t?.attributes.has_date)return"mdi:clock";if(!t.attributes.has_time)return"mdi:calendar";break;case"sun":return"above_horizon"===t?.state?Ab[e]:"mdi:weather-night";case"update":return"on"===t?.state?yb(t)?"mdi:package-down":"mdi:package-up":"mdi:package"}return e in Ab?Ab[e]:a??$b}async function Ib(e,t,n){const a={type:"auth/sign_path",path:t,expires:n},i=await $v(e,Os,a);return i?e.hassUrl(i.path):null}function Tb(e,t,n,a){if(!e||!n||!n.length)return[];const i=[];for(const r of n){const n=t?.states[r],o=e.states[r];if((a?.stateOnly&&n?.state!==o?.state||!a?.stateOnly&&n!==o)&&(i.push({entityID:r,oldState:n,newState:o}),a?.firstOnly))break}return i}function jb(e,t,n,a){return!!Tb(e,t,n,{...a,firstOnly:!0}).length}function Ob(e){if("off"===e.state||!e.attributes.brightness)return"";return`brightness(${(e.attributes.brightness+245)/5}%)`}function Db(e){return"off"===e.state?"":e.attributes.rgb_color?`rgb(${e.attributes.rgb_color.join(",")})`:""}function Rb(e){return{color:Db(e),filter:Ob(e)}}function Pb(e,t){if(!t.entity)return t;const n=e.states[t.entity];n&&t.state_color&&(t.style={...Rb(n),...t.style}),t.title=t.title??(n?.attributes?.friendly_name||t.entity),t.icon=t.icon??Nb(e,t.entity);const a=n?function(e){return Ye(e.entity_id)}(n):void 0;return t.data_domain=t.state_color||"light"===a&&!1!==t.state_color?a:void 0,n&&(t.data_state=(e=>{const t=e.entity_id.split(".")[0];let n=e.state;return"climate"===t&&(n=e.attributes.hvac_action),n})(n)),t}function Lb(e,t){return t?e?.states[t]?.attributes?.friendly_name:void 0}function Nb(e,t,n){const a=e.states[t];return a&&a.attributes.icon?a.attributes.icon:zb(Ye(t),a,a?.state,n)}const Fb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-web-rtc-player"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},Vb=e=>!!e&&["on","open"].includes(e),Hb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Bb(e){return!!e?.startsWith("/")}function qb(e,t){return Bb(t)?e.hassUrl(t):t??null}class Ub{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await tf(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var Wb;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}(Wb||(Wb={}));class Zb{constructor(e,t){this._initializationQueue=new w_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Ub}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([Wb.LANGUAGES,Wb.SIDE_LOAD_ELEMENTS,Wb.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[Wb.MICROPHONE_CONNECT]:[],Wb.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[Wb.LANGUAGES]:async()=>await(async e=>{const t=F_(e);return"ca"===t?L_[t]=await import("./lang-ca-449daa4a.js"):"it"===t?L_[t]=await import("./lang-it-2a20a319.js"):"pt"===t?L_[t]=await import("./lang-pt-PT-c4863423.js"):"pt_BR"===t?L_[t]=await import("./lang-pt-BR-83a703b9.js"):"fr"===t&&(L_[t]=await import("./lang-fr-674e5de5.js")),t&&(N_=t),!0})(e),[Wb.SIDE_LOAD_ELEMENTS]:async()=>await Fb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[Wb.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[Wb.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary(Wb.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Qb{constructor(e,t,n,a){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=a}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),of(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),of(this._element,!0,"tabindex","0"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){of(this._element,!1,"panel"),of(this._element,!1,"tabindex"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize(Wb.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function Gb(e,t,n){return null==e?e:function(e,t,n,a){if(!hh(e))return e;for(var i=-1,r=(t=sv(t,e)).length,o=r-1,s=e;null!=s&&++i{Gb(e,t,n)},Xb=(e,t,n)=>fv(e,t,n),Jb=(e,t)=>{!function(e,t){null==e||Yb(e,t)}(e,t)},ew=e=>u_(e),tw=(e,t)=>e.replace("#",`[${t.toString()}]`),nw=function(e){let t=!1;for(let n=0;n{const i=Xb(e,t);if(void 0===i)return!1;const r=a?.transform?a.transform(i):i;return!(t===n&&Dv(i,r)||(null===r?a?.keepOriginal||(Jb(e,t),0):void 0===r||(a?.keepOriginal||Jb(e,t),Kb(e,n,r),0)))})(a,e,t,n)}},rw=function(e,t,n){return function(a){let i=iw(e,t,n)(a);return i=cw(bs,iw(e,t,n),(e=>e.overrides))(a)||i,i}},ow=function(e,t){return rw(e,e,{transform:t})},sw=function(e){return rw(e,e,{transform:e=>null})},cw=function(e,t,n){return function(a){let i=!1;const r=Xb(a,e);return Array.isArray(r)&&r.forEach((e=>{const a=n?n(e):e;a&&"object"==typeof a&&(i=t(a)||i)})),i}},lw=(e,t)=>{const n=a=>{let i=!1;if(a&&"object"==typeof a){const r=t?t(a):a;r&&(i=e(r)||i),Array.isArray(a)?a.forEach((e=>{i=n(e)||i})):Object.keys(a).forEach((e=>{i=n(a[e])||i}))}return i};return n},dw=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),uw=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},hw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),pw=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),mw=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),gw=[cw(bs,dw,(e=>e.conditions)),e=>lw(dw,(e=>e.conditions))("object"==typeof e&&e?e[Ii]:{}),rw("event_gallery",or),rw("menu.buttons.frigate_ui",is),e=>lw(mw)("object"==typeof e&&e?e:{}),cw(Ca,ow("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),rw("live.jsmpeg",ki),rw("live.image",Ci),rw("live.webrtc_card",Si),cw(Ca,rw("frigate.zone","frigate.zones",{transform:e=>Wg(e)})),cw(Ca,rw("frigate.label","frigate.labels",{transform:e=>Wg(e)})),e=>lw(pw)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Ii in e)||!Array.isArray(e[Ii]))return!1;let t=!1;const n=n=>{if(!t){if(!fv(e,"live.controls.ptz")){const{type:t,...a}=n;Gb(e,"live.controls.ptz",a)}t=!0}},a=e=>{const t=[];for(const i of e)if("custom:frigate-card-ptz"===i.type)n(i);else if("conditional"!==i.type&&"custom:frigate-card-conditional"!==i.type||!Array.isArray(i.elements))t.push(i);else{const e=a(i.elements);e.length&&(i.elements=e,t.push(i))}return t},i=a(e[Ii]);return t&&(i.length?e[Ii]=i:delete e[Ii]),t},rw("view.timeout_seconds",Ri),ow("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:Wg(e))),ow("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:Wg(e))),ow("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:Wg(e))),ow("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:Wg(e))),rw("live.controls.thumbnails.media",io),rw("timeline.media",Ho),rw("live.controls.timeline.media",po),rw("media_viewer.controls.timeline.media",Rr),rw("view.scan",Xi),rw("view.triggers.enabled",ar,{transform:e=>!0===e?"live":null,keepOriginal:!0}),rw("view.triggers.enabled",er,{transform:e=>!0!==e&&null}),rw("view.triggers.untrigger_reset",ir,{transform:e=>e?"default":null}),rw("live.layout",Ai),sw("media_viewer.layout"),sw("image.layout"),cw(bs,uw),e=>lw(uw)("object"==typeof e&&e?e[Ii]:{}),e=>lw(uw)("object"==typeof e&&e?e.automations:{}),cw(Ca,rw("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),rw("performance.profile",$s,{transform:e=>"low"===e?["low-performance"]:null}),cw(bs,iw("overrides","merge")),rw("live.controls.ptz",zi,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],a=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>a.includes(e))))return;const i={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),i),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),i);const r=()=>{i.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),i.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),i.presets.service=e.service,i.presets.data_home=e.data_home),i},keepOriginal:!0}),ow("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),rw("view.update_cycle_camera",Wi),rw("view.update_force",Qi,{transform:e=>!0===e?"all":null}),rw("view.update_seconds",Gi),rw("view.update_entities",Yi),iw("live.controls.title",ds,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),sw("live.controls.title"),sw("media_viewer.controls.title"),e=>lw(hw)("object"==typeof e&&e?e:{}),rw("dimensions.max_height",ys),sw("dimensions.min_height")];class fw extends zs{}class _w extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function vw(e,t,n){let a=ew(t),i=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Jb(a,e)})),Object.keys(t.set??{}).forEach((e=>{Kb(a,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{Kb(a,e,Ly({},Xb(a,e),t.merge?.[e]))})),i=!0);if(!i)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(a=hf(a)),n?.schema){const e=n.schema.safeParse(a);if(!e.success)throw new fw(V_("error.invalid_configuration_override"),[e.error.errors,a]);return e.data}return a}class yw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const a=vl.safeParse(e);a.success?(t.push(...a.data.conditions),a.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>Dv(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const bw={casting:{[Qr]:!1,[Sr]:!1,[es]:"none",[`${os}.enabled`]:!0,[`${ss}.enabled`]:!0,[`${rs}.enabled`]:!1,[`${cs}.enabled`]:!1,[Zr]:["selected","visible"],[vs]:"static",[_s]:"16:9",[$i]:1,[$o]:!0},"low-performance":{[ro]:"none",[Ar]:"none",[Uo]:"none",[fo]:!1,[Nr]:!1,[Bo]:!1,[Wr]:[],[mr]:[],[gr]:[],[fr]:[],[ko]:["unselected","hidden"],[Co]:!1,[xr]:!1,[Eo]:"none",[kr]:"none",[$o]:!1,[Er]:"chevrons",[hs]:"none",[es]:"outside",[`${as}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${ls}.enabled`]:!1,[`${cs}.enabled`]:!1,[lr]:!1,[dr]:!1,[ur]:!1,[cr]:!1,[co]:!1,[lo]:!1,[uo]:!1,[so]:!1,[Ir]:!1,[Tr]:!1,[jr]:!1,[zr]:!1,[Qo]:!1,[Go]:!1,[Yo]:!1,[Zo]:!1,[xs]:!1,[Cs]:10,[Es]:!1,[Ss]:!1,[Mr]:!1,[Ei]:!1,[Mi]:"image",[$i]:10,[ar]:"none",[Ms]:1},scrubbing:{[mo]:"below",[_o]:"ribbon",[go]:"seek",[Pr]:"below",[Fr]:"ribbon",[Lr]:"seek"}},ww=(e,t,n)=>{const a=Ds(Nd).safeParse(e);if(!a.success)return t;const i=a.data;for(const e of n??[])e in bw&&Object.entries(bw[e]).forEach((([e,n])=>{return r=n,void(void 0===Xb(i,a=e)&&Kb(t,a,r));var a,r}));return t},xw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},Cw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const a of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const i=t[a],r=xw(a);i&&r&&(n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[vf({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:i.key,state:"up"}],actions:[vf({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const a=t.ptz_home;return a&&n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[vf()],tag:e}),n};class Mw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(V_("error.invalid_configuration"));const t=Nd.safeParse(e);if(!t.success){const n=aw(e),a=Ps(t.error);let i="";throw n&&(i=`${V_("error.upgrade_available")}. `),new Error(i+`${V_("error.invalid_configuration")}: `+(a&&a.size?JSON.stringify([...a],null," "):V_("error.invalid_configuration_no_hint")))}const n=ww(e,t.data,t.data.profiles);var a;(this._rawConfig=e,Dv(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize(Wb.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const a=Cw(t,n);a.length&&e.getAutomationsManager().addAutomations(a)})(this._api,this),(a=this._api).getAutomationsManager().deleteAutomations(),a.getAutomationsManager().addAutomations(a.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=vw(e,this._config,{configOverrides:this._config.overrides,schema:Nd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(Dv(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||Dv(n?.cameras,this._overriddenConfig?.cameras)&&Dv(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize(Wb.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize(Wb.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class kw{constructor(e){this._timer=new xf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){Dv(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[gf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const Sw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,a=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!a)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},Ew=async(e,t,n)=>{const a=await t.getMediaDownloadPath(n);if(!a)throw new zs(V_("error.download_no_media"));let i=a.endpoint;if(a.sign){let t;try{t=await Ib(e,a.endpoint)}catch(e){Gg(e)}if(!t)throw new zs(V_("error.download_sign_failed"));i=t}Sw(i)},$w=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class Aw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await Ew(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&Sw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${Wu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class zw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const Iw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],Tw=(()=>{if("undefined"==typeof document)return!1;const e=Iw[0],t={};for(const n of Iw){const a=n?.[1];if(a in document){for(const[a,i]of n.entries())t[e[a]]=i;return t}}return!1})(),jw={change:Tw.fullscreenchange,error:Tw.fullscreenerror};let Ow={request:(e=document.documentElement,t)=>new Promise(((n,a)=>{const i=()=>{Ow.off("change",i),n()};Ow.on("change",i);const r=e[Tw.requestFullscreen](t);r instanceof Promise&&r.then(i).catch(a)})),exit:()=>new Promise(((e,t)=>{if(!Ow.isFullscreen)return void e();const n=()=>{Ow.off("change",n),e()};Ow.on("change",n);const a=document[Tw.exitFullscreen]();a instanceof Promise&&a.then(n).catch(t)})),toggle:(e,t)=>Ow.isFullscreen?Ow.exit():Ow.request(e,t),onchange(e){Ow.on("change",e)},onerror(e){Ow.on("error",e)},on(e,t){const n=jw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=jw[e];n&&document.removeEventListener(n,t,!1)},raw:Tw};Object.defineProperties(Ow,{isFullscreen:{get:()=>Boolean(document[Tw.fullscreenElement])},element:{enumerable:!0,get:()=>document[Tw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[Tw.fullscreenEnabled])}}),Tw||(Ow={isEnabled:!1});var Dw=Ow;class Rw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){Dw.isEnabled&&Dw.on("change",this._fullscreenHandler)}disconnect(){Dw.isEnabled&&Dw.off("change",this._fullscreenHandler)}isInFullscreen(){return Dw.isEnabled&&Dw.isFullscreen}toggleFullscreen(){Dw.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){Dw.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class Pw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,a]of this._watcherCallbacks.entries()){const i=Tb(t,e,a,{stateOnly:!0,firstOnly:!0});i.length&&n(i[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class Lw{constructor(e){this._hass=null,this._stateWatcher=new Pw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:V_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var Nw=function(){return th.Date.now()},Fw="Expected a function",Vw=Math.max,Hw=Math.min;function Bw(e,t,n){var a,i,r,o,s,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(Fw);function p(t){var n=a,r=i;return a=i=void 0,l=t,o=e.apply(r,n)}function m(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function g(){var e=Nw();if(m(e))return f(e);s=setTimeout(g,function(e){var n=t-(e-c);return u?Hw(n,r-(e-l)):n}(e))}function f(e){return s=void 0,h&&a?p(e):(a=i=void 0,o)}function _(){var e=Nw(),n=m(e);if(a=arguments,i=this,c=e,n){if(void 0===s)return function(e){return l=e,s=setTimeout(g,t),d?p(e):o}(c);if(u)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),o}return t=Cg(t)||0,hh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Vw(Cg(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==s&&clearTimeout(s),l=0,a=c=i=s=void 0},_.flush=function(){return void 0===s?o:f(Nw())},_}function qw(e,t,n){var a=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return hh(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),Bw(e,t,{leading:a,maxWait:t,trailing:i})}class Uw{constructor(e){this._timer=new xf,this.reportInteraction=qw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class Ww{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};Dv(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Zw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Qw(e,t,n){const a=Zw(t,n);a&&Gw(e,a)}function Gw(e,t){Bg(e,"media:loaded",t)}function Yw(e){Bg(e,"media:unloaded")}function Kw(e){Bg(e,"media:volumechange")}function Xw(e){Bg(e,"media:play")}function Jw(e){Bg(e,"media:pause")}class ex{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class tx{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class nx{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&vb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Gg(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let a;if(vb(n,4096))a="media_stop";else{if(!vb(n,256))return;a="turn_off"}await t.callService("media_player",a,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const a=this._api.getHASSManager().getHASS(),i=n?.camera_entity??null;if(!a||!i)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,o=a.states[i]?.attributes?.entity_picture??null;await a.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${i}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...o&&{thumb:o}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const a=t.cast?.dashboard;a?.dashboard_path&&a?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:a.dashboard_path,view_path:a.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:V_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const a=t.getTitle(),i=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:tx.isVideo(t)?"video":"image",extra:{...a&&{title:a},...i&&{thumb:i}}})}}class ax{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Gg(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof zs&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Is[this._message.type]:0,n=Is[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class rx{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new sb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[a,i]of e.entries()){const e=a.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,o=e.groups.action;let s=null;switch(o){case"camera_select":case"live_substream_select":i&&(s=ff(o,i,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":s=gf(o,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${o}`)}s&&t.push(s)}return t}}class ox{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!Dv(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineLogo??null,a=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,i=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...a?[{type:"custom:frigate-card-status-bar-string",string:a,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...i?[{type:"custom:frigate-card-status-bar-string",string:i,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-image",image:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const a=.99*t,i=1.01*t,r=.99*n,o=1.01*n,s=(e,t,n)=>e>=t&&e<=n;return!!e&&(s(e.width,a,i)&&s(e.height,r,o)||s(e.height,a,i)&&s(e.width,r,o))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class sx{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);of(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const a=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!a&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,a=n?.style??{};for(const n of Object.keys(a)){const i=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===a[n]?t.style.setProperty(i,e[n]):t.style.removeProperty(i)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return uf();const n=e.dimensions.aspect_ratio_mode,a=this._api.getMediaLoadedInfoManager().getLastKnown();return uf(a&&"dynamic"===n?{ratio:[a.width,a.height]}:{ratio:e.dimensions.aspect_ratio})}return uf({defaultStatic:!0})}}class cx{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=qw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Ev([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const a=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!a.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;Dv(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new xf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function lx(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Hg(e,void 0,t):[]}class dx{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return u_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Zg(e)}))),this._queries=lx(t,Dv),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class ux extends dx{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class hx extends dx{}class px{static areEventQueries(e){return e instanceof ux}static areRecordingQueries(e){return e instanceof hx}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const mx=(e,t,n)=>{const a={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const i="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i);case"timeline":return e.getStore().getCameraIDsWithCapability(a);case"media":return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a)}},gx=(e,t)=>Ly({},e,t);class fx{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new fx({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new fx({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=gx(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const _x=(e,t)=>{t?.forEach((t=>t.modify(e)))};class vx extends zs{}class yx extends zs{}class bx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const a=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const i=[...mx(this._api.getCameraManager(),a)];if(!i.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=i.indexOf(e.baseView.camera);n=i[t+1>=i.length?0:t+1]}else n=i[0]}return this.getViewByParameters({params:{...e?.params,view:a,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,a=e?.params?.view??e?.baseView?.view??t.view.default;const i=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!i.has(n)){n=mx(this._api.getCameraManager(),a).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const a=n.getCapabilities()?.getRawCapabilities();return a&&(e[t]=a),e}),{});throw new vx(V_("error.no_supported_cameras"),{view:a,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,a)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Qs)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new yx(V_("error.no_supported_camera"),{view:a,camera:n,...e&&{camera_capabilities:e}})}a=Qs}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(a,t),o={...e?.params,view:a,camera:n,displayMode:r},s=e?.baseView?e.baseView.evolve(o):new fx(o);return _x(s,e?.modifiers),s}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class wx{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class xx{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const Cx=(e,t,n)=>{let a;for(const[i,r]of e.entries()){const e=r.getStartTime(),o=r.getUsableEndTime();if(r.includesTime(t)&&e&&o){const t=o.getTime()-e.getTime();(!a||n&&a.cameraID!==n&&r.getCameraID()===n||t>a.duration&&(!n||a.cameraID!==n||r.getCameraID()===n))&&(a={index:i,duration:t,cameraID:r.getCameraID()})}}return a?a.index:null};class Mx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new Mx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class Sx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),a=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!a.size)return null;const i=n.generateDefaultEventQueries(a,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!i)return null;const r=new ux(i),o=await this.execute(r,e?.executorOptions);return o?{query:r,queryResults:o}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const a=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!a)return null;const i=new hx(a),r=await this.execute(i,e?.executorOptions);return r?{query:i,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const a=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!a)return null;const i=new kx({results:a});return t?.rejectResults?.(i)?null:(t?.selectResult?.id?i.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?i.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&i.selectBestResult((e=>Cx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),i)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class Ex{constructor(e,t){this._api=e,this._executor=t??new Sx(e)}async getExistingQueryModifiers(e,t){return e.query?[new xx({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const a=e?.getDefaultMediaType(),i=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const a="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return a?[new xx(a)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&i.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":i.push(...await r("clips"));break;case"clips":case"snapshots":case"recordings":i.push(...await r(a));break;case"clip":case"snapshot":case"recording":"none"!==n.media_viewer.controls.thumbnails.mode&&i.push(...await r(a))}return i.push(...this._getTimelineWindowViewModifier(e)),i.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),i}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Gy({timeline:{window:{start:Qu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new wx("timeline","window")]}_getSeekTimeModifier(e){return e?[new Gy({mediaViewer:{seek:e}})]:[new wx("mediaViewer","seek")]}}class $x{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new bx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new Ex(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let a=null;try{a=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!a)return;if(this._view&&this._shouldAdoptQueryAndResults(a))return a.query=this._view.query,a.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(a),void this._setView(a);const i=this._loadingIndex++;this._markViewLoadingQuery(a,i),this._setView(a);let r=null,o=null;try{r=await t(a,n?.queryExecutorOptions)}catch(e){o=e}if(this._view&&this.hasMajorMediaChange(this._view,a))return void(this._view.context?.loading?.query===i&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(o)return void this._api.getMessageManager().setErrorIfHigherPriority(o); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const s=this._view.clone();this._view.context?.loading?.query===i&&this._markViewAsNotLoadingQuery(s),_x(s,r),this._setView(s)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),a=px.getMediaType(this._view?.query)===n;return!!t&&a}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!mx(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&My(e)!==My(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;B_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class Ax{constructor(e,t,n,a){this._deviceRegistryManager=new oy(new iy((e=>e.id))),this._entityRegistryManager=new ly(new iy((e=>e.entity_id))),this._resolvedMediaCache=new uy,this._actionsManager=new gb(this),this._automationsManager=new fb(this),this._cameraManager=new ay(this),this._cameraURLManager=new _b(this),this._configManager=new Mw(this),this._defaultManager=new kw(this),this._downloadManager=new Aw(this),this._expandManager=new zw(this),this._fullscreenManager=new Rw(this),this._hassManager=new Lw(this),this._initializationManager=new Zb(this),this._interactionManager=new Uw(this),this._keyboardStateManager=new Ww(this),this._mediaLoadedInfoManager=new ex(this),this._mediaPlayerManager=new nx(this),this._messageManager=new ax(this),this._microphoneManager=new ix(this),this._queryStringManager=new rx(this),this._statusBarItemManager=new ox(this),this._styleManager=new sx(this),this._triggersManager=new cx(this),this._viewManager=new $x(this),e.addController(this),this._conditionsManager=new yw(this,a),this._cardElementManager=new Qb(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-c3e576d8.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class zx{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,a){return[this._getDefaultButton(t),this._getCamerasButton(t,n,a?.view),this._getSubstreamsButton(t,n,a?.view),this._getLiveButton(t,a?.view,a?.viewManager),this._getClipsButton(t,a?.view,a?.viewManager),this._getSnapshotsButton(t,a?.view,a?.viewManager),this._getRecordingsButton(t,a?.view,a?.viewManager),this._getImageButton(t,a?.view,a?.viewManager),this._getTimelineButton(t,a?.view,a?.viewManager),this._getDownloadButton(t,n,a?.view),this._getCameraUIButton(t,a?.showCameraUIButton),this._getMicrophoneButton(t,a?.microphoneManager,a?.currentMediaLoadedInfo),this._getExpandButton(t,a?.inExpandedMode),this._getFullscreenButton(t,a?.inFullscreenMode),this._getCastButton(e,t,n,a?.view,a?.mediaPlayerController),this._getPlayPauseButton(t,a?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,a?.currentMediaLoadedInfo),this._getScreenshotButton(t,a?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,a?.view),this._getPTZControlsButton(t,n,a?.view),this._getPTZHomeButton(t,n,a?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,a),...e})))].filter(sf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?gf("menu_toggle"):gf("default"),hold_action:gf("diagnostics")}}_getCamerasButton(e,t,n){const a=t.getStore().getCameraIDsWithCapability("menu");if(a.size>1){const i=Array.from(t.getStore().getCameraConfigEntries(a),(([e,a])=>{const i=ff("camera_select",e),r=t.getCameraMetadata(e);return{enabled:!0,icon:r?.icon,entity:a.camera_entity,state_color:!0,title:r?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.cameras"),items:i}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const a=t.getStore().getAllDependentCameras(n.camera,"substream");if(a.size&&n.is("live")){const i=[...a].filter((e=>e!==n.camera)),r=[n.camera,...i],o=My(n);if(2===r.length)return{icon:"mdi:video-input-component",style:o!==n.camera?this._getEmphasizedStyle():{},title:V_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:gf(ky(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const a=Array.from(r,(e=>{const n=ff("live_substream_select",e),a=t.getCameraMetadata(e)??void 0,i=t.getStore().getCameraConfig(e);return{enabled:!0,icon:a?.icon,entity:i?.camera_entity,state_color:!0,title:a?.title,selected:o===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:V_("config.menu.buttons.substreams"),style:o!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:a}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:gf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:gf("clips"),hold_action:gf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:gf("snapshots"),hold_action:gf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:gf("recordings"),hold_action:gf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:gf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:V_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:gf("timeline")}:null}_getDownloadButton(e,t,n){const a=n?.queryResults?.getSelectedResult(),i=a?t?.getMediaCapabilities(a):null;return n?.isViewerView()&&i?.canDownload&&!this._isBeingCasted()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.download"),tap_action:gf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.camera_ui"),tap_action:gf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),a=t.isMuted(),i=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":a?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.microphone"),style:n||a?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===i&&{start_tap_action:gf("microphone_unmute"),end_tap_action:gf("microphone_mute")},...!n&&"toggle"===i&&{tap_action:gf(a?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.expand"),tap_action:gf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return this._isBeingCasted()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.fullscreen"),tap_action:gf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,a,i){if(!a)return null;const r=n.getStore().getCameraConfig(a.camera);if(i?.hasMediaPlayers()&&(a.isViewerView()||a.is("live")&&r?.camera_entity)){const n=i.getMediaPlayers().map((t=>{const n=Lb(e,t)||t,a=e.states[t],i=_f(t,"play"),r=_f(t,"stop"),o=!a||"unavailable"===a.state;return{enabled:!0,selected:!1,icon:Nb(e,t),entity:t,state_color:!1,title:n,disabled:o,...!o&&i&&{tap_action:i},...!o&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:V_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.play"),tap_action:gf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.mute"),tap_action:gf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.screenshot"),tap_action:gf("screenshot")}:null}_getDisplayModeButton(e,t,n){const a=n?mx(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&a&&a.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_(t?"display_modes.single":"display_modes.grid"),tap_action:(i=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:i,...r?.cardID&&{card_id:r.cardID}})}}var i,r;return null}_getPTZControlsButton(e,t,n){const a=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!a||"off"===a.mode)return null;const i=Ry(n,{cameraManager:t,..."auto"===a.mode&&{type:"ptz"}});if(i){const t=!1!==n.context?.ptzControls?.enabled&&("on"===a.mode||"auto"===a.mode&&"ptz"===i.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...o?.cardID&&{card_id:o.cardID}})}}var r,o;return null}_getPTZHomeButton(e,t,n){const a=n?Ry(n,{cameraManager:t}):null;return!a||(("digital"===a.type&&n?.context?.zoom?.[a.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:V_("config.menu.buttons.ptz_home"),tap_action:vf({targetID:a.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const a of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(a)?a:[a];for(const a of t){if(!a||"fire-dom-event"!==a.action||!("frigate_card_action"in a))continue;const t=a;if(Zs.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}_isBeingCasted(){return!!navigator.userAgent.match(/CrKey\//)}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function Ix(e){return null==e}var Tx=function(e,t){var n,a="";for(n=0;ns&&(t=a-s+(r=" ... ").length),n-a>s&&(n=a+s-(o=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+o,pos:a-t+r.length}}function Lx(e,t){return jx.repeat(" ",t-e.length)+e}var Nx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,a=/\r?\n|\r|\0/g,i=[0],r=[],o=-1;n=a.exec(e.buffer);)r.push(n.index),i.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var s,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(s=1;s<=t.linesBefore&&!(o-s<0);s++)c=Px(e.buffer,i[o-s],r[o-s],e.position-(i[o]-i[o-s]),u),l=jx.repeat(" ",t.indent)+Lx((e.line-s+1).toString(),d)+" | "+c.str+"\n"+l;for(c=Px(e.buffer,i[o],r[o],e.position,u),l+=jx.repeat(" ",t.indent)+Lx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=jx.repeat("-",t.indent+d+3+c.pos)+"^\n",s=1;s<=t.linesAfter&&!(o+s>=r.length);s++)c=Px(e.buffer,i[o+s],r[o+s],e.position-(i[o]-i[o+s]),u),l+=jx.repeat(" ",t.indent)+Lx((e.line+s+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},Fx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Vx=["scalar","sequence","mapping"];var Hx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Fx.indexOf(t))throw new Rx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Vx.indexOf(this.kind))throw new Rx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Bx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,a){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=a)})),n[t]=e})),n}function qx(e){return this.extend(e)}qx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Hx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new Rx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Rx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new Rx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Hx))throw new Rx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(qx.prototype);return a.implicit=(this.implicit||[]).concat(t),a.explicit=(this.explicit||[]).concat(n),a.compiledImplicit=Bx(a,"implicit"),a.compiledExplicit=Bx(a,"explicit"),a.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),nC=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var aC=/^[-+]?[0-9]+e/;var iC=new Hx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!nC.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||jx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(jx.isNegativeZero(e))return"-0.0";return n=e.toString(10),aC.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),rC=Gx.extend({implicit:[Yx,Kx,tC,iC]}),oC=rC,sC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),cC=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var lC=new Hx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==sC.exec(e)||null!==cC.exec(e))},construct:function(e){var t,n,a,i,r,o,s,c,l=0,d=null;if(null===(t=sC.exec(e))&&(t=cC.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],a=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,a,i));if(r=+t[4],o=+t[5],s=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,a,i,r,o,s,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var dC=new Hx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),uC="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var hC=new Hx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,a=0,i=e.length,r=uC;for(n=0;n64)){if(t<0)return!1;a+=6}return a%8==0},construct:function(e){var t,n,a=e.replace(/[\r\n=]/g,""),i=a.length,r=uC,o=0,s=[];for(t=0;t>16&255),s.push(o>>8&255),s.push(255&o)),o=o<<6|r.indexOf(a.charAt(t));return 0===(n=i%4*6)?(s.push(o>>16&255),s.push(o>>8&255),s.push(255&o)):18===n?(s.push(o>>10&255),s.push(o>>2&255)):12===n&&s.push(o>>4&255),new Uint8Array(s)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,a="",i=0,r=e.length,o=uC;for(t=0;t>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]),i=(i<<8)+e[t];return 0===(n=r%3)?(a+=o[i>>18&63],a+=o[i>>12&63],a+=o[i>>6&63],a+=o[63&i]):2===n?(a+=o[i>>10&63],a+=o[i>>4&63],a+=o[i<<2&63],a+=o[64]):1===n&&(a+=o[i>>2&63],a+=o[i<<4&63],a+=o[64],a+=o[64]),a}}),pC=Object.prototype.hasOwnProperty,mC=Object.prototype.toString;var gC=new Hx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,a,i,r,o=[],s=e;for(t=0,n=s.length;t>10),56320+(e-65536&1023))}for(var qC=new Array(256),UC=new Array(256),WC=0;WC<256;WC++)qC[WC]=HC(WC)?1:0,UC[WC]=HC(WC);function ZC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||bC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function QC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=Nx(n),new Rx(t,n)}function GC(e,t){throw QC(e,t)}function YC(e,t){e.onWarning&&e.onWarning.call(null,QC(e,t))}var KC={YAML:function(e,t,n){var a,i,r;null!==e.version&&GC(e,"duplication of %YAML directive"),1!==n.length&&GC(e,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&GC(e,"ill-formed argument of the YAML directive"),i=parseInt(a[1],10),r=parseInt(a[2],10),1!==i&&GC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&YC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var a,i;2!==n.length&&GC(e,"TAG directive accepts exactly two arguments"),a=n[0],i=n[1],TC.test(a)||GC(e,"ill-formed tag handle (first argument) of the TAG directive"),wC.call(e.tagMap,a)&&GC(e,'there is a previously declared suffix for "'+a+'" tag handle'),jC.test(i)||GC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch(t){GC(e,"tag prefix is malformed: "+i)}e.tagMap[a]=i}};function XC(e,t,n,a){var i,r,o,s;if(t1&&(e.result+=jx.repeat("\n",t-1))}function rM(e,t){var n,a,i=e.tag,r=e.anchor,o=[],s=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),a=e.input.charCodeAt(e.position);0!==a&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,GC(e,"tab characters must not be used in indentation")),45===a)&&PC(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,nM(e,!0,-1)&&e.lineIndent<=t)o.push(null),a=e.input.charCodeAt(e.position);else if(n=e.line,cM(e,t,MC,!1,!0),o.push(e.result),nM(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==a)GC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt?m=1:e.lineIndent===t?m=0:e.lineIndentt)&&(_&&(o=e.line,s=e.lineStart,c=e.position),cM(e,t,kC,!0,i)&&(_?g=e.result:f=e.result),_||(eM(e,h,p,m,g,f,o,s,c),m=g=f=null),nM(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)GC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===i?GC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?GC(e,"repeat of an indentation width identifier"):(l=t+i-1,c=!0)}if(RC(r)){do{r=e.input.charCodeAt(++e.position)}while(RC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!DC(r)&&0!==r)}for(;0!==r;){for(tM(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),DC(r))d++;else{if(e.lineIndent0){for(i=o,r=0;i>0;i--)(o=NC(s=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+o:GC(e,"expected hexadecimal character");e.result+=BC(r),e.position++}else GC(e,"unknown escape sequence");n=a=e.position}else DC(s)?(XC(e,n,a,!0),iM(e,nM(e,!1,t)),n=a=e.position):e.position===e.lineStart&&aM(e)?GC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,a=e.position)}GC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,a;if(42!==(a=e.input.charCodeAt(e.position)))return!1;for(a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!PC(a)&&!LC(a);)a=e.input.charCodeAt(++e.position);return e.position===t&&GC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),wC.call(e.anchorMap,n)||GC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],nM(e,!0,-1),!0}(e)?function(e,t,n){var a,i,r,o,s,c,l,d,u=e.kind,h=e.result;if(PC(d=e.input.charCodeAt(e.position))||LC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a)))return!1;for(e.kind="scalar",e.result="",i=r=e.position,o=!1;0!==d;){if(58===d){if(PC(a=e.input.charCodeAt(e.position+1))||n&&LC(a))break}else if(35===d){if(PC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&aM(e)||n&&LC(d))break;if(DC(d)){if(s=e.line,c=e.lineStart,l=e.lineIndent,nM(e,!1,-1),e.lineIndent>=t){o=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=s,e.lineStart=c,e.lineIndent=l;break}}o&&(XC(e,i,r,!1),iM(e,e.line-s),i=r=e.position,o=!1),RC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return XC(e,i,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,xC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||GC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=s&&rM(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&GC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&GC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):GC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function lM(e){var t,n,a,i,r=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(i=e.input.charCodeAt(e.position))&&(nM(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==i));){for(o=!0,i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);for(a=[],(n=e.input.slice(t,e.position)).length<1&&GC(e,"directive name must not be less than one character in length");0!==i;){for(;RC(i);)i=e.input.charCodeAt(++e.position);if(35===i){do{i=e.input.charCodeAt(++e.position)}while(0!==i&&!DC(i));break}if(DC(i))break;for(t=e.position;0!==i&&!PC(i);)i=e.input.charCodeAt(++e.position);a.push(e.input.slice(t,e.position))}0!==i&&tM(e),wC.call(KC,n)?KC[n](e,n,a):YC(e,'unknown document directive "'+n+'"')}nM(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,nM(e,!0,-1)):o&&GC(e,"directives end mark is expected"),cM(e,e.lineIndent-1,kC,!1,!0),nM(e,!0,-1),e.checkLineBreaks&&zC.test(e.input.slice(r,e.position))&&YC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&aM(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,nM(e,!0,-1)):e.position=55296&&a<=56319&&t+1=56320&&n<=57343?1024*(a-55296)+n-56320+65536:a}function JM(e){return/^\n* /.test(e)}var ek=1,tk=2,nk=3,ak=4,ik=5;function rk(e,t,n,a,i,r,o,s){var c,l=0,d=null,u=!1,h=!1,p=-1!==a,m=-1,g=function(e){return GM(e)&&e!==mM&&!QM(e)&&e!==EM&&e!==IM&&e!==$M&&e!==SM&&e!==jM&&e!==OM&&e!==RM&&e!==LM&&e!==wM&&e!==CM&&e!==kM&&e!==yM&&e!==PM&&e!==AM&&e!==zM&&e!==MM&&e!==bM&&e!==xM&&e!==TM&&e!==DM}(XM(e,0))&&function(e){return!QM(e)&&e!==$M}(XM(e,e.length-1));if(t||o)for(c=0;c=65536?c+=2:c++){if(!GM(l=XM(e,c)))return ik;g=g&&KM(l,d,s),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=XM(e,c))===fM)u=!0,p&&(h=h||c-m-1>a&&" "!==e[m+1],m=c);else if(!GM(l))return ik;g=g&&KM(l,d,s),d=l}h=h||p&&c-m-1>a&&" "!==e[m+1]}return u||h?n>9&&JM(e)?ik:o?r===qM?ik:tk:h?ak:nk:!g||o||i(e)?r===qM?ik:tk:ek}function ok(e,t,n,a,i){e.dump=function(){if(0===t.length)return e.quotingType===qM?'""':"''";if(!e.noCompatMode&&(-1!==FM.indexOf(t)||VM.test(t)))return e.quotingType===qM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),s=a||e.flowLevel>-1&&n>=e.flowLevel;switch(rk(t,s,e.indent,o,(function(t){return function(e,t){var n,a;for(n=0,a=e.implicitTypes.length;n"+sk(t,e.indent)+ck(WM(function(e,t){var n,a,i=/(\n+)([^\n]*)/g,r=(s=e.indexOf("\n"),s=-1!==s?s:e.length,i.lastIndex=s,lk(e.slice(0,s),t)),o="\n"===e[0]||" "===e[0];var s;for(;a=i.exec(e);){var c=a[1],l=a[2];n=" "===l[0],r+=c+(o||n||""===l?"":"\n")+lk(l,t),o=n}return r}(t,o),r));case ik:return'"'+function(e){for(var t,n="",a=0,i=0;i=65536?i+=2:i++)a=XM(e,i),!(t=NM[a])&&GM(a)?(n+=e[i],a>=65536&&(n+=e[i+1])):n+=t||HM(a);return n}(t)+'"';default:throw new Rx("impossible error: invalid scalar style")}}()}function sk(e,t){var n=JM(e)?String(t):"",a="\n"===e[e.length-1];return n+(a&&("\n"===e[e.length-2]||"\n"===e)?"+":a?"":"-")+"\n"}function ck(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function lk(e,t){if(""===e||" "===e[0])return e;for(var n,a,i=/ [^ ]/g,r=0,o=0,s=0,c="";n=i.exec(e);)(s=n.index)-r>t&&(a=o>r?o:s,c+="\n"+e.slice(r,a),r=a+1),o=s;return c+="\n",e.length-r>t&&o>r?c+=e.slice(r,o)+"\n"+e.slice(o+1):c+=e.slice(r),c.slice(1)}function dk(e,t,n,a){var i,r,o,s="",c=e.tag;for(i=0,r=n.length;i tag resolver accepts not "'+c+'" style');a=s.represent[c](t,c)}e.dump=a}return!0}return!1}function hk(e,t,n,a,i,r,o){e.tag=null,e.dump=n,uk(e,n,!1)||uk(e,n,!0);var s,c=hM.call(e.dump),l=a;a&&(a=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(i=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)a&&0!==Object.keys(e.dump).length?(!function(e,t,n,a){var i,r,o,s,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new Rx("sortKeys must be a boolean or a function");for(i=0,r=h.length;i1024)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=ZM(e,t)),hk(e,t+1,s,!0,c)&&(e.dump&&fM===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o,s,c="",l=e.tag,d=Object.keys(n);for(a=0,i=d.length;a1024&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),hk(e,t,o,!1,!1)&&(c+=s+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)a&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?dk(e,t-1,e.dump,i):dk(e,t,e.dump,i),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var a,i,r,o="",s=e.tag;for(a=0,i=n.length;a",e.dump=s+" "+e.dump)}return!0}function pk(e,t){var n,a,i=[],r=[];for(mk(e,i,r),n=0,a=r.length;nq`
${fk.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return o(_k)}};e([he({attribute:!1})],vk.prototype,"message",void 0),e([he({attribute:!1})],vk.prototype,"context",void 0),e([he({attribute:!1})],vk.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],vk.prototype,"dotdotdot",void 0),vk=e([le("frigate-card-message")],vk);let yk=class extends se{render(){if(this.message)return q` ${V_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return o(_k)}};e([he({attribute:!1})],yk.prototype,"message",void 0),yk=e([le("frigate-card-error-message")],yk);let bk=class extends se{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return o(_k)}};function wk(e){return"error"===e?.type?q` `:e?q` `:q``}function xk(e){return q` + + + `}function Ck(e,t,n,a){Bg(e,"message",{message:t,type:n,icon:a?.icon,context:a?.context})}function Mk(e,t,n){Ck(e,t,"error",{context:n?.context})}function kk(e,t){t instanceof Error&&Mk(e,t.message,{...t instanceof zs&&{context:t.context}})}e([he({attribute:!1})],bk.prototype,"message",void 0),e([he({attribute:!1})],bk.prototype,"animated",void 0),e([he({attribute:!1})],bk.prototype,"size",void 0),bk=e([le("frigate-card-progress-indicator")],bk);let Sk=class extends se{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(V_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Gg(e,console.error),new zs(V_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return kk(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],Sk.prototype,"elements",void 0),e([he({attribute:!1})],Sk.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Sk.prototype,"hass",void 0),Sk=e([le("frigate-card-elements-core")],Sk);let Ek=class extends se{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Bg(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Bg(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return o(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],Ek.prototype,"hass",void 0),e([he({attribute:!1})],Ek.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],Ek.prototype,"elements",void 0),Ek=e([le("frigate-card-elements")],Ek);let $k=class extends se{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new _w(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],$k.prototype,"hass",void 0),$k=e([le("frigate-card-conditional")],$k);class Ak extends se{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Bg(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Bg(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],Ak.prototype,"_config",void 0);class zk extends Ak{constructor(){super("menu")}}let Ik=class extends zk{};Ik=e([le("frigate-card-menu-icon")],Ik);let Tk=class extends zk{};Tk=e([le("frigate-card-menu-state-icon")],Tk);let jk=class extends zk{};jk=e([le("frigate-card-menu-submenu")],jk);let Ok=class extends zk{};Ok=e([le("frigate-card-menu-submenu-select")],Ok);class Dk extends Ak{constructor(){super("status-bar")}}let Rk=class extends Dk{};Rk=e([le("frigate-card-status-bar-icon")],Rk);let Pk=class extends Dk{};Pk=e([le("frigate-card-status-bar-image")],Pk);let Lk=class extends Dk{};Lk=e([le("frigate-card-status-bar-string")],Lk);let Nk=class extends se{render(){return q` `}static get styles(){return o(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};Nk=e([le("frigate-card-loading")],Nk);const Fk=(e,t)=>{Bg(e,"action:execution-request",t)};class Vk{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,of(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,a=yf(n,t);if(!a)return;const i=Wg(a);let r=!1;const o=i.filter((e=>sf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(o.length!=i.length&&(r=!0),o.length&&Fk(this._host,{action:i,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=yf("hold",t),a=yf("double_tap",t),i=yf("tap",t),r=yf("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||a||i||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}getFreshButtonState(e,t){const n={...t};return e&&"custom:frigate-card-menu-state-icon"===t.type?Pb(e,n):n}_sortButtons(){this._buttons=Ev(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Us:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=mf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}var Hk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' version='1.1' id='svg54' sodipodi:docname='frigate.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs58' /%3e %3csodipodi:namedview id='namedview56' pagecolor='%23da4040' bordercolor='%23666666' borderopacity='1.0' inkscape:pageshadow='2' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' showgrid='false' width='24px' inkscape:zoom='45.254834' inkscape:cx='-0.03314563' inkscape:cy='9.9768347' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='svg54' showguides='true' inkscape:showpageshadow='2' inkscape:deskcolor='%23d1d1d1' /%3e %3cpath d='m 4.8759466%2c22.743573 c 0.0866%2c0.69274 0.811811%2c1.16359 0.37885%2c1.27183 -0.43297%2c0.10824 -2.32718%2c-3.43665 -2.7601492%2c-4.95202 -0.4329602%2c-1.51538 -0.6764993%2c-3.22017 -0.5682593%2c-4.19434 0.1082301%2c-0.97417 5.7097085%2c-2.48955 5.7097085%2c-2.89545 0%2c-0.4059 -1.81304%2c-0.0271 -1.89422%2c-0.35178 -0.0812%2c-0.32472 1.36925%2c-0.12989 1.75892%2c-0.64945 0.60885%2c-0.81181 1.3800713%2c-0.6765 1.8671505%2c-1.1094696 0.4870902%2c-0.4329599 1.0824089%2c-2.0836399 1.1906589%2c-2.7871996 0.108241%2c-0.70357 -1.0824084%2c-1.51538 -1.4071389%2c-2.05658 -0.3247195%2c-0.54121 0.7035702%2c-0.92005 3.1931099%2c-1.94834 2.48954%2c-1.02829 10.39114%2c-3.30134994 10.49938%2c-3.03074994 0.10824%2c0.27061 -2.59779%2c1.40713994 -4.492%2c2.11069994 -1.89422%2c0.70357 -4.97909%2c2.05658 -4.97909%2c2.43542 0%2c0.37885 0.16236%2c0.67651 0.0541%2c1.54244 -0.10824%2c0.86593 -0.12123%2c1.2702597 -0.32472%2c1.8400997 -0.1353%2c0.37884 -0.2706%2c1.27183 0%2c2.0836295 0.21648%2c0.64945 0.92005%2c1.13653 1.24477%2c1.24478 0.2706%2c0.018 1.01746%2c0.0433 1.8401%2c0 1.02829%2c-0.0541 2.48954%2c0.0541 2.48954%2c0.32472 0%2c0.2706 -2.21894%2c0.10824 -2.21894%2c0.48708 0%2c0.37885 2.27306%2c-0.0541 2.21894%2c0.32473 -0.0541%2c0.37884 -1.89422%2c0.21648 -2.86839%2c0.21648 -0.77933%2c0 -1.93031%2c-0.0361 -2.43542%2c-0.21648 l -0.10824%2c0.37884 c -0.18038%2c0 -0.55744%2c0.10824 -0.94711%2c0.10824 -0.48708%2c0 -0.51414%2c0.16236 -1.40713%2c0.16236 -0.892989%2c0 -0.622391%2c-0.0541 -1.4341894%2c-0.10824 -0.81181%2c-0.0541 -3.842561%2c2.27306 -4.383761%2c3.03075 -0.54121%2c0.75768 -0.21649%2c2.59778 -0.21649%2c3.43665 0%2c0.75379 -0.10824%2c2.43542 0%2c3.30135 z' fill='black' id='path330' style='fill:white%3bfill-opacity:1%3bstroke:none%3bstroke-width:0.1%3bstroke-miterlimit:4%3bstroke-dasharray:none%3bstroke-opacity:1' sodipodi:nodetypes='csccscccccsscscccccsscsccssccscc' /%3e%3c/svg%3e",Bk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg id='svg2' version='1.1' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' width='24' height='24' xml:space='preserve' sodipodi:docname='motioneye.svg' inkscape:export-filename='/home/ccrisan/projects/motioneye/static/img/motioneye-logo.png' inkscape:export-xdpi='960' inkscape:export-ydpi='960' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3e%3cmetadata id='metadata8'%3e%3crdf:RDF%3e%3ccc:Work rdf:about=''%3e%3cdc:format%3eimage/svg%2bxml%3c/dc:format%3e%3cdc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage' /%3e%3c/cc:Work%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs id='defs6'%3e%3clinearGradient inkscape:collect='always' id='linearGradient2058'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2054' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop2056' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient2005'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop2001' /%3e%3cstop style='stop-color:grey%3bstop-opacity:1%3b' offset='1' id='stop2003' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4205'%3e%3cstop style='stop-color:%234aa3e0%3bstop-opacity:1' offset='0' id='stop4207' /%3e%3cstop style='stop-color:%233096db%3bstop-opacity:1' offset='1' id='stop4209' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' id='linearGradient4197'%3e%3cstop style='stop-color:white%3bstop-opacity:1%3b' offset='0' id='stop4199' /%3e%3cstop style='stop-color:%23585858%3bstop-opacity:1' offset='1' id='stop4201' /%3e%3c/linearGradient%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4205' id='linearGradient4211' x1='26.602072' y1='43.034946' x2='26.602072' y2='29.466328' gradientUnits='userSpaceOnUse' gradientTransform='matrix(0.96428571%2c0%2c0%2c0.96428571%2c0.91428571%2c0.91428571)' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4285'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4287' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4289' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4291' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4293' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4295' /%3e%3c/filter%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2005' id='linearGradient4309' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient4197' id='linearGradient4311' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3clinearGradient inkscape:collect='always' xlink:href='%23linearGradient2058' id='linearGradient4313' gradientUnits='userSpaceOnUse' x1='26.445793' y1='47.517574' x2='26.445793' y2='3.8183768' /%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4315' x='-0.03618178' y='-0.20783284' width='1.0723636' height='1.3304883'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4317' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4319' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4321' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4323' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4325' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4327' x='-0.27857143' y='-0.4720238' width='1.5571429' height='1.7505952'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4329' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4331' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.6' result='blur' id='feGaussianBlur4333' /%3e%3cfeOffset dx='0' dy='-1' result='offset' id='feOffset4335' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4337' /%3e%3c/filter%3e%3cfilter style='color-interpolation-filters:sRGB' inkscape:label='Drop Shadow' id='filter4339' x='-0.0202507' y='-0.13980794' width='1.0405014' height='1.2082853'%3e%3cfeFlood flood-opacity='0.588235' flood-color='rgb(0%2c0%2c0)' result='flood' id='feFlood4341' /%3e%3cfeComposite in='flood' in2='SourceGraphic' operator='in' result='composite1' id='feComposite4343' /%3e%3cfeGaussianBlur in='composite1' stdDeviation='0.2' result='blur' id='feGaussianBlur4345' /%3e%3cfeOffset dx='0' dy='-0.5' result='offset' id='feOffset4347' /%3e%3cfeComposite in='SourceGraphic' in2='offset' operator='over' result='composite2' id='feComposite4349' /%3e%3c/filter%3e%3c/defs%3e%3csodipodi:namedview pagecolor='%23ff0d0d' bordercolor='%23666666' borderopacity='1' objecttolerance='10' gridtolerance='10' guidetolerance='10' inkscape:pageopacity='0' inkscape:pageshadow='2' inkscape:window-width='3840' inkscape:window-height='1527' id='namedview4' showgrid='false' inkscape:zoom='29.890116' inkscape:cx='19.973158' inkscape:cy='16.577386' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g10' showguides='true' inkscape:guide-bbox='true' inkscape:showpageshadow='true' inkscape:pagecheckerboard='false' inkscape:deskcolor='%23d1d1d1' /%3e%3cg id='g10' inkscape:groupmode='layer' inkscape:label='ink_ext_XXXXXX' transform='matrix(1.25%2c0%2c0%2c-1.25%2c0%2c64)'%3e%3cg id='g4823' transform='matrix(1.0344694%2c0%2c0%2c1.0344694%2c-3.551886%2c-0.86695248)'%3e%3cpath id='path4244' d='M 8.9346154%2c40.515385 C 5.3647588%2c36.547307 3.2%2c31.357779 3.2%2c25.6 3.2%2c13.228821 13.228821%2c3.2 25.6%2c3.2 37.971179%2c3.2 48%2c13.228821 48%2c25.6 c 0%2c5.736682 -2.161128%2c10.952493 -5.707692%2c14.915385 -1.695935%2c-0.623286 -3.387833%2c-1.349065 -5.061539%2c-2.288462 3.2394%2c-0.937363 5.6%2c-3.937988 5.6%2c-7.457692 0%2c-4.260339 -3.469626%2c-7.753846 -7.753846%2c-7.753846 -3.633936%2c0 -6.690552%2c2.51055 -7.538461%2c5.869231 h -3.876924 c -0.840685%2c-3.360193 -3.903443%2c-5.869231 -7.538461%2c-5.869231 -4.284219%2c0 -7.7807693%2c3.493507 -7.7807693%2c7.753846 0%2c3.56112 2.4570323%2c6.5856 5.7615383%2c7.484616 -1.676267%2c0.912203 -3.404813%2c1.620556 -5.1692306%2c2.261538 z M 25.6%2c26.461538 c 0.532632%2c-1.981435 1.101793%2c-3.947553 3.446154%2c-5.16923 L 25.6%2c16.123077 22.153846%2c21.292308 c 2.053593%2c1.454966 3.000771%2c3.237758 3.446154%2c5.16923 z' style='fill:url(%23linearGradient4309)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4242' d='m 16.123077%2c33.353847 c -1.427443%2c0 -2.584616%2c-1.157173 -2.584616%2c-2.584616 0%2c-1.427444 1.157173%2c-2.584615 2.584616%2c-2.584615 1.427444%2c0 2.584615%2c1.157171 2.584615%2c2.584615 0%2c1.427443 -1.157171%2c2.584616 -2.584615%2c2.584616 z' style='fill:url(%23linearGradient4311)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath id='path4240' d='m 35.076923%2c33.353847 c -1.427443%2c0 -2.584615%2c-1.157173 -2.584615%2c-2.584616 0%2c-1.427444 1.157172%2c-2.584615 2.584615%2c-2.584615 1.427443%2c0 2.584616%2c1.157171 2.584616%2c2.584615 0%2c1.427443 -1.157173%2c2.584616 -2.584616%2c2.584616 z' style='fill:url(%23linearGradient4313)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4327)' inkscape:connector-curvature='0' transform='matrix(0.38078533%2c0%2c0%2c0.38078533%2c2.9655495%2c31.335499)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:%23d9d9d9%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4339)' d='m 25.6%2c47.2 c -4.373944%2c0 -8.437159%2c-1.399808 -11.838461%2c-3.634616 3.677605%2c-0.394237 7.305921%2c-1.342945 11.423077%2c-3.375 4.166157%2c2.122533 8.434154%2c3.008875 12.279808%2c3.452886 C 34.057131%2c45.890032 29.986674%2c47.2 25.6%2c47.2 Z' id='path4248' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3cpath inkscape:connector-curvature='0' style='fill:url(%23linearGradient4211)%3bfill-opacity:1%3bstroke:none%3bfilter:url(%23filter4315)' d='M 39.723077%2c42.552884 C 35.394064%2c42.5242 29.479588%2c40.397223 25.184616%2c38.432418 20.668821%2c40.064102 16.035448%2c42.649343 10.801923%2c42.526924 10.453022%2c42.51873 10.118061%2c42.50105 9.7634616%2c42.475 L 5.6615384%2c42.1375 9.5557693%2c40.839424 c 5.3417977%2c-1.74056 10.0398397%2c-2.851302 14.1749997%2c-10.025963 0.959101%2c0 2.845924%2c-4.15e-4 3.738462%2c-4.15e-4 4.11884%2c7.134039 9.059296%2c8.324614 14.149039%2c10.026378 L 45.460577%2c42.085577 41.4625%2c42.475 c -0.544847%2c0.05181 -1.120992%2c0.08198 -1.739423%2c0.07788 z' id='path4246' sodipodi:nodetypes='cccccccccccc' transform='matrix(0.39488848%2c0%2c0%2c0.39488848%2c2.6045087%2c30.974457)' /%3e%3c/g%3e%3c/g%3e%3c/svg%3e",qk="data:image/svg+xml,%3c%3fxml version='1.0' encoding='UTF-8' standalone='no'%3f%3e%3c!-- Created with Inkscape (http://www.inkscape.org/) --%3e%3csvg version='1.1' id='svg62' width='24' height='24' viewBox='0 0 24 24' sodipodi:docname='reolink.svg' inkscape:version='1.2.2 (b0a8486541%2c 2022-12-01)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3e %3cdefs id='defs66' /%3e %3csodipodi:namedview id='namedview64' pagecolor='%23505050' bordercolor='%23eeeeee' borderopacity='1' inkscape:showpageshadow='0' inkscape:pageopacity='0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23505050' showgrid='true' inkscape:zoom='36.417984' inkscape:cx='18.191562' inkscape:cy='8.6633022' inkscape:window-width='3840' inkscape:window-height='1527' inkscape:window-x='1080' inkscape:window-y='227' inkscape:window-maximized='1' inkscape:current-layer='g68'%3e %3cinkscape:grid type='xygrid' id='grid1175' dotted='false' snapvisiblegridlinesonly='true' /%3e %3c/sodipodi:namedview%3e %3cg inkscape:groupmode='layer' inkscape:label='Reolink Logo' id='g68'%3e %3cpath style='fill:white%3bstroke-width:0.0393282%3bfill-opacity:1' d='M 17.037254%2c23.964909 C 16.764634%2c23.917573 16.561708%2c23.83617 16.325735%2c23.67954 16.196719%2c23.593913 14.543544%2c21.952905 12.217956%2c19.602014 10.077426%2c17.438191 8.2198993%2c15.582673 8.0901166%2c15.478642 7.6038998%2c15.088895 7.0877741%2c14.869424 6.4986827%2c14.801908 6.3140805%2c14.780765 5.079061%2c14.763305 3.7541964%2c14.763126 l -2.408845%2c-4.78e-4 0.00713%2c-7.3937713 v -7.3935985 l 6.2040046%2c3.536e-5 c 3.9799342%2c1.969e-5 6.3590882%2c0.01465833 6.6366112%2c0.0408227 2.331195%2c0.21982024 4.364771%2c1.49885914 5.578726%2c3.50085534 0.686043%2c1.1313823 1.020901%2c2.2783695 1.067186%2c3.6554196 0.06335%2c1.8844953 -0.57426%2c3.6597378 -1.831469%2c5.0992438 -0.756457%2c0.866146 -1.861127%2c1.62991 -2.928729%2c2.024919 l -0.319718%2c0.118287 -1.951287%2c-1.979284 -1.951286%2c-1.979278 1.046741%2c-0.02346 c 0.575706%2c-0.01291 1.099833%2c-0.03689 1.164724%2c-0.0533 0.596068%2c-0.150649 0.949703%2c-0.313968 1.322206%2c-0.6106282 0.643573%2c-0.5125401 1.046169%2c-1.2439257 1.137985%2c-2.0673522 0.167852%2c-1.505317 -0.771478%2c-2.8704888 -2.263547%2c-3.2897068 L 13.950001%2c4.3234481 9.7981831%2c4.3106846 5.6392389%2c4.29801 v 3.0692702 3.0692648 l 1.4185165%2c7.9e-4 c 1.6275801%2c8.87e-4 1.7789152%2c0.01912 2.3105245%2c0.27984 0.3095679%2c0.15183 0.389559%2c0.219499 1.0817441%2c0.915083 3.027399%2c3.042274 12.19404%2c12.30837 12.204589%2c12.337002 0.0161%2c0.04373 -5.364393%2c0.03953 -5.617359%2c-0.0045 z' id='path1173' inkscape:label='R' /%3e %3c/g%3e%3c/svg%3e";const Uk=e=>{switch(e){case"frigate":return Hk;case"motioneye":return Bk;case"reolink":return qk;default:return null}};const Wk=(e,t,n)=>{const a=e.states[t],i=n?.state?n.state:a?a.state:null;if(!i)return null;const r=Ye(t),o=a?a.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${i}`)||o?.device_class&&e.localize(`component.${r}.state.${o.device_class}.${i}`)||e.localize(`component.${r}.state._.${i}`)||i};let Zk=class extends se{_renderItem(e){if(!this.hass)return;const t=Pb(this.hass,{...e});return q` + {t.detail.config=e}} + .actionHandler=${kf({hasHold:bf(e.hold_action),hasDoubleClick:bf(e.double_tap_action)})} + > + ${t.title||""} + ${e.subtitle?q`${e.subtitle}`:""} + ${(e=>{if(e.icon){const t=Uk(e.icon);return t?q``:q` + `}return q``})(t)} + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>wf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],Zk.prototype,"hass",void 0),e([he({attribute:!1})],Zk.prototype,"submenu",void 0),Zk=e([le("frigate-card-submenu")],Zk);let Qk=class extends se{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||jb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,a=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,i={};for(const t of n){const n=Wk(this.hass,e,{...a&&{entity:a},state:t});n&&(i[t]=n)}this._optionTitles=i}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const a={icon:zb("select"),...Pb(this.hass,this.submenuSelect),...this.submenuSelect,type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const i=a.items;for(const a of n){const n=this._optionTitles?.[a]??a;i.push({state_color:!0,selected:t.state===a,enabled:!0,title:n||a,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:a}}},...this.submenuSelect.options&&this.submenuSelect.options[a]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],Qk.prototype,"hass",void 0),e([he({attribute:!1})],Qk.prototype,"submenuSelect",void 0),e([he({attribute:!1})],Qk.prototype,"entityRegistryManager",void 0),e([pe()],Qk.prototype,"_optionTitles",void 0),Qk=e([le("frigate-card-submenu-select")],Qk);let Gk=class extends se{constructor(){super(...arguments),this._controller=new Vk(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this._controller.getFreshButtonState(this.hass,e),n=Uk(t.icon);return q` this._controller.actionHandler(t,e)} + > + ${n?q``:q``} + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),a=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${a.map((e=>this._renderButton(e)))} +
`}static get styles(){return o('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden]) {\n overflow: hidden;\n width: calc(var(--frigate-card-menu-button-size) + 6px);\n height: calc(var(--frigate-card-menu-button-size) + 6px);\n}\n\n:host([data-style=overlay]),\n:host([data-style*=hover]),\n:host([data-style=hidden][expanded]) {\n overflow: visible;\n}\n\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],Gk.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],Gk.prototype,"hass",void 0),Gk=e([le("frigate-card-menu")],Gk);let Yk=class extends se{render(){return q` + + + + + `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};Yk=e([le("frigate-card-overlay")],Yk);class Kk{constructor(e){this._config=null,this._popupTimer=new xf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Ev(t.length?t:e,(e=>e.priority??50),"desc"),a=this._getSufficientValues(this._items),i=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||Dv(a,i)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=yf(e.detail.action,t);n&&Fk(this._host,{action:Wg(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){of(this._host,!1,"hide")}_hide(){of(this._host,!0,"hide")}}let Xk=class extends se{constructor(){super(...arguments),this._controller=new Kk(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=kf({hasHold:bf(e.actions?.hold_action),hasDoubleClick:bf(e.actions?.double_tap_action)});if("custom:frigate-card-status-bar-string"===e.type)return q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`;if("custom:frigate-card-status-bar-icon"===e.type){const a=Uk(e.icon);return a?q`this._controller.actionHandler(t,e.actions)} + />`:q`this._controller.actionHandler(t,e.actions)} + >`}return"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return o("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --mdc-icon-button-size: calc(var(--frigate-card-status-bar-height) - 6px);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px;\n padding: 3px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}")}};e([he({attribute:!1})],Xk.prototype,"items",void 0),e([he({attribute:!1})],Xk.prototype,"config",void 0),Xk=e([le("frigate-card-status-bar")],Xk);function Jk(e){return"number"==typeof e}function eS(e){return"string"==typeof e}function tS(e){return"boolean"==typeof e}function nS(e){return"[object Object]"===Object.prototype.toString.call(e)}function aS(e){return Math.abs(e)}function iS(e){return Math.sign(e)}function rS(e,t){return aS(e-t)}function oS(e){return uS(e).map(Number)}function sS(e){return e[cS(e)]}function cS(e){return Math.max(0,e.length-1)}function lS(e,t){return t===cS(e)}function dS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function uS(e){return Object.keys(e)}function hS(e,t){return[e,t].reduce(((e,t)=>(uS(t).forEach((n=>{const a=e[n],i=t[n],r=nS(a)&&nS(i);e[n]=r?hS(a,i):i})),e)),{})}function pS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function mS(){let e=[];const t={add:function(n,a,i,r={passive:!0}){let o;if("addEventListener"in n)n.addEventListener(a,i,r),o=()=>n.removeEventListener(a,i,r);else{const e=n;e.addListener(i),o=()=>e.removeListener(i)}return e.push(o),t},clear:function(){e=e.filter((e=>e()))}};return t}function gS(e,t,n,a){const i=mS(),r=1e3/60;let o=null,s=0,c=0;function l(e){if(!c)return;o||(o=e);const i=e-o;for(o=e,s+=i;s>=r;)n(r),s-=r;a(s/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),o=null,s=0,c=0}return{init:function(){i.add(e,"visibilitychange",(()=>{e.hidden&&(o=null,s=0)}))},destroy:function(){d(),i.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:a}}function fS(e=0,t=0){const n=aS(e-t);function a(t){return tt}function r(e){return a(e)||i(e)}const o={length:n,max:t,min:e,constrain:function(n){return r(n)?a(n)?e:t:n},reachedAny:r,reachedMax:i,reachedMin:a,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return o}function _S(e,t,n){const{constrain:a}=fS(0,e),i=e+1;let r=o(t);function o(e){return n?aS((i+e)%i):a(e)}function s(){return r}function c(){return _S(e,s(),n)}const l={get:s,set:function(e){return r=o(e),l},add:function(e){return c().set(s()+e)},clone:c};return l}function vS(e,t,n,a,i,r,o,s,c,l,d,u,h,p,m,g,f,_,v){const{cross:y,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=mS(),M=mS(),k=fS(50,225).constrain(p.measure(20)),S={mouse:300,touch:400},E={mouse:500,touch:600},$=m?43:25;let A=!1,z=0,I=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!pS(e,a)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,y),o=rS(t,z),c=rS(n,I);if(!j&&!D){if(!e.cancelable)return P(e);if(j=o>c,!j)return P(e)}const d=r.pointerMove(e);o>g&&(O=!0),l.useFriction(.3).useDuration(.75),s.start(),i.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(m?E:S)[D?"mouse":"touch"],a=function(e,t){const n=u.add(-1*iS(e)),a=d.byDistance(e,!m).distance;return m||aS(e)=2,s&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),i.set(o),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),z=r.readPoint(e),I=r.readPoint(e,y),h.emit("pointerDown")}(s)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",s).add(c,"mousedown",s).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function yS(e,t){let n,a;function i(e){return e.timeStamp}function r(n,a){const i="client"+("x"===(a||e.scroll)?"X":"Y");return(pS(n,t)?n:n.touches[0])[i]}return{pointerDown:function(e){return n=e,a=e,r(e)},pointerMove:function(e){const t=r(e)-r(a),o=i(e)-i(n)>170;return a=e,o&&(n=e),t},pointerUp:function(e){if(!n||!a)return 0;const t=r(a)-r(n),o=i(e)-i(n),s=i(e)-i(a)>170,c=t/o;return o&&!s&&aS(c)>.1?c:0},readPoint:r}}function bS(e,t,n,a,i,r,o){const s=[e].concat(a);let c,l,d=[],u=!1;function h(e){return i.measureSize(o.measure(e))}return{init:function(i){r&&(l=h(e),d=a.map(h),c=new ResizeObserver((n=>{(tS(r)||r(i,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,o=a.indexOf(r.target),s=n?l:d[o];if(aS(h(n?e:a[o])-s)>=.5){i.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{s.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function wS(e,t,n,a,i){const r=i.measure(10),o=i.measure(50),s=fS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(i){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=aS(e[c]-t.get()),u=n.get()-t.get(),h=s.constrain(d/o);n.subtract(u*h),!i&&aS(u)e.add(i)))}};return c}function CS(e,t,n,a,i){const{reachedAny:r,removeOffset:o,constrain:s}=a;function c(e){return e.concat().sort(((e,t)=>aS(e)-aS(t)))[0]}function l(t,a){const i=[t,t+n,t-n];if(!e)return t;if(!a)return c(i);const r=i.filter((e=>iS(e)===a));return r.length?c(r):sS(i)-n}return{byDistance:function(n,a){const c=i.get()+n,{index:d,distance:u}=function(n){const a=e?o(n):s(n),i=t.map(((e,t)=>({diff:l(e-a,0),index:t}))).sort(((e,t)=>aS(e.diff)-aS(t.diff))),{index:r}=i[0];return{index:r,distance:a}}(c),h=!e&&r(c);return!a||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-i.get(),n)}},shortcut:l}}function MS(e,t,n,a,i,r,o,s){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){s&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(tS(s)||s(u,t))&&function(t){if((new Date).getTime()-l>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));Jk(r)&&(i.useDuration(0),a.index(r,0),o.emit("slideFocus"))}(d)}),c)})))}}}function kS(e){let t=e;function n(e){return Jk(e)?e:e.get()}const a={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return a}function SS(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},a=t.style;let i=!1;return{clear:function(){i||(a.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){i||(a.transform=n(e.direction(t)))},toggleActive:function(e){i=!e}}}function ES(e,t,n,a,i,r,o,s,c){const l=.5,d=oS(i),u=oS(i).reverse(),h=function(){const e=o[0];return g(m(u,e),n,!1)}().concat(function(){const e=t-o[0]-1;return g(m(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-i[t]),t)}function m(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function g(i,o,d){const u=function(e){return r.map(((n,i)=>({start:n-a[i]+l+e,end:n+t-l+e})))}(o);return i.map((t=>{const a=d?0:-n,i=d?n:0,r=d?"end":"start",o=u[t][r];return{index:t,loopPoint:o,slideLocation:kS(-1),translate:SS(e,c[t]),target:()=>s.get()>o?a:i}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:a}=e,i=t();i!==a.get()&&(n.to(i),a.set(i))}))},loopPoints:h};return f}function $S(e,t,n){let a,i=!1;return{init:function(r){n&&(a=new MutationObserver((e=>{i||(tS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),a.observe(e,{childList:!0}))},destroy:function(){a&&a.disconnect(),i=!0}}}function AS(e,t,n,a){const i={};let r,o=null,s=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);i[n]=e})),o=null,s=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:a}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&o)return o;if(!e&&s)return s;const t=function(e){return uS(i).reduce(((t,n)=>{const a=parseInt(n),{isIntersecting:r}=i[a];return(e&&r||!e&&!r)&&t.push(a),t}),[])}(e);return e&&(o=t),e||(s=t),t}}}function zS(e,t,n,a,i,r,o,s,c){const{startEdge:l,endEdge:d,direction:u}=e,h=Jk(n);const p={groupSlides:function(e){return h?function(e,t){return oS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?oS(e).reduce(((n,h,p)=>{const m=sS(n)||0,g=0===m,f=h===cS(e),_=i[l]-r[m][l],v=i[l]-r[h][d],y=!a&&g?u(o):0,b=aS(v-(!a&&f?u(s):0)-(_+y));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,a)=>{const i=Math.max(a[n-1]||0);return e.slice(i,t)})):[]}(e)}};return p}function IS(e,t,n,a,i,r,o){const{align:s,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:m,inViewThreshold:g,slidesToScroll:f,skipSnaps:_,containScroll:v,watchResize:y,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:a,offsetHeight:i}=e;return{top:t,right:n+a,bottom:t+i,left:n,width:a,height:i}}},M=C.measure(t),k=n.map(C.measure),S=function(e,t){const n="rtl"===t,a="y"===e,i=!a&&n?-1:1,r={scroll:a?"y":"x",cross:a?"x":"y",startEdge:a?"top":n?"right":"left",endEdge:a?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return a?t:n},direction:function(e){return e*i}};return r}(c,l),E=S.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return a(e)/2},end:a};function a(e){return t-e}const i={measure:function(a,i){return eS(e)?n[e](a):e(t,a,i)}};return i}(s,E),z=!u&&!!v,I=u||!!v,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,a,i,r){const{measureSize:o,startEdge:s,endEdge:c}=e,l=n[0]&&i,d=function(){if(!l)return 0;const e=n[0];return aS(t[s]-e[s])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(sS(a));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(o),p=n.map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?h[t]+d:i?h[t]+u:n[t+1][s]-e[s]})).map(aS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(S,M,k,n,I,i),R=zS(S,E,f,u,M,k,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,a,i){const{startEdge:r,endEdge:o}=e,{groupSlides:s}=i,c=s(a).map((e=>sS(e)[o]-e[0][r])).map(aS).map(t.measure),l=a.map((e=>n[r]-e[r])).map((e=>-aS(e))),d=s(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(S,A,M,k,R),N=-sS(P)+sS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,a,i){const r=fS(-t+e,0),o=n.map(((e,t)=>{const{min:a,max:i}=r,o=r.constrain(e),s=!t,l=lS(n,t);return s?i:l||c(a,o)?a:c(i,o)?i:o})).map((e=>parseFloat(e.toFixed(3)))),s=function(){const e=o[0],t=sS(o);return fS(o.lastIndexOf(e),o.indexOf(t)+1)}();function c(e,t){return rS(e,t)<1}return{snapsContained:function(){if(t<=e+i)return[r.max];if("keepSnaps"===a)return o;const{min:n,max:c}=s;return o.slice(n,c)}(),scrollContainLimit:s}}(E,N,L,v,2),H=z?F:L,{limit:B}=function(e,t,n){const a=t[0];return{limit:fS(n?a-e:sS(t),a)}}(N,H,u),q=_S(cS(H),d,u),U=q.clone(),W=oS(n),Z=gS(a,i,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:a}},i)=>{a||n.constrain(e.pointerDown()),t.seek(i)})(se,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:a,scrollLooper:i,slideLooper:r,dragHandler:o,animation:s,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),m=d?h:h&&p;m&&!o.pointerDown()&&(s.stop(),c.emit("settle")),m||c.emit("scroll");const g=n.get()*u+Y.get()*(1-u);a.set(g),d&&(i.loop(e.direction()),r.loop()),t.to(a.get())})(se,e))),Q=H[q.get()],G=kS(Q),Y=kS(Q),K=kS(Q),X=kS(Q),J=function(e,t,n,a,i,r){let o=0,s=0,c=i,l=r,d=e.get(),u=0;function h(e){return c=e,m}function p(e){return l=e,m}const m={direction:function(){return s},duration:function(){return c},velocity:function(){return o},seek:function(t){const i=t/1e3,r=c*i,h=a.get()-e.get();let p=0;return c?(n.set(e),o+=h/r,o*=l,d+=o,e.add(o*i),p=d-u):(o=0,n.set(a),e.set(a),p=h),s=iS(p),u=d,m},settled:function(){return aS(a.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(i)},useFriction:p,useDuration:h};return m}(G,K,Y,X,h,.68),ee=CS(u,H,N,B,X),te=function(e,t,n,a,i,r,o){function s(i){const s=i.distance,c=i.index!==t.get();r.add(s),s&&(a.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(i.index),o.emit("select"))}const c={distance:function(e,t){s(i.byDistance(e,t))},index:function(e,n){const a=t.clone().set(e);s(i.byIndex(a.get(),n))}};return c}(Z,q,U,J,ee,X,o),ne=function(e){const{max:t,length:n}=e,a={get:function(e){return n?(e-t)/-n:0}};return a}(B),ae=mS(),ie=AS(t,n,o,g),{slideRegistry:re}=function(e,t,n,a,i,r){const{groupSlides:o}=i,{min:s,max:c}=a;return{slideRegistry:function(){const a=o(r),i=!e||"keepSnaps"===t;return 1===n.length?[r]:i?a:a.slice(s,c).map(((e,t,n)=>{const a=!t,i=lS(n,t);return a?dS(sS(n[0])+1):i?dS(cS(r)-sS(n)[0]+1,sS(n)[0]):e}))}()}}(z,v,H,V,R,W),oe=MS(e,n,re,te,J,ae,o,x),se={ownerDocument:a,ownerWindow:i,eventHandler:o,containerRect:M,slideRects:k,animation:Z,axis:S,dragHandler:vS(S,e,a,i,X,yS(S,i),G,Z,te,J,ee,q,o,$,p,m,_,.68,w),eventStore:ae,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:bS(t,o,i,n,S,y,C),scrollBody:J,scrollBounds:wS(B,K,X,J,$),scrollLooper:xS(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:ES(S,E,N,T,j,P,H,K,n),slideFocus:oe,slidesHandler:$S(t,o,b),slidesInView:ie,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:SS(S,t)};return se}const TS={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function jS(e){function t(e,t){return hS(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const a=n.breakpoints||{},i=uS(a).filter((t=>e.matchMedia(t).matches)).map((e=>a[e])).reduce(((e,n)=>t(e,n)),{});return t(n,i)},optionsMediaQueries:function(t){return t.map((e=>uS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function OS(e,t,n){const a=e.ownerDocument,i=a.defaultView,r=jS(i),o=function(e){let t=[];const n={init:function(n,a){return t=a.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),a.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),s=mS(),c=function(){let e,t={};function n(e){return t[e]||[]}const a={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),a},off:function(e,i){return t[e]=n(e).filter((e=>e!==i)),a},on:function(e,i){return t[e]=n(e).concat([i]),a},clear:function(){t={}}};return a}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:m}=c,g=S;let f,_,v,y,b=!1,w=l(TS,OS.globalOptions),x=l(w),C=[];function M(t){const n=IS(e,v,y,a,i,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function k(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,a=eS(t)?e.querySelector(t):t;v=a||e.children[0];const i=eS(n)?v.querySelectorAll(n):n;y=[].slice.call(i||v.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>s.add(e,"change",S))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(z),f.eventHandler.init(z),f.resizeHandler.init(z),f.slidesHandler.init(z),f.options.loop&&f.slideLooper.loop(),v.offsetParent&&y.length&&f.dragHandler.init(z),_=o.init(z,C)))}function S(e,t){const n=A();E(),k(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),o.destroy(),s.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const z={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return v},internalEngine:function(){return f},destroy:function(){b||(b=!0,s.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:m,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:g,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return y},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return k(t,n),setTimeout((()=>c.emit("init")),0),z}function DS(){return DS=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(i)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,a)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=PS(l.axisMovement,a),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:a,timeStamp:i}),g(),p({axisDelta:a,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},g=function(){var e;l.scrollPointsToMerge.length===US?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(PS),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var a=t.timeStamp-n.timeStamp;if(!(a<=0)){var i=t.axisDeltaSum.map((function(e){return e/a})),r=i.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=i,l.accelerationFactors.push(r),v(a)}}},v=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},y=function(e){return 0===e||e<=qS&&e>=BS},b=function(){if(l.accelerationFactors.length>=WS){if(d&&(d=!1,LS(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*WS);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(y).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=GS()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(a),a=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},k=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return NS({observe:function(a){return a.addEventListener("wheel",e,{passive:!1}),t.push(a),function(){return n(a)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),S=k.observe,E=k.unobserve,$=k.disconnect;return h(e),NS({on:r,off:o,observe:S,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var KS={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function XS(e){var t;void 0===e&&(e={});var n=function(){};var a={name:"wheelGestures",options:e,init:function(a,i){var r,o,s=i.mergeOptions,c=i.optionsAtMedia,l=s(KS,XS.globalOptions),d=s(l,e);t=c(d);var u,h=a.internalEngine(),p=null!=(r=t.target)?r:a.containerNode().parentNode,m=null!=(o=t.forceWheelAxis)?o:h.options.axis,g=YS({preventWheelAction:m,reverseSign:[!0,!0,!1]}),f=g.observe(p),_=g.on("wheel",(function(e){var a=e.axisDelta,i=a[0],r=a[1],o="x"===m?i:r,s="x"===m?r:i,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(o)>Math.abs(s)&&!v&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}v=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!v)return;l?function(e){v=!1,x(w("mouseup",e)),y(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),v=!1;function y(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){v&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,a;if(m===h.options.axis){var i=t.axisMovement;n=i[0],a=i[1]}else{var r=t.axisMovement;a=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var o=h.containerRect.width,s=h.containerRect.height;n=n<0?Math.max(n,-o):Math.min(n,o),a=a<0?Math.max(a,-s):Math.min(a,s)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+a,screenX:u.screenX+n,screenY:u.screenY+a,movementX:n,movementY:a,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){a.containerNode().dispatchEvent(e)}n=function(){f(),_(),y()}},destroy:function(){return n()}};return a}XS.globalOptions=void 0;class JS{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=lf(this._parent);!Dv(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._carousel=this._createCarousel(lf(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Bg(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=OS(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable},[...this._plugins,...e.length>1?[XS({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Bg(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}let eE=class extends se{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=ze(),this._refRoot=ze(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new JS(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return o(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],eE.prototype,"direction",void 0),e([he({attribute:!0})],eE.prototype,"transitionEffect",void 0),e([he({attribute:!1})],eE.prototype,"loop",void 0),e([he({attribute:!1})],eE.prototype,"dragFree",void 0),e([he({attribute:!1})],eE.prototype,"dragEnabled",void 0),e([he({attribute:!1})],eE.prototype,"plugins",void 0),e([he({attribute:!1})],eE.prototype,"selected",void 0),eE=e([le("frigate-card-carousel")],eE); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const tE=window,nE=tE.ShadowRoot&&(void 0===tE.ShadyCSS||tE.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,aE=Symbol(),iE=new WeakMap;let rE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==aE)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(nE&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=iE.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&iE.set(t,e))}return e}toString(){return this.cssText}};const oE=(e,t)=>{nE?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),a=tE.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=t.cssText,e.appendChild(n)}))},sE=nE?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new rE("string"==typeof e?e:e+"",void 0,aE))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var cE;const lE=window,dE=lE.trustedTypes,uE=dE?dE.emptyScript:"",hE=lE.reactiveElementPolyfillSupport,pE={toAttribute(e,t){switch(t){case Boolean:e=e?uE:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},mE=(e,t)=>t!==e&&(t==t||e==e),gE={attribute:!0,type:String,converter:pE,reflect:!1,hasChanged:mE},fE="finalized";class _E extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const a=this._$Ep(n,t);void 0!==a&&(this._$Ev.set(a,n),e.push(a))})),e}static createProperty(e,t=gE){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,n,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(a){const i=this[e];this[t]=a,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||gE}static finalize(){if(this.hasOwnProperty(fE))return!1;this[fE]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(sE(e))}else void 0!==e&&t.push(sE(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return oE(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=gE){var a;const i=this.constructor._$Ep(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==(null===(a=n.converter)||void 0===a?void 0:a.toAttribute)?n.converter:pE).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$El=null}}_$AK(e,t){var n;const a=this.constructor,i=a._$Ev.get(e);if(void 0!==i&&this._$El!==i){const e=a.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:pE;this._$El=i,this[i]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let a=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||mE)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):a=!1),!this.isUpdatePending&&a&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}_E[fE]=!0,_E.elementProperties=new Map,_E.elementStyles=[],_E.shadowRootOptions={mode:"open"},null==hE||hE({ReactiveElement:_E}),(null!==(cE=lE.reactiveElementVersions)&&void 0!==cE?cE:lE.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const vE=0,yE=Symbol();class bE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const a="object"==typeof t?t:{task:t,args:n};this.t=a.task,this.h=a.args,void 0!==a.autoRun&&(this.autoRun=a.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,a;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const i=++this.o;try{n=await this.t(e)}catch(e){a=e}this.o===i&&(n===yE?this.status=0:(void 0===a?(this.status=2,this.l(n)):(this.status=3,this.u(a)),this.m=n,this._=a),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,a,i;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(a=e.complete)||void 0===a?void 0:a.call(e,this.value);case 3:return null===(i=e.error)||void 0===i?void 0:i.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>mE(e,t[n]))):e!==t}}class wE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var xE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}";const CE=(e,t,n,a)=>{const i={...a?.cardWideConfig&&{cardWideConfig:a.cardWideConfig}};return q` ${t.render({initial:()=>a?.inProgressFunc?.()??xk(i),pending:()=>a?.inProgressFunc?.()??xk(i),error:t=>{Gg(t),kk(e,t)},complete:n})}`},ME=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,kE=(e,t,n,a=!0)=>new bE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const a=t();return e&&a&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(ME)?t:new Promise(((n,a)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>a(e),t.readAsDataURL(e)})):a()})):null)(a,n):null},autoRun:a}),SE=300;let EE=class extends se{constructor(){super(),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=kE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===vE&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return this._embedThumbnailTask?q`${this.thumbnail?CE(this,this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e}):e} `:e}static get styles(){return o(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nha-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nha-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],EE.prototype,"thumbnail",void 0),e([he({attribute:!1})],EE.prototype,"hass",void 0),EE=e([le("frigate-card-thumbnail-feature-thumbnail")],EE);let $E=class extends se{render(){if(this.date)return q` + ${this.cameraMetadata?.engineLogo?q``:""} +
+
${Wu(this.date,"HH:mm")}
+
${Wu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return o(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nimg.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],$E.prototype,"date",void 0),e([he({attribute:!1})],$E.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],$E.prototype,"showCameraTitle",void 0),$E=e([le("frigate-card-thumbnail-feature-text")],$E);let AE=class extends se{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),a=n?Kg(n):null,i=this.media.getEndTime(),r=n&&i?ef(n,i):null,o=this.media.inProgress()?V_("event.in_progress"):null,s=qg(this.media.getWhat()?.join(", "))??null,c=qg(this.media.getWhere()?.join(", "))??null,l=qg(this.media.getTags()?.join(", "))??null,d=s||l?(s??"")+(s&&l?": ":"")+(l??""):null,u=this.seek?Wu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${a?q`
+ + ${a} +
+ ${r||o?q`
+ + ${r?q`${r}`:""} + ${o?q`${o}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],AE.prototype,"media",void 0),e([he({attribute:!1})],AE.prototype,"seek",void 0),e([he({attribute:!1})],AE.prototype,"cameraTitle",void 0),AE=e([le("frigate-card-thumbnail-details-event")],AE);let zE=class extends se{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Kg(e):null,n=this.media.getEndTime(),a=e&&n?ef(e,n):null,i=this.media.inProgress()?V_("recording.in_progress"):null,r=this.seek?Wu(this.seek,"HH:mm:ss"):null,o=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${a||i?q`
+ + ${a?q`${a}`:""} + ${i?q`${i}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==o?q`
+ + ${o} +
`:""} +
+ `}static get styles(){return o(xE)}};e([he({attribute:!1})],zE.prototype,"media",void 0),e([he({attribute:!1})],zE.prototype,"seek",void 0),e([he({attribute:!1})],zE.prototype,"cameraTitle",void 0),zE=e([le("frigate-card-thumbnail-details-recording")],zE);let IE=class extends se{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},a=this.show_timeline_control&&(!tx.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),i=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&i?.canFavorite,o=this.show_download_control&&this.hass&&this.media.getID()&&i?.canDownload,s=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${tx.isEvent(this.media)&&e?q``:tx.isEvent(this.media)||tx.isRecording(this.media)?q``:q``} + ${r?q` {if(wf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Gg(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&tx.isEvent(this.media)?q``:this.details&&tx.isRecording(this.media)?q``:q``} + ${a?q`{wf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new wE(["timeline"])]})}} + >`:""} + ${o?q` {if(wf(e),this.hass&&this.cameraManager&&this.media)try{await Ew(this.hass,this.cameraManager,this.media)}catch(e){kk(this,e)}}} + >`:""} + `}static get styles(){return o(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nha-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nha-icon:hover {\n opacity: 1;\n}\n\nha-icon.star {\n top: 3px;\n left: 3px;\n}\n\nha-icon.star.starred {\n color: gold;\n}\n\nha-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nha-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],IE.prototype,"cameraManager",void 0),e([he({attribute:!1})],IE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],IE.prototype,"show_download_control",void 0),e([he({attribute:!1})],IE.prototype,"seek",void 0),IE=e([le("frigate-card-thumbnail")],IE);let TE=class extends se{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,a=this._getSelectedSlide();for(const i of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":a===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Bg(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),wf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return o(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],TE.prototype,"hass",void 0),e([he({attribute:!1})],TE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],TE.prototype,"cameraManager",void 0),e([he({attribute:!1})],TE.prototype,"config",void 0),e([he({attribute:!1})],TE.prototype,"fadeThumbnails",void 0),TE=e([le("frigate-card-thumbnail-carousel")],TE);var jE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const OE=document.createElement("template");OE.innerHTML='\n
\n
\n';class DE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(OE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",DE);let RE=class extends se{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=ze(),this._refSlot=ze(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Yg()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?lf(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?lf(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{wf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return o("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nha-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) ha-icon.control,\nha-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) ha-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) ha-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],RE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],RE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"open",void 0),e([he({attribute:!1})],RE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],RE.prototype,"empty",void 0),RE=e([le("frigate-card-drawer")],RE);let PE=class extends se{constructor(){super(...arguments),this._refDrawerLeft=ze(),this._refDrawerRight=ze(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],PE.prototype,"drawerIcons",void 0),PE=e([le("frigate-card-surround-basic")],PE);let LE=class extends se{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-fabd0153.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Bg(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new wE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return o(jE)}};e([he({attribute:!1})],LE.prototype,"hass",void 0),e([he({attribute:!1})],LE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Qg})],LE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],LE.prototype,"cameraManager",void 0),e([he({attribute:!1})],LE.prototype,"cardWideConfig",void 0),LE=e([le("frigate-card-surround")],LE);var NE="Wed, 11 Dec 2024 03:36:17 GMT",FE="47fdfbc",VE="Tue, 10 Dec 2024 19:35:09 -0800";const HE=ba.object({domain:ba.string(),version:ba.string().optional()}).passthrough(),BE="hass_web_proxy",qE=(e,t)=>`/api/${BE}/v${t??0}/?url=${encodeURIComponent(e)}`,UE=(e,t,n="media")=>(e=>e.config.components.includes(BE))(e)&&!!t[n];async function WE(e,t,n){await e.callService(BE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const ZE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await $v(e,HE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let QE=class extends se{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const a=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],i=new Map;return a?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&i.set(t,e.model)}))})),{card_version:"6.0.3",browser:navigator.userAgent,date:new Date,lang:F_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:FE,build_date:NE,commit_date:VE},...e&&{ha_version:e.config.version},integrations:{reolink:await ZE("reolink",e),frigate:{...await ZE("frigate",e),...i.size&&{devices:Object.fromEntries(i)}},hass_web_proxy:await ZE(BE,e),motioneye:await ZE("motioneye",e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return wk({message:V_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return o(jE)}};e([he({attribute:!1})],QE.prototype,"hass",void 0),e([he({attribute:!1})],QE.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],QE.prototype,"rawConfig",void 0),e([pe()],QE.prototype,"_diagnostics",void 0),QE=e([le("frigate-card-diagnostics")],QE);let GE=class extends se{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-0a012f43.js").then((function(e){return e.i})),e?.isGalleryView()?import("./gallery-c718155d.js"):e?.isViewerView()?import("./index-0197eb89.js"):e?.is("image")?import("./image-cbfd7ccb.js"):e?.is("timeline")&&import("./timeline-62b72e11.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},a=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,i=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],GE.prototype,"hass",void 0),e([he({attribute:!1})],GE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"cameraManager",void 0),e([he({attribute:!1})],GE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],GE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],GE.prototype,"rawConfig",void 0),e([he({attribute:!1})],GE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],GE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],GE.prototype,"hide",void 0),e([he({attribute:!1})],GE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],GE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],GE.prototype,"deviceRegistryManager",void 0),GE=e([le("frigate-card-views")],GE);console.info(`%c FRIGATE-HASS-CARD \n%c ${V_("common.version")} 6.0.3`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:V_("common.frigate_card"),description:V_("common.frigate_card_description"),preview:!0,documentationURL:wa});let YE=class extends se{constructor(){super(...arguments),this._controller=new Ax(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new zx,this._refMenu=ze(),this._refOverlay=ze(),this._refMain=ze(),this._refElements=ze(),this._refViews=ze()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await Ax.getConfigElement()}static getStubConfig(e,t){return Ax.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,a=this._config.status_bar.style,i=this._config.status_bar.position;if("none"===t&&"none"===a||"overlay"===e&&"outside"===t&&"outside"===a||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==a||i!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),o="none"!==a&&("outside"===a&&"outerlay"===e||"outside"!==a&&"overlay"===e),s="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==a||"top"===n&&("hidden"!==t||"popup"===a);return q` + ${r&&s?this._renderMenu(n):""} + ${o?this._renderStatusBar(i):""} + ${r&&!s?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),a=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${a?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${wk(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return o(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};YE=e([le("frigate-card")],YE);export{Il as $,tr as A,nr as B,Zi as C,ar as D,ir as E,rr as F,Pi as G,Li as H,Ni as I,Fi as J,Vi as K,Hi as L,Bi as M,qi as N,Ui as O,gs as P,Ws as Q,ns as R,Us as S,qo as T,Fo as U,Vo as V,Ho as W,Bo as X,Bs as Y,zl as Z,e as _,se as a,dr as a$,H_ as a0,tw as a1,et as a2,nw as a3,$s as a4,Di as a5,ji as a6,Oi as a7,Ri as a8,Wi as a9,Yr as aA,oo as aB,so as aC,lo as aD,uo as aE,co as aF,ao as aG,io as aH,ro as aI,mo as aJ,_o as aK,vo as aL,ho as aM,po as aN,fo as aO,go as aP,eo as aQ,no as aR,to as aS,Xr as aT,Jr as aU,Kr as aV,Ao as aW,Io as aX,zo as aY,hr as aZ,cr as a_,es as aa,Jo as ab,Xo as ac,ts as ad,hs as ae,us as af,ms as ag,qs as ah,ps as ai,So as aj,Co as ak,To as al,Mo as am,ko as an,qr as ao,Ur as ap,Wr as aq,Zr as ar,Eo as as,$o as at,yo as au,xo as av,bo as aw,wo as ax,Qr as ay,Gr as az,pe as b,ja as b$,ur as b0,lr as b1,sr as b2,mr as b3,gr as b4,fr as b5,_r as b6,xr as b7,Hr as b8,Cr as b9,Po as bA,Wo as bB,Zo as bC,Go as bD,Yo as bE,Qo as bF,Uo as bG,vs as bH,_s as bI,ys as bJ,xs as bK,Cs as bL,As as bM,Ms as bN,Es as bO,Ss as bP,Jb as bQ,Kb as bR,Uk as bS,Ug as bT,Ma as bU,Ja as bV,Ya as bW,La as bX,Na as bY,ka as bZ,Oa as b_,kr as ba,Mr as bb,vr as bc,wr as bd,yr as be,br as bf,Sr as bg,Er as bh,$r as bi,Or as bj,zr as bk,Tr as bl,jr as bm,Ir as bn,Ar as bo,Pr as bp,Fr as bq,Vr as br,Dr as bs,Rr as bt,Nr as bu,Lr as bv,Ro as bw,Lo as bx,Oo as by,Do as bz,ew as c,wf as c$,Da as c0,Ta as c1,Ga as c2,Ua as c3,Wa as c4,Za as c5,Qa as c6,_i as c7,fi as c8,Ra as c9,ai as cA,ii as cB,Sa as cC,Ea as cD,pi as cE,hi as cF,gi as cG,mi as cH,Fd as cI,Ca as cJ,ks as cK,ge as cL,fe as cM,W as cN,xe as cO,Gw as cP,Mk as cQ,ze as cR,Yw as cS,df as cT,wk as cU,je as cV,Qg as cW,vw as cX,td as cY,kk as cZ,Ky as c_,Pa as ca,Ha as cb,qa as cc,Fa as cd,Va as ce,Ba as cf,Ka as cg,Xa as ch,ti as ci,ei as cj,yi as ck,vi as cl,bi as cm,wi as cn,$a as co,Aa as cp,za as cq,Ia as cr,ni as cs,ri as ct,oi as cu,si as cv,ci as cw,li as cx,di as cy,ui as cz,aw as d,ba as d$,My as d0,ve as d1,jE as d2,Vd as d3,nu as d4,c as d5,ux as d6,Qv as d7,hx as d8,lx as d9,wx as dA,Ck as dB,U as dC,xf as dD,Bw as dE,kE as dF,CE as dG,yf as dH,Fk as dI,vf as dJ,kf as dK,bf as dL,p_ as dM,h_ as dN,Pv as dO,Lv as dP,Ud as dQ,Vv as dR,Yg as dS,Kg as dT,Cx as dU,Gy as dV,gx as dW,su as dX,sf as dY,Fv as dZ,Hg as d_,px as da,Gg as db,Ev as dc,Wu as dd,Xg as de,Qu as df,Bg as dg,qw as dh,af as di,SE as dj,kx as dk,xk as dl,$w as dm,tx as dn,hy as dp,Bb as dq,qb as dr,UE as ds,WE as dt,Ib as du,qE as dv,Qw as dw,Kw as dx,Xw as dy,Jw as dz,_e as e,nf as e0,$v as e1,zs as e2,Kv as e3,Wv as e4,Z_ as e5,Q_ as e6,Yv as e7,Jg as e8,tf as e9,Lu as eA,Vb as eB,Zv as eC,Nb as eD,lf as eE,qy as eF,Uy as eG,Wy as eH,pf as eI,Qy as eJ,Rg as eK,Zy as eL,s as eM,Ae as eN,ye as eO,Zw as eP,bE as eQ,me as eR,be as eS,jb as eT,Gv as ea,Hk as eb,Hv as ec,rf as ed,Tv as ee,Bk as ef,Iv as eg,zv as eh,jv as ei,qk as ej,Xd as ek,Hd as el,Gd as em,Qd as en,Yd as eo,vu as ep,Jd as eq,eu as er,yu as es,_u as et,Bd as eu,au as ev,gu as ew,Ou as ex,Nu as ey,Fu as ez,ww as f,Fb as g,Xb as h,Dv as i,Lb as j,qg as k,V_ as l,Ki as m,he as n,Gi as o,Ld as p,Qi as q,o as r,of as s,le as t,Yi as u,Hb as v,Xi as w,q as x,er as y,Ji as z}; diff --git a/www/community/frigate-hass-card/card-c642ee74.js.gz b/www/community/frigate-hass-card/card-c642ee74.js.gz new file mode 100644 index 00000000..8746fa86 Binary files /dev/null and b/www/community/frigate-hass-card/card-c642ee74.js.gz differ diff --git a/www/community/frigate-hass-card/card-e5d55e5b.js b/www/community/frigate-hass-card/card-e5d55e5b.js new file mode 100644 index 00000000..8092b84e --- /dev/null +++ b/www/community/frigate-hass-card/card-e5d55e5b.js @@ -0,0 +1,654 @@ +function e(e,t,n,i){var a,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(r<3?a(s):r>3?a(t,n,s):a(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}"function"==typeof SuppressedError&&SuppressedError; +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap;let r=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&a.set(t,e))}return e}toString(){return this.cssText}};const s=e=>new r("string"==typeof e?e:e+"",void 0,i),o=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[i+1]),e[0]);return new r(n,e,i)},c=(e,i)=>{if(n)e.adoptedStyleSheets=i.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of i){const i=document.createElement("style"),a=t.litNonce;void 0!==a&&i.setAttribute("nonce",a),i.textContent=n.cssText,e.appendChild(i)}},l=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return s(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,{is:d,defineProperty:u,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:g,getPrototypeOf:m}=Object,f=globalThis,_=f.trustedTypes,y=_?_.emptyScript:"",v=f.reactiveElementPolyfillSupport,b=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?y:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},x=(e,t)=>!d(e,t),C={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class M extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);void 0!==i&&u(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:a}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return i?.call(this)},set(t){const r=i?.call(this);a.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=m(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...p(e),...g(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(void 0!==i&&!0===n.reflect){const a=(void 0!==n.converter?.toAttribute?n.converter:w).toAttribute(t,n.type);this._$Em=e,null==a?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=n.getPropertyOptions(i),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=i,this[i]=a.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??x)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[b("elementProperties")]=new Map,M[b("finalized")]=new Map,v?.({ReactiveElement:M}),(f.reactiveElementVersions??=[]).push("2.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const S=globalThis,k=S.trustedTypes,E=k?k.createPolicy("lit-html",{createHTML:e=>e}):void 0,$="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,I="?"+A,z=`<${I}>`,T=document,j=()=>T.createComment(""),O=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,N=/>/g,F=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,H=/"/g,B=/^(?:script|style|textarea|title)$/i,q=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),U=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Z=new WeakMap,Q=T.createTreeWalker(T,129);function G(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const n=e.length-1,i=[];let a,r=2===t?"":"",s=P;for(let t=0;t"===c[0]?(s=a??P,l=-1):void 0===c[1]?l=-2:(l=s.lastIndex-c[2].length,o=c[1],s=void 0===c[3]?F:'"'===c[3]?H:V):s===H||s===V?s=F:s===L||s===N?s=P:(s=F,a=void 0);const u=s===F&&e[t+1].startsWith("/>")?" ":"";r+=s===P?n+z:l>=0?(i.push(o),n.slice(0,l)+$+n.slice(l)+A+u):n+A+(-2===l?t:u)}return[G(e,r+(e[n]||"")+(2===t?"":"")),i]};class K{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let a=0,r=0;const s=e.length-1,o=this.parts,[c,l]=Y(e,t);if(this.el=K.createElement(c,n),Q.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Q.nextNode())&&o.length0){i.textContent=k?k.emptyScript:"";for(let n=0;nD(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==W&&O(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=K.createElement(G(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new J(i,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new K(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const a of e)i===t.length?t.push(n=new ee(this.S(j()),this.S(j()),this,this.options)):n=t[i],n._$AI(a),i++;i2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=W}_$AI(e,t=this,n,i){const a=this.strings;let r=!1;if(void 0===a)e=X(this,e,t,0),r=!O(e)||e!==this._$AH&&e!==U,r&&(this._$AH=e);else{const i=e;let s,o;for(e=a[0],s=0;s{const i=n?.renderBefore??t;let a=i._$litPart$;if(void 0===a){const e=n?.renderBefore??null;i._$litPart$=a=new ee(t.insertBefore(j(),e),e,void 0,n??{})}return a._$AI(e),a})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};oe._$litElement$=!0,oe.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:oe});const ce=globalThis.litElementPolyfillSupport;ce?.({LitElement:oe}),(globalThis.litElementVersions??=[]).push("4.0.4"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const le=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,de={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:x},ue=(e=de,t,n)=>{const{kind:i,metadata:a}=n;let r=globalThis.litPropertyMetadata.get(a);if(void 0===r&&globalThis.litPropertyMetadata.set(a,r=new Map),r.set(n.name,e),"accessor"===i){const{name:i}=n;return{set(n){const a=t.get.call(this);t.set.call(this,n),this.requestUpdate(i,a,e)},init(t){return void 0!==t&&this.P(i,void 0,e),t}}}if("setter"===i){const{name:i}=n;return function(n){const a=this[i];t.call(this,n),this.requestUpdate(i,a,e)}}throw Error("Unsupported decorator location: "+i)};function he(e){return(t,n)=>"object"==typeof n?ue(e,t,n):((e,t,n)=>{const i=t.hasOwnProperty(n);return t.constructor.createProperty(n,i?{...e,wrapped:!0}:e),i?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */}function pe(e){return he({...e,state:!0,attribute:!1})} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const ge={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},me=e=>(...t)=>({_$litDirective$:e,values:t});let fe=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _e=me(class extends fe{constructor(e){if(super(e),e.type!==ge.ATTRIBUTE||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const n=e.element.classList;for(const e of this.st)e in t||(n.remove(e),this.st.delete(e));for(const e in t){const i=!!t[e];i===this.st.has(e)||this.nt?.has(e)||(i?(n.add(e),this.st.add(e)):(n.remove(e),this.st.delete(e)))}return U}}),ye=e=>e??W +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,ve=e=>null===e||"object"!=typeof e&&"function"!=typeof e,be=e=>void 0===e.strings,we={},xe=(e,t=we)=>e._$AH=t +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */,Ce=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Ce(e,t);return!0},Me=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},Se=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),$e(t)}}; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function ke(e){void 0!==this._$AN?(Me(this),this._$AM=e,Se(this)):this._$AM=e}function Ee(e,t=!1,n=0){const i=this._$AH,a=this._$AN;if(void 0!==a&&0!==a.size)if(t)if(Array.isArray(i))for(let e=n;e{e.type==ge.CHILD&&(e._$AP??=Ee,e._$AQ??=ke)};class Ae extends fe{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Se(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Ce(this,e),Me(this))}setValue(e){if(be(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}} +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Ie=()=>new ze;let ze=class{};const Te=new WeakMap,je=me(class extends Ae{render(e){return W}update(e,[t]){const n=t!==this.Y;return n&&void 0!==this.Y&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),W}rt(e){if("function"==typeof this.Y){const t=this.ht??globalThis;let n=Te.get(t);void 0===n&&(n=new WeakMap,Te.set(t,n)),void 0!==n.get(this.Y)&&this.Y.call(this.ht,void 0),n.set(this.Y,e),void 0!==e&&this.Y.call(this.ht,e)}else this.Y.value=e}get lt(){return"function"==typeof this.Y?Te.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Oe="important",De=" !"+Oe,Re=me(class extends fe{constructor(e){if(super(e),e.type!==ge.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,n)=>{const i=e[n];return null==i?t:t+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`}),"")}update(e,[t]){const{style:n}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?n.removeProperty(e):n[e]=null);for(const e in t){const i=t[e];if(null!=i){this.ft.add(e);const t="string"==typeof i&&i.endsWith(De);e.includes("-")||t?n.setProperty(e,t?i.slice(0,-11):i,t?Oe:""):n[e]=i}}return U}}); +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function Pe(e,t,n,i=20,a=0){let r=[];if(a>=i)return r;const s=e=>{const r=e.assignedNodes().filter((e=>1===e.nodeType));return r.length>0?Pe(r[0].parentElement,t,n,i,a+1):[]},o=Array.from(e.children||[]);for(const e of o)t(e)||(n(e)&&r.push(e),null!=e.shadowRoot?r.push(...Pe(e.shadowRoot,t,n,i,a+1)):"SLOT"===e.tagName?r.push(...s(e)):r.push(...Pe(e,t,n,i,a+1)));return r}function Le(e){return e.hasAttribute("hidden")||e.hasAttribute("aria-hidden")&&"false"!==e.getAttribute("aria-hidden")||"none"===e.style.display||"0"===e.style.opacity||"hidden"===e.style.visibility||"collapse"===e.style.visibility}function Ne(e){return"-1"!==e.getAttribute("tabindex")&&!Le(e)&&!function(e){return e.hasAttribute("disabled")||e.hasAttribute("aria-disabled")&&"false"!==e.getAttribute("aria-disabled")}(e)&&(e.hasAttribute("tabindex")||(e instanceof HTMLAnchorElement||e instanceof HTMLAreaElement)&&e.hasAttribute("href")||e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLIFrameElement)}const Fe=new Map;const Ve=document.createElement("template");Ve.innerHTML='\n\t
\n\t
\n\t\n\t
\n';class He extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Ve.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Pe(this,Le,Ne)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){!function(e,t,n){const i=Fe.get(n);null!=i&&window.clearTimeout(i),Fe.set(n,window.setTimeout((()=>{e(),Fe.delete(n)}),t))}((()=>{this.focused!==e&&(this._focused=e,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}function Be(e){return Number(e.getAttribute("data-dialog-count"))||0}function qe(e,t){e.setAttribute("data-dialog-count",t.toString())}function Ue(e=document.activeElement){return null!=e&&null!=e.shadowRoot&&null!=e.shadowRoot.activeElement?Ue(e.shadowRoot.activeElement):e}window.customElements.define("focus-trap",He);const We=document.createElement("template");We.innerHTML='\n \n
\n \n \n \n';class Ze extends HTMLElement{constructor(){super(),this.$scrollContainer=document.documentElement,this.$previousActiveElement=null;const e=this.attachShadow({mode:"open"});e.appendChild(We.content.cloneNode(!0)),this.$dialog=e.querySelector("#dialog"),this.$backdrop=e.querySelector("#backdrop"),this.onBackdropClick=this.onBackdropClick.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.setAttribute("aria-modal","true"),this.$dialog.setAttribute("role","alertdialog")}static get observedAttributes(){return["open","center"]}get open(){return this.hasAttribute("open")}set open(e){e?this.setAttribute("open",""):this.removeAttribute("open")}get center(){return this.hasAttribute("center")}set center(e){e?this.setAttribute("center",""):this.removeAttribute("center")}connectedCallback(){this.$backdrop.addEventListener("click",this.onBackdropClick)}disconnectedCallback(){this.$backdrop.removeEventListener("click",this.onBackdropClick),this.open&&this.didClose()}show(){this.open=!0}close(e){this.result=e,this.open=!1}onBackdropClick(){this.assertClosing()&&this.close()}onKeyDown(e){if("Escape"===e.code)this.assertClosing()&&(this.close(),e.stopImmediatePropagation())}assertClosing(){return this.dispatchEvent(new CustomEvent("closing",{cancelable:!0}))}didOpen(){this.$previousActiveElement=Ue(document.activeElement),requestAnimationFrame((()=>{this.$dialog.focusFirstElement()})),this.tabIndex=0,this.$scrollContainer.style.overflow="hidden",this.addEventListener("keydown",this.onKeyDown,{capture:!0,passive:!0}),qe(this.$scrollContainer,Be(this.$scrollContainer)+1),this.dispatchEvent(new CustomEvent("open"))}didClose(){this.removeEventListener("keydown",this.onKeyDown,{capture:!0}),qe(this.$scrollContainer,Math.max(0,Be(this.$scrollContainer)-1)),Be(this.$scrollContainer)<=0&&(this.$scrollContainer.style.overflow=""),this.tabIndex=-1,null!=this.$previousActiveElement&&(this.$previousActiveElement.focus(),this.$previousActiveElement=null),this.dispatchEvent(new CustomEvent("close",{detail:this.result}))}attributeChangedCallback(e,t,n){if("open"===e)this.open?this.didOpen():this.didClose()}}var Qe,Ge;function Ye(e){return e.substr(0,e.indexOf("."))}customElements.define("web-dialog",Ze),function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qe||(Qe={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Ge||(Ge={}));var Ke,Xe,Je=["closed","locked","off"],et=function(e,t,n,i){i=i||{},n=null==n?{}:n;var a=new Event(t,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return a.detail=n,e.dispatchEvent(a),a},tt=function(e){et(window,"haptic",e)},nt=function(e,t){return function(e,t,n){void 0===n&&(n=!0);var i,a=Ye(t),r="group"===a?"homeassistant":a;switch(a){case"lock":i=n?"unlock":"lock";break;case"cover":i=n?"open_cover":"close_cover";break;default:i=n?"turn_on":"turn_off"}return e.callService(r,i,{entity_id:t})}(e,t,Je.includes(e.states[t].state))},it=function(e,t,n,i){if(i||(i={action:"more-info"}),!i.confirmation||i.confirmation.exemptions&&i.confirmation.exemptions.some((function(e){return e.user===t.user.id}))||(tt("warning"),confirm(i.confirmation.text||"Are you sure you want to "+i.action+"?")))switch(i.action){case"more-info":(n.entity||n.camera_image)&&et(e,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":i.navigation_path&&function(e,t,n){void 0===n&&(n=!1),n?history.replaceState(null,"",t):history.pushState(null,"",t),et(window,"location-changed",{replace:n})}(0,i.navigation_path);break;case"url":i.url_path&&window.open(i.url_path);break;case"toggle":n.entity&&(nt(t,n.entity),tt("success"));break;case"perform-action":if(!i.perform_action)return void tt("failure");var a=i.perform_action.split(".",2);t.callService(a[0],a[1],i.data,i.target),tt("success");break;case"call-service":if(!i.service)return void tt("failure");var r=i.service.split(".",2);t.callService(r[0],r[1],i.data,i.target),tt("success");break;case"fire-dom-event":et(e,"ll-custom",i)}};!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),i={};for(const e of n)i[e]=t[e];return e.objectValues(i)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ke||(Ke={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Xe||(Xe={}));const at=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rt=e=>{switch(typeof e){case"undefined":return at.undefined;case"string":return at.string;case"number":return isNaN(e)?at.nan:at.number;case"boolean":return at.boolean;case"function":return at.function;case"bigint":return at.bigint;case"symbol":return at.symbol;case"object":return Array.isArray(e)?at.array:null===e?at.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?at.promise:"undefined"!=typeof Map&&e instanceof Map?at.map:"undefined"!=typeof Set&&e instanceof Set?at.set:"undefined"!=typeof Date&&e instanceof Date?at.date:at.object;default:return at.unknown}},st=Ke.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ot extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},i=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(i);else if("invalid_return_type"===a.code)i(a.returnTypeError);else if("invalid_arguments"===a.code)i(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,i=0;for(;ie.message)){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ot.create=e=>new ot(e);const ct=(e,t)=>{let n;switch(e.code){case st.invalid_type:n=e.received===at.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case st.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case st.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case st.invalid_union:n="Invalid input";break;case st.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case st.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case st.invalid_arguments:n="Invalid function arguments";break;case st.invalid_return_type:n="Invalid function return type";break;case st.invalid_date:n="Invalid date";break;case st.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case st.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case st.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case st.custom:n="Invalid input";break;case st.invalid_intersection_types:n="Intersection results could not be merged";break;case st.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case st.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}};let lt=ct;function dt(){return lt}const ut=e=>{const{data:t,path:n,errorMaps:i,issueData:a}=e,r=[...n,...a.path||[]],s={...a,path:r};if(void 0!==a.message)return{...a,path:r,message:a.message};let o="";const c=i.filter((e=>!!e)).slice().reverse();for(const e of c)o=e(s,{data:t,defaultError:o}).message;return{...a,path:r,message:o}};function ht(e,t){const n=dt(),i=ut({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ct?void 0:ct].filter((e=>!!e))});e.common.issues.push(i)}class pt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if("aborted"===i.status)return gt;"dirty"===i.status&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,i=await e.value;n.push({key:t,value:i})}return pt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:t,value:a}=i;if("aborted"===t.status)return gt;if("aborted"===a.status)return gt;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!i.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}}const gt=Object.freeze({status:"aborted"}),mt=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),_t=e=>"aborted"===e.status,yt=e=>"dirty"===e.status,vt=e=>"valid"===e.status,bt=e=>"undefined"!=typeof Promise&&e instanceof Promise;function wt(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function xt(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n}var Ct,Mt,St;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Ct||(Ct={}));class kt{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(e,t)=>{if(vt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ot(e.common.issues);return this._error=t,this._error}}};function $t(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:i,description:a}=e;if(t&&(n||i))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:(t,a)=>{var r,s;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(r=null!=o?o:i)&&void 0!==r?r:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(s=null!=o?o:n)&&void 0!==s?s:a.defaultError}},description:a}}class At{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new pt,ctx:{common:e.parent.common,data:e.data,parsedType:rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(bt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},a=this._parseSync({data:e,path:i.path,parent:i});return Et(i,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rt(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(bt(i)?i:Promise.resolve(i));return Et(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,i)=>{const a=e(t),r=()=>i.addIssue({code:st.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((e=>!!e||(r(),!1))):!!a||(r(),!1)}))}refinement(e,t){return this._refinement(((n,i)=>!!e(n)||(i.addIssue("function"==typeof t?t(n,i):t),!1)))}_refinement(e){return new Sn({schema:this,typeName:Pn.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return kn.create(this,this._def)}nullable(){return En.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this,this._def)}promise(){return Mn.create(this,this._def)}or(e){return ln.create([this,e],this._def)}and(e){return pn.create(this,e,this._def)}transform(e){return new Sn({...$t(this._def),schema:this,typeName:Pn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $n({...$t(this._def),innerType:this,defaultValue:t,typeName:Pn.ZodDefault})}brand(){return new Tn({typeName:Pn.ZodBranded,type:this,...$t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new An({...$t(this._def),innerType:this,catchValue:t,typeName:Pn.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jn.create(this,e)}readonly(){return On.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const It=/^c[^\s-]{8,}$/i,zt=/^[0-9a-z]+$/,Tt=/^[0-9A-HJKMNP-TV-Z]{26}$/,jt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ot=/^[a-z0-9_-]{21}$/i,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Pt;const Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ht=new RegExp(`^${Vt}$`);function Bt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function qt(e){let t=`${Vt}T${Bt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ut(e,t){return!("v4"!==t&&t||!Lt.test(e))||!("v6"!==t&&t||!Nt.test(e))}class Wt extends At{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==at.string){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.string,received:t.parsedType}),gt}const t=new pt;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.lengthi.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:st.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const a=e.data.length>i.value,r=e.data.lengthe.test(t)),{validation:t,code:st.invalid_string,...Ct.errToObj(n)})}_addCheck(e){return new Wt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ct.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ct.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ct.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ct.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ct.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ct.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ct.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ct.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ct.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ct.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Ct.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ct.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ct.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ct.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ct.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ct.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ct.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ct.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ct.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ct.errToObj(t)})}nonempty(e){return this.min(1,Ct.errToObj(e))}trim(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuei?n:i;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}Wt.create=e=>{var t;return new Wt({checks:[],typeName:Pn.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Qt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==at.number){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.number,received:t.parsedType}),gt}let t;const n=new pt;for(const i of this._def.checks)if("int"===i.kind)Ke.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:st.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty());else if("min"===i.kind){(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:st.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty())}else"multipleOf"===i.kind?0!==Zt(e.data,i.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:st.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):"finite"===i.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ht(t,{code:st.not_finite,message:i.message}),n.dirty()):Ke.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,i){return new Qt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(i)}]})}_addCheck(e){return new Qt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ct.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ct.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ct.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ct.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Ke.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew Qt({checks:[],typeName:Pn.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Gt extends At{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==at.bigint){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.bigint,received:t.parsedType}),gt}let t;const n=new pt;for(const i of this._def.checks)if("min"===i.kind){(i.inclusive?e.datai.value:e.data>=i.value)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:st.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty())}else"multipleOf"===i.kind?e.data%i.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),ht(t,{code:st.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Ke.assertNever(i);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ct.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ct.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ct.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ct.toString(t))}setLimit(e,t,n,i){return new Gt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ct.toString(i)}]})}_addCheck(e){return new Gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ct.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ct.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ct.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Gt({checks:[],typeName:Pn.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$t(e)})};class Yt extends At{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==at.boolean){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.boolean,received:t.parsedType}),gt}return ft(e.data)}}Yt.create=e=>new Yt({typeName:Pn.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$t(e)});class Kt extends At{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==at.date){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.date,received:t.parsedType}),gt}if(isNaN(e.data.getTime())){return ht(this._getOrReturnCtx(e),{code:st.invalid_date}),gt}const t=new pt;let n;for(const i of this._def.checks)"min"===i.kind?e.data.getTime()i.value&&(n=this._getOrReturnCtx(e,n),ht(n,{code:st.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),t.dirty()):Ke.assertNever(i);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ct.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ct.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew Kt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Pn.ZodDate,...$t(e)});class Xt extends At{_parse(e){if(this._getType(e)!==at.symbol){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.symbol,received:t.parsedType}),gt}return ft(e.data)}}Xt.create=e=>new Xt({typeName:Pn.ZodSymbol,...$t(e)});class Jt extends At{_parse(e){if(this._getType(e)!==at.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.undefined,received:t.parsedType}),gt}return ft(e.data)}}Jt.create=e=>new Jt({typeName:Pn.ZodUndefined,...$t(e)});class en extends At{_parse(e){if(this._getType(e)!==at.null){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.null,received:t.parsedType}),gt}return ft(e.data)}}en.create=e=>new en({typeName:Pn.ZodNull,...$t(e)});class tn extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return ft(e.data)}}tn.create=e=>new tn({typeName:Pn.ZodAny,...$t(e)});class nn extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ft(e.data)}}nn.create=e=>new nn({typeName:Pn.ZodUnknown,...$t(e)});class an extends At{_parse(e){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.never,received:t.parsedType}),gt}}an.create=e=>new an({typeName:Pn.ZodNever,...$t(e)});class rn extends At{_parse(e){if(this._getType(e)!==at.undefined){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.void,received:t.parsedType}),gt}return ft(e.data)}}rn.create=e=>new rn({typeName:Pn.ZodVoid,...$t(e)});class sn extends At{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==at.array)return ht(t,{code:st.invalid_type,expected:at.array,received:t.parsedType}),gt;if(null!==i.exactLength){const e=t.data.length>i.exactLength.value,a=t.data.lengthi.maxLength.value&&(ht(t,{code:st.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>i.type._parseAsync(new kt(t,e,t.path,n))))).then((e=>pt.mergeArray(n,e)));const a=[...t.data].map(((e,n)=>i.type._parseSync(new kt(t,e,t.path,n))));return pt.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new sn({...this._def,minLength:{value:e,message:Ct.toString(t)}})}max(e,t){return new sn({...this._def,maxLength:{value:e,message:Ct.toString(t)}})}length(e,t){return new sn({...this._def,exactLength:{value:e,message:Ct.toString(t)}})}nonempty(e){return this.min(1,e)}}function on(e){if(e instanceof cn){const t={};for(const n in e.shape){const i=e.shape[n];t[n]=kn.create(on(i))}return new cn({...e._def,shape:()=>t})}return e instanceof sn?new sn({...e._def,type:on(e.element)}):e instanceof kn?kn.create(on(e.unwrap())):e instanceof En?En.create(on(e.unwrap())):e instanceof gn?gn.create(e.items.map((e=>on(e)))):e}sn.create=(e,t)=>new sn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Pn.ZodArray,...$t(t)});class cn extends At{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Ke.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==at.object){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.object,received:t.parsedType}),gt}const{status:t,ctx:n}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),r=[];if(!(this._def.catchall instanceof an&&"strip"===this._def.unknownKeys))for(const e in n.data)a.includes(e)||r.push(e);const s=[];for(const e of a){const t=i[e],a=n.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new kt(n,a,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof an){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)s.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)r.length>0&&(ht(n,{code:st.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const i=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new kt(n,i,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of s){const n=await t.key,i=await t.value;e.push({key:n,value:i,alwaysSet:t.alwaysSet})}return e})).then((e=>pt.mergeObjectSync(t,e))):pt.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return Ct.errToObj,new cn({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var i,a,r,s;const o=null!==(r=null===(a=(i=this._def).errorMap)||void 0===a?void 0:a.call(i,t,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=Ct.errToObj(e).message)&&void 0!==s?s:o}:{message:o}}}:{}})}strip(){return new cn({...this._def,unknownKeys:"strip"})}passthrough(){return new cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Pn.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new cn({...this._def,catchall:e})}pick(e){const t={};return Ke.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}omit(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new cn({...this._def,shape:()=>t})}deepPartial(){return on(this)}partial(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()})),new cn({...this._def,shape:()=>t})}required(e){const t={};return Ke.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof kn;)e=e._def.innerType;t[n]=e}})),new cn({...this._def,shape:()=>t})}keyof(){return wn(Ke.objectKeys(this.shape))}}cn.create=(e,t)=>new cn({shape:()=>e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.strictCreate=(e,t)=>new cn({shape:()=>e,unknownKeys:"strict",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)}),cn.lazycreate=(e,t)=>new cn({shape:e,unknownKeys:"strip",catchall:an.create(),typeName:Pn.ZodObject,...$t(t)});class ln extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new ot(e.ctx.common.issues)));return ht(t,{code:st.invalid_union,unionErrors:n}),gt}));{let e;const i=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},r=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:n}),n.common.issues.length&&i.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=i.map((e=>new ot(e)));return ht(t,{code:st.invalid_union,unionErrors:a}),gt}}get options(){return this._def.options}}ln.create=(e,t)=>new ln({options:e,typeName:Pn.ZodUnion,...$t(t)});const dn=e=>e instanceof vn?dn(e.schema):e instanceof Sn?dn(e.innerType()):e instanceof bn?[e.value]:e instanceof xn?e.options:e instanceof Cn?Ke.objectValues(e.enum):e instanceof $n?dn(e._def.innerType):e instanceof Jt?[void 0]:e instanceof en?[null]:e instanceof kn?[void 0,...dn(e.unwrap())]:e instanceof En?[null,...dn(e.unwrap())]:e instanceof Tn||e instanceof On?dn(e.unwrap()):e instanceof An?dn(e._def.innerType):[];class un extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==at.object)return ht(t,{code:st.invalid_type,expected:at.object,received:t.parsedType}),gt;const n=this.discriminator,i=t.data[n],a=this.optionsMap.get(i);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(ht(t,{code:st.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),gt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const n of t){const t=dn(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of t){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,n)}}return new un({typeName:Pn.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...$t(n)})}}function hn(e,t){const n=rt(e),i=rt(t);if(e===t)return{valid:!0,data:e};if(n===at.object&&i===at.object){const n=Ke.objectKeys(t),i=Ke.objectKeys(e).filter((e=>-1!==n.indexOf(e))),a={...e,...t};for(const n of i){const i=hn(e[n],t[n]);if(!i.valid)return{valid:!1};a[n]=i.data}return{valid:!0,data:a}}if(n===at.array&&i===at.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let i=0;i{if(_t(e)||_t(i))return gt;const a=hn(e.value,i.value);return a.valid?((yt(e)||yt(i))&&t.dirty(),{status:t.value,value:a.data}):(ht(n,{code:st.invalid_intersection_types}),gt)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>i(e,t))):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}pn.create=(e,t,n)=>new pn({left:e,right:t,typeName:Pn.ZodIntersection,...$t(n)});class gn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.array)return ht(n,{code:st.invalid_type,expected:at.array,received:n.parsedType}),gt;if(n.data.lengththis._def.items.length&&(ht(n,{code:st.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;return i?i._parse(new kt(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(i).then((e=>pt.mergeArray(t,e))):pt.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new gn({...this._def,rest:e})}}gn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new gn({items:e,typeName:Pn.ZodTuple,rest:null,...$t(t)})};class mn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.object)return ht(n,{code:st.invalid_type,expected:at.object,received:n.parsedType}),gt;const i=[],a=this._def.keyType,r=this._def.valueType;for(const e in n.data)i.push({key:a._parse(new kt(n,e,n.path,e)),value:r._parse(new kt(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?pt.mergeObjectAsync(t,i):pt.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return new mn(t instanceof At?{keyType:e,valueType:t,typeName:Pn.ZodRecord,...$t(n)}:{keyType:Wt.create(),valueType:e,typeName:Pn.ZodRecord,...$t(t)})}}class fn extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.map)return ht(n,{code:st.invalid_type,expected:at.map,received:n.parsedType}),gt;const i=this._def.keyType,a=this._def.valueType,r=[...n.data.entries()].map((([e,t],r)=>({key:i._parse(new kt(n,e,n.path,[r,"key"])),value:a._parse(new kt(n,t,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const i=await n.key,a=await n.value;if("aborted"===i.status||"aborted"===a.status)return gt;"dirty"!==i.status&&"dirty"!==a.status||t.dirty(),e.set(i.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of r){const i=n.key,a=n.value;if("aborted"===i.status||"aborted"===a.status)return gt;"dirty"!==i.status&&"dirty"!==a.status||t.dirty(),e.set(i.value,a.value)}return{status:t.value,value:e}}}}fn.create=(e,t,n)=>new fn({valueType:t,keyType:e,typeName:Pn.ZodMap,...$t(n)});class _n extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==at.set)return ht(n,{code:st.invalid_type,expected:at.set,received:n.parsedType}),gt;const i=this._def;null!==i.minSize&&n.data.sizei.maxSize.value&&(ht(n,{code:st.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const a=this._def.valueType;function r(e){const n=new Set;for(const i of e){if("aborted"===i.status)return gt;"dirty"===i.status&&t.dirty(),n.add(i.value)}return{status:t.value,value:n}}const s=[...n.data.values()].map(((e,t)=>a._parse(new kt(n,e,n.path,t))));return n.common.async?Promise.all(s).then((e=>r(e))):r(s)}min(e,t){return new _n({...this._def,minSize:{value:e,message:Ct.toString(t)}})}max(e,t){return new _n({...this._def,maxSize:{value:e,message:Ct.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:Pn.ZodSet,...$t(t)});class yn extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==at.function)return ht(t,{code:st.invalid_type,expected:at.function,received:t.parsedType}),gt;function n(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:st.invalid_arguments,argumentsError:n}})}function i(e,n){return ut({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,dt(),ct].filter((e=>!!e)),issueData:{code:st.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof Mn){const e=this;return ft((async function(...t){const s=new ot([]),o=await e._def.args.parseAsync(t,a).catch((e=>{throw s.addIssue(n(t,e)),s})),c=await Reflect.apply(r,this,o),l=await e._def.returns._def.type.parseAsync(c,a).catch((e=>{throw s.addIssue(i(c,e)),s}));return l}))}{const e=this;return ft((function(...t){const s=e._def.args.safeParse(t,a);if(!s.success)throw new ot([n(t,s.error)]);const o=Reflect.apply(r,this,s.data),c=e._def.returns.safeParse(o,a);if(!c.success)throw new ot([i(o,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new yn({...this._def,args:gn.create(e).rest(nn.create())})}returns(e){return new yn({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new yn({args:e||gn.create([]).rest(nn.create()),returns:t||nn.create(),typeName:Pn.ZodFunction,...$t(n)})}}class vn extends At{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}vn.create=(e,t)=>new vn({getter:e,typeName:Pn.ZodLazy,...$t(t)});class bn extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ht(t,{received:t.data,code:st.invalid_literal,expected:this._def.value}),gt}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wn(e,t){return new xn({values:e,typeName:Pn.ZodEnum,...$t(t)})}bn.create=(e,t)=>new bn({value:e,typeName:Pn.ZodLiteral,...$t(t)});class xn extends At{constructor(){super(...arguments),Mt.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{expected:Ke.joinValues(n),received:t.parsedType,code:st.invalid_type}),gt}if(wt(this,Mt,"f")||xt(this,Mt,new Set(this._def.values),"f"),!wt(this,Mt,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return ht(t,{received:t.data,code:st.invalid_enum_value,options:n}),gt}return ft(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xn.create(e,{...this._def,...t})}exclude(e,t=this._def){return xn.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Mt=new WeakMap,xn.create=wn;class Cn extends At{constructor(){super(...arguments),St.set(this,void 0)}_parse(e){const t=Ke.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==at.string&&n.parsedType!==at.number){const e=Ke.objectValues(t);return ht(n,{expected:Ke.joinValues(e),received:n.parsedType,code:st.invalid_type}),gt}if(wt(this,St,"f")||xt(this,St,new Set(Ke.getValidEnumValues(this._def.values)),"f"),!wt(this,St,"f").has(e.data)){const e=Ke.objectValues(t);return ht(n,{received:n.data,code:st.invalid_enum_value,options:e}),gt}return ft(e.data)}get enum(){return this._def.values}}St=new WeakMap,Cn.create=(e,t)=>new Cn({values:e,typeName:Pn.ZodNativeEnum,...$t(t)});class Mn extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==at.promise&&!1===t.common.async)return ht(t,{code:st.invalid_type,expected:at.promise,received:t.parsedType}),gt;const n=t.parsedType===at.promise?t.data:Promise.resolve(t.data);return ft(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Mn.create=(e,t)=>new Mn({type:e,typeName:Pn.ZodPromise,...$t(t)});class Sn extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Pn.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:e=>{ht(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===i.type){const e=i.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return gt;const i=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===i.status?gt:"dirty"===i.status||"dirty"===t.value?mt(i.value):i}));{if("aborted"===t.value)return gt;const i=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===i.status?gt:"dirty"===i.status||"dirty"===t.value?mt(i.value):i}}if("refinement"===i.type){const e=e=>{const t=i.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===i.status?gt:("dirty"===i.status&&t.dirty(),e(i.value),{status:t.value,value:i.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?gt:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===i.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!vt(e))return e;const r=i.transform(e.value,a);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>vt(e)?Promise.resolve(i.transform(e.value,a)).then((e=>({status:t.value,value:e}))):e))}Ke.assertNever(i)}}Sn.create=(e,t,n)=>new Sn({schema:e,typeName:Pn.ZodEffects,effect:t,...$t(n)}),Sn.createWithPreprocess=(e,t,n)=>new Sn({schema:t,effect:{type:"preprocess",transform:e},typeName:Pn.ZodEffects,...$t(n)});class kn extends At{_parse(e){return this._getType(e)===at.undefined?ft(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}kn.create=(e,t)=>new kn({innerType:e,typeName:Pn.ZodOptional,...$t(t)});class En extends At{_parse(e){return this._getType(e)===at.null?ft(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}En.create=(e,t)=>new En({innerType:e,typeName:Pn.ZodNullable,...$t(t)});class $n extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===at.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:Pn.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$t(t)});class An extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bt(i)?i.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ot(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new ot(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}An.create=(e,t)=>new An({innerType:e,typeName:Pn.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$t(t)});class In extends At{_parse(e){if(this._getType(e)!==at.nan){const t=this._getOrReturnCtx(e);return ht(t,{code:st.invalid_type,expected:at.nan,received:t.parsedType}),gt}return{status:"valid",value:e.data}}}In.create=e=>new In({typeName:Pn.ZodNaN,...$t(e)});const zn=Symbol("zod_brand");class Tn extends At{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class jn extends At{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?gt:"dirty"===e.status?(t.dirty(),mt(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?gt:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new jn({in:e,out:t,typeName:Pn.ZodPipeline})}}class On extends At{_parse(e){const t=this._def.innerType._parse(e),n=e=>(vt(e)&&(e.value=Object.freeze(e.value)),e);return bt(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Dn(e,t={},n){return e?tn.create().superRefine(((i,a)=>{var r,s;if(!e(i)){const e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,o=null===(s=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===s||s,c="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...c,fatal:o})}})):tn.create()}On.create=(e,t)=>new On({innerType:e,typeName:Pn.ZodReadonly,...$t(t)});const Rn={object:cn.lazycreate};var Pn;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Pn||(Pn={}));const Ln=Wt.create,Nn=Qt.create,Fn=In.create,Vn=Gt.create,Hn=Yt.create,Bn=Kt.create,qn=Xt.create,Un=Jt.create,Wn=en.create,Zn=tn.create,Qn=nn.create,Gn=an.create,Yn=rn.create,Kn=sn.create,Xn=cn.create,Jn=cn.strictCreate,ei=ln.create,ti=un.create,ni=pn.create,ii=gn.create,ai=mn.create,ri=fn.create,si=_n.create,oi=yn.create,ci=vn.create,li=bn.create,di=xn.create,ui=Cn.create,hi=Mn.create,pi=Sn.create,gi=kn.create,mi=En.create,fi=Sn.createWithPreprocess,_i=jn.create,yi={string:e=>Wt.create({...e,coerce:!0}),number:e=>Qt.create({...e,coerce:!0}),boolean:e=>Yt.create({...e,coerce:!0}),bigint:e=>Gt.create({...e,coerce:!0}),date:e=>Kt.create({...e,coerce:!0})},vi=gt;var bi=Object.freeze({__proto__:null,defaultErrorMap:ct,setErrorMap:function(e){lt=e},getErrorMap:dt,makeIssue:ut,EMPTY_PATH:[],addIssueToContext:ht,ParseStatus:pt,INVALID:gt,DIRTY:mt,OK:ft,isAborted:_t,isDirty:yt,isValid:vt,isAsync:bt,get util(){return Ke},get objectUtil(){return Xe},ZodParsedType:at,getParsedType:rt,ZodType:At,datetimeRegex:qt,ZodString:Wt,ZodNumber:Qt,ZodBigInt:Gt,ZodBoolean:Yt,ZodDate:Kt,ZodSymbol:Xt,ZodUndefined:Jt,ZodNull:en,ZodAny:tn,ZodUnknown:nn,ZodNever:an,ZodVoid:rn,ZodArray:sn,ZodObject:cn,ZodUnion:ln,ZodDiscriminatedUnion:un,ZodIntersection:pn,ZodTuple:gn,ZodRecord:mn,ZodMap:fn,ZodSet:_n,ZodFunction:yn,ZodLazy:vn,ZodLiteral:bn,ZodEnum:xn,ZodNativeEnum:Cn,ZodPromise:Mn,ZodEffects:Sn,ZodTransformer:Sn,ZodOptional:kn,ZodNullable:En,ZodDefault:$n,ZodCatch:An,ZodNaN:In,BRAND:zn,ZodBranded:Tn,ZodPipeline:jn,ZodReadonly:On,custom:Dn,Schema:At,ZodSchema:At,late:Rn,get ZodFirstPartyTypeKind(){return Pn},coerce:yi,any:Zn,array:Kn,bigint:Vn,boolean:Hn,date:Bn,discriminatedUnion:ti,effect:pi,enum:di,function:oi,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dn((t=>t instanceof e),t),intersection:ni,lazy:ci,literal:li,map:ri,nan:Fn,nativeEnum:ui,never:Gn,null:Wn,nullable:mi,number:Nn,object:Xn,oboolean:()=>Hn().optional(),onumber:()=>Nn().optional(),optional:gi,ostring:()=>Ln().optional(),pipeline:_i,preprocess:fi,promise:hi,record:ai,set:si,strictObject:Jn,string:Ln,symbol:qn,transformer:pi,tuple:ii,undefined:Un,union:ei,unknown:Qn,void:Yn,NEVER:vi,ZodIssueCode:st,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ot});const wi="cameras",xi=`${wi}.#.camera_entity`,Ci=`${wi}.#.frigate.camera_name`,Mi=`${wi}.#.capabilities.disable`,Si=`${wi}.#.capabilities.disable_except`,ki=`${wi}.#.cast.method`,Ei=`${wi}.#.cast.dashboard.dashboard_path`,$i=`${wi}.#.cast.dashboard.view_path`,Ai=`${wi}.#.dimensions.aspect_ratio`,Ii=`${wi}.#.frigate.client_id`,zi=`${wi}.#.frigate.labels`,Ti=`${wi}.#.frigate.url`,ji=`${wi}.#.frigate.zones`,Oi=`${wi}.#.go2rtc.modes`,Di=`${wi}.#.go2rtc.stream`,Ri=`${wi}.#.icon`,Pi=`${wi}.#.id`,Li=`${wi}.#.image.entity`,Ni=`${wi}.#.image.entity_parameters`,Fi=`${wi}.#.image.mode`,Vi=`${wi}.#.image.refresh_seconds`,Hi=`${wi}.#.image.url`,Bi=`${wi}.#.motioneye.images.directory_pattern`,qi=`${wi}.#.motioneye.images.file_pattern`,Ui=`${wi}.#.motioneye.movies.directory_pattern`,Wi=`${wi}.#.motioneye.movies.file_pattern`,Zi=`${wi}.#.motioneye.url`,Qi=`${wi}.#.title`,Gi=`${wi}.#.webrtc_card.entity`,Yi=`${wi}.#.webrtc_card.url`,Ki=`${wi}.#.live_provider`,Xi=`${wi}.#.dependencies.cameras`,Ji=`${wi}.#.dependencies.all_cameras`,ea=`${wi}.#.dimensions.layout.fit`,ta=`${wi}.#.dimensions.layout.pan.x`,na=`${wi}.#.dimensions.layout.pan.y`,ia=`${wi}.#.dimensions.layout.position.x`,aa=`${wi}.#.dimensions.layout.position.y`,ra=`${wi}.#.dimensions.layout.view_box.top`,sa=`${wi}.#.dimensions.layout.view_box.bottom`,oa=`${wi}.#.dimensions.layout.view_box.left`,ca=`${wi}.#.dimensions.layout.view_box.right`,la=`${wi}.#.dimensions.layout.zoom`,da=`${wi}.#.proxy.dynamic`,ua=`${wi}.#.proxy.media`,ha=`${wi}.#.proxy.ssl_ciphers`,pa=`${wi}.#.proxy.ssl_verification`,ga=`${wi}.#.reolink.media_resolution`,ma=`${wi}.#.reolink.url`,fa=`${wi}.#.triggers.motion`,_a=`${wi}.#.triggers.occupancy`,ya=`${wi}.#.triggers.entities`,va=`${wi}.#.triggers.events`,ba="cameras_global",wa=`${ba}.image`,xa=`${ba}.live_provider`,Ca=`${ba}.jsmpeg`,Ma=`${ba}.webrtc_card`,Sa=`${ba}.triggers.occupancy`,ka=`${ba}.image.refresh_seconds`,Ea=`${ba}.dimensions.layout`,$a=`${ba}.ptz`,Aa="elements",Ia="view",za=`${Ia}.camera_select`,Ta=`${Ia}.dark_mode`,ja=`${Ia}.default`,Oa=`${Ia}.interaction_seconds`,Da=`${Ia}.keyboard_shortcuts`,Ra=`${Ia}.keyboard_shortcuts.enabled`,Pa=`${Da}.ptz_left`,La=`${Da}.ptz_right`,Na=`${Da}.ptz_up`,Fa=`${Da}.ptz_down`,Va=`${Da}.ptz_zoom_in`,Ha=`${Da}.ptz_zoom_out`,Ba=`${Da}.ptz_home`,qa=`${Ia}.default_cycle_camera`,Ua=`${Ia}.default_reset`,Wa=`${Ua}.interaction_mode`,Za=`${Ua}.every_seconds`,Qa=`${Ua}.entities`,Ga=`${Ua}.after_interaction`,Ya=`${Ia}.triggers`,Ka=`${Ya}.show_trigger_status`,Xa=`${Ya}.filter_selected_camera`,Ja=`${Ya}.untrigger_seconds`,er=`${Ya}.actions`,tr=`${er}.trigger`,nr=`${er}.untrigger`,ir=`${er}.interaction_mode`,ar="media_gallery",rr=`${ar}.controls.filter.mode`,sr=`${ar}.controls.thumbnails.show_details`,or=`${ar}.controls.thumbnails.show_download_control`,cr=`${ar}.controls.thumbnails.show_favorite_control`,lr=`${ar}.controls.thumbnails.show_timeline_control`,dr=`${ar}.controls.thumbnails.size`,ur="media_viewer",hr=`${ur}.auto_play`,pr=`${ur}.auto_pause`,gr=`${ur}.auto_mute`,mr=`${ur}.auto_unmute`,fr=`${ur}.display.mode`,_r=`${ur}.display.grid_columns`,yr=`${ur}.display.grid_max_columns`,vr=`${ur}.display.grid_selected_width_factor`,br=`${ur}.draggable`,wr=`${ur}.lazy_load`,xr=`${ur}.snapshot_click_plays_clip`,Cr=`${ur}.transition_effect`,Mr=`${ur}.controls.builtin`,Sr=`${ur}.controls.next_previous.style`,kr=`${ur}.controls.next_previous.size`,Er=`${ur}.controls.thumbnails.mode`,$r=`${ur}.controls.thumbnails.show_details`,Ar=`${ur}.controls.thumbnails.show_download_control`,Ir=`${ur}.controls.thumbnails.show_favorite_control`,zr=`${ur}.controls.thumbnails.show_timeline_control`,Tr=`${ur}.controls.thumbnails.size`,jr=`${ur}.controls.timeline.clustering_threshold`,Or=`${ur}.controls.timeline.events_media_type`,Dr=`${ur}.controls.timeline.mode`,Rr=`${ur}.controls.timeline.pan_mode`,Pr=`${ur}.controls.timeline.show_recordings`,Lr=`${ur}.controls.timeline.style`,Nr=`${ur}.controls.timeline.window_seconds`,Fr=`${ur}.zoomable`,Vr="live",Hr=`${Vr}.auto_play`,Br=`${Vr}.auto_pause`,qr=`${Vr}.auto_mute`,Ur=`${Vr}.auto_unmute`,Wr=`${Vr}.controls.builtin`,Zr=`${Vr}.controls.next_previous.style`,Qr=`${Vr}.controls.next_previous.size`,Gr=`${Vr}.controls.ptz.hide_home`,Yr=`${Vr}.controls.ptz.hide_pan_tilt`,Kr=`${Vr}.controls.ptz.hide_zoom`,Xr=`${Vr}.controls.ptz.mode`,Jr=`${Vr}.controls.ptz.orientation`,es=`${Vr}.controls.ptz.position`,ts=`${Vr}.controls.thumbnails.media_type`,ns=`${Vr}.controls.thumbnails.events_media_type`,is=`${Vr}.controls.thumbnails.mode`,as=`${Vr}.controls.thumbnails.size`,rs=`${Vr}.controls.thumbnails.show_details`,ss=`${Vr}.controls.thumbnails.show_download_control`,os=`${Vr}.controls.thumbnails.show_favorite_control`,cs=`${Vr}.controls.thumbnails.show_timeline_control`,ls=`${Vr}.controls.timeline.clustering_threshold`,ds=`${Vr}.controls.timeline.events_media_type`,us=`${Vr}.controls.timeline.mode`,hs=`${Vr}.controls.timeline.pan_mode`,ps=`${Vr}.controls.timeline.show_recordings`,gs=`${Vr}.controls.timeline.style`,ms=`${Vr}.controls.timeline.window_seconds`,fs=`${Vr}.display.mode`,_s=`${Vr}.display.grid_columns`,ys=`${Vr}.display.grid_max_columns`,vs=`${Vr}.display.grid_selected_width_factor`,bs=`${Vr}.draggable`,ws=`${Vr}.lazy_load`,xs=`${Vr}.lazy_unload`,Cs=`${Vr}.preload`,Ms=`${Vr}.transition_effect`,Ss=`${Vr}.show_image_during_load`,ks=`${Vr}.microphone.disconnect_seconds`,Es=`${Vr}.microphone.mute_after_microphone_mute_seconds`,$s=`${Vr}.microphone.always_connected`,As=`${Vr}.zoomable`,Is="image",zs=`${Is}.entity`,Ts=`${Is}.entity_parameters`,js=`${Is}.mode`,Os=`${Is}.refresh_seconds`,Ds=`${Is}.url`,Rs="timeline",Ps=`${Rs}.window_seconds`,Ls=`${Rs}.clustering_threshold`,Ns=`${Rs}.events_media_type`,Fs=`${Rs}.show_recordings`,Vs=`${Rs}.style`,Hs=`${Rs}.controls.thumbnails.mode`,Bs=`${Rs}.controls.thumbnails.size`,qs=`${Rs}.controls.thumbnails.show_details`,Us=`${Rs}.controls.thumbnails.show_download_control`,Ws=`${Rs}.controls.thumbnails.show_favorite_control`,Zs=`${Rs}.controls.thumbnails.show_timeline_control`,Qs="menu",Gs=`${Qs}.alignment`,Ys=`${Qs}.position`,Ks=`${Qs}.style`,Xs=`${Qs}.button_size`,Js=`${Qs}.buttons`,eo=`${Js}.frigate`,to=`${Js}.camera_ui`,no=`${Js}.fullscreen`,io=`${Js}.play`,ao=`${Js}.mute`,ro=`${Js}.media_player`,so=`${Js}.timeline`,oo="status_bar",co=`${oo}.position`,lo=`${oo}.style`,uo=`${oo}.popup_seconds`,ho=`${oo}.height`,po=`${oo}.items`,go="dimensions",mo=`${go}.aspect_ratio`,fo=`${go}.aspect_ratio_mode`,_o=`${go}.height`,yo="overrides",vo="performance",bo=`${vo}.features.animated_progress_indicator`,wo=`${vo}.features.media_chunk_size`,xo=`${vo}.features.max_simultaneous_engine_requests`,Co=`${vo}.profile`,Mo=`${vo}.style.box_shadow`,So=`${vo}.style.border_radius`,ko="profiles",Eo=1e3;class $o extends Error{constructor(e,t){super(e),this.context=t}}const Ao={info:10,error:20,connection:30,diagnostics:40},Io=["clips","favorite-events","favorite-recordings","live","menu","ptz","recordings","seek","snapshots","substream"],zo=bi.object({url:bi.string(),mime_type:bi.string()}),To=bi.object({path:bi.string()});function jo(e){if(e instanceof bi.ZodDefault)return jo(e.removeDefault());if(e instanceof bi.ZodObject){const t={};for(const n in e.shape){const i=e.shape[n];t[n]=bi.ZodOptional.create(jo(i))}return new bi.ZodObject({...e._def,shape:()=>t})}return e instanceof bi.ZodArray?bi.ZodArray.create(jo(e.element)).min(e._def.minLength?.value,e._def.minLength?.message).max(e._def.maxLength?.value,e._def.maxLength?.message).length(e._def.exactLength?.value,e._def.exactLength?.message):e instanceof bi.ZodOptional?bi.ZodOptional.create(jo(e.unwrap())):e instanceof bi.ZodNullable?bi.ZodNullable.create(jo(e.unwrap())):e instanceof bi.ZodTuple?bi.ZodTuple.create(e.items.map((e=>jo(e)))):e}function Oo(e){const t=e.format();return Object.keys(t).filter((e=>!e.startsWith("_")))}const Do=e=>{const t=new Set;if(e.issues.length)for(const n of e.issues)if("invalid_union"===n.code){const e=n.unionErrors;for(const n of e)Do(n).forEach(t.add,t)}else t.add(Ro(n.path));return t},Ro=e=>{let t="";for(let n=0;n"fire-dom-event")).or(bi.literal("fire-dom-event")),card_id:bi.string().regex(Jo,"card_id parameter can only contain [a-z][A-Z][0-9_]-").optional()}),mc=gc.extend({frigate_card_action:bi.enum(Uo)}),fc=gc.extend({frigate_card_action:bi.enum(["camera_ui","default","download","expand","fullscreen","live_substream_off","live_substream_on","menu_toggle","microphone_connect","microphone_disconnect","microphone_mute","microphone_unmute","mute","pause","play","screenshot","unmute"])}),_c=gc.extend({frigate_card_action:bi.literal("camera_select"),camera:bi.string().optional(),triggered:bi.boolean().optional()}),yc=gc.extend({frigate_card_action:bi.literal("live_substream_select"),camera:bi.string()}),vc=gc.extend({frigate_card_action:bi.literal("media_player"),media_player:bi.string(),media_player_action:bi.enum(["play","stop"])}),bc=gc.extend({frigate_card_action:bi.literal("display_mode_select"),display_mode:nc}),wc=gc.extend({frigate_card_action:bi.literal("ptz"),camera:bi.string().optional(),ptz_action:bi.enum(Fo).optional(),ptz_phase:bi.enum(Ko).optional(),ptz_preset:bi.string().optional()}),xc=gc.extend({frigate_card_action:bi.literal("ptz_digital"),target_id:bi.string().optional(),absolute:bi.object({zoom:tc.optional(),pan:ec.optional()}).optional(),ptz_action:bi.enum(Fo).optional(),ptz_phase:bi.enum(Ko).optional()}),Cc=gc.extend({frigate_card_action:bi.literal("ptz_multi"),target_id:bi.string().optional(),ptz_action:bi.enum(Fo).optional(),ptz_phase:bi.enum(Ko).optional(),ptz_preset:bi.string().optional()}),Mc=gc.extend({frigate_card_action:bi.literal("ptz_controls"),enabled:bi.boolean()}),Sc=bi.object({ms:bi.number().optional(),s:bi.number().optional(),m:bi.number().optional(),h:bi.number().optional()}),kc=gc.extend({frigate_card_action:bi.literal("sleep"),duration:Sc.optional().default({s:1})}),Ec=gc.extend({frigate_card_action:bi.literal("status_bar"),status_bar_action:bi.enum(["add","remove","reset"]),items:bi.lazy((()=>al)).array().optional()}),$c=gc.extend({frigate_card_action:bi.literal("log"),message:bi.string(),level:bi.enum(["debug","info","warn","error"]).default("info")}),Ac=bi.union([_c,fc,yc,$c,vc,wc,xc,Cc,Mc,mc,bc,kc,Ec]),Ic=bi.union([rc,cc,oc,lc,dc,uc,pc,hc,Ac]),zc=bi.object({tap_action:Ic.or(Ic.array()).optional(),hold_action:Ic.or(Ic.array()).optional(),double_tap_action:Ic.or(Ic.array()).optional(),start_tap_action:Ic.or(Ic.array()).optional(),end_tap_action:Ic.or(Ic.array()).optional()}).passthrough(),Tc=bi.object({actions:zc.optional()}),jc=zc.extend({style:bi.record(bi.string().nullable().or(bi.undefined()).or(bi.number())).optional(),title:bi.string().nullable().optional()}),Oc=jc.extend({type:bi.literal("state-badge"),entity:bi.string()}),Dc=jc.extend({type:bi.literal("state-icon"),entity:bi.string(),icon:bi.string().optional(),state_color:bi.boolean().default(!0)}),Rc=jc.extend({type:bi.literal("state-label"),entity:bi.string(),attribute:bi.string().optional(),prefix:bi.string().optional(),suffix:bi.string().optional()}),Pc=jc.extend({type:bi.literal("service-button"),title:bi.string(),service:bi.string(),service_data:bi.object({}).passthrough().optional()}),Lc=jc.extend({type:bi.literal("icon"),icon:bi.string(),entity:bi.string().optional()}),Nc=jc.extend({type:bi.literal("image"),entity:bi.string().optional(),image:bi.string().optional(),camera_image:bi.string().optional(),camera_view:bi.string().optional(),state_image:bi.object({}).passthrough().optional(),filter:bi.string().optional(),state_filter:bi.object({}).passthrough().optional(),aspect_ratio:bi.string().optional()}),Fc=bi.object({condition:bi.literal("state").optional(),entity:bi.string(),state:bi.string().or(bi.string().array()).optional(),state_not:bi.string().or(bi.string().array()).optional()}),Vc=bi.object({condition:bi.literal("numeric_state"),entity:bi.string(),above:bi.number().optional(),below:bi.number().optional()}),Hc=bi.object({condition:bi.literal("screen"),media_query:bi.string()}),Bc=bi.object({condition:bi.literal("user"),users:bi.string().array().min(1)}),qc=bi.discriminatedUnion("condition",[Fc,Vc,Hc,Bc]),Uc=bi.object({type:bi.literal("conditional"),conditions:qc.array(),elements:bi.lazy((()=>_l))}),Wc=bi.object({type:bi.string().superRefine(((e,t)=>{e.match(/^custom:(?!frigate-card).+/)||t.addIssue({code:bi.ZodIssueCode.custom,message:"Frigate-card custom elements must match specific schemas",fatal:!0})}))}).passthrough(),Zc=bi.object({enabled:bi.boolean().default(!0).optional(),priority:bi.number().min(0).max(Bo).default(50).optional(),alignment:bi.enum(["matching","opposing"]).default("matching").optional(),icon:bi.string().optional(),permanent:bi.boolean().default(!1).optional()}),Qc=Zc.merge(Lc).extend({type:bi.literal("custom:frigate-card-menu-icon")}),Gc=Zc.merge(Dc).extend({type:bi.literal("custom:frigate-card-menu-state-icon")}).merge(Zc),Yc=jc.extend({entity:bi.string().optional(),icon:bi.string().optional(),state_color:bi.boolean().default(!0),selected:bi.boolean().default(!1),subtitle:bi.string().optional(),enabled:bi.boolean().default(!0)}),Kc=Zc.merge(Lc).extend({type:bi.literal("custom:frigate-card-menu-submenu"),items:Yc.array()}),Xc=Zc.merge(Dc).extend({type:bi.literal("custom:frigate-card-menu-submenu-select"),options:bi.record(Yc.deepPartial()).optional()}),Jc=bi.object({enabled:bi.boolean().default(!0).optional(),priority:bi.number().min(0).max(100).default(50).optional()}),el=Jc.extend({sufficient:bi.boolean().default(!1).optional(),exclusive:bi.boolean().default(!1).optional(),expand:bi.boolean().default(!1).optional(),actions:zc.optional()}),tl=el.extend({type:bi.literal("custom:frigate-card-status-bar-icon"),icon:bi.string()}),nl=el.extend({type:bi.literal("custom:frigate-card-status-bar-image"),image:bi.string()}),il=el.extend({type:bi.literal("custom:frigate-card-status-bar-string"),string:bi.string()}),al=bi.union([tl,nl,il]),rl=bi.object({condition:bi.literal("view"),views:bi.string().array()}),sl=bi.object({condition:bi.literal("fullscreen"),fullscreen:bi.boolean()}),ol=bi.object({condition:bi.literal("expand"),expand:bi.boolean()}),cl=bi.object({condition:bi.literal("camera"),cameras:bi.string().array()}),ll=bi.object({condition:bi.literal("media_loaded"),media_loaded:bi.boolean()}),dl=bi.object({condition:bi.literal("display_mode"),display_mode:nc}),ul=bi.object({condition:bi.literal("triggered"),triggered:bi.string().array()}),hl=bi.object({condition:bi.literal("interaction"),interaction:bi.boolean()}),pl=bi.object({condition:bi.literal("microphone"),connected:bi.boolean().optional(),muted:bi.boolean().optional()}),gl=bi.object({condition:bi.literal("key"),key:bi.string(),state:bi.enum(["down","up"]).optional(),ctrl:bi.boolean().optional(),shift:bi.boolean().optional(),alt:bi.boolean().optional(),meta:bi.boolean().optional()}),ml=bi.discriminatedUnion("condition",[Fc,Vc,Hc,Bc,rl,sl,ol,cl,ll,dl,ul,hl,pl,gl]),fl=bi.object({type:bi.literal("custom:frigate-card-conditional"),conditions:ml.array(),elements:bi.lazy((()=>_l))}),_l=bi.union([Uc,Wc,fl,Lc,Nc,Qc,Gc,Kc,Xc,Pc,Oc,Dc,Rc,tl,nl,il]).array().optional(),yl=bi.object({fit:bi.enum(["contain","cover","fill"]).optional(),position:bi.object({x:bi.number().min(0).max(100).optional(),y:bi.number().min(0).max(100).optional()}).optional(),view_box:bi.object({bottom:bi.number().min(0).max(100).optional().default(0),left:bi.number().min(0).max(100).optional().default(0),right:bi.number().min(0).max(100).optional().default(0),top:bi.number().min(0).max(100).optional().default(0)}).optional(),pan:ec.optional(),zoom:tc.optional()}),vl=bi.number().array().length(2).or(bi.string().regex(/^\s*\d+\.?\d*\s*[:/]\s*\d+\.?\d*\s*$/).transform((e=>e.split(/[:\/]/).map((e=>Number(e)))))),bl={r2c_delay_between_calls_seconds:.5,c2r_delay_between_calls_seconds:.2},wl=function(e){return t=>{if(!t||"object"!=typeof t||!t.service)return t;const n={...t};return Object.keys(t).forEach((i=>{const a=i.match(/^data_(.+)$/),r=a?.[1];r&&!(`${e}${r}`in t)&&(n[`${e}${r}`]={action:"perform-action",perform_action:t.service,data:t[i]},delete n[i],delete n.service)})),n}},xl=bi.preprocess(wl("actions_"),bi.object({actions_left:oc.optional(),actions_left_start:oc.optional(),actions_left_stop:oc.optional(),actions_right:oc.optional(),actions_right_start:oc.optional(),actions_right_stop:oc.optional(),actions_up:oc.optional(),actions_up_start:oc.optional(),actions_up_stop:oc.optional(),actions_down:oc.optional(),actions_down_start:oc.optional(),actions_down_stop:oc.optional(),actions_zoom_in:oc.optional(),actions_zoom_in_start:oc.optional(),actions_zoom_in_stop:oc.optional(),actions_zoom_out:oc.optional(),actions_zoom_out_start:oc.optional(),actions_zoom_out_stop:oc.optional(),r2c_delay_between_calls_seconds:bi.number().default(bl.r2c_delay_between_calls_seconds),c2r_delay_between_calls_seconds:bi.number().default(bl.c2r_delay_between_calls_seconds),presets:bi.preprocess(wl(""),bi.union([bi.record(oc),bi.object({service:bi.string().optional()})])).optional(),service:bi.string().optional()}).passthrough()),Cl={orientation:"horizontal",mode:"auto",hide_pan_tilt:!1,hide_zoom:!1,hide_home:!1,position:"bottom-right"},Ml=bi.object({mode:bi.enum(["off","auto","on"]).default(Cl.mode),position:bi.enum(["top-left","top-right","bottom-left","bottom-right"]).default(Cl.position),orientation:bi.enum(["vertical","horizontal"]).default(Cl.orientation),hide_pan_tilt:bi.boolean().default(Cl.hide_pan_tilt),hide_zoom:bi.boolean().default(Cl.hide_zoom),hide_home:bi.boolean().default(Cl.hide_home),style:bi.object({}).passthrough().optional()}),Sl={mode:"auto",refresh_seconds:1},kl=bi.object({mode:bi.enum(["auto","camera","entity","screensaver","url"]).default(Sl.mode),refresh_seconds:bi.number().min(0).default(Sl.refresh_seconds),url:bi.string().optional(),entity:bi.string().optional(),entity_parameters:bi.string().optional()}),El=kl.merge(Tc).default(Sl),$l=75,Al=300,Il={size:100,show_details:!0,show_favorite_control:!0,show_timeline_control:!0,show_download_control:!0},zl=bi.object({size:bi.number().min(75).max(300).default(Il.size),show_details:bi.boolean().default(Il.show_details),show_favorite_control:bi.boolean().default(Il.show_favorite_control),show_timeline_control:bi.boolean().default(Il.show_timeline_control),show_download_control:bi.boolean().default(Il.show_download_control)}),Tl={...Il,mode:"right"},jl=zl.extend({mode:bi.enum(["none","above","below","left","right"]).default(Tl.mode)}),Ol=bi.enum(["all","clips","snapshots"]),Dl={clustering_threshold:3,events_media_type:"all",window_seconds:3600,show_recordings:!0,style:"stack",pan_mode:"pan"},Rl=bi.enum(["pan","seek","seek-in-media","seek-in-camera"]),Pl=bi.object({clustering_threshold:bi.number().optional().default(Dl.clustering_threshold),events_media_type:Ol.optional().default(Dl.events_media_type),window_seconds:bi.number().min(60).max(86400).optional().default(Dl.window_seconds),show_recordings:bi.boolean().optional().default(Dl.show_recordings),style:bi.enum(["stack","ribbon"]).optional().default(Dl.style),pan_mode:Rl.optional().default(Dl.pan_mode)}),Ll={...Dl,mode:"none",style:"ribbon"},Nl=Pl.extend({mode:bi.enum(["none","above","below"]).default(Ll.mode),style:Pl.shape.style.default(Ll.style)}),Fl={...Dl,controls:{thumbnails:Tl}},Vl=Pl.extend({controls:bi.object({thumbnails:jl.default(Fl.controls.thumbnails)}).default(Fl.controls)}).default(Fl),Hl=bi.object({style:bi.enum(["none","chevrons","icons","thumbnails"]),size:bi.number().min(20)}),Bl=bi.enum(["none","slide"]),ql={always_connected:!1,disconnect_seconds:90,mute_after_microphone_mute_seconds:60},Ul=bi.object({always_connected:bi.boolean().default(ql.always_connected),disconnect_seconds:bi.number().min(0).default(ql.disconnect_seconds),mute_after_microphone_mute_seconds:bi.number().min(0).default(ql.mute_after_microphone_mute_seconds)}).default(ql),Wl=bi.object({url:bi.string().transform((e=>e.replace(/\/+$/,""))).optional(),host:bi.string().optional(),modes:bi.enum(["webrtc","mse","mp4","mjpeg"]).array().optional(),stream:bi.string().optional()}),Zl=bi.object({entity:bi.string().optional(),url:bi.string().optional()}).passthrough(),Ql=bi.object({options:bi.object({audio:bi.boolean().optional(),video:bi.boolean().optional(),pauseWhenHidden:bi.boolean().optional(),disableGl:bi.boolean().optional(),disableWebAssembly:bi.boolean().optional(),preserveDrawingBuffer:bi.boolean().optional(),progressive:bi.boolean().optional(),throttled:bi.boolean().optional(),chunkSize:bi.number().optional(),maxAudioLag:bi.number().optional(),videoBufferSize:bi.number().optional(),audioBufferSize:bi.number().optional()}).optional()}),Gl={...Tl,media_type:"events",events_media_type:"all"},Yl={auto_play:[...Qo],auto_pause:[],auto_mute:[...Yo],auto_unmute:["microphone"],preload:!1,lazy_load:!0,lazy_unload:[],draggable:!0,zoomable:!0,transition_effect:"slide",show_image_during_load:!0,mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"chevrons"},ptz:Cl,thumbnails:Gl,timeline:Ll},microphone:{...ql}},Kl=jl.extend({media_type:bi.enum(["events","recordings"]).default(Yl.controls.thumbnails.media_type),events_media_type:Ol.default(Yl.controls.thumbnails.events_media_type)}),Xl=bi.object({auto_pause:bi.enum(Zo).array().default(Yl.auto_pause),auto_play:bi.enum(Qo).array().default(Yl.auto_play),auto_mute:bi.enum(Yo).array().default(Yl.auto_mute),auto_unmute:bi.enum(Go).array().default(Yl.auto_unmute),controls:bi.object({builtin:bi.boolean().default(Yl.controls.builtin),next_previous:Hl.extend({style:bi.enum(["none","chevrons","icons"]).default(Yl.controls.next_previous.style),size:Hl.shape.size.default(Yl.controls.next_previous.size)}).default(Yl.controls.next_previous),ptz:Ml.default(Yl.controls.ptz),thumbnails:Kl.default(Yl.controls.thumbnails),timeline:Nl.default(Yl.controls.timeline)}).default(Yl.controls),display:ic,draggable:bi.boolean().default(Yl.draggable),lazy_load:bi.boolean().default(Yl.lazy_load),lazy_unload:bi.enum(Zo).array().default(Yl.lazy_unload),microphone:Ul.default(Yl.microphone),preload:bi.boolean().default(Yl.preload),show_image_during_load:bi.boolean().default(Yl.show_image_during_load),transition_effect:Bl.default(Yl.transition_effect),zoomable:bi.boolean().default(Yl.zoomable)}).merge(Tc).default(Yl),Jl=bi.object({live:Xl}),ed=bi.object({method:bi.enum(["standard","dashboard"]).default("standard").optional(),dashboard:bi.object({dashboard_path:bi.string().optional(),view_path:bi.string().optional()}).optional()}),td={dependencies:{all_cameras:!1,cameras:[]},engine:"auto",frigate:{client_id:"frigate"},live_provider:"auto",motioneye:{images:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"},movies:{directory_pattern:"%Y-%m-%d",file_pattern:"%H-%M-%S"}},reolink:{media_resolution:"low"},ptz:bl,triggers:{motion:!1,occupancy:!1,events:[...Xo],entities:[]},proxy:{media:"auto",dynamic:!0,ssl_verification:"auto",ssl_ciphers:"auto"},always_error_if_entity_unavailable:!1},nd=bi.object({media:bi.boolean().or(bi.literal("auto")).default(td.proxy.media),dynamic:bi.boolean().default(td.proxy.dynamic),ssl_verification:bi.boolean().or(bi.literal("auto")).default(td.proxy.ssl_verification),ssl_ciphers:bi.enum(["default","insecure","intermediate","modern"]).or(bi.literal("auto")).default(td.proxy.ssl_ciphers)}),id=bi.object({camera_entity:bi.string().optional(),icon:bi.string().optional(),title:bi.string().optional(),capabilities:bi.object({disable:bi.enum(Io).array().optional(),disable_except:bi.enum(Io).array().optional()}).optional(),id:bi.string().optional(),dependencies:bi.object({all_cameras:bi.boolean().default(td.dependencies.all_cameras),cameras:bi.string().array().default(td.dependencies.cameras)}).default(td.dependencies),triggers:bi.object({motion:bi.boolean().default(td.triggers.motion),occupancy:bi.boolean().default(td.triggers.occupancy),entities:bi.string().array().default(td.triggers.entities),events:bi.enum(Xo).array().default(td.triggers.events)}).default(td.triggers),engine:bi.enum(["auto","frigate","generic","motioneye","reolink"]).default("auto"),frigate:bi.object({url:bi.string().optional(),client_id:bi.string().default(td.frigate.client_id),camera_name:bi.string().optional(),labels:bi.string().array().optional(),zones:bi.string().array().optional()}).default(td.frigate),motioneye:bi.object({url:bi.string().optional(),images:bi.object({directory_pattern:bi.string().includes("%").default(td.motioneye.images.directory_pattern),file_pattern:bi.string().includes("%").default(td.motioneye.images.file_pattern)}).default(td.motioneye.images),movies:bi.object({directory_pattern:bi.string().includes("%").default(td.motioneye.movies.directory_pattern),file_pattern:bi.string().includes("%").default(td.motioneye.movies.file_pattern)}).default(td.motioneye.movies)}).default(td.motioneye),reolink:bi.object({url:bi.string().optional(),media_resolution:bi.enum(["high","low"]).default(td.reolink.media_resolution)}).default(td.reolink),live_provider:bi.enum(["auto","image","ha","jsmpeg","go2rtc","webrtc-card"]).default(td.live_provider),go2rtc:Wl.optional(),image:kl.optional().default(Sl),jsmpeg:Ql.optional(),webrtc_card:Zl.optional(),cast:ed.optional(),ptz:xl.default(td.ptz),dimensions:bi.object({aspect_ratio:vl.optional(),layout:yl.optional()}).optional(),proxy:nd.default(td.proxy),always_error_if_entity_unavailable:bi.boolean().default(td.always_error_if_entity_unavailable)}).default(td),ad=id.array().min(1),rd={default:Wo,camera_select:"current",interaction_seconds:300,default_reset:{every_seconds:0,after_interaction:!1,entities:[],interaction_mode:"inactive"},default_cycle_camera:!1,dark_mode:"off",triggers:{show_trigger_status:!1,filter_selected_camera:!0,actions:{trigger:"update",untrigger:"none"},untrigger_seconds:0},keyboard_shortcuts:Lo},sd=bi.enum(["all","inactive","active"]).default("inactive"),od=bi.object({actions:bi.object({interaction_mode:sd,trigger:bi.enum(["default","live","media","none","update"]).default(rd.triggers.actions.trigger),untrigger:bi.enum(["default","none"]).default(rd.triggers.actions.untrigger)}).default(rd.triggers.actions),filter_selected_camera:bi.boolean().default(rd.triggers.filter_selected_camera),show_trigger_status:bi.boolean().default(rd.triggers.show_trigger_status),untrigger_seconds:bi.number().default(rd.triggers.untrigger_seconds)}),cd=bi.object({default:bi.enum(Uo).default(rd.default),camera_select:bi.enum([...Uo,"current"]).default(rd.camera_select),interaction_seconds:bi.number().default(rd.interaction_seconds),default_cycle_camera:bi.boolean().default(rd.default_cycle_camera),default_reset:bi.object({after_interaction:bi.boolean().default(rd.default_reset.after_interaction),every_seconds:bi.number().default(rd.default_reset.every_seconds),entities:bi.string().array().default(rd.default_reset.entities),interaction_mode:sd.default(rd.default_reset.interaction_mode)}).default(rd.default_reset),render_entities:bi.string().array().optional(),dark_mode:bi.enum(["on","off","auto"]).optional(),triggers:od.default(rd.triggers),keyboard_shortcuts:No.default(rd.keyboard_shortcuts)}).merge(Tc).default(rd),ld=["left","right","top","bottom"],dd=ld,ud={priority:50,enabled:!0},hd={priority:50,enabled:!1},pd={alignment:"left",button_size:40,buttons:{camera_ui:ud,cameras:ud,clips:ud,ptz_home:hd,display_mode:ud,download:ud,expand:hd,frigate:ud,fullscreen:ud,image:hd,live:ud,media_player:ud,microphone:{...hd,type:"momentary"},mute:hd,play:hd,ptz_controls:hd,recordings:hd,screenshot:hd,snapshots:ud,substreams:ud,timeline:ud},position:"top",style:"hidden"},gd=Zc.extend({enabled:Zc.shape.enabled.default(ud.enabled),priority:Zc.shape.priority.default(ud.priority)}),md=Zc.extend({enabled:Zc.shape.enabled.default(hd.enabled),priority:Zc.shape.priority.default(hd.priority)}),fd=bi.object({style:bi.enum(["none","hidden","overlay","hover","hover-card","outside"]).default(pd.style),position:bi.enum(ld).default(pd.position),alignment:bi.enum(dd).default(pd.alignment),buttons:bi.object({camera_ui:gd.default(pd.buttons.camera_ui),cameras:gd.default(pd.buttons.cameras),clips:gd.default(pd.buttons.clips),ptz_home:md.default(pd.buttons.ptz_home),display_mode:gd.default(pd.buttons.display_mode),download:gd.default(pd.buttons.download),expand:md.default(pd.buttons.expand),frigate:gd.default(pd.buttons.frigate),fullscreen:gd.default(pd.buttons.fullscreen),image:md.default(pd.buttons.image),live:gd.default(pd.buttons.live),media_player:gd.default(pd.buttons.media_player),microphone:md.extend({type:bi.enum(["momentary","toggle"]).default(pd.buttons.microphone.type)}).default(pd.buttons.microphone),mute:md.default(pd.buttons.mute),play:md.default(pd.buttons.play),ptz_controls:md.default(pd.buttons.ptz_controls),recordings:md.default(pd.buttons.recordings),screenshot:md.default(pd.buttons.screenshot),snapshots:gd.default(pd.buttons.snapshots),substreams:gd.default(pd.buttons.substreams),timeline:gd.default(pd.buttons.timeline)}).default(pd.buttons),button_size:bi.number().min(20).default(pd.button_size)}).default(pd),_d={priority:50,enabled:!0},yd={height:30,items:{engine:_d,resolution:_d,technology:_d,title:_d},position:"bottom",style:"popup",popup_seconds:3},vd=bi.object({position:bi.enum(["top","bottom"]).default(yd.position),style:bi.enum(["none","overlay","hover","hover-card","outside","popup"]).default(yd.style),popup_seconds:bi.number().min(0).max(60).default(yd.popup_seconds),height:bi.number().min(20).default(yd.height),items:bi.object({engine:Jc.default(yd.items.engine),technology:Jc.default(yd.items.technology),resolution:Jc.default(yd.items.resolution),title:Jc.default(yd.items.title)}).default(yd.items)}).default(yd),bd={auto_play:[...Qo],auto_pause:[...Zo],auto_mute:[...Zo],auto_unmute:[],lazy_load:!0,draggable:!0,zoomable:!0,transition_effect:"slide",snapshot_click_plays_clip:!0,display_mode:"single",controls:{builtin:!0,next_previous:{size:48,style:"thumbnails"},thumbnails:Tl,timeline:Ll,ptz:{...Cl,mode:"off"}}},wd=Hl.extend({style:bi.enum(["none","thumbnails","chevrons"]).default(bd.controls.next_previous.style),size:Hl.shape.size.default(bd.controls.next_previous.size)}),xd=bi.object({auto_play:bi.enum(Qo).array().default(bd.auto_play),auto_pause:bi.enum(Zo).array().default(bd.auto_pause),auto_mute:bi.enum(Zo).array().default(bd.auto_mute),auto_unmute:bi.enum(Qo).array().default(bd.auto_unmute),lazy_load:bi.boolean().default(bd.lazy_load),draggable:bi.boolean().default(bd.draggable),zoomable:bi.boolean().default(bd.zoomable),transition_effect:Bl.default(bd.transition_effect),snapshot_click_plays_clip:bi.boolean().default(bd.snapshot_click_plays_clip),display:ic,controls:bi.object({builtin:bi.boolean().default(bd.controls.builtin),next_previous:wd.default(bd.controls.next_previous),ptz:Ml.extend({mode:bi.enum(["off","on"]).default(bd.controls.ptz.mode)}).default(bd.controls.ptz),thumbnails:jl.default(bd.controls.thumbnails),timeline:Nl.default(bd.controls.timeline)}).default(bd.controls)}).merge(Tc).default(bd),Cd={...Tl,show_details:!1},Md={controls:{thumbnails:Cd,filter:{mode:"right"}}},Sd=jl.extend({show_details:bi.boolean().default(Cd.show_details)}),kd=bi.object({controls:bi.object({thumbnails:Sd.default(Md.controls.thumbnails),filter:bi.object({mode:bi.enum(["none","left","right"]).default(Md.controls.filter.mode)}).default(Md.controls.filter)}).default(Md.controls)}).merge(Tc).default(Md),Ed={aspect_ratio_mode:"dynamic",aspect_ratio:[16,9],height:"auto"},$d=bi.object({aspect_ratio_mode:bi.enum(["dynamic","static","unconstrained"]).default(Ed.aspect_ratio_mode),aspect_ratio:vl.default(Ed.aspect_ratio),height:bi.string().default(Ed.height)}).default(Ed),Ad=bi.object({conditions:ml.array(),merge:bi.object({}).passthrough().optional(),set:bi.object({}).passthrough().optional(),delete:bi.string().array().optional()}).array().optional(),Id=Ic.array(),zd=bi.object({conditions:ml.array(),actions:Id.optional(),actions_not:Id.optional()}).refine((e=>e.actions?.length||e.actions_not?.length),"Automations must include at least one action").array(),Td={features:{animated_progress_indicator:!0,media_chunk_size:50},style:{border_radius:!0,box_shadow:!0}},jd=bi.object({features:bi.object({animated_progress_indicator:bi.boolean().default(Td.features.animated_progress_indicator),media_chunk_size:bi.number().min(0).max(1e3).default(Td.features.media_chunk_size),max_simultaneous_engine_requests:bi.number().min(1).optional()}).default(Td.features),style:bi.object({border_radius:bi.boolean().default(Td.style.border_radius),box_shadow:bi.boolean().default(Td.style.box_shadow)}).default(Td.style)}).default(Td),Od={logging:!1},Dd=bi.object({logging:bi.boolean().default(Od.logging)}).default(Od),Rd=bi.enum(["casting","low-performance","scrubbing"]).array().optional(),Pd=bi.object({cameras:jo(ad),cameras_global:id,view:cd,menu:fd,status_bar:vd,live:Xl,media_gallery:kd,media_viewer:xd,image:El,elements:_l,dimensions:$d,timeline:Vl,performance:jd,debug:Dd,automations:zd.optional(),profiles:Rd,overrides:Ad,card_mod:bi.unknown(),card_id:bi.string().regex(Jo).optional(),type:bi.string()}),Ld={cameras:td,view:rd,menu:pd,status_bar:yd,live:Yl,media_gallery:Md,media_viewer:bd,image:Sl,timeline:Fl,performance:Td,debug:Od};function Nd(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function Fd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Vd(e,t){const n=Nd(e);return isNaN(t)?Fd(e,NaN):t?(n.setDate(n.getDate()+t),n):n}function Hd(e,t){const n=Nd(e);if(isNaN(t))return Fd(e,NaN);if(!t)return n;const i=n.getDate(),a=Fd(e,n.getTime());a.setMonth(n.getMonth()+t+1,0);return i>=a.getDate()?a:(n.setFullYear(a.getFullYear(),a.getMonth(),i),n)}function Bd(e,t){const{years:n=0,months:i=0,weeks:a=0,days:r=0,hours:s=0,minutes:o=0,seconds:c=0}=t,l=Nd(e),d=i||n?Hd(l,i+12*n):l,u=1e3*(c+60*(o+60*s));return Fd(e,(r||a?Vd(d,r+7*a):d).getTime()+u)}const qd=6048e5,Ud=864e5,Wd=6e4,Zd=36e5,Qd=1e3;let Gd={};function Yd(){return Gd}function Kd(e,t){const n=Yd(),i=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=Nd(e),r=a.getDay(),s=(r=a.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function eu(e){const t=Nd(e);return t.setHours(0,0,0,0),t}function tu(e){const t=Nd(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function nu(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=Nd(e);return!isNaN(Number(n))}function iu(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return 0===n?0:n}}function au(e,t){return+Nd(e)-+Nd(t)}function ru(e,t,n){const i=au(e,t)/1e3;return iu(n?.roundingMethod)(i)}const su={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function ou(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const cu={date:ou({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:ou({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:ou({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},lu={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function du(e){return(t,n)=>{let i;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,a=n?.width?String(n.width):t;i=e.formattingValues[a]||e.formattingValues[t]}else{const t=e.defaultWidth,a=n?.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[t]}return i[e.argumentCallback?e.argumentCallback(t):t]}}function uu(e){return(t,n={})=>{const i=n.width,a=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],r=t.match(a);if(!r)return null;const s=r[0],o=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(o)?function(e,t){for(let n=0;ne.test(s))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(o,(e=>e.test(s)));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(s.length)}}}var hu;const pu={code:"en-US",formatDistance:(e,t,n)=>{let i;const a=su[e];return i="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i},formatLong:cu,formatRelative:(e,t,n,i)=>lu[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:du({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:du({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:du({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:du({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:du({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(hu={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(hu.matchPattern);if(!n)return null;const i=n[0],a=e.match(hu.parsePattern);if(!a)return null;let r=hu.valueCallback?hu.valueCallback(a[0]):a[0];return r=t.valueCallback?t.valueCallback(r):r,{value:r,rest:e.slice(i.length)}}),era:uu({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:uu({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:uu({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:uu({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:uu({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function gu(e){const t=Nd(e),n=function(e,t){const n=eu(e),i=eu(t),a=+n-tu(n),r=+i-tu(i);return Math.round((a-r)/Ud)}(t,function(e){const t=Nd(e),n=Fd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function mu(e){const t=Nd(e),n=+Xd(t)-+function(e){const t=Jd(e),n=Fd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Xd(n)}(t);return Math.round(n/qd)+1}function fu(e,t){const n=Nd(e),i=n.getFullYear(),a=Yd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,s=Fd(e,0);s.setFullYear(i+1,0,r),s.setHours(0,0,0,0);const o=Kd(s,t),c=Fd(e,0);c.setFullYear(i,0,r),c.setHours(0,0,0,0);const l=Kd(c,t);return n.getTime()>=o.getTime()?i+1:n.getTime()>=l.getTime()?i:i-1}function _u(e,t){const n=Nd(e),i=+Kd(n,t)-+function(e,t){const n=Yd(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=fu(e,t),r=Fd(e,0);return r.setFullYear(a,0,i),r.setHours(0,0,0,0),Kd(r,t)}(n,t);return Math.round(i/qd)+1}function yu(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const vu={y(e,t){const n=e.getFullYear(),i=n>0?n:1-n;return yu("yy"===t?i%100:i,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):yu(n+1,2)},d:(e,t)=>yu(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>yu(e.getHours()%12||12,t.length),H:(e,t)=>yu(e.getHours(),t.length),m:(e,t)=>yu(e.getMinutes(),t.length),s:(e,t)=>yu(e.getSeconds(),t.length),S(e,t){const n=t.length,i=e.getMilliseconds();return yu(Math.trunc(i*Math.pow(10,n-3)),t.length)}},bu="midnight",wu="noon",xu="morning",Cu="afternoon",Mu="evening",Su="night",ku={G:function(e,t,n){const i=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});default:return n.era(i,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear(),i=t>0?t:1-t;return n.ordinalNumber(i,{unit:"year"})}return vu.y(e,t)},Y:function(e,t,n,i){const a=fu(e,i),r=a>0?a:1-a;if("YY"===t){return yu(r%100,2)}return"Yo"===t?n.ordinalNumber(r,{unit:"year"}):yu(r,t.length)},R:function(e,t){return yu(Jd(e),t.length)},u:function(e,t){return yu(e.getFullYear(),t.length)},Q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(i);case"QQ":return yu(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});default:return n.quarter(i,{width:"wide",context:"formatting"})}},q:function(e,t,n){const i=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(i);case"qq":return yu(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});default:return n.quarter(i,{width:"wide",context:"standalone"})}},M:function(e,t,n){const i=e.getMonth();switch(t){case"M":case"MM":return vu.M(e,t);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});default:return n.month(i,{width:"wide",context:"formatting"})}},L:function(e,t,n){const i=e.getMonth();switch(t){case"L":return String(i+1);case"LL":return yu(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});default:return n.month(i,{width:"wide",context:"standalone"})}},w:function(e,t,n,i){const a=_u(e,i);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):yu(a,t.length)},I:function(e,t,n){const i=mu(e);return"Io"===t?n.ordinalNumber(i,{unit:"week"}):yu(i,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):vu.d(e,t)},D:function(e,t,n){const i=gu(e);return"Do"===t?n.ordinalNumber(i,{unit:"dayOfYear"}):yu(i,t.length)},E:function(e,t,n){const i=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},e:function(e,t,n,i){const a=e.getDay(),r=(a-i.weekStartsOn+8)%7||7;switch(t){case"e":return String(r);case"ee":return yu(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,i){const a=e.getDay(),r=(a-i.weekStartsOn+8)%7||7;switch(t){case"c":return String(r);case"cc":return yu(r,t.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const i=e.getDay(),a=0===i?7:i;switch(t){case"i":return String(a);case"ii":return yu(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const i=e.getHours();let a;switch(a=12===i?wu:0===i?bu:i/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const i=e.getHours();let a;switch(a=i>=17?Mu:i>=12?Cu:i>=4?xu:Su,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return vu.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):vu.H(e,t)},K:function(e,t,n){const i=e.getHours()%12;return"Ko"===t?n.ordinalNumber(i,{unit:"hour"}):yu(i,t.length)},k:function(e,t,n){let i=e.getHours();return 0===i&&(i=24),"ko"===t?n.ordinalNumber(i,{unit:"hour"}):yu(i,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):vu.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):vu.s(e,t)},S:function(e,t){return vu.S(e,t)},X:function(e,t,n){const i=e.getTimezoneOffset();if(0===i)return"Z";switch(t){case"X":return $u(i);case"XXXX":case"XX":return Au(i);default:return Au(i,":")}},x:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"x":return $u(i);case"xxxx":case"xx":return Au(i);default:return Au(i,":")}},O:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Eu(i,":");default:return"GMT"+Au(i,":")}},z:function(e,t,n){const i=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Eu(i,":");default:return"GMT"+Au(i,":")}},t:function(e,t,n){return yu(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return yu(e.getTime(),t.length)}};function Eu(e,t=""){const n=e>0?"-":"+",i=Math.abs(e),a=Math.trunc(i/60),r=i%60;return 0===r?n+String(a):n+String(a)+t+yu(r,2)}function $u(e,t){if(e%60==0){return(e>0?"-":"+")+yu(Math.abs(e)/60,2)}return Au(e,t)}function Au(e,t=""){const n=e>0?"-":"+",i=Math.abs(e);return n+yu(Math.trunc(i/60),2)+t+yu(i%60,2)}const Iu=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},zu=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Tu={p:zu,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],i=n[1],a=n[2];if(!a)return Iu(e,t);let r;switch(i){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",Iu(i,t)).replace("{{time}}",zu(a,t))}},ju=/^D+$/,Ou=/^Y+$/,Du=["D","DD","YY","YYYY"];function Ru(e){return ju.test(e)}function Pu(e){return Ou.test(e)}function Lu(e,t,n){const i=function(e,t,n){const i="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${i} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(console.warn(i),Du.includes(e))throw new RangeError(i)}const Nu=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Fu=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Vu=/^'([^]*?)'?$/,Hu=/''/g,Bu=/[a-zA-Z]/;function qu(e,t,n){const i=Yd(),a=n?.locale??i.locale??pu,r=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??i.weekStartsOn??i.locale?.options?.weekStartsOn??0,o=Nd(e);if(!nu(o))throw new RangeError("Invalid time value");let c=t.match(Fu).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Tu[t])(e,a.formatLong)}return e})).join("").match(Nu).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Uu(e)};if(ku[t])return{isToken:!0,value:e};if(t.match(Bu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));a.localize.preprocessor&&(c=a.localize.preprocessor(o,c));const l={firstWeekContainsDate:r,weekStartsOn:s,locale:a};return c.map((i=>{if(!i.isToken)return i.value;const r=i.value;(!n?.useAdditionalWeekYearTokens&&Pu(r)||!n?.useAdditionalDayOfYearTokens&&Ru(r))&&Lu(r,t,String(e));return(0,ku[r[0]])(o,r,a.localize,l)})).join("")}function Uu(e){const t=e.match(Vu);return t?t[1].replace(Hu,"'"):e}function Wu(e,t){const{years:n=0,months:i=0,weeks:a=0,days:r=0,hours:s=0,minutes:o=0,seconds:c=0}=t,l=function(e,t){return Hd(e,-t)}(e,i+12*n),d=function(e,t){return Vd(e,-t)}(l,r+7*a),u=1e3*(c+60*(o+60*s));return Fd(e,d.getTime()-u)}function Zu(e,t){return e===t||e!=e&&t!=t}function Qu(e,t){for(var n=e.length;n--;)if(Zu(e[n][0],t))return n;return-1}var Gu=Array.prototype.splice;function Yu(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1},Yu.prototype.set=function(e,t){var n=this.__data__,i=Qu(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Ku="object"==typeof global&&global&&global.Object===Object&&global,Xu="object"==typeof self&&self&&self.Object===Object&&self,Ju=Ku||Xu||Function("return this")(),eh=Ju.Symbol,th=Object.prototype,nh=th.hasOwnProperty,ih=th.toString,ah=eh?eh.toStringTag:void 0;var rh=Object.prototype.toString;var sh="[object Null]",oh="[object Undefined]",ch=eh?eh.toStringTag:void 0;function lh(e){return null==e?void 0===e?oh:sh:ch&&ch in Object(e)?function(e){var t=nh.call(e,ah),n=e[ah];try{e[ah]=void 0;var i=!0}catch(e){}var a=ih.call(e);return i&&(t?e[ah]=n:delete e[ah]),a}(e):function(e){return rh.call(e)}(e)}function dh(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var uh="[object AsyncFunction]",hh="[object Function]",ph="[object GeneratorFunction]",gh="[object Proxy]";function mh(e){if(!dh(e))return!1;var t=lh(e);return t==hh||t==ph||t==uh||t==gh}var fh,_h=Ju["__core-js_shared__"],yh=(fh=/[^.]+$/.exec(_h&&_h.keys&&_h.keys.IE_PROTO||""))?"Symbol(src)_1."+fh:"";var vh=Function.prototype.toString;function bh(e){if(null!=e){try{return vh.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var wh=/^\[object .+?Constructor\]$/,xh=Function.prototype,Ch=Object.prototype,Mh=xh.toString,Sh=Ch.hasOwnProperty,kh=RegExp("^"+Mh.call(Sh).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Eh(e){return!(!dh(e)||(t=e,yh&&yh in t))&&(mh(e)?kh:wh).test(bh(e));var t}function $h(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Eh(n)?n:void 0}var Ah=$h(Ju,"Map"),Ih=$h(Object,"create");var zh=Object.prototype.hasOwnProperty;var Th=Object.prototype.hasOwnProperty;function jh(e){var t=-1,n=null==e?0:e.length;for(this.clear();++to))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var u=-1,h=!0,p=n&Vh?new Ph:void 0;for(r.set(e,t),r.set(t,e);++u-1&&e%1==0&&e-1&&e%1==0&&e<=Ep}var Ap={};function Ip(e){return function(t){return e(t)}}Ap["[object Float32Array]"]=Ap["[object Float64Array]"]=Ap["[object Int8Array]"]=Ap["[object Int16Array]"]=Ap["[object Int32Array]"]=Ap["[object Uint8Array]"]=Ap["[object Uint8ClampedArray]"]=Ap["[object Uint16Array]"]=Ap["[object Uint32Array]"]=!0,Ap["[object Arguments]"]=Ap["[object Array]"]=Ap["[object ArrayBuffer]"]=Ap["[object Boolean]"]=Ap["[object DataView]"]=Ap["[object Date]"]=Ap["[object Error]"]=Ap["[object Function]"]=Ap["[object Map]"]=Ap["[object Number]"]=Ap["[object Object]"]=Ap["[object RegExp]"]=Ap["[object Set]"]=Ap["[object String]"]=Ap["[object WeakMap]"]=!1;var zp="object"==typeof exports&&exports&&!exports.nodeType&&exports,Tp=zp&&"object"==typeof module&&module&&!module.nodeType&&module,jp=Tp&&Tp.exports===zp&&Ku.process,Op=function(){try{var e=Tp&&Tp.require&&Tp.require("util").types;return e||jp&&jp.binding&&jp.binding("util")}catch(e){}}(),Dp=Op,Rp=Dp&&Dp.isTypedArray,Pp=Rp?Ip(Rp):function(e){return gp(e)&&$p(e.length)&&!!Ap[lh(e)]},Lp=Object.prototype.hasOwnProperty;function Np(e,t){var n=cp(e),i=!n&&vp(e),a=!n&&!i&&Cp(e),r=!n&&!i&&!a&&Pp(e),s=n||i||a||r,o=s?function(e,t){for(var n=-1,i=Array(e);++n0){if(++am>=800)return arguments[0]}else am=0;return im.apply(void 0,arguments)});function om(e,t){return sm(function(e,t,n){return t=Jg(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,r=Jg(i.length-t,0),s=Array(r);++a1?n[a-1]:void 0,s=a>2?n[2]:void 0;for(r=e.length>3&&"function"==typeof r?(a--,r):void 0,s&&cm(n[0],n[1],s)&&(r=a<3?void 0:r,a=1),t=Object(t);++i-1}function Pm(e,t,n){for(var i=-1,a=null==e?0:e.length;++i=Nm){var l=t?null:Lm(e);if(l)return Uh(l);s=!1,a=Nh,c=new Ph}else c=t?[]:o;e:for(;++ie[0].toUpperCase()+e.substring(1))).join(" ")}function Bm(e,t,n){const i=e[t];return e.splice(t,1),e.splice(n,0,i),e}const qm=e=>Array.isArray(e)?e:[e],Um=e=>e instanceof Set?e:new Set(qm(e));function Wm(e,t,n){return!function(e,t,n){var i=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===i?yg(e,t,void 0,n):!!i}(e,t,n)}function Zm(e,t=console.warn){e instanceof $o&&e.context?t(e,e.context):t("object"==typeof e&&"message"in e?e.message:e)}const Qm=()=>window.matchMedia("(hover: hover) and (pointer: fine)").matches,Gm=(e,t)=>qu(e,"yyyy-MM-dd HH:mm"+(t?":ss":"")),Ym=e=>qu(e,"yyyy-MM-dd"),Km=(e,t)=>{window.requestIdleCallback?window.requestIdleCallback(e,{...t&&{timeout:t}}):e()};function Xm(e,t){const n=function(e,t,n){const i=au(e,t)/Zd;return iu(n?.roundingMethod)(i)}(t,e),i=function(e,t,n){const i=au(e,t)/Wd;return iu(n?.roundingMethod)(i)}(t,e)-60*n;let a="";return n&&(a+=`${n}h `),i&&(a+=`${i}m `),a+=`${ru(t,e)-60*n*60-60*i}s`,a}const Jm=async(e,t)=>await Promise.all(Array.from(e).map((e=>t(e)))),ef=e=>new Date(`${e}T00:00:00`),tf=async e=>{await new Promise((t=>setTimeout(t,1e3*e)))},nf=e=>!isNaN(e.getTime()),af=(e,t,n,i)=>{t?e.setAttribute(n,i??""):e.removeAttribute(n)},rf=e=>!!e,sf=e=>e instanceof HTMLElement,of=e=>(e instanceof HTMLSlotElement?e.assignedElements({flatten:!0}):[...e.children]).filter(sf),cf=e=>e?.ratio&&2===e.ratio.length?`${e.ratio[0]} / ${e.ratio[1]}`:e?.defaultStatic?"16 / 9":"auto",lf=e=>({"aspect-ratio":cf(e)}),df=e=>{if(Array.isArray(e))return e.filter((e=>void 0!==e)).map((e=>df(e)));if("object"==typeof e&&null!==e){const t={};for(const n in e)t[n]=df(e[n]);return t}return e},uf=(e,t,n)=>Om(e,n)===Om(t,n);function hf(e){if(!e)return null;const t=Ac.safeParse(e);return t.success?t.data:null}function pf(e,t){return{action:"fire-dom-event",frigate_card_action:e,...t?.cardID&&{card_id:t.cardID}}}function gf(e,t,n){return{action:"fire-dom-event",frigate_card_action:e,camera:t,...n?.cardID&&{card_id:n.cardID}}}function mf(e,t,n){return{action:"fire-dom-event",frigate_card_action:"media_player",media_player:e,media_player_action:t,...n?.cardID&&{card_id:n.cardID}}}function ff(e){return{action:"fire-dom-event",frigate_card_action:"ptz_multi",...e?.cardID&&{card_id:e.cardID},...e?.ptzAction&&{ptz_action:e.ptzAction},...e?.ptzPhase&&{ptz_phase:e.ptzPhase},...e?.ptzPreset&&{ptz_preset:e.ptzPreset},...e?.targetID&&{target_id:e.targetID}}}function _f(e,t){return e&&t?"tap"===e&&t.tap_action?t.tap_action:"hold"===e&&t.hold_action?t.hold_action:"double_tap"===e&&t.double_tap_action?t.double_tap_action:"end_tap"===e&&t.end_tap_action?t.end_tap_action:"start_tap"===e&&t.start_tap_action?t.start_tap_action:null:null}const yf=e=>qm(e).some((e=>function(e){return void 0!==e&&"none"!==e.action}(e))),vf=e=>{e.stopPropagation()};class bf{constructor(){this._timer=null,this._repeated=!1}stop(){this._timer&&(this._repeated?window.clearInterval(this._timer):window.clearTimeout(this._timer),this._timer=null)}isRunning(){return null!==this._timer}start(e,t){this.stop(),this._timer=window.setTimeout((()=>{this._timer=null,t()}),1e3*e),this._repeated=!1}startRepeated(e,t){this.stop(),this._timer=window.setInterval((()=>{t()}),1e3*e),this._repeated=!0}}class wf extends HTMLElement{constructor(){super(...arguments),this.holdTime=.4,this.holdTimer=new bf,this.doubleClickTimer=new bf,this.held=!1,this.started=!1}connectedCallback(){["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((e=>{document.addEventListener(e,(()=>{this.holdTimer.stop()}),{passive:!0})}))}bind(e,t){if(e.actionHandlerOptions)return void(e.actionHandlerOptions=t);e.actionHandlerOptions=t,e.addEventListener("contextmenu",(e=>{const t=e||window.event;return t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0,t.returnValue=!1,!1}));const n=()=>{this.held=!1,this.holdTimer.start(this.holdTime,(()=>{this.held=!0})),this.started||(this.started=!0,et(e,"action",{action:"start_tap"}))},i=t=>{this.holdTimer.stop(),this.started&&(this.started=!1,et(e,"action",{action:"end_tap"}))},a=t=>{const n=e.actionHandlerOptions;n?.allowPropagation||vf(t),["touchend","touchcancel"].includes(t.type)&&!this.held||(i(),n?.hasHold&&this.held?et(e,"action",{action:"hold"}):n?.hasDoubleClick?"click"===t.type&&t.detail<2||!this.doubleClickTimer.isRunning()?this.doubleClickTimer.start(.25,(()=>et(e,"action",{action:"tap"}))):(this.doubleClickTimer.stop(),et(e,"action",{action:"double_tap"})):et(e,"action",{action:"tap"}))};e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchend",a),e.addEventListener("touchcancel",a),e.addEventListener("mousedown",n,{passive:!0}),e.addEventListener("click",a),e.addEventListener("keyup",(e=>{"Enter"===e.key&&a(e)})),e.addEventListener("mouseleave",i)}}customElements.define("action-handler-frigate-card",wf);const xf=(e,t)=>{const n=(()=>{const e=document.body;if(e.querySelector("action-handler-frigate-card"))return e.querySelector("action-handler-frigate-card");const t=document.createElement("action-handler-frigate-card");return e.appendChild(t),t})();n&&n.bind(e,t)},Cf=me(class extends fe{update(e,[t]){return xf(e.element,t),U}render(e){}});var Mf=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)op(t,pp(e)),e=Dg(e);return t}:dp;function Sf(e){return lp(e,Gg,Mf)}var kf=Object.prototype.hasOwnProperty;var Ef=/\w*$/;var $f=eh?eh.prototype:void 0,Af=$f?$f.valueOf:void 0;var If="[object Boolean]",zf="[object Date]",Tf="[object Map]",jf="[object Number]",Of="[object RegExp]",Df="[object Set]",Rf="[object String]",Pf="[object Symbol]",Lf="[object ArrayBuffer]",Nf="[object DataView]",Ff="[object Float32Array]",Vf="[object Float64Array]",Hf="[object Int8Array]",Bf="[object Int16Array]",qf="[object Int32Array]",Uf="[object Uint8Array]",Wf="[object Uint8ClampedArray]",Zf="[object Uint16Array]",Qf="[object Uint32Array]";function Gf(e,t,n){var i,a,r,s=e.constructor;switch(t){case Lf:return Ig(e);case If:case zf:return new s(+e);case Nf:return function(e,t){var n=t?Ig(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case Ff:case Vf:case Hf:case Bf:case qf:case Uf:case Wf:case Zf:case Qf:return zg(e,n);case Tf:return new s;case jf:case Rf:return new s(e);case Of:return(r=new(a=e).constructor(a.source,Ef.exec(a))).lastIndex=a.lastIndex,r;case Df:return new s;case Pf:return i=e,Af?Object(Af.call(i)):{}}}var Yf=Dp&&Dp.isMap,Kf=Yf?Ip(Yf):function(e){return gp(e)&&"[object Map]"==ug(e)};var Xf=Dp&&Dp.isSet,Jf=Xf?Ip(Xf):function(e){return gp(e)&&"[object Set]"==ug(e)},e_=1,t_=2,n_=4,i_="[object Arguments]",a_="[object Function]",r_="[object GeneratorFunction]",s_="[object Object]",o_={};function c_(e,t,n,i,a,r){var s,o=t&e_,c=t&t_,l=t&n_;if(n&&(s=a?n(e,i,a,r):n(e)),void 0!==s)return s;if(!dh(e))return e;var d=cp(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&kf.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!o)return Tg(e,s)}else{var u=ug(e),h=u==a_||u==r_;if(Cp(e))return Ag(e,o);if(u==s_||u==i_||h&&!a){if(s=c||h?{}:Rg(e),!o)return c?function(e,t){return Wg(e,Mf(e),t)}(e,function(e,t){return e&&Wg(t,Gg(t),e)}(s,e)):function(e,t){return Wg(e,pp(e),t)}(e,function(e,t){return e&&Wg(t,Wp(t),e)}(s,e))}else{if(!o_[u])return a?e:{};s=Gf(e,u,o)}}r||(r=new Rh);var p=r.get(e);if(p)return p;r.set(e,s),Jf(e)?e.forEach((function(i){s.add(c_(i,t,n,i,e,r))})):Kf(e)&&e.forEach((function(i,a){s.set(a,c_(i,t,n,a,e,r))}));var g=d?void 0:(l?c?Sf:Zp:c?Gg:Wp)(e);return function(e,t){for(var n=-1,i=null==e?0:e.length;++nvoid 0===globalThis.DOMException?new m_(e):new DOMException(e),__=e=>{const t=void 0===e.reason?f_("This operation was aborted."):e.reason;return t instanceof Error?t:f_(t)};class y_{#e=[];enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority)return void this.#e.push(n);const i=function(e,t,n){let i=0,a=e.length;for(;a>0;){const r=Math.trunc(a/2);let s=i+r;n(e[s],t)<=0?(i=++s,a-=r+1):a=r}return i}(this.#e,n,((e,t)=>t.priority-e.priority));this.#e.splice(i,0,n)}dequeue(){const e=this.#e.shift();return e?.run}filter(e){return this.#e.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this.#e.length}}class v_ extends p_{#t;#n;#i=0;#a;#r;#s=0;#o;#c;#e;#l;#d=0;#u;#h;#p;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:y_,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#t=e.carryoverConcurrencyCount,this.#n=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#a=e.intervalCap,this.#r=e.interval,this.#e=new e.queueClass,this.#l=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#p=!0===e.throwOnTimeout,this.#h=!1===e.autoStart}get#g(){return this.#n||this.#i{this.#y()}),t)),!0;this.#i=this.#t?this.#d:0}return!1}#_(){if(0===this.#e.size)return this.#o&&clearInterval(this.#o),this.#o=void 0,this.emit("empty"),0===this.#d&&this.emit("idle"),!1;if(!this.#h){const e=!this.#w;if(this.#g&&this.#m){const t=this.#e.dequeue();return!!t&&(this.emit("active"),t(),e&&this.#b(),!0)}}return!1}#b(){this.#n||void 0!==this.#o||(this.#o=setInterval((()=>{this.#v()}),this.#r),this.#s=Date.now()+this.#r)}#v(){0===this.#i&&0===this.#d&&this.#o&&(clearInterval(this.#o),this.#o=void 0),this.#i=this.#t?this.#d:0,this.#x()}#x(){for(;this.#_(););}get concurrency(){return this.#u}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#x()}async#C(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(e.reason)}),{once:!0})}))}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#p,...t},new Promise(((n,i)=>{this.#e.enqueue((async()=>{this.#d++,this.#i++;try{t.signal?.throwIfAborted();let i=e({signal:t.signal});t.timeout&&(i=function(e,t){const{milliseconds:n,fallback:i,message:a,customTimers:r={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let s;const o=new Promise(((o,c)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){const{signal:e}=t;e.aborted&&c(__(e)),e.addEventListener("abort",(()=>{c(__(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(o,c);const l=new g_;s=r.setTimeout.call(void 0,(()=>{if(i)try{o(i())}catch(e){c(e)}else"function"==typeof e.cancel&&e.cancel(),!1===a?o():a instanceof Error?c(a):(l.message=a??`Promise timed out after ${n} milliseconds`,c(l))}),n),(async()=>{try{o(await e)}catch(e){c(e)}})()})),c=o.finally((()=>{c.clear()}));return c.clear=()=>{r.clearTimeout.call(void 0,s),s=void 0},c}(Promise.resolve(i),{milliseconds:t.timeout})),t.signal&&(i=Promise.race([i,this.#C(t.signal)]));const a=await i;n(a),this.emit("completed",a)}catch(e){if(e instanceof g_&&!t.throwOnTimeout)return void n();i(e),this.emit("error",e)}finally{this.#f()}}),t),this.emit("add"),this.#_()}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this.#h?(this.#h=!1,this.#x(),this):this}pause(){this.#h=!0}clear(){this.#e=new this.#l}async onEmpty(){0!==this.#e.size&&await this.#M("empty")}async onSizeLessThan(e){this.#e.sizethis.#e.size{const i=()=>{t&&!t()||(this.off(e,i),n())};this.on(e,i)}))}get size(){return this.#e.size}sizeBy(e){return this.#e.filter(e).length}get pending(){return this.#d}get isPaused(){return this.#h}}var b_={frigate_card:"Frigate card",frigate_card_description:"A Lovelace card for use with Frigate",live:"Live",no_media:"No media to display",recordings:"Recordings",version:"Version"},w_={cameras:{camera_entity:"Camera Entity",capabilities:{capabilities:{clips:"Clips","favorite-events":"Favorite Events","favorite-recordings":"Favorite Recordings",live:"Live",menu:"Menu",ptz:"PTZ",recordings:"Recordings",seek:"Seeking",snapshots:"Snapshots",substream:"Substream"},disable:"Disable",disable_except:"Disable except",editor_label:"Camera capabilities"},cast:{dashboard:{dashboard_path:"Dashboard path",view_path:"View path"},editor_label:"Cast options",method:"Cast method",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Show events for all cameras with this camera",cameras:"Show events for specific cameras with this camera",editor_label:"Dependency options"},dimensions:{aspect_ratio:"Static aspect ratio",editor_label:"Camera dimensions",layout:{editor_label:"Camera Layout",fit:"Layout fit",fits:{contain:"Media is contained/letterboxed",cover:"Media expands proportionally to cover the card",fill:"Media is stretched to fill the card"},pan:{x:"Pan horizontal percentage",y:"Pan vertical percentage"},position:{editor_label:"Layout Cover Position",x:"Horizontal placement percentage",y:"Vertical placement percentage"},view_box:{bottom:"Bottom inset percentage",editor_label:"Layout View Box",left:"Left inset percentage",right:"Right inset percentage",top:"Top inset percentage"},zoom:"Zoom factor"}},engines:{editor_label:"Camera engine options"},frigate:{camera_name:"Frigate camera name (Autodetected from entity)",client_id:"Frigate client id (For >1 Frigate server)",editor_label:"Frigate options",labels:"Frigate labels/object filters",url:"Frigate server URL",zones:"Frigate zones"},go2rtc:{editor_label:"go2rtc Options",modes:{editor_label:"go2rtc Modes",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"go2rtc stream name"},icon:"Icon for this camera (Autodetected from entity)",id:"Unique id for this camera in this card",image:{editor_label:"Image Options",refresh_seconds:"Number of seconds after which to refresh live image (0=never)",url:"Image URL to use instead of camera entity snapshot"},live_provider:"Live view provider for this camera",live_provider_options:{editor_label:"Live provider options"},live_providers:{auto:"Automatic",go2rtc:"go2rtc",ha:"Home Assistant video stream (i.e. HLS, LL-HLS, WebRTC via HA)",image:"Home Assistant images",jsmpeg:"JSMpeg","webrtc-card":"WebRTC Card (i.e. AlexxIT's WebRTC Card)"},motioneye:{editor_label:"MotionEye options",images:{directory_pattern:"Images directory pattern",file_pattern:"Images file pattern"},movies:{directory_pattern:"Movies directory pattern",file_pattern:"Movies file pattern"},url:"MotionEye UI URL"},proxy:{dynamic:"Dynamic proxying",editor_label:"Camera proxying",media:{auto:"Media proxying automatically configured",editor_label:"Media proxying",false:"Media proxying disabled",true:"Media proxying enabled"},ssl_ciphers:{auto:"SSL ciphers automatically configured",default:"Default SSL ciphers",editor_label:"SSL ciphers",insecure:"Insecure SSL ciphers",intermediate:"Intermediate SSL ciphers",modern:"Modern SSL ciphers"},ssl_verification:{auto:"SSL verification automatically configured",editor_label:"SSL verification",false:"SSL verification disabled",true:"SSL verification enabled"}},reolink:{editor_label:"Reolink options",media_resolution:{editor_label:"Media Resolution",high:"High Resolution",low:"Low Resolution"},url:"Reolink UI URL"},title:"Title for this camera (Autodetected from entity)",triggers:{editor_label:"Trigger options",entities:"Trigger from other entities",events:{clips:"Events with new clips",editor_label:"Trigger Events",events:"All events",snapshots:"Events with new snapshots"},motion:"Trigger by auto-detecting the motion sensor",occupancy:"Trigger by auto-detecting the occupancy sensor"},webrtc_card:{editor_label:"WebRTC Card Options",entity:"WebRTC Card Camera Entity (Not a Frigate camera)",url:"WebRTC Card Camera URL"}},common:{controls:{builtin:"Built-in video controls",filter:{editor_label:"Media Filter",mode:"Filter mode",modes:{left:"Media filter in a drawer to the left",none:"No media filter",right:"Media filter in a drawer to the right"}},next_previous:{editor_label:"Next & Previous",size:"Next & previous control size in pixels",style:"Next & previous control style",styles:{chevrons:"Chevrons",icons:"Icons",none:"None",thumbnails:"Thumbnails"}},thumbnails:{editor_label:"Thumbnails",events_media_type:"Whether to show event thumbnails of clips or snapshots",events_media_types:{clips:"Clip thumbnails",snapshots:"Snapshot thumbnails"},media_type:"Whether to show thumnails of events or recordings",media_types:{events:"Events",recordings:"Recordings"},mode:"Thumbnails mode",modes:{above:"Thumbnails above",below:"Thumbnails below",left:"Thumbnails in a drawer to the left",none:"No thumbnails",right:"Thumbnails in a drawer to the right"},show_details:"Show details with thumbnails",show_download_control:"Show download control on thumbnails",show_favorite_control:"Show favorite control on thumbnails",show_timeline_control:"Show timeline control on thumbnails",size:"Thumbnails size in pixels"},timeline:{editor_label:"Mini Timeline",mode:"Mode",modes:{above:"Above",below:"Below",none:"None"},pan_mode:"Default pan mode",pan_modes:{pan:"Pan",seek:"Pan seeks across all media","seek-in-camera":"Pan seeks within selected camera only","seek-in-media":"Pan seeks within selected media item only"}}},display:{editor_label:"Display",grid_columns:"Exact number of grid columns",grid_max_columns:"Maximum number of grid columns",grid_selected_width_factor:"Increase selected media width by this factor",mode:"Mode"},image:{entity:"Entity for use with entity mode",entity_parameters:"Query parameters added to the entity-based picture URLs (e.g. width=1920&height=1080)",mode:"Image mode",modes:{camera:"Home Assistant camera snapshot of camera entity",entity:"Entity with entity_picture attribute",screensaver:"Embedded Frigate logo",url:"Arbitrary image specified by URL"},refresh_seconds:"Number of seconds after which to refresh (0=never)",url:"Static image URL"},media_action_conditions:{all:"All opportunities",hidden:"On browser/tab hiding",microphone_mute:"On microphone mute",microphone_unmute:"On microphone unmute",never:"Never",selected:"On selection",unselected:"On unselection",visible:"On browser/tab visibility"},timeline:{clustering_threshold:"The count of events at which they are clustered (0=no clustering)",events_media_type:"The events media the timeline displays",events_media_types:{all:"All event media types",clips:"Clips",snapshots:"Snapshots"},show_recordings:"Show recordings",style:"Timeline style",styles:{ribbon:"Events on a single ribbon",stack:"Stacked & clustered events"},window_seconds:"The default length of the timeline view in seconds"}},dimensions:{aspect_ratio:"Default aspect ratio (e.g. '16:9')",aspect_ratio_mode:"Aspect ratio mode",aspect_ratio_modes:{dynamic:"Aspect ratio adjusts to media",static:"Static aspect ratio",unconstrained:"Unconstrained aspect ratio"},height:"Card height in CSS units (e.g. '500px')"},live:{auto_mute:"Automatically mute live cameras",auto_pause:"Automatically pause live cameras",auto_play:"Automatically play live cameras",auto_unmute:"Automatically unmute live cameras",controls:{editor_label:"Live Controls",ptz:{editor_label:"PTZ",hide_home:"Hide home control",hide_pan_tilt:"Hide pan & tilt control",hide_zoom:"Hide zoom control",mode:"Mode",modes:{off:"Off",on:"On"},orientation:"Orientation",orientations:{horizontal:"Horizontal",vertical:"Vertical"},position:"Position",positions:{"bottom-left":"Bottom left","bottom-right":"Bottom right","top-left":"Top left","top-right":"Top right"}}},draggable:"Live cameras view can be dragged/swiped",lazy_load:"Live cameras are lazily loaded",lazy_unload:"Live cameras are lazily unloaded",microphone:{always_connected:"Always keep the microphone connected",disconnect_seconds:"Seconds after which to disconnect microphone (0=never)",editor_label:"Microphone",enabled:"Microphone enabled",mute_after_microphone_mute_seconds:"Seconds after microphone mute to mute inbound audio"},preload:"Preload live view in the background",show_image_during_load:"Show still image while the live stream is loading",transition_effect:"Live camera transition effect",zoomable:"Live cameras can be zoomed/panned"},media_viewer:{auto_mute:"Automatically mute media",auto_pause:"Automatically pause media",auto_play:"Automatically play media",auto_unmute:"Automatically unmute media",controls:{editor_label:"Media Viewer Controls"},draggable:"Media Viewer can be dragged/swiped",lazy_load:"Media Viewer media is lazily loaded in carousel",snapshot_click_plays_clip:"Clicking on a snapshot plays a related clip",transition_effect:"Media Viewer transition effect",transition_effects:{none:"No transition",slide:"Slide transition"},zoomable:"Media Viewer can be zoomed/panned"},menu:{alignment:"Menu alignment",alignments:{bottom:"Aligned to the bottom",left:"Aligned to the left",right:"Aligned to the right",top:"Aligned to the top"},button_size:"Menu button size in pixels",buttons:{alignment:"Button alignment",alignments:{matching:"Matching the menu alignment",opposing:"Opposing the menu alignment"},camera_ui:"Camera user interface",cameras:"Cameras",clips:"Clips",display_mode:"Display mode",download:"Download",enabled:"Button enabled",expand:"Expand",frigate:"Frigate menu / Default view",fullscreen:"Fullscreen",icon:"Icon",image:"Image",live:"Live",media_player:"Send to media player",microphone:"Microphone",mute:"Mute / Unmute",permanent:"Show when the menu is hidden",play:"Play / Pause",priority:"Priority",ptz_controls:"Show PTZ controls",ptz_home:"PTZ Home",recordings:"Recordings",screenshot:"Screenshot",snapshots:"Snapshots",substreams:"Substream(s)",timeline:"Timeline",type:"Button type",types:{momentary:"Momentary",toggle:"Toggle"}},position:"Menu position",positions:{bottom:"Positioned on the bottom",left:"Positioned on the left",right:"Positioned on the right",top:"Positioned on the top"},style:"Menu style",styles:{hidden:"Hidden menu",hover:"Hover menu","hover-card":"Hover menu (card-wide)",none:"No menu",outside:"Outside menu",overlay:"Overlay menu"}},overrides:{info:"This card configuration has manually specified overrides configured which may override values shown in the visual editor, please consult the code editor to view/modify these overrides"},performance:{features:{animated_progress_indicator:"Animated Progress Indicator",editor_label:"Feature Options",max_simultaneous_engine_requests:"Max simultaneous camera engine requests",media_chunk_size:"Media chunk size"},style:{border_radius:"Curves",box_shadow:"Shadows",editor_label:"Style Options"},warning:"This card is in low profile mode so defaults have changed to optimize performance"},profiles:{casting:"Casting",editor_label:"Configuration profiles","low-performance":"Low performance",scrubbing:"Video scrubbing"},status_bar:{height:"Status bar height in pixels",items:{enabled:"Item enabled",engine:"Camera engine",live_provider:"Live provider",priority:"Item priority",resolution:"Resolution",technology:"Technology",title:"Title"},popup_seconds:"Status bar popup seconds",position:"Status bar position",positions:{bottom:"Positioned on the bottom",top:"Positioned on the top"},style:"Status bar style",styles:{hover:"Hover status bar","hover-card":"Hover status bar (card-wide)",none:"No status bar",outside:"Outside status bar",overlay:"Overlay status bar",popup:"Popup status bar"}},view:{camera_select:"View for newly selected cameras",dark_mode:"Dark mode",dark_modes:{auto:"Auto",off:"Off",on:"On"},default:"Default view",default_cycle_camera:"Cycle through cameras when default view updates",default_reset:{after_interaction:"Reset to the default view after user interaction ends",editor_label:"Default view reset behavior",entities:"Reset to the default view on entity state change",every_seconds:"Reset to default view every X seconds (0=never)",interaction_mode:"How default reset behaves when the card has human interaction",interaction_modes:{active:"Only allow reset when card has active human interaction",all:"Reset regardless of human interaction",inactive:"Only reset when card has no human interaction"}},interaction_seconds:"Seconds after user action to remain interacted with (0=never)",keyboard_shortcuts:{editor_label:"Keyboard shortcuts",enabled:"Keyboard shortcuts enabled",ptz_down:"PTZ Down",ptz_home:"PTZ Home",ptz_left:"PTZ Left",ptz_right:"PTZ Right",ptz_up:"PTZ Up",ptz_zoom_in:"PTZ Zoom In",ptz_zoom_out:"PTZ Zoom Out"},triggers:{actions:{editor_label:"Trigger actions",interaction_mode:"How to handle actions when the card has human interaction",interaction_modes:{active:"Only trigger actions when card has human interaction",all:"Trigger actions regardless of human interaction",inactive:"Only trigger actions when card has no human interaction"},trigger:"Trigger action",triggers:{default:"Change to or update default view",live:"Change to or update live view",media:"Change to the relevant media view for new media",none:"No action"},untrigger:"Untrigger action",untriggers:{default:"Change to default view/camera",none:"No action"}},editor_label:"Trigger behavior",filter_selected_camera:"Only trigger on selected camera",show_trigger_status:"Show pulsing border when triggered",untrigger_seconds:"Seconds after inactive state change to untrigger"},views:{clip:"Most recent clip",clips:"Clips gallery",current:"Current view",image:"Static image",live:"Live view",recording:"Most recent recording",recordings:"Recordings gallery",snapshot:"Most recent snapshot",snapshots:"Snapshots gallery",timeline:"Timeline view"}}},x_={grid:"Show media viewer for each camera in a grid",single:"Show single media viewer"},C_={add_new_camera:"Add new camera",button:"Button",camera:"Camera",cameras:"Cameras",cameras_secondary:"What cameras to render on this card",delete:"Delete",dimensions:"Card dimensions",dimensions_secondary:"Card dimensions & shape options",image:"Image",image_secondary:"Static image view options",live:"Live",live_secondary:"Live camera view options",media_gallery:"Media gallery",media_gallery_secondary:"Media gallery options",media_viewer:"Media viewer",media_viewer_secondary:"Viewer for static media (clips, snapshots or recordings)",menu:"Menu",menu_secondary:"Menu look & feel options",move_down:"Move down",move_up:"Move up",overrides:"Overrides are active",overrides_secondary:"Dynamic configuration overrides detected",performance:"Performance",performance_secondary:"Card performance options",profiles:"Configuration profiles",profiles_secondary:"Choose pre-configured sets of defaults",status_bar:"Status bar",status_bar_secondary:"Status bar look & feel options",timeline:"Timeline",timeline_secondary:"Event timeline options",upgrade:"Upgrade",upgrade_available:"An automatic card configuration upgrade is available",view:"View",view_secondary:"What the card should show and how to show it"},M_={ptz:{down:"Down",home:"Home",left:"Left",right:"Right",up:"Up",zoom_in:"Zoom In",zoom_out:"Zoom Out"}},S_={awaiting_live:"Waiting for live stream to load ...",awaiting_media:"Waiting for media to load",camera_initialization:"Camera initialization failed",camera_initialization_reolink:"Could not initialize Reolink camera",could_not_render_elements:"Could not render picture elements",could_not_resolve:"Could not resolve media URL",diagnostics:"Card diagnostics. Please review for confidential information prior to sharing",download_no_media:"No media to download",download_sign_failed:"Could not sign media URL for download",duplicate_camera_id:"Duplicate Frigate camera id for the following camera, use the 'id' parameter to uniquely identify cameras",empty_response:"Received empty response from Home Assistant for request",failed_response:"Failed to receive response from Home Assistant for request",failed_retain:"Could not retain event",failed_sign:"Could not sign Home Assistant URL",image_load_error:"The image could not be loaded",invalid_configuration:"Invalid configuration",invalid_configuration_no_hint:"No location hint available (bad or missing type?)",invalid_configuration_override:"Invalid override configuration",invalid_elements_config:"Invalid picture elements configuration",invalid_response:"Received invalid response from Home Assistant for request",jsmpeg_no_player:"Could not start JSMPEG player",live_camera_no_endpoint:"Could not get camera endpoint for this live provider (incomplete configuration?)",live_camera_not_found:"The configured camera_entity was not found",live_camera_unavailable:"Camera unavailable",no_camera_engine:"Could not determine suitable engine for camera",no_camera_entity:"Could not find camera entity",no_camera_entity_for_triggers:"A camera entity is required in order to autodetect triggers",no_camera_id:"Could not determine camera id for the following camera, may need to set 'id' parameter manually",no_camera_name:"Could not determine a Frigate camera name for camera (or one of its dependents), please specify either 'camera_entity' or 'camera_name'",no_dashboard_or_view:"Both 'dashboard_path' and 'view_path' parameters are required for the 'dashboard' cast method",no_live_camera:"The camera_entity parameter must be set and valid for this live provider",no_supported_camera:"The selected camera does not support this view",no_supported_cameras:"No cameras support this view",reconnecting:"Reconnecting",too_many_automations:"Too many nested automation calls, please check your configuration for loops",troubleshooting:"Check troubleshooting",unknown:"Unknown error",upgrade_available:"An automated card configuration upgrade is available, please visit the visual card editor",webrtc_card_reported_error:"WebRTC Card reported an error",webrtc_card_waiting:"Waiting for WebRTC Card to load ..."},k_={camera:"Camera",duration:"Duration",in_progress:"In Progress",score:"Score",seek:"Seek",start:"Start",tag:"Tag",what:"What",where:"Where"},E_={assign:"Assign",modifiers:{alt:"Alt",ctrl:"Ctrl",meta:"Meta",shift:"Shift"},unassign:"Unassign"},$_={all:"All",camera:"Camera",favorite:"Favorite",media_type:"Media Type",media_types:{clips:"Clips",recordings:"Recordings",snapshots:"Snapshots"},not_favorite:"Not Favorite",select_camera:"Select camera...",select_favorite:"Select favorite...",select_media_type:"Select media type...",select_tag:"Select tag...",select_what:"Select what...",select_when:"Select when...",select_where:"Select where...",tag:"Tag",what:"What",when:"When",whens:{custom:"Custom",past_month:"Past Month",past_week:"Past Week",today:"Today",yesterday:"Yesterday"},where:"Where"},A_={unseekable:"Seek time not found in media"},I_={camera:"Camera",duration:"Duration",events:"Events",in_progress:"In Progress",seek:"Seek",start:"Start"},z_={download:"Download media",no_thumbnail:"No thumbnail available",retain_indefinitely:"Media will be indefinitely retained",timeline:"See media in timeline"},T_={select_date:"Choose date"},j_={common:b_,config:w_,display_modes:x_,editor:C_,elements:M_,error:S_,event:k_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:I_,thumbnail:z_,timeline:T_},O_=Object.freeze({__proto__:null,common:b_,config:w_,default:j_,display_modes:x_,editor:C_,elements:M_,error:S_,event:k_,key_assigner:E_,media_filter:$_,media_viewer:A_,recording:I_,thumbnail:z_,timeline:T_});const D_="en",R_={[D_]:O_};let P_;function L_(e){const t=e=>e.replace("-","_"),n=e?.language??e?.selectedLanguage;if(n)return t(n);const i=localStorage.getItem("selectedLanguage");if(i){const e=JSON.parse(i);if(e)return t(e)}for(const e of navigator.languages){const n=t(e);if(n&&n in R_)return n}return D_}function N_(e,t="",n=""){let i="";try{i=e.split(".").reduce(((e,t)=>e[t]),R_[P_??D_])}catch(e){}return i||(i=e.split(".").reduce(((e,t)=>e[t]),R_[D_])),""!==t&&""!==n&&(i=i.replace(t,n)),i}function F_(e){return"string"==typeof e?.id&&e.id||"string"==typeof e?.camera_entity&&e.camera_entity||"object"==typeof e?.webrtc_card&&e.webrtc_card&&("string"==typeof e.webrtc_card.entity&&e.webrtc_card.entity||"string"==typeof e.webrtc_card.url&&e.webrtc_card.url)||"object"==typeof e?.go2rtc&&e.go2rtc&&"string"==typeof e.go2rtc.url&&"string"==typeof e.go2rtc.stream&&`${e.go2rtc.url}#${e.go2rtc.stream}`||"object"==typeof e?.frigate&&e.frigate&&"string"==typeof e?.frigate.camera_name&&e.frigate.camera_name||""}const V_=(e,...t)=>{e?.debug?.logging&&console.debug(...t)},H_=(e,t,n)=>"preset"===t?(n?.preset?e.ptz.presets?.[n.preset]:null)??null:n?.phase?e.ptz[`actions_${t}_${n.phase}`]??null:e.ptz[`actions_${t}`]??null,B_=(e,t,n)=>!!H_(e,t,n),q_=(e,t)=>{const n=B_(e,t,{phase:"start"})&&B_(e,t,{phase:"stop"}),i=B_(e,t);return n||i?[...n?["continuous"]:[],...i?["relative"]:[]]:null},U_=e=>{const t=q_(e,"left"),n=q_(e,"right"),i=q_(e,"up"),a=q_(e,"down"),r=q_(e,"zoom_in"),s=q_(e,"zoom_out"),o=e.ptz.presets?Object.keys(e.ptz.presets):void 0;return t?.length||n?.length||i?.length||a?.length||r?.length||s?.length||o?.length?{...t?{left:t}:{},...n?{right:n}:{},...i?{up:i}:{},...a?{down:a}:{},...r?{zoomIn:r}:{},...s?{zoomOut:s}:{},...o?{presets:o}:{}}:null};class W_{constructor(e,t){this._capabilities=e;for(const e of t?.disable??[])this._disable(e);for(const e of Io)t?.disableExcept?.length&&!t.disableExcept.includes(e)&&this._disable(e)}_disable(e){delete this._capabilities[e]}matches(e){let t=!0;return"string"==typeof e&&(t&&=this.has(e)),"object"==typeof e&&e.allCapabilities&&(t&&=e.allCapabilities.every((e=>this.has(e)))),"object"==typeof e&&e.anyCapabilities&&(t&&=e.anyCapabilities.some((e=>this.has(e)))),t}has(e){return!!this._capabilities[e]}getPTZCapabilities(){return this._capabilities.ptz??null}hasPTZCapability(){return!!(this._capabilities.ptz?.down?.length||this._capabilities.ptz?.up?.length||this._capabilities.ptz?.left?.length||this._capabilities.ptz?.right?.length||this._capabilities.ptz?.zoomIn?.length||this._capabilities.ptz?.zoomOut?.length||this._capabilities.ptz?.presets?.length)}getRawCapabilities(){return this._capabilities}}function Z_(e,t,n){var i=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var r=Array(a);++it||r&&s&&c&&!o&&!l||i&&s&&c||!n&&c||!a)return 1;if(!i&&!r&&!l&&e=o?c:c*("desc"==n[i]?-1:1)}return e.index-t.index}(e,t,n)}))}function Sy(e,t,n,i){return null==e?[]:(cp(t)||(t=null==t?[]:[t]),cp(n=i?void 0:n)||(n=null==n?[]:[n]),My(e,t,n))}async function ky(e,t,n,i=!1){let a;try{a=await e.callWS(n)}catch(e){if(!(e instanceof Error))throw new $o(N_("error.failed_response"),{request:n,response:e});throw e}if(!a)throw new $o(N_("error.empty_response"),{request:n});const r=i?t.safeParse(JSON.parse(a)):t.safeParse(a);if(!r.success)throw new $o(N_("error.invalid_response"),{request:n,response:a,invalid_keys:Oo(r.error)});return r.data}const Ey=bi.lazy((()=>bi.object({title:bi.string(),media_class:bi.string(),media_content_type:bi.string(),media_content_id:bi.string(),can_play:bi.boolean(),can_expand:bi.boolean(),children_media_class:bi.string().nullable().optional(),thumbnail:bi.string().nullable(),children:bi.array(Ey).nullable().optional()}))),$y="video",Ay="image",Iy=60,zy=e=>Sy(e,(e=>e._metadata?.startDate),"desc");class Ty{async walkBrowseMedias(e,t,n){return t&&t.length?(await Jm(t,(async t=>await this._walkBrowseMedia(e,t,n)))).flat():[]}async _walkBrowseMedia(e,t,n){let i=[];for(const a of function(e,t,n){t=(n?cm(e,t,n):void 0===t)?1:G_(Mm(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,r=0,s=Array(Q_(i/t));aawait this._browseMedia(e,i,{cache:n?.cache,metadataGenerator:t.metadataGenerator})));for(const e of r)for(const n of e.children??[])t.matcher(n)&&i.push(n);if(t.sorter&&(i=t.sorter(i)),t.earlyExit&&t.earlyExit(i))break}const a=t.advance?t.advance(i):null;return a?.length?await this.walkBrowseMedias(e,a,n):i}async _browseMedia(e,t,n){const i="object"==typeof t?t.media_content_id:t,a=n?.cache?n.cache.get(i):null;if(a)return a;const r={type:"media_source/browse_media",media_content_id:i},s=await ky(e,Ey,r);if(n?.metadataGenerator)for(const e of s.children??[])e._metadata=n.metadataGenerator(e,"object"==typeof t?t:void 0)??void 0;return n?.cache&&n.cache.set(i,s,Bd(new Date,{seconds:60})),s}}function jy(e,t){return yg(e,t)}function Oy(e,t){return e&&e.length?function(e,t){for(var n=-1,i=e.length,a=0,r=[];++nPy(t,e)))}add(e){this._ranges.push(e),this._ranges=Ny(this._ranges)}clear(){this._ranges=[]}}class Ry{constructor(e){this._ranges=e??[]}hasCoverage(e){const t=new Date;return this._ranges.some((n=>tet.start>=e.start&&t.end<=e.end,Ly=(e,t)=>e.start>=t.start&&e.start<=t.end||e.end>=t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end,Ny=(e,t=0)=>{const n=[];e=Sy(e,(e=>e.start),"asc");let i=null;for(const a of e){const e=a.start instanceof Date?a.start.getTime():a.start;if(!i){i={...a};continue}(i.end instanceof Date?i.end.getTime():i.end)+1e3*t>=e?a.end>i.end&&(i.end=a.end):(n.push(i),i={...a})}return i&&n.push(i),n};class Fy{constructor(){this._data=[]}get(e){const t=new Date;for(const n of this._data)if((!n.expires||t<=n.expires)&&this._contains(e,n.request))return n.response;return null}clear(){this._data=[]}has(e){return!!this.get(e)}set(e,t,n){this._data.push({request:e,response:t,expires:n}),this._expireOldRequests()}_contains(e,t){return jy(e,t)}_expireOldRequests(){const e=new Date;this._data=this._data.filter((t=>!t.expires||e=e.start.getTime()){if(i>e.end.getTime())break;t.push(n)}}return t}getSize(){return this._data.length}expireMatches(e){this._data=this._data.filter((t=>!e(t)))}}class By{constructor(){this._segments=new Map}add(e,t,n){let i=this._segments.get(e);i||(i=new Hy((e=>1e3*e.start_time),(e=>e.id)),this._segments.set(e,i)),i.add(t,n)}clear(){this._segments.clear()}hasCoverage(e,t){return!!this._segments.get(e)?.hasCoverage(t)}get(e,t){return this._segments.get(e)?.get(t)??null}getSize(e){return this._segments.get(e)?.getSize()??null}getCameraIDs(){return[...this._segments.keys()]}expireMatches(e,t){this._segments.get(e)?.expireMatches(t)}}class qy extends $o{}class Uy extends $o{}var Wy,Zy,Qy;!function(e){e.Event="event-query",e.Recording="recording-query",e.RecordingSegments="recording-segments-query",e.MediaMetadata="media-metadata"}(Wy||(Wy={})),function(e){e.Event="event-results",e.Recording="recording-results",e.RecordingSegments="recording-segments-results",e.MediaMetadata="media-metadata-results"}(Zy||(Zy={})),function(e){e.Frigate="frigate",e.Generic="generic",e.MotionEye="motioneye",e.Reolink="reolink"}(Qy||(Qy={}));const Gy=e=>e.camera_entity??e.webrtc_card?.entity??null;class Yy{constructor(e){this._entityRegistryManager=e}async createEngine(e,t){let n;switch(e){case Qy.Generic:const{GenericCameraManagerEngine:e}=await import("./engine-generic-93cdbee6.js").then((function(e){return e.e}));n=new e(t.stateWatcher,t.eventCallback);break;case Qy.Frigate:const{FrigateCameraManagerEngine:i}=await import("./engine-frigate-be325e58.js");n=new i(this._entityRegistryManager,t.stateWatcher,new By,new Vy,t.eventCallback);break;case Qy.MotionEye:const{MotionEyeCameraManagerEngine:a}=await import("./engine-motioneye-aba6e54b.js");n=new a(this._entityRegistryManager,t.stateWatcher,new Ty,t.resolvedMediaCache,new Vy,t.eventCallback);break;case Qy.Reolink:const{ReolinkCameraManagerEngine:r}=await import("./engine-reolink-a43e6d37.js");n=new r(this._entityRegistryManager,t.stateWatcher,new Ty,t.resolvedMediaCache,new Vy,t.eventCallback)}return n}async getEngineForCamera(e,t){let n=null;if("frigate"===t.engine)n=Qy.Frigate;else if("motioneye"===t.engine)n=Qy.MotionEye;else if("generic"===t.engine)n=Qy.Generic;else if("reolink"===t.engine)n=Qy.Reolink;else{const i=Gy(t);if(i){const a=await this._entityRegistryManager.getEntity(e,i);if(!a){if(e.states[i])return Qy.Generic;throw new qy(N_("error.no_camera_entity"),t)}switch(a?.platform){case"frigate":n=Qy.Frigate;break;case"motioneye":n=Qy.MotionEye;break;case"reolink":n=Qy.Reolink;break;default:n=Qy.Generic}}else t.frigate.camera_name?n=Qy.Frigate:(t.webrtc_card?.url||t.go2rtc?.url&&t.go2rtc?.stream)&&(n=Qy.Generic)}return n}}class Ky{constructor(){this._cameras=new Map,this._enginesByType=new Map}addCamera(e){this._cameras.set(e.getID(),e),this._enginesByType.set(e.getEngine().getEngineType(),e.getEngine())}async setCameras(e){for(const t of e){const e=this._cameras.get(t.getID());e!==t&&(this.addCamera(t),await(e?.destroy()))}for(const t of this._cameras.values())e.includes(t)||(await t.destroy(),this._cameras.delete(t.getID()))}async reset(){await Jm(this._cameras.values(),(e=>e.destroy())),this._cameras.clear(),this._enginesByType.clear()}getCamera(e){return this._cameras.get(e)??null}getCameras(){return this._cameras}getCameraConfig(e){return this._cameras.get(e)?.getConfig()??null}hasCameraID(e){return this._cameras.has(e)}getCameraCount(){return this._cameras.size}getDefaultCameraID(){return this._cameras.keys().next().value??null}*getCameraConfigs(e){for(const[t,n]of this.getCameraConfigEntries(e))yield n}*getCameraConfigEntries(e){for(const t of e??this._cameras.keys()){const e=this.getCameraConfig(t);e&&(yield[t,e])}}getCameraIDs(){return new Set(this._cameras.keys())}getCameraIDsWithCapability(e){const t=new Set;for(const n of this._cameras.values())n.getCapabilities()?.matches(e)&&t.add(n.getID());return t}getCameraConfigForMedia(e){return this.getCameraConfig(e.getCameraID())}getEngineOfType(e){return this._enginesByType.get(e)??null}getEngineForCameraID(e){return this._cameras.get(e)?.getEngine()??null}getEnginesForCameraIDs(e){const t=new Map;for(const n of e){const e=this.getEngineForCameraID(n);e&&(t.has(e)||t.set(e,new Set),t.get(e)?.add(n))}return t.size?t:null}getEngineForMedia(e){return this.getEngineForCameraID(e.getCameraID())}getAllDependentCameras(e,t){const n=new Set,i=new Set,a=e=>{n.add(e);const r=this.getCamera(e),s=r?.getConfig();if(r&&s){t&&!r.getCapabilities()?.matches(t)||i.add(e);const o=new Set;s.dependencies.cameras.forEach((e=>o.add(e))),s.dependencies.all_cameras&&this.getCameraIDs().forEach((e=>o.add(e)));for(const e of o)n.has(e)||a(e)}};return a(e),i}}const Xy=e=>{return Sy((n=e=>e.getID()??e,(t=e)&&t.length?Fm(t,by(n)):[]),(e=>e.getStartTime()??e.getID()),"asc");var t,n};class Jy{static isEventQuery(e){return e.type===Wy.Event}static isRecordingQuery(e){return e.type===Wy.Recording}static isRecordingSegmentsQuery(e){return e.type===Wy.RecordingSegments}static isMediaMetadataQuery(e){return e.type===Wy.MediaMetadata}}class ev{static isEventQueryResult(e){return e.type===Zy.Event}static isRecordingQueryResult(e){return e.type===Zy.Recording}static isRecordingSegmentsQueryResult(e){return e.type===Zy.RecordingSegments}static isMediaMetadataQueryResult(e){return e.type===Zy.MediaMetadata}}class tv{constructor(e,t){this._requestLimit=new v_,this._api=e,this._engineFactory=t?.factory??new Yy(this._api.getEntityRegistryManager()),this._store=t?.store??new Ky}async initializeCamerasFromConfig(){const e=this._api.getConfigManager().getConfig(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;this._requestLimit.concurrency=e.performance.features.max_simultaneous_engine_requests??1/0;const n=e.cameras.map((t=>{return n={},i=l_(e?.cameras_global),dm(n,i,t,((e,t)=>Array.isArray(t)?t:void 0));var n,i}));try{await this._initializeCameras(n)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e,N_("error.camera_initialization")),!1}return!0}async reset(){await this._store.reset()}async _getEnginesForCameras(e){const t=new Map,n=new Map,i=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!i)return t;const a=await(async e=>await Jm(e,(e=>this._engineFactory.getEngineForCamera(i,e))))(e);for(const[i,r]of e.entries()){const e=a[i],s=e?n.get(e)??await this._engineFactory.createEngine(e,{eventCallback:e=>this._api.getTriggersManager().handleCameraEvent(e),stateWatcher:this._api.getHASSManager().getStateWatcher(),resolvedMediaCache:this._api.getResolvedMediaCache()}):null;if(!s||!e)throw new qy(N_("error.no_camera_engine"),l_(r));n.set(e,s),t.set(r,s)}return t}async _initializeCameras(e){const t=new Date,n=this._api.getHASSManager().getHASS(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */ +if(!n)return;e.some((e=>(e=>e.triggers.motion||e.triggers.occupancy)(e)))&&await this._api.getEntityRegistryManager().fetchEntityList(n);const i=await this._getEnginesForCameras(e),a=await Jm(i.entries(),(async([e,t])=>await t.createCamera(n,e))),r=async()=>{a.forEach((e=>e.destroy()))},s=new Set;for(const e of a){const t=F_(e.getConfig());if(!t)throw await r(),new qy(N_("error.no_camera_id"),e.getConfig());if(s.has(t))throw await r(),new qy(N_("error.duplicate_camera_id"),e.getConfig());e.setID(t),s.add(t)}await this._store.setCameras(a),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager initialized (Cameras: ",this._store.getCameras(),`, Duration: ${((new Date).getTime()-t.getTime())/1e3}s,`,")")}isInitialized(){return this._store.getCameraCount()>0}getStore(){return this._store}generateDefaultEventQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.Event,...t})}generateDefaultRecordingQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.Recording,...t})}generateDefaultRecordingSegmentsQueries(e,t){return this._generateDefaultQueries(e,{type:Wy.RecordingSegments,...t})}_generateDefaultQueries(e,t){const n=[],i=Um(e),a=this._store.getEnginesForCameraIDs(i);if(!a)return null;for(const[e,i]of a){let a=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jy.isEventQuery(t)?a=e.generateDefaultEventQuery(this._store,i,t):Jy.isRecordingQuery(t)?a=e.generateDefaultRecordingQuery(this._store,i,t):Jy.isRecordingSegmentsQuery(t)&&(a=e.generateDefaultRecordingSegmentsQuery(this._store,i,t));for(const e of a??[])n.push(e)}return n.length?n:null}async getMediaMetadata(){const e=new Set,t=new Set,n=new Set,i=new Set,a={type:Wy.MediaMetadata,cameraIDs:this._store.getCameraIDs()},r=await this._handleQuery(a);for(const a of r.values())a.metadata.tags&&a.metadata.tags.forEach(e.add,e),a.metadata.what&&a.metadata.what.forEach(t.add,t),a.metadata.where&&a.metadata.where.forEach(n.add,n),a.metadata.days&&a.metadata.days.forEach(i.add,i);return t.size||n.size||i.size||e.size?{...e.size&&{tags:e},...t.size&&{what:t},...n.size&&{where:n},...i.size&&{days:i}}:null}async getEvents(e,t){return await this._handleQuery(e,t)}async getRecordings(e,t){return await this._handleQuery(e,t)}async getRecordingSegments(e,t){return await this._handleQuery(e,t)}async executeMediaQueries(e,t){return this._convertQueryResultsToMedia(await this._handleQuery(e,t))}async extendMediaQueries(e,t,n,i){if(!this._api.getHASSManager().getHASS())return null;const a=e=>{let n=null;for(const i of t){const t=i.getStartTime();t&&(!n||"earliest"===e&&tn)&&(n=t)}return n},r=this._api.getConfigManager().getCardWideConfig()?.performance?.features.media_chunk_size??50,s=[],o=[];for(const t of e){const e={...t}; +/* istanbul ignore else: the else path cannot be reached -- @preserve */if("later"===n){const t=a("latest");t&&(e.start=t,delete e.end)}else if("earlier"===n){const t=a("earliest");t&&(e.end=t,delete e.start)}e.limit=r,o.push({...t,limit:(t.limit??0)+r}),s.push(e)}const c=this._convertQueryResultsToMedia(await this._handleQuery(s,i));if(!c.length)return null;const l=Xy(t.concat(c));return l.length===t.length?null:{queries:o,results:l}}async getMediaDownloadPath(e){const t=this._store.getCameraConfigForMedia(e),n=this._store.getEngineForMedia(e),i=this._api.getHASSManager().getHASS();return t&&n&&i?await n.getMediaDownloadPath(i,t,e):null}getMediaCapabilities(e){const t=this._store.getEngineForMedia(e);return t?t.getMediaCapabilities(e):null}async favoriteMedia(e,t){const n=this._store.getCameraConfigForMedia(e),i=this._store.getEngineForMedia(e),a=this._api.getHASSManager().getHASS();if(!n||!i||!a)return;const r=new Date;await this._requestLimit.add((()=>i.favoriteMedia(a,n,e,t))),V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card CameraManager favorite request (",`Duration: ${((new Date).getTime()-r.getTime())/1e3}s,`,"Media:",e.getID(),", Favorite:",t,")")}areMediaQueriesResultsFresh(e,t){const n=new Date;for(const i of e){const e=this._store.getEnginesForCameraIDs(i.cameraIDs);for(const[a,r]of e??[]){const e=a.getQueryResultMaxAge({...i,cameraIDs:r});if(null!==e&&Bd(t,{seconds:e})i?null:await this._requestLimit.add((()=>a.getMediaSeekTime(r,this._store,e,t)))??null}async _handleQuery(e,t){const n=qm(e),i=new Map,a=new Date,r=this._api.getHASSManager().getHASS();if(!r)return i;const s=async(e,n)=>{let a=null; +/* istanbul ignore else: the else path cannot be reached -- @preserve */Jy.isEventQuery(n)?a=await e.getEvents(r,this._store,n,t):Jy.isRecordingQuery(n)?a=await e.getRecordings(r,this._store,n,t):Jy.isRecordingSegmentsQuery(n)?a=await e.getRecordingSegments(r,this._store,n,t):Jy.isMediaMetadataQuery(n)&&(a=await e.getMediaMetadata(r,this._store,n,t)),a?.forEach(((e,t)=>i.set(t,e)))},o=async e=>{const t=this._store.getEnginesForCameraIDs(e.cameraIDs);t&&await Promise.all(Array.from(t.keys()).map((n=>this._requestLimit.add((()=>s(n,{...e,cameraIDs:t.get(n)}))))))};await Promise.all(n.map((e=>o(e))));const c=(l=Array.from(i.values()).map((e=>Number(e.cached??0))))&&l.length?function(e,t){for(var n,i=-1,a=e.length;++ithis._store.getCamera(e))).filter(rf);return new W_({live:t.some((e=>e.getCapabilities()?.has("live"))),clips:t.some((e=>e.getCapabilities()?.has("clips"))),recordings:t.some((e=>e.getCapabilities()?.has("recordings"))),snapshots:t.some((e=>e.getCapabilities()?.has("snapshots"))),"favorite-events":t.some((e=>e.getCapabilities()?.has("favorite-events"))),"favorite-recordings":t.some((e=>e.getCapabilities()?.has("favorite-recordings"))),seek:t.some((e=>e.getCapabilities()?.has("seek"))),menu:t.some((e=>e.getCapabilities()?.has("menu")))})}async executePTZAction(e,t,n){const i=this._store.getCameraConfig(e);if(!i)return;const a=H_(i,t,n);if(a)return await this._api.getActionsManager().executeActions(a);const r=this._api.getHASSManager().getHASS(),s=this._store.getEngineForCameraID(e);return s&&r?await this._requestLimit.add((()=>s.executePTZAction(r,i,t,n))):void 0}}class nv{constructor(e){this._cache=new Map,this._keyCallback=e}has(e){return this._cache.has(e)}getMatches(e){return[...this._cache.values()].filter(e)}get(e){return this._cache.get(e)??null}add(e){const t=e=>this._cache.set(this._keyCallback(e),e);Array.isArray(e)?e.forEach(t):t(e)}}const iv=bi.object({id:bi.string(),model:bi.string().nullable(),config_entries:bi.string().array(),manufacturer:bi.string().nullable()}).array();class av{constructor(e){this._fetchedDeviceList=!1,this._cache=e}async getDevice(e,t){return this._cache.has(t)?this._cache.get(t):(await this._fetchDeviceList(e),this._cache.get(t)??null)}async getMatchingDevices(e,t){return await this._fetchDeviceList(e),this._cache.getMatches(t)}async _fetchDeviceList(e){if(this._fetchedDeviceList)return;let t=null;try{t=await ky(e,iv,{type:"config/device_registry/list"})}catch(e){return void Zm(e)}this._cache.add(t),this._fetchedDeviceList=!0}}const rv=bi.object({config_entry_id:bi.string().nullable(),device_id:bi.string().nullable(),disabled_by:bi.string().nullable(),entity_id:bi.string(),hidden_by:bi.string().nullable(),platform:bi.string(),translation_key:bi.string().nullable(),unique_id:bi.string().or(bi.number()).optional()}),sv=rv.array();class ov{constructor(e){this._fetchedEntityList=!1,this._cache=e}async getEntity(e,t){const n=this._cache.get(t);if(n)return n;let i=null;try{i=await ky(e,rv,{type:"config/entity_registry/get",entity_id:t})}catch(e){return Zm(e),null}return this._cache.add(i),i}async getMatchingEntities(e,t){return await this.fetchEntityList(e),this._cache.getMatches(t)}async getEntities(e,t){const n=new Map;return await Promise.all(t.map((async t=>{const i=await this.getEntity(e,t);i&&n.set(t,i)}))),n}async fetchEntityList(e){if(this._fetchedEntityList)return;let t=null;try{t=await ky(e,sv,{type:"config/entity_registry/list"})}catch(e){return void Zm(e)}this._cache.add(t),this._fetchedEntityList=!0}}class cv extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield e)}}for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){const i="number"==typeof n&&n!==Number.POSITIVE_INFINITY?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:i}):this._set(e,{value:t,expiry:i}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,n]=e;!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}for(const e of this.oldCache){const[t,n]=e;if(!this.cache.has(t)){!1===this._deleteIfExpired(t,n)&&(yield[t,n.value])}}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const n=e[t],[i,a]=n;!1===this._deleteIfExpired(i,a)&&(yield[i,a.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const n=e[t],[i,a]=n;if(!this.cache.has(i)){!1===this._deleteIfExpired(i,a)&&(yield[i,a.value])}}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[n,i]of this.entriesAscending())e.call(t,i,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class lv{constructor(){this._cache=new cv({maxSize:1e3})}has(e){return this._cache.has(e)}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t)}}const dv=async(e,t,n)=>{const i=n?n.get(t):void 0;if(i)return i;const a={type:"media_source/resolve_media",media_content_id:t};let r=null;try{r=await ky(e,zo,a)}catch(e){Zm(e)}return n&&r&&n.set(t,r),r};class uv{constructor(e,t,n){this._context=e,this._action=t,this._config=n}async execute(e){}async stop(){}}class hv extends uv{}class pv extends hv{async execute(e){const t=this._action.camera??(this._action.triggered?e.getTriggersManager().getMostRecentlyTriggeredCameraID():null),n=e.getViewManager().getView(),i=e.getConfigManager().getConfig();if(t&&n){const a=i?.view.camera_select??"current",r="current"===a?n.view:a;await e.getViewManager().setViewByParametersWithNewQuery({params:{view:r,camera:t},failSafe:!0})}}}class gv extends hv{async execute(e){e.getCameraURLManager().openURL()}}class mv extends hv{async execute(e){await e.getViewManager().setViewDefaultWithNewQuery()}}class fv extends hv{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{displayMode:this._action.display_mode}})}}class _v extends hv{async execute(e){await e.getDownloadManager().downloadViewerMedia()}}class yv extends hv{async execute(e){e.getExpandManager().toggleExpanded()}}class vv extends hv{async execute(e){e.getFullscreenManager().toggleFullscreen()}}class bv extends uv{async execute(e){const t=e.getHASSManager().getHASS();t&&it(e.getCardElementManager().getElement(),t,this._config??{},this._action)}}class wv extends hv{async execute(e){console[this._action.level](this._action.message)}}const xv=(e,t)=>e.context?.live?.overrides?.get(t??e.camera)??t??e.camera,Cv=e=>xv(e)!==e.camera,Mv=(e,t)=>{const n=e.context?.live?.overrides??new Map;n.set(e.camera,t),e.mergeInContext({live:{overrides:n}})};class Sv extends hv{async execute(e){const t=this._action.media_player,n=e.getMediaPlayerManager(),i=e.getViewManager().getView(),a=i?.queryResults?.getSelectedResult()??null;"stop"===this._action.media_player_action?await n.stop(t):i?.is("live")?await n.playLive(t,xv(i)):i?.isViewerView()&&a&&await n.playMedia(t,a)}}class kv extends hv{async execute(e){e.getCardElementManager().toggleMenu()}}class Ev extends hv{async execute(e){await e.getMicrophoneManager().connect()}}class $v extends hv{async execute(e){e.getMicrophoneManager().disconnect()}}class Av extends hv{async execute(e){e.getMicrophoneManager().mute()}}class Iv extends hv{async execute(e){await e.getMicrophoneManager().unmute()}}class zv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.mute())}}class Tv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.pause())}}class jv extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.play())}}const Ov=(e,t)=>{if(e.isViewerView()){const n=e.queryResults?.getSelectedResult()?.getID()??null;return"ptz"!==t?.type&&n?{targetID:n,type:"digital"}:null}if(e.is("live")){const n=xv(e);let i="digital";return"digital"!==t?.type&&t?.cameraManager&&(Dv(t.cameraManager,n)&&(i="ptz"),"ptz"!==i&&"ptz"===t?.type)?null:{targetID:n,type:i}}return null},Dv=(e,t)=>!!e.getStore().getCamera(t)?.getCapabilities()?.hasPTZCapability();var Rv=lm((function(e,t,n){Kg(e,t,n)}));const Pv=(e,t)=>{t?.[e]?.inProgressAction?.stop()},Lv=(e,t,n,i)=>{Rv(t,{[n]:{[e]:{inProgressAction:i}}})};class Nv extends hv{constructor(){super(...arguments),this._timer=new bf}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.camera??Ov(t,{type:"ptz",cameraManager:e.getCameraManager()})?.targetID??null,i=n?e.getCameraManager().getCameraCapabilities(n)?.getPTZCapabilities():null,a=n?e.getCameraManager().getStore().getCameraConfig(n)?.ptz:null;if(!n||!i||!a)return;if(!this._action.ptz_action)return void(i.presets&&i.presets.length>=1&&await e.getCameraManager().executePTZAction(n,"preset",{phase:this._action.ptz_phase,preset:i.presets[0]}));const r=(e=>{switch(e){case"left":case"right":case"up":case"down":return e;case"zoom_in":return"zoomIn";case"zoom_out":return"zoomOut"}return null})(this._action.ptz_action);if(r&&i[r]?.includes(this._action.ptz_phase?"continuous":"relative")||"preset"===this._action.ptz_action)return await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{phase:this._action.ptz_phase,preset:this._action.ptz_preset});if("start"===this._action.ptz_phase){Pv(n,this._context.ptz),Lv(n,this._context,"ptz",this);const t=async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset}),this._timer.start(a.r2c_delay_between_calls_seconds,t)};await t()}else"stop"===this._action.ptz_phase?Pv(n,this._context.ptz):(await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"start"}),this._timer.start(a.c2r_delay_between_calls_seconds,(async()=>{this._action.ptz_action&&await e.getCameraManager().executePTZAction(n,this._action.ptz_action,{preset:this._action.ptz_preset,phase:"stop"})})))}}class Fv extends hv{async execute(e){e.getViewManager().setViewWithMergedContext({ptzControls:{enabled:this._action.enabled}})}}function Vv(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=wm(n))==n?n:0),void 0!==t&&(t=(t=wm(t))==t?t:0),function(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}(wm(e),t,n)}const Hv=50,Bv=50,qv=1,Uv=4,Wv=e=>void 0===e?.pan?.x&&void 0===e?.pan?.y&&void 0===e?.zoom;class Zv{constructor(e){this._context=e}modify(e){e.mergeInContext(this._context)}}const Qv=(e,t)=>({zoom:{[e]:{observed:t?.observed??void 0,requested:t?.requested??null}}}),Gv=(e,t,n)=>{t&&n&&t.setViewByParameters({modifiers:[new Zv(Qv(n,{observed:e.detail}))]})};class Yv extends hv{constructor(){super(...arguments),this._timer=new bf}async _stepChange(e,t){e.getViewManager().setViewWithMergedContext(Qv(t,{requested:this._convertActionToZoomSettings(e.getViewManager().getView()?.context?.zoom?.[t]?.observed)}))}async stop(){this._timer.stop()}async execute(e){const t=e.getViewManager().getView();if(!t)return;const n=this._action.target_id??Ov(t,{type:"digital",cameraManager:e.getCameraManager()})?.targetID;return n?this._action.absolute||!this._action.ptz_phase?await this._stepChange(e,n): +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +void("start"===this._action.ptz_phase?(Pv(n,this._context.ptzDigital),Lv(n,this._context,"ptzDigital",this),await this._stepChange(e,n),this._timer.startRepeated(.1,(()=>this._stepChange(e,n)))):"stop"===this._action.ptz_phase&&(Pv(n,this._context.ptzDigital),delete this._context.ptzDigital?.[n])):void 0}_convertActionToZoomSettings(e){if(!this._action.absolute&&!this._action.ptz_action)return{};if(this._action.absolute)return this._action.absolute;const t=e?.zoom??1,n=e?.pan?.x??50,i=e?.pan?.y??50,a="zoom_in"===this._action.ptz_action?.1:"zoom_out"===this._action.ptz_action?-.1:0,r="left"===this._action.ptz_action?-5:"right"===this._action.ptz_action?5:0,s="up"===this._action.ptz_action?-5:"down"===this._action.ptz_action?5:0;return{zoom:Vv(t+a,1,10),pan:{x:Vv(n+r,0,100),y:Vv(i+s,0,100)}}}}class Kv extends hv{async execute(e){const t=e.getViewManager().getView();let n=null,i=null;if(this._action.target_id)n=this._action.target_id,i=Dv(e.getCameraManager(),n)?"ptz":"digital";else if(t){const a=Ov(t,{cameraManager:e.getCameraManager()});n=a?.targetID??null,i=a?.type??null}n&&null!==i&&("ptz"===i?this._toPTZAction(n):this._toPTZDigitalAction(n)).execute(e)}_toPTZAction(e){return new Nv(this._context,(t={cardID:this._action.card_id,cameraID:e,ptzAction:this._action.ptz_action,ptzPhase:this._action.ptz_phase,ptzPreset:this._action.ptz_preset},{action:"fire-dom-event",frigate_card_action:"ptz",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.ptzPreset&&{ptz_preset:t.ptzPreset},...t?.cameraID&&{camera:t.cameraID}}),this._config);var t}_toPTZDigitalAction(e){return new Yv(this._context,(t={cardID:this._action.card_id,ptzPhase:this._action.ptz_phase,ptzAction:this._action.ptz_action,targetID:e},{action:"fire-dom-event",frigate_card_action:"ptz_digital",...t?.cardID&&{card_id:t.cardID},...t?.ptzAction&&{ptz_action:t.ptzAction},...t?.ptzPhase&&{ptz_phase:t.ptzPhase},...t?.absolute&&{absolute:t.absolute},...t?.targetID&&{target_id:t.targetID}}),this._config);var t}}class Xv extends hv{async execute(e){await e.getDownloadManager().downloadScreenshot()}}class Jv extends hv{async execute(e){var t;await tf((t=this._action.duration,3600*(t.h??0)+60*(t.m??0)+(t.s??0)+(t.ms??0)/1e3))}}class eb extends hv{async execute(e){switch(this._action.status_bar_action){case"reset":e.getStatusBarItemManager().removeAllDynamicStatusBarItems();break;case"add":this._action.items?.forEach((t=>e.getStatusBarItemManager().addDynamicStatusBarItem(t)));break;case"remove":this._action.items?.forEach((t=>e.getStatusBarItemManager().removeDynamicStatusBarItem(t)))}}}class tb{modify(e){(e=>{const t=e.context?.live?.overrides;t&&t.has(e.camera)&&e.context?.live?.overrides?.delete(e.camera)})(e)}}class nb extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new tb]})}}class ib{constructor(e){this._api=e}modify(e){const t=[...this._api.getCameraManager().getStore().getAllDependentCameras(e.camera,"substream")];if(t.length<=1)return;const n=xv(e),i=t.indexOf(n),a=i<0?0:(i+1)%t.length;Mv(e,t[a])}}class ab extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new ib(e)]})}}class rb{constructor(e){this._substreamID=e}modify(e){Mv(e,this._substreamID)}}class sb extends hv{async execute(e){e.getViewManager().setViewByParameters({modifiers:[new rb(this._action.camera)]})}}class ob extends hv{async execute(e){await(e.getMediaLoadedInfoManager().get()?.player?.unmute())}}class cb extends hv{async execute(e){await e.getViewManager().setViewByParametersWithNewQuery({params:{view:this._action.frigate_card_action}})}}class lb{createAction(e,t,n){const i=hf(t);if("fire-dom-event"!==t.action||!i)return new bv(e,t,n?.config);if(i.card_id&&i.card_id!==n?.cardID)return null;switch(i.frigate_card_action){case"default":return new mv(e,i,n?.config);case"clip":case"clips":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":case"diagnostics":return new cb(e,i,n?.config);case"sleep":return new Jv(e,i,n?.config);case"download":return new _v(e,i,n?.config);case"camera_ui":return new gv(e,i,n?.config);case"expand":return new yv(e,i,n?.config);case"fullscreen":return new vv(e,i,n?.config);case"menu_toggle":return new kv(e,i,n?.config);case"camera_select":return new pv(e,i,n?.config);case"live_substream_select":return new sb(e,i,n?.config);case"live_substream_off":return new nb(e,i,n?.config);case"live_substream_on":return new ab(e,i,n?.config);case"media_player":return new Sv(e,i,n?.config);case"microphone_connect":return new Ev(e,i,n?.config);case"microphone_disconnect":return new $v(e,i,n?.config);case"microphone_mute":return new Av(e,i,n?.config);case"microphone_unmute":return new Iv(e,i,n?.config);case"mute":return new zv(e,i,n?.config);case"unmute":return new ob(e,i,n?.config);case"play":return new jv(e,i,n?.config);case"pause":return new Tv(e,i,n?.config);case"screenshot":return new Xv(e,i,n?.config);case"display_mode_select":return new fv(e,i,n?.config);case"ptz":return new Nv(e,i,n?.config);case"ptz_digital":return new Yv(e,i,n?.config);case"ptz_multi":return new Kv(e,i,n?.config);case"ptz_controls":return new Fv(e,i,n?.config);case"log":return new wv(e,i,n?.config);case"status_bar":return new eb(e,i,n?.config)} +/* istanbul ignore next: this path cannot be reached -- @preserve */ +/* istanbul ignore next: this path cannot be reached -- @preserve */ +return console.warn(`Frigate card received unknown card action: ${i.frigate_card_action}`),null}}class db{constructor(e,t,n){this._actions=[],this._factory=new lb,this._stopped=!1,this._context=e;for(const i of qm(t)){const t=this._factory.createAction(e,i,n);t&&this._actions.push(t)}}async execute(e){for(const t of this._actions){if(this._stopped)break;await t.execute(e)}}async stop(){this._stopped=!0}}const ub=bi.object({action:bi.enum(["tap","double_tap","hold","start_tap","end_tap"])}),hb=bi.object({detail:ub});class pb{constructor(e){this._actionsInFlight=[],this._actionContext={},this.handleInteractionEvent=e=>{const t=hb.safeParse(e);if(!t.success)return;const n=t.data.detail.action,i=this.getMergedActions(),a=_f(n,i);i&&n&&a&&this.executeActions(a,i)},this.handleCustomActionEvent=e=>{"detail"in e&&this.executeActions(e.detail)},this.handleActionExecutionRequestEvent=async e=>{await this.executeActions(e.detail.action,e.detail.config)},this._api=e}getMergedActions(){const e=this._api.getViewManager().getView();if(this._api.getMessageManager().hasMessage())return{};const t=this._api.getConfigManager().getConfig();let n;if(e?.is("live"))n=t?.live.actions;else if(e?.isGalleryView())n=t?.media_gallery?.actions;else if(e?.isViewerView())n=t?.media_viewer.actions;else{if(!e?.is("image"))return{};n=t?.image?.actions}return{...t?.view.actions,...n}}uninitialize(){this._actionsInFlight.forEach((e=>e.stop()))}async executeActions(e,t){const n=new db(this._actionContext,e,{config:t,cardID:this._api.getConfigManager().getConfig()?.card_id});this._actionsInFlight.push(n),await n.execute(this._api),this._actionsInFlight=this._actionsInFlight.filter((e=>e!==n))}}class gb{constructor(e){this._automations=[],this._priorEvaluations=new Map,this._nestedAutomationExecutions=0,this._api=e}deleteAutomations(e){this._automations=this._automations.filter((t=>t.tag!==e))}addAutomations(e){this._automations.push(...e)}execute(){if(!this._api.getHASSManager().hasHASS()||!this._api.getInitializationManager().isInitializedMandatory()||this._api.getMessageManager().hasErrorMessage())return;const e=[];for(const t of this._automations){const n=this._api.getConditionsManager().evaluateConditions(t.conditions),i=n?t.actions:t.actions_not,a=this._priorEvaluations.get(t);this._priorEvaluations.set(t,n),n!==a&&i&&e.push(...i)}if(!e.length)return;(async e=>{++this._nestedAutomationExecutions,this._nestedAutomationExecutions>10?this._api.getMessageManager().setMessageIfHigherPriority({type:"error",message:N_("error.too_many_automations")}):(await this._api.getActionsManager().executeActions(e),--this._nestedAutomationExecutions)})(e)}}class mb{constructor(e){this._api=e}openURL(){const e=this.getCameraURL();e&&window.open(e)}hasCameraURL(){return!!this.getCameraURL()}getCameraURL(){const e=this._api.getViewManager().getView(),t=e?.queryResults?.getSelectedResult()??null,n=e?.camera?this._api.getCameraManager().getCameraEndpoints(e.camera,{view:e.view,...t&&{media:t}})??null:null;return n?.ui?.endpoint??null}}const fb=()=>!!navigator.userAgent.match(/CrKey\//);async function _b(e,t,n){const i={type:"auth/sign_path",path:t,expires:n},a=await ky(e,To,i);return a?e.hassUrl(a.path):null}function yb(e,t,n,i){if(!e||!n||!n.length)return[];const a=[];for(const r of n){const n=t?.states[r],s=e.states[r];if((i?.stateOnly&&n?.state!==s?.state||!i?.stateOnly&&n!==s)&&(a.push({entityID:r,oldState:n,newState:s}),i?.firstOnly))break}return a}function vb(e,t,n,i){return!!yb(e,t,n,{...i,firstOnly:!0}).length}function bb(e,t){return t?e?.states[t]?.attributes?.friendly_name??null:null}const wb=async()=>{if(["ha-button-menu","ha-button","ha-camera-stream","ha-card","ha-circular-progress","ha-combo-box","ha-hls-player","ha-icon-button","ha-icon","ha-menu-button","ha-selector","ha-state-icon","ha-web-rtc-player","mwc-button","mwc-list-item","state-badge"].every((e=>customElements.get(e))))return!0;const e=await window.loadCardHelpers();await e.createCardElement({type:"picture-glance",entities:[],camera_image:"dummy-to-load-editor-components"}),await customElements.whenDefined("hui-picture-glance-card");const t=customElements.get("hui-picture-glance-card");if(!t)return!1;const n=new t;return await n.constructor.getConfigElement(),!0},xb=e=>!!e&&["on","open"].includes(e),Cb=(e,t)=>{if(!e)return[];const n=Object.keys(e.states).filter((e=>!t||e.substr(0,e.indexOf("."))===t));return n.sort(),n};function Mb(e){return!!e?.startsWith("/")}function Sb(e,t){return Mb(t)?e.hassUrl(t):t??null}const kb=(e,t)=>!!((e.attributes.supported_features??0)&t);class Eb{constructor(){this._initialized=new Set}async initializeMultipleIfNecessary(e){return(await Jm(Object.entries(e),(async([e,t])=>await this.initializeIfNecessary(e,t)))).every(Boolean)}async initializeIfNecessary(e,t){return!!this._initialized.has(e)||(t?!!await t()&&(this._initialized.add(e),!0):(this._initialized.add(e),!0))}uninitialize(e){this._initialized.delete(e)}isInitialized(e){return this._initialized.has(e)}isInitializedMultiple(e){return e.every((e=>this.isInitialized(e)))}}var $b;!function(e){e.LANGUAGES="languages",e.SIDE_LOAD_ELEMENTS="side-load-elements",e.CAMERAS="cameras",e.MICROPHONE_CONNECT="microphone-connect",e.VIEW="view"}($b||($b={}));class Ab{constructor(e,t){this._initializationQueue=new v_({concurrency:1}),this._everInitialized=!1,this._api=e,this._initializer=t??new Eb}wasEverInitialized(){return this._everInitialized}isInitializedMandatory(){return!!this._api.getConfigManager().getConfig()&&this._initializer.isInitializedMultiple([$b.LANGUAGES,$b.SIDE_LOAD_ELEMENTS,$b.CAMERAS,...this._api.getMicrophoneManager().shouldConnectOnInitialization()?[$b.MICROPHONE_CONNECT]:[],$b.VIEW])}async initializeMandatory(){await this._initializationQueue.add((()=>this._initializeMandatory()))}async _initializeMandatory(){const e=this._api.getHASSManager().getHASS();if(!e||this.isInitializedMandatory())return;if(!await this._initializer.initializeMultipleIfNecessary({[$b.LANGUAGES]:async()=>await(async e=>{const t=L_(e);return"ca"===t?R_[t]=await import("./lang-ca-99b9960f.js"):"it"===t?R_[t]=await import("./lang-it-7713a746.js"):"pt"===t?R_[t]=await import("./lang-pt-PT-16f39312.js"):"pt_BR"===t?R_[t]=await import("./lang-pt-BR-ea76ed6c.js"):"fr"===t&&(R_[t]=await import("./lang-fr-e5e97bbf.js")),t&&(P_=t),!0})(e),[$b.SIDE_LOAD_ELEMENTS]:async()=>await wb()}))return;this._api.getConfigManager().getConfig()&&await this._initializer.initializeMultipleIfNecessary({[$b.CAMERAS]:async()=>await this._api.getCameraManager().initializeCamerasFromConfig(),...this._api.getMicrophoneManager().shouldConnectOnInitialization()&&{[$b.MICROPHONE_CONNECT]:async()=>await this._api.getMicrophoneManager().connect()}})&&!this._api.getMessageManager().hasMessage()&&await this._initializer.initializeIfNecessary($b.VIEW,this._api.getViewManager().initialize)&&(this._everInitialized=!0,this._api.getCardElementManager().update())}uninitialize(e){this._initializer.uninitialize(e)}}class Ib{constructor(e,t,n,i){this.update=()=>{this._element.requestUpdate()},this._api=e,this._element=t,this._scrollCallback=n,this._menuToggleCallback=i}getElement(){return this._element}scrollReset(){this._scrollCallback()}toggleMenu(){this._menuToggleCallback()}hasUpdated(){return this._element.hasUpdated}elementConnected(){this._api.getInteractionManager().initialize(),this._api.getFullscreenManager().initialize(),this._api.getExpandManager().initialize(),this._api.getMediaLoadedInfoManager().initialize(),this._api.getMicrophoneManager().initialize(),this._api.getKeyboardStateManager().initialize(),this._api.getDefaultManager().initialize(),this._api.getMediaPlayerManager().initialize(),this._api.getHASSManager().getStateWatcher()?.subscribe(this.update,[...this._api.getConfigManager().getConfig()?.view.render_entities??[],...this._api.getMediaPlayerManager().getMediaPlayers()??[]]),af(this._element,(e=>{const t=e.getRootNode();return!!(t&&t instanceof ShadowRoot&&"HUI-PANEL-VIEW"===t.host.tagName)})(this._element),"panel"),af(this._element,fb(),"casted"),this._api.getFullscreenManager().connect(),this._element.addEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.addEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.addEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.addEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.addEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.addEventListener("popstate",this._api.getQueryStringManager().requestExecution),this._api.getQueryStringManager().requestExecution(),this._element.requestUpdate()}elementDisconnected(){af(this._element,!1,"panel"),af(this._element,!1,"tabindex"),af(this._element,!1,"casted"),this._api.getMediaLoadedInfoManager().clear(),this._api.getFullscreenManager().disconnect(),this._api.getKeyboardStateManager().uninitialize(),this._api.getActionsManager().uninitialize(),this._api.getDefaultManager().uninitialize(),this._api.getHASSManager().getStateWatcher()?.unsubscribe(this.update),this._api.getInitializationManager().uninitialize($b.CAMERAS),this._api.getCameraManager().reset(),this._element.removeEventListener("mousemove",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("wheel",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("ll-custom",this._api.getActionsManager().handleCustomActionEvent),this._element.removeEventListener("action",this._api.getActionsManager().handleInteractionEvent),this._element.removeEventListener("action",this._api.getInteractionManager().reportInteraction),this._element.removeEventListener("frigate-card:action:execution-request",this._api.getActionsManager().handleActionExecutionRequestEvent),window.removeEventListener("location-changed",this._api.getQueryStringManager().requestExecution),window.removeEventListener("popstate",this._api.getQueryStringManager().requestExecution)}}function zb(e,t,n){return null==e?e:function(e,t,n,i){if(!dh(e))return e;for(var a=-1,r=(t=ry(t,e)).length,s=r-1,o=e;null!=o&&++a{zb(e,t,n)},Ob=(e,t,n)=>gy(e,t,n),Db=(e,t)=>{!function(e,t){null==e||Tb(e,t)}(e,t)},Rb=e=>l_(e),Pb=(e,t)=>e.replace("#",`[${t.toString()}]`),Lb=function(e){let t=!1;for(let n=0;n{const a=Ob(e,t);if(void 0===a)return!1;const r=i?.transform?i.transform(a):a;return!(t===n&&jy(a,r)||(null===r?i?.keepOriginal||(Db(e,t),0):void 0===r||(i?.keepOriginal||Db(e,t),jb(e,n,r),0)))})(i,e,t,n)}},Vb=function(e,t,n){return function(i){let a=Fb(e,t,n)(i);return a=qb(yo,Fb(e,t,n),(e=>e.overrides))(i)||a,a}},Hb=function(e,t){return Vb(e,e,{transform:t})},Bb=function(e){return Vb(e,e,{transform:e=>null})},qb=function(e,t,n){return function(i){let a=!1;const r=Ob(i,e);return Array.isArray(r)&&r.forEach((e=>{const i=n?n(e):e;i&&"object"==typeof i&&(a=t(i)||a)})),a}},Ub=(e,t)=>{const n=i=>{let a=!1;if(i&&"object"==typeof i){const r=t?t(i):i;r&&(a=e(r)||a),Array.isArray(i)?i.forEach((e=>{a=n(e)||a})):Object.keys(i).forEach((e=>{a=n(i[e])||a}))}return a};return n},Wb=e=>!("object"!=typeof e||!e||void 0===e.mediaLoaded)&&(e.media_loaded=e.mediaLoaded,delete e.mediaLoaded,!0),Zb=e=>{if("object"!=typeof e||!e||"object"!=typeof e.conditions||!e.conditions)return!1;const t=e.conditions,n=[];if(void 0!==t.view&&n.push({condition:"view",views:t.view}),void 0!==t.fullscreen&&n.push({condition:"fullscreen",fullscreen:t.fullscreen}),void 0!==t.expand&&n.push({condition:"expand",expand:t.expand}),void 0!==t.camera&&n.push({condition:"camera",cameras:t.camera}),void 0!==t.media_loaded&&n.push({condition:"media_loaded",media_loaded:t.media_loaded}),void 0!==t.state&&Array.isArray(t.state))for(const e of t.state)"object"!=typeof e||!e||void 0===e.state&&void 0===e.state_not&&void 0===e.entity||n.push({condition:"state",...e.state&&{state:e.state},...e.state_not&&{state_not:e.state_not},...e.entity&&{entity:e.entity}});return void 0!==t.media_query&&n.push({condition:"screen",media_query:t.media_query}),!!n.length&&(e.conditions=n,!0)},Qb=e=>!("object"!=typeof e||!e||"call-service"!==e.action||"string"!=typeof e.service)&&(e.action="perform-action",e.perform_action=e.service,delete e.service,!0),Gb=e=>!("object"!=typeof e||!e||"call-service"!==e.action||void 0===e.service||void 0===e.service_data||void 0!==e.data)&&(e.data=e.service_data,delete e.service_data,!0),Yb=e=>!("object"!=typeof e||!e||"custom:frigate-card-action"!==e.action||"frigate_ui"!==e.frigate_card_action)&&(e.frigate_card_action="camera_ui",!0),Kb=[qb(yo,Wb,(e=>e.conditions)),e=>Ub(Wb,(e=>e.conditions))("object"==typeof e&&e?e[Aa]:{}),Vb("event_gallery",ar),Vb("menu.buttons.frigate_ui",to),e=>Ub(Yb)("object"==typeof e&&e?e:{}),qb(wi,Hb("live_provider",(e=>"frigate-jsmpeg"===e?"jsmpeg":e))),Vb("live.jsmpeg",Ca),Vb("live.image",wa),Vb("live.webrtc_card",Ma),qb(wi,Vb("frigate.zone","frigate.zones",{transform:e=>qm(e)})),qb(wi,Vb("frigate.label","frigate.labels",{transform:e=>qm(e)})),e=>Ub(Gb)("object"==typeof e&&e?e:{}),function(e){if("object"!=typeof e||!e||!(Aa in e)||!Array.isArray(e[Aa]))return!1;let t=!1;const n=n=>{if(!t){if(!gy(e,"live.controls.ptz")){const{type:t,...i}=n;zb(e,"live.controls.ptz",i)}t=!0}},i=e=>{const t=[];for(const a of e)if("custom:frigate-card-ptz"===a.type)n(a);else if("conditional"!==a.type&&"custom:frigate-card-conditional"!==a.type||!Array.isArray(a.elements))t.push(a);else{const e=i(a.elements);e.length&&(a.elements=e,t.push(a))}return t},a=i(e[Aa]);return t&&(a.length?e[Aa]=a:delete e[Aa]),t},Vb("view.timeout_seconds",Oa),Hb("live.lazy_unload",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qm(e))),Hb("live.auto_play",(e=>"all"===e?null:"never"===e?[]:qm(e))),Hb("live.auto_pause",(e=>"all"===e?["unselected","hidden"]:"never"===e?null:qm(e))),Hb("live.auto_mute",(e=>"all"===e?null:"never"===e?[]:qm(e))),Hb("live.auto_unmute",(e=>"all"===e?["selected","visible","microphone"]:"never"===e?null:qm(e))),Hb("media_viewer.auto_play",(e=>"all"===e?null:"never"===e?[]:qm(e))),Hb("media_viewer.auto_pause",(e=>"all"===e?null:"never"===e?[]:qm(e))),Hb("media_viewer.auto_mute",(e=>"all"===e?null:"never"===e?[]:qm(e))),Hb("media_viewer.auto_unmute",(e=>"all"===e?["selected","visible"]:"never"===e?null:qm(e))),Vb("live.controls.thumbnails.media",ns),Vb("timeline.media",Ns),Vb("live.controls.timeline.media",ds),Vb("media_viewer.controls.timeline.media",Or),Vb("view.scan",Ya),Vb("view.triggers.enabled",tr,{transform:e=>!0===e?"live":null,keepOriginal:!0}),Vb("view.triggers.enabled",Xa,{transform:e=>!0!==e&&null}),Vb("view.triggers.untrigger_reset",nr,{transform:e=>e?"default":null}),Vb("live.layout",Ea),Bb("media_viewer.layout"),Bb("image.layout"),qb(yo,Zb),e=>Ub(Zb)("object"==typeof e&&e?e[Aa]:{}),e=>Ub(Zb)("object"==typeof e&&e?e.automations:{}),qb(wi,Vb("hide","capabilities",{transform:e=>!0===e?{disable_except:["substream"]}:null})),Vb("performance.profile",ko,{transform:e=>"low"===e?["low-performance"]:null}),qb(yo,Fb("overrides","merge")),Vb("live.controls.ptz",$a,{transform:e=>{if("object"!=typeof e||!e)return;const t=["data_left","data_right","data_up","data_down","data_zoom_in","data_zoom_out","service"],n=["actions_left","actions_right","actions_up","actions_down","actions_zoom_in","actions_zoom_out"],i=[...t,...n,"data_home","actions_home"];if(!Object.keys(e).some((e=>i.includes(e))))return;const a={};t.filter((t=>t in e)).reduce(((t,n)=>(t[n]=e[n],t)),a),n.filter((t=>t in e)).reduce(((t,n)=>("object"==typeof e[n]&&"tap_action"in e[n]&&(t[n]=e[n].tap_action),t)),a);const r=()=>{a.presets="presets"in e&&"object"==typeof e.presets&&e.presets?e.presets:{}};return"actions_home"in e&&"object"==typeof e.actions_home&&e.actions_home&&"tap_action"in e.actions_home?(r(),a.presets.home=e.actions_home.tap_action):"data_home"in e&&"object"==typeof e.data_home&&e.data_home&&"string"==typeof e.service&&(r(),a.presets.service=e.service,a.presets.data_home=e.data_home),a},keepOriginal:!0}),Hb("live.controls.ptz",(e=>{if("object"!=typeof e||!e)return e;const t=["mode","position","orientation","hide_pan_tilt","hide_zoom","hide_home","style"],n=Object.keys(e);return n.some((e=>!t.includes(e)))?n.filter((e=>t.includes(e))).reduce(((t,n)=>(t[n]=e[n],t)),{}):void 0})),Vb("view.update_cycle_camera",qa),Vb("view.update_force",Wa,{transform:e=>!0===e?"all":null}),Vb("view.update_seconds",Za),Vb("view.update_entities",Qa),Fb("live.controls.title",oo,{transform:e=>"object"==typeof e&&e&&"string"==typeof e.mode?"none"===e.mode?{style:"none"}:e.mode.includes("bottom")?{position:"bottom"}:e.mode.includes("top")?{position:"top"}:null:null}),Bb("live.controls.title"),Bb("media_viewer.controls.title"),e=>Ub(Qb)("object"==typeof e&&e?e:{}),Vb("dimensions.max_height",_o),Bb("dimensions.min_height")];class Xb extends $o{}class Jb extends Event{constructor(e,t){super("frigate-card:conditions:evaluate",t),this.conditions=e}}function ew(e,t,n){let i=Rb(t),a=!1;if(n?.configOverrides)for(const t of n.configOverrides)e.evaluateConditions(t.conditions,n?.stateOverrides)&&(t.delete?.forEach((e=>{Db(i,e)})),Object.keys(t.set??{}).forEach((e=>{jb(i,e,t.set?.[e])})),Object.keys(t.merge??{}).forEach((e=>{jb(i,e,Rv({},Ob(i,e),t.merge?.[e]))})),a=!0);if(!a)return t;if(n?.configOverrides?.some((e=>e.delete?.length))&&(i=df(i)),n?.schema){const e=n.schema.safeParse(i);if(!e.success)throw new Xb(N_("error.invalid_configuration_override"),[e.error.errors,i]);return e.data}return i}class tw{constructor(e,t){this._state={},this._epoch=this._createEpoch(),this._hasHAStateConditions=!1,this._mediaQueries=[],this._mediaQueryTrigger=()=>this._triggerChange(),this._api=e,this._listeners=[()=>this._api.getConfigManager().computeOverrideConfig(),()=>this._api.getAutomationsManager().execute(),...t?[t]:[]]}removeConditions(){this._mediaQueries.forEach((e=>e.removeEventListener("change",this._mediaQueryTrigger))),this._mediaQueries=[]}setConditionsFromConfig(){this.removeConditions();const e=(()=>{const e=this._api.getConfigManager().getConfig(),t=[];e?.overrides?.forEach((e=>t.push(...e.conditions))),e?.automations?.forEach((e=>t.push(...e.conditions)));const n=e=>{const i=fl.safeParse(e);i.success?(t.push(...i.data.conditions),i.data.elements?.forEach(n)):e&&"object"==typeof e&&Object.keys(e).forEach((t=>n(e[t])))};return e?.elements?.forEach(n),t})();this._hasHAStateConditions=e.some((e=>!e.condition||["state","numeric_state","user"].includes(e.condition))),e.forEach((e=>{if("screen"===e.condition){const t=window.matchMedia(e.media_query);t.addEventListener("change",this._mediaQueryTrigger),this._mediaQueries.push(t)}}))}setState(e){Object.keys(e).every((t=>jy(e[t],this._state[t])))||(this._state={...this._state,...e},this._triggerChange())}getState(){return this._state}hasHAStateConditions(){return this._hasHAStateConditions}getEpoch(){return this._epoch}evaluateConditions(e,t){return e.every((e=>this._evaluateCondition(e,t)))}_evaluateCondition(e,t){const n={...this._state,...t};switch(e.condition){case void 0:case"state":return!!n.state&&(!e.state&&!e.state_not||e.entity in n.state&&(!e.state||(Array.isArray(e.state)?e.state.includes(n.state[e.entity].state):e.state===n.state[e.entity].state))&&(!e.state_not||(Array.isArray(e.state_not)?!e.state_not.includes(n.state[e.entity].state):e.state_not!==n.state[e.entity].state)));case"view":return!!n?.view&&e.views.includes(n.view);case"fullscreen":return void 0!==n.fullscreen&&e.fullscreen===n.fullscreen;case"expand":return void 0!==n.expand&&e.expand===n.expand;case"camera":return!!n.camera&&e.cameras.includes(n.camera);case"numeric_state":return!!n.state&&e.entity in n.state&&void 0!==n.state[e.entity].state&&(void 0===e.above||Number(n.state[e.entity].state)>e.above)&&(void 0===e.below||Number(n.state[e.entity].state)n.triggered?.has(e)));case"interaction":return void 0!==n.interaction&&e.interaction===n.interaction;case"microphone":return!(void 0!==e.connected&&n.microphone?.connected!==e.connected||void 0!==e.muted&&n.microphone?.muted!==e.muted);case"key":return!(!n.keys||!(e.key in n.keys)||(e.state??"down")!==n.keys[e.key].state||void 0!==e.ctrl&&e.ctrl!==!!n.keys[e.key].ctrl||void 0!==e.alt&&e.alt!==!!n.keys[e.key].alt||void 0!==e.meta&&e.meta!==!!n.keys[e.key].meta||void 0!==e.shift&&e.shift!==!!n.keys[e.key].shift)}}_createEpoch(){return{manager:this}}_triggerChange(){this._epoch=this._createEpoch(),this._listeners.forEach((e=>e()))}}const nw={casting:{[Wr]:!1,[Mr]:!1,[Ks]:"none",[`${io}.enabled`]:!0,[`${ao}.enabled`]:!0,[`${no}.enabled`]:!1,[`${ro}.enabled`]:!1,[Ur]:["selected","visible"],[fo]:"static",[mo]:"16:9",[ka]:1,[Ss]:!0},"low-performance":{[is]:"none",[Er]:"none",[Hs]:"none",[ps]:!1,[Pr]:!1,[Fs]:!1,[qr]:[],[hr]:[],[pr]:[],[gr]:[],[xs]:["unselected","hidden"],[bs]:!1,[br]:!1,[Ms]:"none",[Cr]:"none",[Ss]:!1,[Sr]:"chevrons",[lo]:"none",[Ks]:"outside",[`${eo}.enabled`]:!1,[`${so}.enabled`]:!1,[`${so}.enabled`]:!1,[`${ro}.enabled`]:!1,[or]:!1,[cr]:!1,[lr]:!1,[sr]:!1,[ss]:!1,[os]:!1,[cs]:!1,[rs]:!1,[Ar]:!1,[Ir]:!1,[zr]:!1,[$r]:!1,[Us]:!1,[Ws]:!1,[Zs]:!1,[qs]:!1,[bo]:!1,[wo]:10,[So]:!1,[Mo]:!1,[xr]:!1,[Sa]:!1,[xa]:"image",[ka]:10,[tr]:"none",[xo]:1},scrubbing:{[us]:"below",[gs]:"ribbon",[hs]:"seek",[Dr]:"below",[Lr]:"ribbon",[Rr]:"seek"}},iw=(e,t,n)=>{const i=jo(Pd).safeParse(e);if(!i.success)return t;const a=i.data;for(const e of n??[])e in nw&&Object.entries(nw[e]).forEach((([e,n])=>{return r=n,void(void 0===Ob(a,i=e)&&jb(t,i,r));var i,r}));return t},aw=e=>{switch(e){case"ptz_left":return"left";case"ptz_right":return"right";case"ptz_up":return"up";case"ptz_down":return"down";case"ptz_zoom_in":return"zoom_in";case"ptz_zoom_out":return"zoom_out"} +/* istanbul ignore next: No (current) way to reach this code -- @preserve */return null},rw=(e,t)=>{if(!t.enabled)return[];const n=[];for(const i of["ptz_down","ptz_left","ptz_right","ptz_up","ptz_zoom_in","ptz_zoom_out"]){const a=t[i],r=aw(i);a&&r&&(n.push({conditions:[{condition:"key",key:a.key,state:"down",shift:a.shift,ctrl:a.ctrl,alt:a.alt,meta:a.meta}],actions:[ff({ptzAction:r,ptzPhase:"start"})],tag:e}),n.push({conditions:[{condition:"key",key:a.key,state:"up"}],actions:[ff({ptzAction:r,ptzPhase:"stop"})],tag:e}))}const i=t.ptz_home;return i&&n.push({conditions:[{condition:"key",key:i.key,state:"down",shift:i.shift,ctrl:i.ctrl,alt:i.alt,meta:i.meta}],actions:[ff()],tag:e}),n};class sw{constructor(e){this._config=null,this._overriddenConfig=null,this._rawConfig=null,this._cardWideConfig=null,this._api=e}hasConfig(){return!!this.getConfig()}getConfig(){return this._overriddenConfig??this._config}getCardWideConfig(){return this._cardWideConfig}getNonOverriddenConfig(){return this._config}getRawConfig(){return this._rawConfig}setConfig(e){if(!e)throw new Error(N_("error.invalid_configuration"));const t=Pd.safeParse(e);if(!t.success){const n=Nb(e),i=Do(t.error);let a="";throw n&&(a=`${N_("error.upgrade_available")}. `),new Error(a+`${N_("error.invalid_configuration")}: `+(i&&i.size?JSON.stringify([...i],null," "):N_("error.invalid_configuration_no_hint")))}const n=iw(e,t.data,t.data.profiles);var i;(this._rawConfig=e,jy(this._config,n))||(this._config=n,this._cardWideConfig={performance:n.performance,debug:n.debug},this._api.getConditionsManager().setConditionsFromConfig(),this._api.getConditionsManager().setState({view:void 0,displayMode:void 0,camera:void 0}),this._api.getMediaLoadedInfoManager().clear(),this._api.getInitializationManager().uninitialize($b.VIEW),this._api.getViewManager().reset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setPerformance(),this._api.getStatusBarItemManager().removeAllDynamicStatusBarItems(),((e,t)=>{e.getAutomationsManager().deleteAutomations(t);const n=e.getConfigManager().getConfig()?.view.keyboard_shortcuts;if(!n)return;const i=rw(t,n);i.length&&e.getAutomationsManager().addAutomations(i)})(this._api,this),(i=this._api).getAutomationsManager().deleteAutomations(),i.getAutomationsManager().addAutomations(i.getConfigManager().getNonOverriddenConfig()?.automations??[]),this.computeOverrideConfig(),this._api.getCardElementManager().update())}computeOverrideConfig(){const e=this._api.getConditionsManager();if(!this._config)return;let t=null;try{t=ew(e,this._config,{configOverrides:this._config.overrides,schema:Pd})}catch(e){return void this._api.getMessageManager().setErrorIfHigherPriority(e)}if(jy(t,this._overriddenConfig))return;const n=this._overriddenConfig;this._overriddenConfig=t,this._api.getStyleManager().setMinMaxHeight(),!n||jy(n?.cameras,this._overriddenConfig?.cameras)&&jy(n?.cameras_global,this._overriddenConfig?.cameras_global)||this._api.getInitializationManager().uninitialize($b.CAMERAS),n&&n?.live.microphone.always_connected!==this._overriddenConfig?.live.microphone.always_connected&&this._api.getInitializationManager().uninitialize($b.MICROPHONE_CONNECT),this._initializeBackground(n)}async _initializeBackground(e){await this._api.getDefaultManager().initializeIfNecessary(e),await this._api.getMediaPlayerManager().initializeIfNecessary(e),this._api.getCardElementManager().update()}}class ow{constructor(e){this._timer=new bf,this._stateChangeHandler=()=>{this._setToDefaultIfAllowed()},this._api=e}async initializeIfNecessary(e){jy(e?.view.default_reset,this._api.getConfigManager().getConfig()?.view.default_reset)||await this.initialize()}async initialize(){this.uninitialize();const e=this._api.getConfigManager().getConfig()?.view.default_reset;e?.entities.length&&this._api.getHASSManager().getStateWatcher().subscribe(this._stateChangeHandler,e.entities);const t=this._api.getConfigManager().getConfig()?.view.default_reset.every_seconds;return t&&this._timer.startRepeated(t,(()=>this._setToDefaultIfAllowed())),this._api.getConfigManager().getConfig()?.view.default_reset.after_interaction&&this._api.getAutomationsManager().addAutomations([{actions:[pf("default")],conditions:[{condition:"interaction",interaction:!1}],tag:this}]),!0}uninitialize(){this._timer.stop(),this._api.getHASSManager().getStateWatcher().unsubscribe(this._stateChangeHandler),this._api.getAutomationsManager().deleteAutomations(this)}_setToDefaultIfAllowed(){this._isAutomatedUpdateAllowed()&&this._api.getViewManager().setViewDefault()}_isAutomatedUpdateAllowed(){const e=this._api.getConfigManager().getConfig()?.view.default_reset.interaction_mode;return!!e&&((e,t)=>{switch(e){case"all":return!0;case"active":return t;case"inactive":return!t}})(e,this._api.getInteractionManager().hasInteraction())}}const cw=(e,t="download")=>{const n=new URL(e).origin===window.location.origin,i=e.startsWith("data:");if(navigator.userAgent.startsWith("Home Assistant/")||navigator.userAgent.startsWith("HomeAssistant/")||!n&&!i)window.open(e,"_blank");else{const n=document.createElement("a");n.setAttribute("download",t),n.href=e,n.click(),n.remove()}},lw=async(e,t,n)=>{const i=await t.getMediaDownloadPath(n);if(!i)throw new $o(N_("error.download_no_media"));let a=i.endpoint;if(i.sign){let t;try{t=await _b(e,i.endpoint)}catch(e){Zm(e)}if(!t)throw new $o(N_("error.download_sign_failed"));a=t}cw(a)},dw=e=>{const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg")):null};class uw{constructor(e){this._api=e}async downloadViewerMedia(){const e=this._api.getViewManager().getView()?.queryResults?.getSelectedResult(),t=this._api.getHASSManager().getHASS();if(!e||!t)return!1;try{await lw(t,this._api.getCameraManager(),e)}catch(e){return this._api.getMessageManager().setErrorIfHigherPriority(e),!1}return!0}async downloadScreenshot(){const e=await(this._api.getMediaLoadedInfoManager().get()?.player?.getScreenshotURL());e&&cw(e,(e=>{if(e?.is("live")||e?.is("image"))return`${e.view}-${e.camera}-${qu(new Date,"yyyy-MM-dd-HH-mm-ss")}.jpg`;if(e?.isViewerView()){const t=e.queryResults?.getSelectedResult(),n=t?.getID()??null;return`${e.view}-${e.camera}${n?`-${n}`:""}.jpg`}return"screenshot.jpg"})(this._api.getViewManager().getView()))}}class hw{constructor(e){this._expanded=!1,this._api=e}initialize(){this._setConditionState()}isExpanded(){return this._expanded}toggleExpanded(){this.setExpanded(!this._expanded)}setExpanded(e){e&&this._api.getFullscreenManager().isInFullscreen()&&this._api.getFullscreenManager().stopFullscreen(),this._expanded=e,this._setConditionState(),this._api.getCardElementManager().update()}_setConditionState(){this._api.getConditionsManager()?.setState({expand:this._expanded})}}const pw=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],gw=(()=>{if("undefined"==typeof document)return!1;const e=pw[0],t={};for(const n of pw){const i=n?.[1];if(i in document){for(const[i,a]of n.entries())t[e[i]]=a;return t}}return!1})(),mw={change:gw.fullscreenchange,error:gw.fullscreenerror};let fw={request:(e=document.documentElement,t)=>new Promise(((n,i)=>{const a=()=>{fw.off("change",a),n()};fw.on("change",a);const r=e[gw.requestFullscreen](t);r instanceof Promise&&r.then(a).catch(i)})),exit:()=>new Promise(((e,t)=>{if(!fw.isFullscreen)return void e();const n=()=>{fw.off("change",n),e()};fw.on("change",n);const i=document[gw.exitFullscreen]();i instanceof Promise&&i.then(n).catch(t)})),toggle:(e,t)=>fw.isFullscreen?fw.exit():fw.request(e,t),onchange(e){fw.on("change",e)},onerror(e){fw.on("error",e)},on(e,t){const n=mw[e];n&&document.addEventListener(n,t,!1)},off(e,t){const n=mw[e];n&&document.removeEventListener(n,t,!1)},raw:gw};Object.defineProperties(fw,{isFullscreen:{get:()=>Boolean(document[gw.fullscreenElement])},element:{enumerable:!0,get:()=>document[gw.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[gw.fullscreenEnabled])}}),gw||(fw={isEnabled:!1});var _w=fw;class yw{constructor(e){this._fullscreenHandler=()=>{this._api.getExpandManager().setExpanded(!1),this._setConditionState(),this._api.getCardElementManager().update()},this._api=e}initialize(){this._setConditionState()}connect(){_w.isEnabled&&_w.on("change",this._fullscreenHandler)}disconnect(){_w.isEnabled&&_w.off("change",this._fullscreenHandler)}isInFullscreen(){return _w.isEnabled&&_w.isFullscreen}toggleFullscreen(){_w.toggle(this._api.getCardElementManager().getElement())}stopFullscreen(){_w.exit()}_setConditionState(){this._api.getConditionsManager()?.setState({fullscreen:this.isInFullscreen()})}}class vw{constructor(){this._watcherCallbacks=new Map}setHASS(e,t){if(e)for(const[n,i]of this._watcherCallbacks.entries()){const a=yb(t,e,i,{stateOnly:!0,firstOnly:!0});a.length&&n(a[0])}}subscribe(e,t){return!!t.length&&(this._watcherCallbacks.has(e)?this._watcherCallbacks.get(e)?.push(...t):this._watcherCallbacks.set(e,t),!0)}unsubscribe(e){this._watcherCallbacks.delete(e)}}class bw{constructor(e){this._hass=null,this._stateWatcher=new vw,this._api=e}getHASS(){return this._hass}hasHASS(){return!!this._hass}getStateWatcher(){return this._stateWatcher}setHASS(e){if(((e,t)=>e?.connected!==t?.connected)(this._hass,e)&&(e?.connected?this._api.getMessageManager().resetType("connection"):this._api.getMessageManager().setMessageIfHigherPriority({message:N_("error.reconnecting"),icon:"mdi:lan-disconnect",type:"connection",dotdotdot:!0})),!e)return;const t=this._hass;this._hass=e,this._api.getConditionsManager().hasHAStateConditions()&&this._api.getConditionsManager().setState({state:this._hass.states,user:this._hass.user}),this._api.getStyleManager().setLightOrDarkMode(),this._stateWatcher.setHASS(t,e)}}var ww=function(){return Ju.Date.now()},xw="Expected a function",Cw=Math.max,Mw=Math.min;function Sw(e,t,n){var i,a,r,s,o,c,l=0,d=!1,u=!1,h=!0;if("function"!=typeof e)throw new TypeError(xw);function p(t){var n=i,r=a;return i=a=void 0,l=t,s=e.apply(r,n)}function g(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=r}function m(){var e=ww();if(g(e))return f(e);o=setTimeout(m,function(e){var n=t-(e-c);return u?Mw(n,r-(e-l)):n}(e))}function f(e){return o=void 0,h&&i?p(e):(i=a=void 0,s)}function _(){var e=ww(),n=g(e);if(i=arguments,a=this,c=e,n){if(void 0===o)return function(e){return l=e,o=setTimeout(m,t),d?p(e):s}(c);if(u)return clearTimeout(o),o=setTimeout(m,t),p(c)}return void 0===o&&(o=setTimeout(m,t)),s}return t=wm(t)||0,dh(n)&&(d=!!n.leading,r=(u="maxWait"in n)?Cw(wm(n.maxWait)||0,t):r,h="trailing"in n?!!n.trailing:h),_.cancel=function(){void 0!==o&&clearTimeout(o),l=0,i=c=a=o=void 0},_.flush=function(){return void 0===o?s:f(ww())},_}function kw(e,t,n){var i=!0,a=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return dh(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),Sw(e,t,{leading:i,maxWait:t,trailing:a})}class Ew{constructor(e){this._timer=new bf,this.reportInteraction=kw((()=>{this._reportInteraction()}),1e3),this._api=e}initialize(){this._api.getConditionsManager().setState({interaction:!1})}hasInteraction(){return this._timer.isRunning()}_reportInteraction(){this._timer.stop();const e=this._api.getConfigManager().getConfig()?.view.interaction_seconds;e&&(this._api.getConditionsManager().setState({interaction:!0}),this._timer.start(e,(()=>{this._api.getConditionsManager().setState({interaction:!1}),this._api.getStyleManager().setLightOrDarkMode()})))}}class $w{constructor(e){this._state={},this._handleKeydown=e=>{const t={state:"down",ctrl:e.ctrlKey,alt:e.altKey,meta:e.metaKey,shift:e.shiftKey};jy(this._state[e.key],t)||(this._state[e.key]=t,this._processStateChange())},this._handleKeyup=e=>{e.key in this._state&&"down"===this._state[e.key].state&&(this._state[e.key].state="up",this._processStateChange())},this._handleBlur=()=>{Object.keys(this._state).length&&(this._state={},this._processStateChange())},this._api=e}initialize(){const e=this._api.getCardElementManager().getElement();e.addEventListener("keydown",this._handleKeydown),e.addEventListener("keyup",this._handleKeyup),e.addEventListener("blur",this._handleBlur)}uninitialize(){const e=this._api.getCardElementManager().getElement();e.removeEventListener("keydown",this._handleKeydown),e.removeEventListener("keyup",this._handleKeyup),e.removeEventListener("blur",this._handleBlur)}_processStateChange(){this._api.getConditionsManager().setState({keys:this._state})}}function Aw(e,t){let n;return n=e instanceof Event?e.composedPath()[0]:e,n instanceof HTMLImageElement?{width:n.naturalWidth,height:n.naturalHeight,...t}:n instanceof HTMLVideoElement?{width:n.videoWidth,height:n.videoHeight,...t}:n instanceof HTMLCanvasElement?{width:n.width,height:n.height,player:t?.player,...t}:null}function Iw(e,t,n){const i=Aw(t,n);i&&zw(e,i)}function zw(e,t){Vm(e,"media:loaded",t)}function Tw(e){Vm(e,"media:unloaded")}function jw(e){Vm(e,"media:volumechange")}function Ow(e){Vm(e,"media:play")}function Dw(e){Vm(e,"media:pause")}class Rw{constructor(e){this._current=null,this._lastKnown=null,this._api=e}initialize(){this.clear()}set(e){var t;(t=e).height>=50&&t.width>=50&&(V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card media load: ",e),this._current=e,this._lastKnown=e,this._api.getConditionsManager().setState({media_loaded:!0}),this._api.getStyleManager().setExpandedMode(),this._api.getCardElementManager().update())}get(){return this._current}getLastKnown(){return this._lastKnown}clear(){this._current=null,this._api.getConditionsManager().setState({media_loaded:!1})}has(){return!!this._current}}class Pw{static isEvent(e){return this.isClip(e)||this.isSnapshot(e)}static isRecording(e){return"recording"===e.getMediaType()}static isClip(e){return"clip"===e.getMediaType()}static isSnapshot(e){return"snapshot"===e.getMediaType()}static isVideo(e){return this.isClip(e)||this.isRecording(e)}}class Lw{constructor(e){this._mediaPlayers=[],this._api=e}getMediaPlayers(){return this._mediaPlayers}hasMediaPlayers(){return this._mediaPlayers.length>0}async initializeIfNecessary(e){e?.menu.buttons.media_player.enabled!==this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled&&await this.initialize()}async initialize(){const e=this._api.getHASSManager().getHASS();if(!e||!this._api.getConfigManager().getConfig()?.menu.buttons.media_player.enabled)return!1;const t=Object.keys(e.states).filter((t=>{if(t.startsWith("media_player.")){const n=e.states[t];if(n&&"unavailable"!==n.state&&kb(n,131072))return!0}return!1}));let n=null;try{n=await this._api.getEntityRegistryManager().getEntities(e,t)}catch(e){Zm(e)}return this._mediaPlayers=t.filter((e=>{const t=n?.get(e);return!t||!t.hidden_by})),!0}async stop(e){const t=this._api.getHASSManager().getHASS(),n=t?.states[e];if(!n)return;let i;if(kb(n,4096))i="media_stop";else{if(!kb(n,256))return;i="turn_off"}await t.callService("media_player",i,{entity_id:e})}async playLive(e,t){const n=this._api.getCameraManager().getStore().getCameraConfig(t);n&&("dashboard"===n.cast?.method?await this._playLiveDashboard(e,n):await this._playLiveStandard(e,t,n))}async _playLiveStandard(e,t,n){const i=this._api.getHASSManager().getHASS(),a=n?.camera_entity??null;if(!i||!a)return;const r=this._api.getCameraManager().getCameraMetadata(t)?.title??null,s=i.states[a]?.attributes?.entity_picture??null;await i.callService("media_player","play_media",{entity_id:e,media_content_id:`media-source://camera/${a}`,media_content_type:"application/vnd.apple.mpegurl",extra:{...r&&{title:r},...s&&{thumb:s}}})}async _playLiveDashboard(e,t){const n=this._api.getHASSManager().getHASS();if(!n)return;const i=t.cast?.dashboard;i?.dashboard_path&&i?.view_path?await n.callService("cast","show_lovelace_view",{entity_id:e,dashboard_path:i.dashboard_path,view_path:i.view_path}):this._api.getMessageManager().setMessageIfHigherPriority({type:"error",icon:"mdi:cast",message:N_("error.no_dashboard_or_view")})}async playMedia(e,t){const n=this._api.getHASSManager().getHASS();if(!n||!t)return;const i=t.getTitle(),a=t.getThumbnail();await n.callService("media_player","play_media",{entity_id:e,media_content_id:t.getContentID(),media_content_type:Pw.isVideo(t)?"video":"image",extra:{...i&&{title:i},...a&&{thumb:a}}})}}class Nw{constructor(e){this._message=null,this._api=e}getMessage(){return this._message}hasMessage(){return!!this._message}hasErrorMessage(){return"error"===this._message?.type}reset(){const e=this.hasMessage();this._message=null,e&&this._api.getCardElementManager().update()}resetType(e){this._message?.type===e&&this.reset()}setErrorIfHigherPriority(e,t){e&&"object"==typeof e&&"message"in e&&(Zm(e),this.setMessageIfHigherPriority({message:t?`${t}: ${e.message}`:e.message,type:"error",...e instanceof $o&&{context:e.context}}))}setMessageIfHigherPriority(e){const t=this._message?Ao[this._message.type]:0,n=Ao[e.type];return!(this._message&&ne.stop())),this._stream=void 0,this._setConditionState(),this._api.getCardElementManager().update()}getStream(){return this._stream??void 0}mute(){const e=this.isMuted();this._mute=!0,this._setMute(),this._setConditionState(),e||this._callListeners("muted")}async unmute(){if(!this.isSupported())return;const e=!this.isMuted(),t=()=>{this._mute=!1,this._setMute()};this.isConnected()||this.isForbidden()?this.isConnected()&&t():(t(),await this.connect()),this._setConditionState(),e||this._callListeners("unmuted")}isConnected(){return!!this._stream}isForbidden(){return null===this._stream}isMuted(){return!this._stream||this._stream.getTracks().every((e=>!e.enabled))}addListener(e){this._listeners.push(e)}removeListener(e){this._listeners=this._listeners.filter((t=>t!==e))}_callListeners(e){this._listeners.forEach((t=>t(e)))}_setMute(){this._stream?.getTracks().forEach((e=>{e.enabled=!this._mute})),this._startTimer(),this._api.getCardElementManager().update()}_startTimer(){const e=this._api.getConfigManager().getConfig()?.live.microphone;if(e?.always_connected)return;const t=e?.disconnect_seconds??0;t&&this._timer.start(t,(()=>{this.disconnect()}))}_setConditionState(){this._api.getConditionsManager().setState({microphone:{muted:this.isMuted(),connected:this.isConnected()}})}}class Vw{constructor(e){this._shouldRun=!0,this.requestExecution=()=>{this._shouldRun=!0,this._api.getCardElementManager().update()},this.executeIfNecessary=async()=>{this._shouldRun&&(this._shouldRun=!1,await this._executeViewRelated(this._calculateIntent()),await this._executeNonViewRelated(this._calculateIntent()))},this._isViewAction=e=>{switch(e.frigate_card_action){case"clip":case"clips":case"diagnostics":case"image":case"live":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":return!0}return!1},this._api=e}hasViewRelatedActionsToRun(){return!!this._calculateIntent().view&&this._shouldRun}async _executeViewRelated(e){e.view&&(e.view.default?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.view.camera},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}):await this._api.getViewManager().setViewByParametersWithNewQuery({params:{...e.view.view&&{view:e.view.view},...e.view.camera&&{camera:e.view.camera}},...e.view.substream&&{modifiers:[new rb(e.view.substream)]}}))}async _executeNonViewRelated(e){e.other&&await this._api.getActionsManager().executeActions(e.other)}_calculateIntent(){const e={};for(const t of this._getActions())this._isViewAction(t)?((e.view??={}).view=t.frigate_card_action,(e.view??={}).default=void 0):"default"===t.frigate_card_action?((e.view??={}).default=!0,(e.view??={}).view=void 0):"camera_select"===t.frigate_card_action?(e.view??={}).camera=t.camera:"live_substream_select"===t.frigate_card_action?(e.view??={}).substream=t.camera:(e.other??=[]).push(t);return e}_getActions(){const e=new URLSearchParams(window.location.search),t=[],n=new RegExp(/^frigate-card-action([.:](?\w+))?[.:](?\w+)/);for(const[i,a]of e.entries()){const e=i.match(n);if(!e||!e.groups)continue;const r=e.groups.cardID,s=e.groups.action;let o=null;switch(s){case"camera_select":case"live_substream_select":a&&(o=gf(s,a,{cardID:r}));break;case"camera_ui":case"clip":case"clips":case"default":case"diagnostics":case"download":case"expand":case"image":case"live":case"menu_toggle":case"recording":case"recordings":case"snapshot":case"snapshots":case"timeline":o=pf(s,{cardID:r});break;default:console.warn(`Frigate card received unknown card action in query string: ${s}`)}o&&t.push(o)}return t}}class Hw{constructor(e){this._items=[],this._dynamicItems=[],this._api=e}addDynamicStatusBarItem(e){this._dynamicItems.includes(e)||this._dynamicItems.push(e),this._api.getCardElementManager().update()}removeDynamicStatusBarItem(e){this._dynamicItems=this._dynamicItems.filter((t=>!jy(t,e))),this._api.getCardElementManager().update()}removeAllDynamicStatusBarItems(){this._dynamicItems=[],this._api.getCardElementManager().update()}calculateItems(e){const t=e?.view?e?.cameraManager?.getCameraMetadata(e?.view?.camera):null,n=t?.engineIcon??null,i=e?.view?.is("live")?t?.title??null:e?.view?.isViewerView()?e?.view.queryResults?.getSelectedResult()?.getTitle()??null:null,a=e?.mediaLoadedInfo?this._calculateResolution(e?.mediaLoadedInfo):null,r=e?.mediaLoadedInfo?.technology?.length?e?.mediaLoadedInfo.technology[0]:null;return[...i?[{type:"custom:frigate-card-status-bar-string",string:i,expand:!0,sufficient:!0,...e?.statusConfig?.items.title}]:[],...a?[{type:"custom:frigate-card-status-bar-string",string:a,...e?.statusConfig?.items.resolution}]:[],...r&&"webrtc"===r?[{type:"custom:frigate-card-status-bar-icon",icon:"mdi:webrtc",...e?.statusConfig?.items.technology}]:r?[{type:"custom:frigate-card-status-bar-string",string:r.toUpperCase(),...e?.statusConfig?.items.technology}]:[],...n?[{type:"custom:frigate-card-status-bar-icon",icon:n,...e?.statusConfig?.items.engine}]:[],...this._dynamicItems]}_matchesWidthHeight(e,t,n){const i=.99*t,a=1.01*t,r=.99*n,s=1.01*n,o=(e,t,n)=>e>=t&&e<=n;return!!e&&(o(e.width,i,a)&&o(e.height,r,s)||o(e.height,i,a)&&o(e.width,r,s))}_calculateResolution(e){return this._matchesWidthHeight(e,1920,1080)?"1080p":this._matchesWidthHeight(e,1280,720)?"720p":this._matchesWidthHeight(e,640,480)?"VGA":this._matchesWidthHeight(e,3840,2160)?"4K":this._matchesWidthHeight(e,720,480)?"480p":this._matchesWidthHeight(e,720,576)?"576p":this._matchesWidthHeight(e,7680,4320)?"8K":`${e.width}x${e.height}`}}class Bw{constructor(e){this.setLightOrDarkMode=()=>{const e=this._api.getConfigManager().getConfig(),t="on"===e?.view.dark_mode||"auto"===e?.view.dark_mode&&(!this._api.getInteractionManager().hasInteraction()||!!this._api.getHASSManager().getHASS()?.themes.darkMode);af(this._api.getCardElementManager().getElement(),t,"dark")},this._api=e}setExpandedMode(){const e=this._api.getCardElementManager().getElement(),t=this._api.getViewManager().getView(),n=this._api.getMediaLoadedInfoManager().getLastKnown();e.style.setProperty("--frigate-card-expand-aspect-ratio",t?.isAnyMediaView()&&n?`${n.width} / ${n.height}`:"unset");const i=t?.isGrid();e.style.setProperty("--frigate-card-expand-width",!i&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-width)"),e.style.setProperty("--frigate-card-expand-height",!i&&t?.isAnyMediaView()?"none":"var(--frigate-card-expand-max-height)")}setMinMaxHeight(){const e=this._api.getConfigManager().getConfig();if(e){this._api.getCardElementManager().getElement().style.setProperty("--frigate-card-height",e.dimensions.height)}}setPerformance(){const e={box_shadow:"none",border_radius:"0px"},t=this._api.getCardElementManager().getElement(),n=this._api.getConfigManager().getCardWideConfig()?.performance,i=n?.style??{};for(const n of Object.keys(i)){const a=`--frigate-card-css-${n.replaceAll("_","-")}`;!1===i[n]?t.style.setProperty(a,e[n]):t.style.removeProperty(a)}}_isAspectRatioEnforced(e,t){const n=e.dimensions.aspect_ratio_mode;return!(this._api.getFullscreenManager().isInFullscreen()||this._api.getExpandManager().isExpanded()||"unconstrained"===n||"dynamic"===n&&(!t||t?.isAnyMediaView()||t?.is("timeline")||t?.is("diagnostics")))}getAspectRatioStyle(){const e=this._api.getConfigManager().getConfig(),t=this._api.getViewManager().getView();if(e){if(!this._isAspectRatioEnforced(e,t))return lf();const n=e.dimensions.aspect_ratio_mode,i=this._api.getMediaLoadedInfoManager().getLastKnown();return lf(i&&"dynamic"===n?{ratio:[i.width,i.height]}:{ratio:e.dimensions.aspect_ratio})}return lf({defaultStatic:!0})}}class qw{constructor(e){this._triggeredCameras=new Map,this._triggeredCameraTimers=new Map,this._throttledTriggerAction=kw(this._triggerAction.bind(this),1e3,{trailing:!0}),this._api=e}getTriggeredCameraIDs(){return new Set(this._triggeredCameras.keys())}isTriggered(){return!!this._triggeredCameras.size}getMostRecentlyTriggeredCameraID(){const e=Sy([...this._triggeredCameras.entries()],(e=>e[1].getTime()),"desc");return e.length?e[0][0]:null}async handleCameraEvent(e){const t=this._api.getConfigManager().getConfig()?.view.triggers,n=this._api.getViewManager().getView()?.camera;if(!t||!n)return;const i=this._api.getCameraManager().getStore().getAllDependentCameras(n);t.filter_selected_camera&&!i.has(e.cameraID)||("end"!==e.type?(this._triggeredCameras.set(e.cameraID,new Date),this._setConditionStateIfNecessary(),await this._throttledTriggerAction(e)):this._startUntriggerTimer(e.cameraID))}_hasAllowableInteractionStateForAction(){const e=this._api.getConfigManager().getConfig()?.view.triggers,t=this._api.getInteractionManager().hasInteraction();return!!e&&("all"===e.actions.interaction_mode||"active"===e.actions.interaction_mode&&t||"inactive"===e.actions.interaction_mode&&!t)}async _triggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.trigger,n=this._api.getConfigManager().getConfig()?.view.default;("high"!==e.fidelity||e.snapshot||e.clip||"live"===t||"default"===t&&"live"===n)&&(this._hasAllowableInteractionStateForAction()&&("update"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({queryExecutorOptions:{useCache:!1}}):"live"===t?await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:"live",camera:e.cameraID}}):"default"===t?await this._api.getViewManager().setViewDefaultWithNewQuery({params:{camera:e.cameraID}}):"high"===e.fidelity&&"media"===t&&await this._api.getViewManager().setViewByParametersWithNewQuery({params:{view:e.clip?"clip":"snapshot",camera:e.cameraID}})),this._api.getCardElementManager().update())}_setConditionStateIfNecessary(){const e=new Set(this._triggeredCameras.keys()),t=e.size?e:void 0;jy(t,this._api.getConditionsManager().getState().triggered)||this._api.getConditionsManager().setState({triggered:t})}async _untriggerAction(e){const t=this._api.getConfigManager().getConfig()?.view.triggers.actions.untrigger;"default"===t&&this._hasAllowableInteractionStateForAction()&&await this._api.getViewManager().setViewDefaultWithNewQuery(),this._triggeredCameras.delete(e),this._deleteTimer(e),this._setConditionStateIfNecessary(),this._api.getCardElementManager().update()}_startUntriggerTimer(e){this._deleteTimer(e);const t=new bf;this._triggeredCameraTimers.set(e,t),t.start( +/* istanbul ignore next: the case of config being null here cannot be + reached, as there's no way to have the untrigger call happen without + a config. -- @preserve */ +this._api.getConfigManager().getConfig()?.view.triggers.untrigger_seconds??0,(async()=>{await this._untriggerAction(e)}))}_deleteTimer(e){this._triggeredCameraTimers.get(e)?.stop(),this._triggeredCameraTimers.delete(e)}}function Uw(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Fm(e,void 0,t):[]}class Ww{constructor(e){this._queries=null,e&&(this._queries=e)}clone(){return l_(this)}getQueries(){return this._queries}setQueries(e){return this._queries=e,this}getQueryCameraIDs(){if(!this._queries)return null;const e=new Set;return this._queries.forEach((t=>[...t.cameraIDs].forEach((t=>e.add(t))))),e}setQueryCameraIDs(e){if(!this._queries)return this;const t=[];return this._queries.forEach((n=>t.push({...n,cameraIDs:Um(e)}))),this._queries=Uw(t,jy),this}hasQueriesForCameraIDs(e){for(const t of e)if(!this._queries?.some((e=>e.cameraIDs.has(t))))return!1;return!0}}class Zw extends Ww{convertToClipsQueries(){for(const e of this._queries??[])delete e.hasSnapshot,e.hasClip=!0;return this}}class Qw extends Ww{}class Gw{static areEventQueries(e){return e instanceof Zw}static areRecordingQueries(e){return e instanceof Qw}static areClipsQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasClip))}static areSnapshotQueries(e){return this.areEventQueries(e)&&!!e?.getQueries()?.every((e=>e.hasSnapshot))}static getQueriesType(e){return this.areEventQueries(e)?"event":this.areRecordingQueries(e)?"recording":null}static getMediaType(e){return this.areClipsQueries(e)?"clips":this.areSnapshotQueries(e)?"snapshots":this.areRecordingQueries(e)?"recordings":null}}const Yw=(e,t,n)=>{const i={anyCapabilities:["clips","snapshots","recordings"]};switch(t){case"image":case"diagnostics":return e.getStore().getCameraIDs();case"live":case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":const a="clip"===t?"clips":"snapshot"===t?"snapshots":"recording"===t?"recordings":t;return n?e.getStore().getAllDependentCameras(n,a):e.getStore().getCameraIDsWithCapability(a);case"timeline":return e.getStore().getCameraIDsWithCapability(i);case"media":return n?e.getStore().getAllDependentCameras(n,i):e.getStore().getCameraIDsWithCapability(i)}},Kw=(e,t)=>Rv({},e,t);class Xw{constructor(e){this.view=e.view,this.camera=e.camera,this.query=e.query??null,this.queryResults=e.queryResults??null,this.context=e.context??null,this.displayMode=e.displayMode??null}clone(){return new Xw({view:this.view,camera:this.camera,query:this.query?.clone()??null,queryResults:this.queryResults?.clone()??null,context:this.context,displayMode:this.displayMode})}evolve(e){return new Xw({view:void 0!==e.view?e.view:this.view,camera:void 0!==e.camera?e.camera:this.camera,query:void 0!==e.query?e.query:this.query?.clone()??null,queryResults:void 0!==e.queryResults?e.queryResults:this.queryResults?.clone()??null,context:void 0!==e.context?e.context:this.context,displayMode:void 0!==e.displayMode?e.displayMode:this.displayMode})}mergeInContext(e){return this.context=Kw(this.context,e),this}removeContext(e){return this.context&&delete this.context[e],this}removeContextProperty(e,t){const n=this.context?.[e];return n&&delete n[t],this}is(e){return this.view==e}isGalleryView(){return["clips","snapshots","recordings"].includes(this.view)}isAnyMediaView(){return this.isViewerView()||this.is("live")||this.is("image")}isViewerView(){return["media","clip","snapshot","recording"].includes(this.view)}supportsMultipleDisplayModes(){return this.isViewerView()||this.is("live")}getDefaultMediaType(){return["clip","clips"].includes(this.view)?"clips":["snapshot","snapshots"].includes(this.view)?"snapshots":["recording","recordings"].includes(this.view)?"recordings":null}isGrid(){return"grid"===this.displayMode}}const Jw=(e,t)=>{t?.forEach((t=>t.modify(e)))};class ex extends $o{}class tx extends $o{}class nx{constructor(e){this._api=e}getViewDefault(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=null;const i=e?.params?.view??t.view.default;if(e?.params?.camera)n=e.params.camera;else{const a=[...Yw(this._api.getCameraManager(),i)];if(!a.length)return null;if(e?.baseView?.camera&&t.view.default_cycle_camera){const t=a.indexOf(e.baseView.camera);n=a[t+1>=a.length?0:t+1]}else n=a[0]}return this.getViewByParameters({params:{...e?.params,view:i,camera:n},baseView:e?.baseView})}getViewByParameters(e){const t=this._api.getConfigManager().getConfig();if(!t)return null;let n=e?.params?.camera??e?.baseView?.camera??null,i=e?.params?.view??e?.baseView?.view??t.view.default;const a=this._api.getCameraManager().getStore().getCameraIDs();if(!n||!a.has(n)){n=Yw(this._api.getCameraManager(),i).keys().next().value??null}if(!n){const e=[...this._api.getCameraManager().getStore().getCameras()].reduce(((e,[t,n])=>{const i=n.getCapabilities()?.getRawCapabilities();return i&&(e[t]=i),e}),{});throw new ex(N_("error.no_supported_cameras"),{view:i,cameras_capabilities:e})}if(!this.isViewSupportedByCamera(n,i)){if(!e?.failSafe||!this.isViewSupportedByCamera(n,Wo)){const e=this._api.getCameraManager().getStore().getCamera(n)?.getCapabilities()?.getRawCapabilities();throw new tx(N_("error.no_supported_camera"),{view:i,camera:n,...e&&{camera_capabilities:e}})}i=Wo}const r=e?.params?.displayMode??e?.baseView?.displayMode??this._getDefaultDisplayModeForView(i,t),s={...e?.params,view:i,camera:n,displayMode:r},o=e?.baseView?e.baseView.evolve(s):new Xw(s);return Jw(o,e?.modifiers),o}isViewSupportedByCamera(e,t){return!!Yw(this._api.getCameraManager(),t,e).size}_getDefaultDisplayModeForView(e,t){let n=null;switch(e){case"media":case"clip":case"recording":case"snapshot":n=t.media_viewer.display?.mode??null;break;case"live":n=t.live.display?.mode??null}return n??"single"}}class ix{constructor(e,t){this._key=e,this._property=t}modify(e){e.removeContextProperty(this._key,this._property)}}class ax{constructor(e){this._query=e?.query,this._queryResults=e?.queryResults}modify(e){void 0!==this._query&&(e.query=this._query),void 0!==this._queryResults&&(e.queryResults=this._queryResults)}}const rx=(e,t,n)=>{let i;for(const[a,r]of e.entries()){const e=r.getStartTime(),s=r.getUsableEndTime();if(r.includesTime(t)&&e&&s){const t=s.getTime()-e.getTime();(!i||n&&i.cameraID!==n&&r.getCameraID()===n||t>i.duration&&(!n||i.cameraID!==n||r.getCameraID()===n))&&(i={index:a,duration:t,cameraID:r.getCameraID()})}}return i?i.index:null};class sx{constructor(e){this._results=e?.results??[],this._selectedIndex=this._getInitialSelectedIndex(e)}_getInitialSelectedIndex(e){return null!=e?.selectedIndex?e.selectedIndex:e?.results&&e.results.length?e?.selectApproach&&"last"!==e?.selectApproach?0:e.results.length-1:null}clone(){return new sx({results:this._results,selectedIndex:this._selectedIndex})}getResults(){return this._results}getSelectedIndex(){return this._selectedIndex}getResultsCount(){return this.getResults().length}hasResults(){return 0!==this.getResultsCount()}getResult(e){return void 0===e?null:this._results[e]}getSelectedResult(){const e=this.getSelectedIndex();return null!==e?this.getResult(e):null}hasSelectedResult(){return null!==this.getSelectedResult()}resetSelectedResult(){this._selectedIndex=null}selectIndex(e){(null===e||e>=0&&ee.getID()))),n=new Set(e._main.getResults()?.map((e=>e.getID())));return!(!t.size||!n.size||t.has(null)||n.has(null))&&((e,t)=>{for(const n of t)if(!e.has(n))return!1;return!0})(t,n)}getCameraIDs(){return new Set(this._cameras.keys())}getSlice(e){return e?this._cameras.get(e)??null:this._main}getResults(e){return this.getSlice(e)?.getResults()??null}getResultsCount(e){return this.getSlice(e)?.getResultsCount()??0}hasResults(e){return 0!==this.getSlice(e)?.getResultsCount()}getResult(e,t){return this.getSlice(t)?.getResult(e)??null}getSelectedIndex(e){return this.getSlice(e)?.getSelectedIndex()??null}getSelectedResult(e){return this.getSlice(e)?.getSelectedResult()??null}getMultipleSelectedResults(e){const t=[];if(!e||e.main){const e=this.getSelectedResult();e&&t.push(e)}const n=this._getCameraIDsFromCriteria(e);for(const e of n??[]){const n=this.getSelectedResult(e);n&&t.push(n)}return t}hasSelectedResult(e){return this.getSlice(e)?.hasSelectedResult()??!1}resetSelectedResult(e){return this.getSlice(e)?.resetSelectedResult(),this}getResultsTimestamp(){return this._resultsTimestamp}selectIndex(e,t){return this.getSlice(t)?.selectIndex(e),t||this.demoteMainSelectionToCameraSelection(),this}demoteMainSelectionToCameraSelection(){const e=this.getSelectedResult();if(e){const t=e.getCameraID();this.resetSelectedResult(t),this.selectResultIfFound((t=>t===e),{cameraID:t})}return this}promoteCameraSelectionToMainSelection(e){const t=this.getSelectedResult(e);return this.resetSelectedResult(),this.selectResultIfFound((e=>e===t)),this}_getCameraIDsFromCriteria(e){return e?.allCameras?this.getCameraIDs():e?.cameraID?new Set([e.cameraID]):null}selectResultIfFound(e,t){t&&!t?.main||(this._main.selectResultIfFound(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectResultIfFound(e);return this}selectBestResult(e,t){t&&!t.main||(this._main.selectBestResult(e),this.demoteMainSelectionToCameraSelection());const n=this._getCameraIDsFromCriteria(t);for(const t of n??[])this.getSlice(t)?.selectBestResult(e);return this}}class cx{constructor(e){this._api=e}async executeDefaultEventQuery(e){const t=e?.eventsMediaType&&"all"!==e?.eventsMediaType?e.eventsMediaType:{anyCapabilities:["clips","snapshots"]},n=this._api.getCameraManager(),i=e?.cameraID?n.getStore().getAllDependentCameras(e.cameraID,t):n.getStore().getCameraIDsWithCapability(t);if(!i.size)return null;const a=n.generateDefaultEventQueries(i,{limit:this._getChunkLimit(),..."clips"===e?.eventsMediaType&&{hasClip:!0},..."snapshots"===e?.eventsMediaType&&{hasSnapshot:!0}});if(!a)return null;const r=new Zw(a),s=await this.execute(r,e?.executorOptions);return s?{query:r,queryResults:s}:null}async executeDefaultRecordingQuery(e){const t=this._api.getCameraManager(),n=e?.cameraID?t.getStore().getAllDependentCameras(e.cameraID,"recordings"):t.getStore().getCameraIDsWithCapability("recordings");if(!n.size)return null;const i=t.generateDefaultRecordingQueries(n,{limit:this._getChunkLimit()});if(!i)return null;const a=new Qw(i),r=await this.execute(a,e?.executorOptions);return r?{query:a,queryResults:r}:null}async execute(e,t){const n=e.getQueries();if(!n)return null;const i=await this._api.getCameraManager().executeMediaQueries(n,{useCache:t?.useCache});if(!i)return null;const a=new ox({results:i});return t?.rejectResults?.(a)?null:(t?.selectResult?.id?a.selectBestResult((e=>e.findIndex((e=>e.getID()===t.selectResult?.id)))):t?.selectResult?.func?a.selectResultIfFound(t.selectResult.func):t?.selectResult?.time&&a.selectBestResult((e=>rx(e,t.selectResult?.time?.time,t.selectResult?.time?.favorCameraID))),a)}_getChunkLimit(){const e=this._api.getConfigManager().getCardWideConfig();return e?.performance?.features.media_chunk_size??50}}class lx{constructor(e,t){this._api=e,this._executor=t??new cx(e)}async getExistingQueryModifiers(e,t){return e.query?[new ax({queryResults:await this._executor.execute(e.query,t)})]:[]}async getNewQueryModifiers(e,t){return await this._executeNewQuery(e,{useCache:!1,...t})}async _executeNewQuery(e,t){const n=this._api.getConfigManager().getConfig();if(!n)return null;const i=e?.getDefaultMediaType(),a=[],r=async n=>{ +/* istanbul ignore if: this path cannot be reached -- @preserve */ +if(!n)return[];const i="recordings"===n?await this._executor.executeDefaultRecordingQuery({...!e.isGrid()&&{cameraID:e.camera},executorOptions:t}):"clips"===n||"snapshots"===n||"all"===n?await this._executor.executeDefaultEventQuery({...!e.isGrid()&&{cameraID:e.camera},eventsMediaType:n,executorOptions:t}):/* istanbul ignore next -- @preserve */ +null;return i?[new ax(i)]:[]};switch(e.view){case"live":"none"!==n.live.controls.thumbnails.mode&&a.push(...await r("recordings"===n.live.controls.thumbnails.media_type?"recordings":n.live.controls.thumbnails.events_media_type));break;case"media":a.push(...await r("clips"));break;case"clip":case"clips":case"snapshot":case"snapshots":case"recording":case"recordings":a.push(...await r(i))}return a.push(...this._getTimelineWindowViewModifier(e)),a.push(...this._getSeekTimeModifier(t?.selectResult?.time?.time)),a}_getTimelineWindowViewModifier(e){if(e.is("live")){const e=new Date,t=this._api.getConfigManager().getConfig()?.live; +/* istanbul ignore if: this if branch cannot be reached as if the config is + empty this function is never called -- @preserve */ +return t?[new Zv({timeline:{window:{start:Wu(e,{seconds:t.controls.timeline.window_seconds}),end:e}}})]:[]}return[new ix("timeline","window")]}_getSeekTimeModifier(e){return e?[new Zv({mediaViewer:{seek:e}})]:[new ix("mediaViewer","seek")]}}class dx{constructor(e,t){this._view=null,this._epoch=this._createEpoch(),this._loadingIndex=1,this.setViewDefault=e=>this._setViewGeneric(this._viewFactory.getViewDefault.bind(this._viewFactory),e),this.setViewByParameters=e=>this._setViewGeneric(this._viewFactory.getViewByParameters.bind(this._viewFactory),e),this.setViewDefaultWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewDefault.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithNewQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getNewQueryModifiers.bind(this._viewQueryExecutor),e),this.setViewByParametersWithExistingQuery=async e=>await this._setViewThenModifyAsync(this._viewFactory.getViewByParameters.bind(this._viewFactory),this._viewQueryExecutor.getExistingQueryModifiers.bind(this._viewQueryExecutor),e),this.initialize=async()=>(this._api.getQueryStringManager().hasViewRelatedActionsToRun()||this.setViewDefaultWithNewQuery({failSafe:!0}),!0),this._api=e,this._viewFactory=t?.viewFactory??new nx(e),this._viewQueryExecutor=t?.viewQueryExecutor??new lx(e)}getEpoch(){return this._epoch}_createEpoch(e){return{manager:this,...e&&{oldView:e}}}getView(){return this._view}hasView(){return!!this.getView()}reset(){this._view&&this._setView(null)}_setViewGeneric(e,t){let n=null;try{n=e({baseView:this._view,...t})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}n&&this._setView(n)}_markViewLoadingQuery(e,t){return e.mergeInContext({loading:{query:t}})}_markViewAsNotLoadingQuery(e){return e.removeContextProperty("loading","query")}async _setViewThenModifyAsync(e,t,n){let i=null;try{i=e({baseView:this._view,...n,params:{query:null,queryResults:null,...n?.params}})}catch(e){this._api.getMessageManager().setErrorIfHigherPriority(e)}if(!i)return;if(this._view&&this._shouldAdoptQueryAndResults(i))return i.query=this._view.query,i.queryResults=this._view.queryResults,this._markViewAsNotLoadingQuery(i),void this._setView(i);const a=this._loadingIndex++;this._markViewLoadingQuery(i,a),this._setView(i);let r=null,s=null;try{r=await t(i,n?.queryExecutorOptions)}catch(e){s=e}if(this._view&&this.hasMajorMediaChange(this._view,i))return void(this._view.context?.loading?.query===a&&this._setView(this._markViewAsNotLoadingQuery(this._view.clone())));if(s)return void this._api.getMessageManager().setErrorIfHigherPriority(s); +/* istanbul ignore if: the if path cannot be reached as the view is set + above -- @preserve */if(!this._view)return;const o=this._view.clone();this._view.context?.loading?.query===a&&this._markViewAsNotLoadingQuery(o),Jw(o,r),this._setView(o)}_shouldAdoptQueryAndResults(e){const t=this._view?.isViewerView()&&e?.isGalleryView(),n=e?.getDefaultMediaType(),i=Gw.getMediaType(this._view?.query)===n;return!!t&&i}setViewWithMergedContext(e){if(this._view)return this._setView(this._view?.clone().mergeInContext(e))}isViewSupportedByCamera(e,t){return!!Yw(this._api.getCameraManager(),t,e).size}hasMajorMediaChange(e,t){const n=t??this._view;return!!e!=!!n||e?.view!==n?.view||e?.camera!==n?.camera||"live"===n?.view&&e&&xv(e)!==xv(n)||"live"!==n?.view&&e?.queryResults!==n?.queryResults}_setView(e){const t=this._view;V_(this._api.getConfigManager().getCardWideConfig(),"Frigate Card view change: ",e),this._view=e,this._epoch=this._createEpoch(t),this.hasMajorMediaChange(t)&&this._api.getMediaLoadedInfoManager().clear(),t?.view!==e?.view&&this._api.getCardElementManager().scrollReset(),this._api.getMessageManager().reset(),this._api.getStyleManager().setExpandedMode(),this._api.getConditionsManager()?.setState({view:e?.view,camera:e?.camera,displayMode:e?.displayMode??void 0}),this._api.getCardElementManager().update()}}class ux{constructor(e,t,n,i){this._deviceRegistryManager=new av(new nv((e=>e.id))),this._entityRegistryManager=new ov(new nv((e=>e.entity_id))),this._resolvedMediaCache=new lv,this._actionsManager=new pb(this),this._automationsManager=new gb(this),this._cameraManager=new tv(this),this._cameraURLManager=new mb(this),this._configManager=new sw(this),this._defaultManager=new ow(this),this._downloadManager=new uw(this),this._expandManager=new hw(this),this._fullscreenManager=new yw(this),this._hassManager=new bw(this),this._initializationManager=new Ab(this),this._interactionManager=new Ew(this),this._keyboardStateManager=new $w(this),this._mediaLoadedInfoManager=new Rw(this),this._mediaPlayerManager=new Lw(this),this._messageManager=new Nw(this),this._microphoneManager=new Fw(this),this._queryStringManager=new Vw(this),this._statusBarItemManager=new Hw(this),this._styleManager=new Bw(this),this._triggersManager=new qw(this),this._viewManager=new dx(this),e.addController(this),this._conditionsManager=new tw(this,i),this._cardElementManager=new Ib(this,e,t,n)}getActionsManager(){return this._actionsManager}getAutomationsManager(){return this._automationsManager}getCameraManager(){return this._cameraManager}getCameraURLManager(){return this._cameraURLManager}getCardElementManager(){return this._cardElementManager}getConditionsManager(){return this._conditionsManager}static async getConfigElement(){return await import("./editor-238b96c0.js"),document.createElement("frigate-card-editor")}getConfigManager(){return this._configManager}getDefaultManager(){return this._defaultManager}getDeviceRegistryManager(){return this._deviceRegistryManager}getDownloadManager(){return this._downloadManager}getEntityRegistryManager(){return this._entityRegistryManager}getExpandManager(){return this._expandManager}getFullscreenManager(){return this._fullscreenManager}getHASSManager(){return this._hassManager}getInitializationManager(){return this._initializationManager}getInteractionManager(){return this._interactionManager}getKeyboardStateManager(){return this._keyboardStateManager}getMediaLoadedInfoManager(){return this._mediaLoadedInfoManager}getMediaPlayerManager(){return this._mediaPlayerManager}getMessageManager(){return this._messageManager}getMicrophoneManager(){return this._microphoneManager}getQueryStringManager(){return this._queryStringManager}getResolvedMediaCache(){return this._resolvedMediaCache}getStatusBarItemManager(){return this._statusBarItemManager}static getStubConfig(e){return{cameras:[{camera_entity:e.find((e=>e.startsWith("camera.")))??"camera.demo"}]}}getStyleManager(){return this._styleManager}getTriggersManager(){return this._triggersManager}getViewManager(){return this._viewManager}hostConnected(){this.getCardElementManager().elementConnected()}hostDisconnected(){this.getCardElementManager().elementDisconnected()}}class hx{constructor(){this._dynamicMenuButtons=[]}addDynamicMenuButton(e){this._dynamicMenuButtons.includes(e)||this._dynamicMenuButtons.push(e)}removeDynamicMenuButton(e){this._dynamicMenuButtons=this._dynamicMenuButtons.filter((t=>t!=e))}calculateButtons(e,t,n,i){return[this._getDefaultButton(t),this._getCamerasButton(t,n,i?.view),this._getSubstreamsButton(t,n,i?.view),this._getLiveButton(t,i?.view,i?.viewManager),this._getClipsButton(t,i?.view,i?.viewManager),this._getSnapshotsButton(t,i?.view,i?.viewManager),this._getRecordingsButton(t,i?.view,i?.viewManager),this._getImageButton(t,i?.view,i?.viewManager),this._getTimelineButton(t,i?.view,i?.viewManager),this._getDownloadButton(t,n,i?.view),this._getCameraUIButton(t,i?.showCameraUIButton),this._getMicrophoneButton(t,i?.microphoneManager,i?.currentMediaLoadedInfo),this._getExpandButton(t,i?.inExpandedMode),this._getFullscreenButton(t,i?.inFullscreenMode),this._getCastButton(e,t,n,i?.view,i?.mediaPlayerController),this._getPlayPauseButton(t,i?.currentMediaLoadedInfo),this._getMuteUnmuteButton(t,i?.currentMediaLoadedInfo),this._getScreenshotButton(t,i?.currentMediaLoadedInfo),this._getDisplayModeButton(t,n,i?.view),this._getPTZControlsButton(t,n,i?.view),this._getPTZHomeButton(t,n,i?.view),...this._dynamicMenuButtons.map((e=>({style:this._getStyleFromActions(t,e,i),...e})))].filter(rf)}_getDefaultButton(e){return{icon:"frigate",...e.menu.buttons.frigate,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.frigate"),permanent:!0,tap_action:"hidden"===e.menu?.style?pf("menu_toggle"):pf("default"),hold_action:pf("diagnostics")}}_getCamerasButton(e,t,n){const i=t.getStore().getCameraIDsWithCapability("menu");if(i.size>1){const a=Array.from(i,(e=>{const i=gf("camera_select",e),a=t.getCameraMetadata(e);return{enabled:!0,icon:a?.icon.icon,entity:a?.icon.entity,state_color:!0,title:a?.title,selected:n?.camera===e,...i&&{tap_action:i}}}));return{icon:"mdi:video-switch",...e.menu.buttons.cameras,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.cameras"),items:a}}return null}_getSubstreamsButton(e,t,n){if(!n)return null;const i=t.getStore().getAllDependentCameras(n.camera,"substream");if(i.size&&n.is("live")){const a=[...i].filter((e=>e!==n.camera)),r=[n.camera,...a],s=xv(n);if(2===r.length)return{icon:"mdi:video-input-component",style:s!==n.camera?this._getEmphasizedStyle():{},title:N_("config.menu.buttons.substreams"),...e.menu.buttons.substreams,type:"custom:frigate-card-menu-icon",tap_action:pf(Cv(n)?"live_substream_off":"live_substream_on")};if(r.length>2){const i=Array.from(r,(e=>{const n=gf("live_substream_select",e),i=t.getCameraMetadata(e)??void 0;return{enabled:!0,icon:i?.icon.icon,entity:i?.icon.entity,state_color:!0,title:i?.title,selected:s===e,...n&&{tap_action:n}}}));return{icon:"mdi:video-input-component",title:N_("config.menu.buttons.substreams"),style:s!==n.camera?this._getEmphasizedStyle():{},...e.menu.buttons.substreams,type:"custom:frigate-card-menu-submenu",items:i}}}return null}_getLiveButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"live")?{icon:"mdi:cctv",...e.menu.buttons.live,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.live"),style:t.is("live")?this._getEmphasizedStyle():{},tap_action:pf("live")}:null}_getClipsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"clips")?{icon:"mdi:filmstrip",...e.menu.buttons.clips,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.clips"),style:t?.is("clips")?this._getEmphasizedStyle():{},tap_action:pf("clips"),hold_action:pf("clip")}:null}_getSnapshotsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"snapshots")?{icon:"mdi:camera",...e.menu.buttons.snapshots,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.snapshots"),style:t?.is("snapshots")?this._getEmphasizedStyle():{},tap_action:pf("snapshots"),hold_action:pf("snapshot")}:null}_getRecordingsButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"recordings")?{icon:"mdi:album",...e.menu.buttons.recordings,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.recordings"),style:t.is("recordings")?this._getEmphasizedStyle():{},tap_action:pf("recordings"),hold_action:pf("recording")}:null}_getImageButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"image")?{icon:"mdi:image",...e.menu.buttons.image,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.image"),style:t?.is("image")?this._getEmphasizedStyle():{},tap_action:pf("image")}:null}_getTimelineButton(e,t,n){return t&&n?.isViewSupportedByCamera(t.camera,"timeline")?{icon:"mdi:chart-gantt",...e.menu.buttons.timeline,type:"custom:frigate-card-menu-icon",title:N_("config.view.views.timeline"),style:t.is("timeline")?this._getEmphasizedStyle():{},tap_action:pf("timeline")}:null}_getDownloadButton(e,t,n){const i=n?.queryResults?.getSelectedResult(),a=i?t?.getMediaCapabilities(i):null;return n?.isViewerView()&&a?.canDownload&&!fb()?{icon:"mdi:download",...e.menu.buttons.download,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.download"),tap_action:pf("download")}:null}_getCameraUIButton(e,t){return t?{icon:"mdi:web",...e.menu.buttons.camera_ui,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.camera_ui"),tap_action:pf("camera_ui")}:null}_getMicrophoneButton(e,t,n){if(t&&n?.capabilities?.supports2WayAudio){const n=t.isForbidden()||!t.isSupported(),i=t.isMuted(),a=e.menu.buttons.microphone.type;return{icon:n?"mdi:microphone-message-off":i?"mdi:microphone-off":"mdi:microphone",...e.menu.buttons.microphone,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.microphone"),style:n||i?{}:this._getEmphasizedStyle(!0),...!n&&"momentary"===a&&{start_tap_action:pf("microphone_unmute"),end_tap_action:pf("microphone_mute")},...!n&&"toggle"===a&&{tap_action:pf(i?"microphone_unmute":"microphone_mute")}}}return null}_getExpandButton(e,t){return{icon:t?"mdi:arrow-collapse-all":"mdi:arrow-expand-all",...e.menu.buttons.expand,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.expand"),tap_action:pf("expand"),style:t?this._getEmphasizedStyle():{}}}_getFullscreenButton(e,t){return fb()?null:{icon:t?"mdi:fullscreen-exit":"mdi:fullscreen",...e.menu.buttons.fullscreen,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.fullscreen"),tap_action:pf("fullscreen"),style:t?this._getEmphasizedStyle():{}}}_getCastButton(e,t,n,i,a){if(!i)return null;const r=n.getStore().getCameraConfig(i.camera);if(a?.hasMediaPlayers()&&(i.isViewerView()||i.is("live")&&r?.camera_entity)){const n=a.getMediaPlayers().map((t=>{const n=bb(e,t)||t,i=e.states[t],a=mf(t,"play"),r=mf(t,"stop"),s=!i||"unavailable"===i.state;return{enabled:!0,selected:!1,entity:t,state_color:!1,title:n,disabled:s,...!s&&a&&{tap_action:a},...!s&&r&&{hold_action:r}}}));return{icon:"mdi:cast",...t.menu.buttons.media_player,type:"custom:frigate-card-menu-submenu",title:N_("config.menu.buttons.media_player"),items:n}}return null}_getPlayPauseButton(e,t){if(t&&t.player&&t.capabilities?.supportsPause){const n=t.player.isPaused();return{icon:n?"mdi:play":"mdi:pause",...e.menu.buttons.play,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.play"),tap_action:pf(n?"play":"pause")}}return null}_getMuteUnmuteButton(e,t){if(t&&t.player&&t?.capabilities?.hasAudio){const n=t.player.isMuted();return{icon:n?"mdi:volume-off":"mdi:volume-high",...e.menu.buttons.mute,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.mute"),tap_action:pf(n?"unmute":"mute")}}return null}_getScreenshotButton(e,t){return t&&t.player?{icon:"mdi:monitor-screenshot",...e.menu.buttons.screenshot,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.screenshot"),tap_action:pf("screenshot")}:null}_getDisplayModeButton(e,t,n){const i=n?Yw(t,n.view):null;if(n?.supportsMultipleDisplayModes()&&i&&i.size>1){const t=n.isGrid();return{icon:t?"mdi:grid-off":"mdi:grid",...e.menu.buttons.display_mode,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_(t?"display_modes.single":"display_modes.grid"),tap_action:(a=t?"single":"grid",{action:"fire-dom-event",frigate_card_action:"display_mode_select",display_mode:a,...r?.cardID&&{card_id:r.cardID}})}}var a,r;return null}_getPTZControlsButton(e,t,n){const i=n?.is("live")?e.live.controls.ptz:n?.isViewerView()?e.media_viewer.controls.ptz:null;if(!n||!i||"off"===i.mode)return null;const a=Ov(n,{cameraManager:t,..."auto"===i.mode&&{type:"ptz"}});if(a){const t=!1!==n.context?.ptzControls?.enabled&&("on"===i.mode||"auto"===i.mode&&"ptz"===a.type);return{icon:"mdi:pan",...e.menu.buttons.ptz_controls,style:t?this._getEmphasizedStyle():{},type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_controls"),tap_action:(r=!t,{action:"fire-dom-event",frigate_card_action:"ptz_controls",enabled:r,...s?.cardID&&{card_id:s.cardID}})}}var r,s;return null}_getPTZHomeButton(e,t,n){const i=n?Ov(n,{cameraManager:t}):null;return!i||(("digital"===i.type&&n?.context?.zoom?.[i.targetID]?.observed?.isDefault)??1)?null:{icon:"mdi:home",...e.menu.buttons.ptz_home,type:"custom:frigate-card-menu-icon",title:N_("config.menu.buttons.ptz_home"),tap_action:ff({targetID:i.targetID})}}_getEmphasizedStyle(e){return e?{animation:"pulse 3s infinite",color:"var(--error-color, white)"}:{color:"var(--primary-color, white)"}}_getStyleFromActions(e,t,n){for(const i of[t.tap_action,t.double_tap_action,t.hold_action,t.start_tap_action,t.end_tap_action]){const t=Array.isArray(i)?i:[i];for(const i of t){if(!i||"fire-dom-event"!==i.action||!("frigate_card_action"in i))continue;const t=i;if(Uo.some((e=>e===t.frigate_card_action&&n?.view?.is(t.frigate_card_action)))||"default"===t.frigate_card_action&&n?.view?.is(e.view.default)||"fullscreen"===t.frigate_card_action&&n?.inFullscreenMode||"camera_select"===t.frigate_card_action&&n?.view?.camera===t.camera)return this._getEmphasizedStyle()}}return{}}} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +function px(e){return null==e}var gx=function(e,t){var n,i="";for(n=0;no&&(t=i-o+(r=" ... ").length),n-i>o&&(n=i+o-(s=" ...").length),{str:r+e.slice(t,n).replace(/\t/g,"→")+s,pos:i-t+r.length}}function bx(e,t){return mx.repeat(" ",t-e.length)+e}var wx=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,a=[0],r=[],s=-1;n=i.exec(e.buffer);)r.push(n.index),a.push(n.index+n[0].length),e.position<=n.index&&s<0&&(s=a.length-2);s<0&&(s=a.length-1);var o,c,l="",d=Math.min(e.line+t.linesAfter,r.length).toString().length,u=t.maxLength-(t.indent+d+3);for(o=1;o<=t.linesBefore&&!(s-o<0);o++)c=vx(e.buffer,a[s-o],r[s-o],e.position-(a[s]-a[s-o]),u),l=mx.repeat(" ",t.indent)+bx((e.line-o+1).toString(),d)+" | "+c.str+"\n"+l;for(c=vx(e.buffer,a[s],r[s],e.position,u),l+=mx.repeat(" ",t.indent)+bx((e.line+1).toString(),d)+" | "+c.str+"\n",l+=mx.repeat("-",t.indent+d+3+c.pos)+"^\n",o=1;o<=t.linesAfter&&!(s+o>=r.length);o++)c=vx(e.buffer,a[s+o],r[s+o],e.position-(a[s]-a[s+o]),u),l+=mx.repeat(" ",t.indent)+bx((e.line+o+1).toString(),d)+" | "+c.str+"\n";return l.replace(/\n$/,"")},xx=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Cx=["scalar","sequence","mapping"];var Mx=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===xx.indexOf(t))throw new yx('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===Cx.indexOf(this.kind))throw new yx('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function Sx(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)})),n[t]=e})),n}function kx(e){return this.extend(e)}kx.prototype.extend=function(e){var t=[],n=[];if(e instanceof Mx)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new yx("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof Mx))throw new yx("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new yx("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new yx("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof Mx))throw new yx("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(kx.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=Sx(i,"implicit"),i.compiledExplicit=Sx(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Lx=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var Nx=/^[-+]?[0-9]+e/;var Fx=new Mx("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!Lx.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||mx.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(mx.isNegativeZero(e))return"-0.0";return n=e.toString(10),Nx.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),Vx=zx.extend({implicit:[Tx,jx,Px,Fx]}),Hx=Vx,Bx=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),qx=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var Ux=new Mx("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==Bx.exec(e)||null!==qx.exec(e))},construct:function(e){var t,n,i,a,r,s,o,c,l=0,d=null;if(null===(t=Bx.exec(e))&&(t=qx.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,a=+t[3],!t[4])return new Date(Date.UTC(n,i,a));if(r=+t[4],s=+t[5],o=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(d=-d)),c=new Date(Date.UTC(n,i,a,r,s,o,l)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var Wx=new Mx("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Zx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var Qx=new Mx("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,a=e.length,r=Zx;for(n=0;n64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),a=i.length,r=Zx,s=0,o=[];for(t=0;t>16&255),o.push(s>>8&255),o.push(255&s)),s=s<<6|r.indexOf(i.charAt(t));return 0===(n=a%4*6)?(o.push(s>>16&255),o.push(s>>8&255),o.push(255&s)):18===n?(o.push(s>>10&255),o.push(s>>2&255)):12===n&&o.push(s>>4&255),new Uint8Array(o)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",a=0,r=e.length,s=Zx;for(t=0;t>18&63],i+=s[a>>12&63],i+=s[a>>6&63],i+=s[63&a]),a=(a<<8)+e[t];return 0===(n=r%3)?(i+=s[a>>18&63],i+=s[a>>12&63],i+=s[a>>6&63],i+=s[63&a]):2===n?(i+=s[a>>10&63],i+=s[a>>4&63],i+=s[a<<2&63],i+=s[64]):1===n&&(i+=s[a>>2&63],i+=s[a<<4&63],i+=s[64],i+=s[64]),i}}),Gx=Object.prototype.hasOwnProperty,Yx=Object.prototype.toString;var Kx=new Mx("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,a,r,s=[],o=e;for(t=0,n=o.length;t>10),56320+(e-65536&1023))}for(var kC=new Array(256),EC=new Array(256),$C=0;$C<256;$C++)kC[$C]=MC($C)?1:0,EC[$C]=MC($C);function AC(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||nC,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function IC(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=wx(n),new yx(t,n)}function zC(e,t){throw IC(e,t)}function TC(e,t){e.onWarning&&e.onWarning.call(null,IC(e,t))}var jC={YAML:function(e,t,n){var i,a,r;null!==e.version&&zC(e,"duplication of %YAML directive"),1!==n.length&&zC(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&zC(e,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),r=parseInt(i[2],10),1!==a&&zC(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=r<2,1!==r&&2!==r&&TC(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,a;2!==n.length&&zC(e,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],gC.test(i)||zC(e,"ill-formed tag handle (first argument) of the TAG directive"),iC.call(e.tagMap,i)&&zC(e,'there is a previously declared suffix for "'+i+'" tag handle'),mC.test(a)||zC(e,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch(t){zC(e,"tag prefix is malformed: "+a)}e.tagMap[i]=a}};function OC(e,t,n,i){var a,r,s,o;if(t1&&(e.result+=mx.repeat("\n",t-1))}function VC(e,t){var n,i,a=e.tag,r=e.anchor,s=[],o=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=s),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,zC(e,"tab characters must not be used in indentation")),45===i)&&vC(e.input.charCodeAt(e.position+1));)if(o=!0,e.position++,LC(e,!0,-1)&&e.lineIndent<=t)s.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,qC(e,t,sC,!1,!0),s.push(e.result),LC(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)zC(e,"bad indentation of a sequence entry");else if(e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt)&&(_&&(s=e.line,o=e.lineStart,c=e.position),qC(e,t,oC,!0,a)&&(_?m=e.result:f=e.result),_||(RC(e,h,p,g,m,f,s,o,c),g=m=f=null),LC(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===r||e.lineIndent>t)&&0!==l)zC(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===a?zC(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?zC(e,"repeat of an indentation width identifier"):(l=t+a-1,c=!0)}if(yC(r)){do{r=e.input.charCodeAt(++e.position)}while(yC(r));if(35===r)do{r=e.input.charCodeAt(++e.position)}while(!_C(r)&&0!==r)}for(;0!==r;){for(PC(e),e.lineIndent=0,r=e.input.charCodeAt(e.position);(!c||e.lineIndentl&&(l=e.lineIndent),_C(r))d++;else{if(e.lineIndent0){for(a=s,r=0;a>0;a--)(s=wC(o=e.input.charCodeAt(++e.position)))>=0?r=(r<<4)+s:zC(e,"expected hexadecimal character");e.result+=SC(r),e.position++}else zC(e,"unknown escape sequence");n=i=e.position}else _C(o)?(OC(e,n,i,!0),FC(e,LC(e,!1,t)),n=i=e.position):e.position===e.lineStart&&NC(e)?zC(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}zC(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!vC(i)&&!bC(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&zC(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),iC.call(e.anchorMap,n)||zC(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],LC(e,!0,-1),!0}(e)?function(e,t,n){var i,a,r,s,o,c,l,d,u=e.kind,h=e.result;if(vC(d=e.input.charCodeAt(e.position))||bC(d)||35===d||38===d||42===d||33===d||124===d||62===d||39===d||34===d||37===d||64===d||96===d)return!1;if((63===d||45===d)&&(vC(i=e.input.charCodeAt(e.position+1))||n&&bC(i)))return!1;for(e.kind="scalar",e.result="",a=r=e.position,s=!1;0!==d;){if(58===d){if(vC(i=e.input.charCodeAt(e.position+1))||n&&bC(i))break}else if(35===d){if(vC(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&NC(e)||n&&bC(d))break;if(_C(d)){if(o=e.line,c=e.lineStart,l=e.lineIndent,LC(e,!1,-1),e.lineIndent>=t){s=!0,d=e.input.charCodeAt(e.position);continue}e.position=r,e.line=o,e.lineStart=c,e.lineIndent=l;break}}s&&(OC(e,a,r,!1),FC(e,e.line-o),a=r=e.position,s=!1),yC(d)||(r=e.position+1),d=e.input.charCodeAt(++e.position)}return OC(e,a,r,!1),!!e.result||(e.kind=u,e.result=h,!1)}(e,h,aC===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||zC(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===g&&(f=o&&VC(e,p))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&zC(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c"),null!==e.result&&u.kind!==e.kind&&zC(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+u.kind+'", not "'+e.kind+'"'),u.resolve(e.result,e.tag)?(e.result=u.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):zC(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function UC(e){var t,n,i,a,r=e.position,s=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(a=e.input.charCodeAt(e.position))&&(LC(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==a));){for(s=!0,a=e.input.charCodeAt(++e.position),t=e.position;0!==a&&!vC(a);)a=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&zC(e,"directive name must not be less than one character in length");0!==a;){for(;yC(a);)a=e.input.charCodeAt(++e.position);if(35===a){do{a=e.input.charCodeAt(++e.position)}while(0!==a&&!_C(a));break}if(_C(a))break;for(t=e.position;0!==a&&!vC(a);)a=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==a&&PC(e),iC.call(jC,n)?jC[n](e,n,i):TC(e,'unknown document directive "'+n+'"')}LC(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,LC(e,!0,-1)):s&&zC(e,"directives end mark is expected"),qC(e,e.lineIndent-1,oC,!1,!0),LC(e,!0,-1),e.checkLineBreaks&&hC.test(e.input.slice(r,e.position))&&TC(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&NC(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,LC(e,!0,-1)):e.position=55296&&i<=56319&&t+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function DM(e){return/^\n* /.test(e)}var RM=1,PM=2,LM=3,NM=4,FM=5;function VM(e,t,n,i,a,r,s,o){var c,l=0,d=null,u=!1,h=!1,p=-1!==i,g=-1,m=function(e){return zM(e)&&e!==YC&&!IM(e)&&e!==lM&&e!==pM&&e!==dM&&e!==cM&&e!==mM&&e!==fM&&e!==yM&&e!==bM&&e!==iM&&e!==rM&&e!==oM&&e!==tM&&e!==vM&&e!==uM&&e!==hM&&e!==sM&&e!==nM&&e!==aM&&e!==gM&&e!==_M}(OM(e,0))&&function(e){return!IM(e)&&e!==dM}(OM(e,e.length-1));if(t||s)for(c=0;c=65536?c+=2:c++){if(!zM(l=OM(e,c)))return FM;m=m&&jM(l,d,o),d=l}else{for(c=0;c=65536?c+=2:c++){if((l=OM(e,c))===XC)u=!0,p&&(h=h||c-g-1>i&&" "!==e[g+1],g=c);else if(!zM(l))return FM;m=m&&jM(l,d,o),d=l}h=h||p&&c-g-1>i&&" "!==e[g+1]}return u||h?n>9&&DM(e)?FM:s?r===kM?FM:PM:h?NM:LM:!m||s||a(e)?r===kM?FM:PM:RM}function HM(e,t,n,i,a){e.dump=function(){if(0===t.length)return e.quotingType===kM?'""':"''";if(!e.noCompatMode&&(-1!==xM.indexOf(t)||CM.test(t)))return e.quotingType===kM?'"'+t+'"':"'"+t+"'";var r=e.indent*Math.max(1,n),s=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-r),o=i||e.flowLevel>-1&&n>=e.flowLevel;switch(VM(t,o,e.indent,s,(function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+BM(t,e.indent)+qM($M(function(e,t){var n,i,a=/(\n+)([^\n]*)/g,r=(o=e.indexOf("\n"),o=-1!==o?o:e.length,a.lastIndex=o,UM(e.slice(0,o),t)),s="\n"===e[0]||" "===e[0];var o;for(;i=a.exec(e);){var c=i[1],l=i[2];n=" "===l[0],r+=c+(s||n||""===l?"":"\n")+UM(l,t),s=n}return r}(t,s),r));case FM:return'"'+function(e){for(var t,n="",i=0,a=0;a=65536?a+=2:a++)i=OM(e,a),!(t=wM[i])&&zM(i)?(n+=e[a],i>=65536&&(n+=e[a+1])):n+=t||MM(i);return n}(t)+'"';default:throw new yx("impossible error: invalid scalar style")}}()}function BM(e,t){var n=DM(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function qM(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function UM(e,t){if(""===e||" "===e[0])return e;for(var n,i,a=/ [^ ]/g,r=0,s=0,o=0,c="";n=a.exec(e);)(o=n.index)-r>t&&(i=s>r?s:o,c+="\n"+e.slice(r,i),r=i+1),s=o;return c+="\n",e.length-r>t&&s>r?c+=e.slice(r,s)+"\n"+e.slice(s+1):c+=e.slice(r),c.slice(1)}function WM(e,t,n,i){var a,r,s,o="",c=e.tag;for(a=0,r=n.length;a tag resolver accepts not "'+c+'" style');i=o.represent[c](t,c)}e.dump=i}return!0}return!1}function QM(e,t,n,i,a,r,s){e.tag=null,e.dump=n,ZM(e,n,!1)||ZM(e,n,!0);var o,c=QC.call(e.dump),l=i;i&&(i=e.flowLevel<0||e.flowLevel>t);var d,u,h="[object Object]"===c||"[object Array]"===c;if(h&&(u=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||u||2!==e.indent&&t>0)&&(a=!1),u&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(h&&u&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===c)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var a,r,s,o,c,l,d="",u=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new yx("sortKeys must be a boolean or a function");for(a=0,r=h.length;a1024)&&(e.dump&&XC===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=AM(e,t)),QM(e,t+1,o,!0,c)&&(e.dump&&XC===e.dump.charCodeAt(0)?l+=":":l+=": ",d+=l+=e.dump));e.tag=u,e.dump=d||"{}"}(e,t,e.dump,a),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var i,a,r,s,o,c="",l=e.tag,d=Object.keys(n);for(i=0,a=d.length;i1024&&(o+="? "),o+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),QM(e,t,s,!1,!1)&&(c+=o+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),u&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===c)i&&0!==e.dump.length?(e.noArrayIndent&&!s&&t>0?WM(e,t-1,e.dump,a):WM(e,t,e.dump,a),u&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var i,a,r,s="",o=e.tag;for(i=0,a=n.length;i",e.dump=o+" "+e.dump)}return!0}function GM(e,t){var n,i,a=[],r=[];for(YM(e,a,r),n=0,i=r.length;n`;if(this.icon?.icon)return q``;if(this.hass&&this.icon?.entity){const e=this._controller.createStateObjectForStateBadge(this.hass,this.icon.entity);if(e)return q``}return this.icon?.fallback?q``:q``}static get styles(){return s(":host {\n display: inline-block;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n --ha-icon-display: block;\n}\n\n* {\n display: block;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n}")}};e([he({attribute:!1})],tS.prototype,"hass",void 0),e([he({attribute:!1})],tS.prototype,"icon",void 0),tS=e([le("frigate-card-icon")],tS);let nS=class extends oe{constructor(){super(...arguments),this.message=""}render(){const e=this.icon?this.icon:"mdi:information-outline",t={dotdotdot:!!this.dotdotdot},n=e=>q`
${XM.dump(e)}
`;return q`
+
+
+ +
+
+ + ${this.message?q`${this.message}${this.context&&"string"==typeof this.context?": "+this.context:""}`:""} + + ${this.context&&Array.isArray(this.context)?this.context.map((e=>n(e))):"object"==typeof this.context?n(this.context):""} +
+
+
`}static get styles(){return s(JM)}};e([he({attribute:!1})],nS.prototype,"message",void 0),e([he({attribute:!1})],nS.prototype,"context",void 0),e([he({attribute:!1})],nS.prototype,"icon",void 0),e([he({attribute:!0,type:Boolean})],nS.prototype,"dotdotdot",void 0),nS=e([le("frigate-card-message")],nS);let iS=class extends oe{render(){if(this.message)return q` ${N_("error.troubleshooting")}.`} + .icon=${this.message.icon??"mdi:alert-circle"} + .context=${this.message.context} + .dotdotdot=${this.message.dotdotdot} + > + `}static get styles(){return s(JM)}};e([he({attribute:!1})],iS.prototype,"message",void 0),iS=e([le("frigate-card-error-message")],iS);let aS=class extends oe{constructor(){super(...arguments),this.message="",this.animated=!1,this.size="large"}render(){return q`
+ ${this.animated?q` + `:q``} + ${this.message?q`${this.message}`:q``} +
`}static get styles(){return s(JM)}};function rS(e){return"error"===e?.type?q` `:e?q` `:q``}function sS(e){return q` + + + `}function oS(e,t,n){!function(e,t,n,i){Vm(e,"message",{message:t,type:n,icon:i?.icon,context:i?.context})}(e,t,"error",{context:n?.context})}function cS(e,t){t instanceof Error&&oS(e,t.message,{...t instanceof $o&&{context:t.context}})}e([he({attribute:!1})],aS.prototype,"message",void 0),e([he({attribute:!1})],aS.prototype,"animated",void 0),e([he({attribute:!1})],aS.prototype,"size",void 0),aS=e([le("frigate-card-progress-indicator")],aS);let lS=class extends oe{constructor(){super(...arguments),this._root=null}createRenderRoot(){return this}_createRoot(){const e=customElements.get("hui-conditional-element");if(!e||!this.hass)throw new Error(N_("error.could_not_render_elements"));const t=new e;t.hass=this.hass;const n={type:"conditional",conditions:[],elements:this.elements};try{t.setConfig(n)}catch(e){throw Zm(e,console.error),new $o(N_("error.invalid_elements_config"))}return t}willUpdate(e){try{!this.elements||this._root&&!e.has("elements")||(this._root=this._createRoot())}catch(e){return cS(this,e)}}render(){return q`${this._root||""}`}updated(){this.hass&&this._root&&(this._root.hass=this.hass)}};e([he({attribute:!1})],lS.prototype,"elements",void 0),e([he({attribute:!1})],lS.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],lS.prototype,"hass",void 0),lS=e([le("frigate-card-elements-core")],lS);let dS=class extends oe{constructor(){super(...arguments),this._menuRemoveHandler=e=>{Vm(this,"menu:remove",e.detail)},this._statusBarRemoveHandler=e=>{Vm(this,"status-bar:remove",e.detail)},this._menuAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:menu:remove",this._menuRemoveHandler)},this._statusBarAddHandler=e=>{const t=e.composedPath();t.length&&this._addHandler(t[0],"frigate-card:status-bar:add",this._statusBarRemoveHandler)}}_addHandler(e,t,n){e.removeEventListener(t,n),e.addEventListener(t,n)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler)}disconnectedCallback(){this.removeEventListener("frigate-card:menu:add",this._menuAddHandler),this.addEventListener("frigate-card:status-bar:add",this._statusBarAddHandler),super.disconnectedCallback()}render(){return q` + `}static get styles(){return s(":host {\n position: absolute;\n inset: 0;\n overflow: hidden;\n pointer-events: none;\n}\n\n.element {\n position: absolute;\n transform: translate(-50%, -50%);\n pointer-events: auto;\n}\n\nhui-error-card.element {\n inset: 0px;\n transform: unset;\n}")}};e([he({attribute:!1})],dS.prototype,"hass",void 0),e([he({attribute:!1})],dS.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],dS.prototype,"elements",void 0),dS=e([le("frigate-card-elements")],dS);let uS=class extends oe{setConfig(e){this._config=e}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className=""}render(){if(function(e,t){if(!t)return!0;const n=new Jb(t,{bubbles:!0,composed:!0});return e.dispatchEvent(n),n.evaluation??!1}(this,this._config?.conditions))return q` + `}};e([he({attribute:!1,hasChanged:()=>!0})],uS.prototype,"hass",void 0),uS=e([le("frigate-card-conditional")],uS);class hS extends oe{constructor(e){super(),this._config=null,this._eventCategory=e}setConfig(e){this._config=e}connectedCallback(){super.connectedCallback(),this._config&&Vm(this,`${this._eventCategory}:add`,this._config)}disconnectedCallback(){this._config&&Vm(this,`${this._eventCategory}:remove`,this._config),super.disconnectedCallback()}}e([pe()],hS.prototype,"_config",void 0);class pS extends hS{constructor(){super("menu")}}let gS=class extends pS{};gS=e([le("frigate-card-menu-icon")],gS);let mS=class extends pS{};mS=e([le("frigate-card-menu-state-icon")],mS);let fS=class extends pS{};fS=e([le("frigate-card-menu-submenu")],fS);let _S=class extends pS{};_S=e([le("frigate-card-menu-submenu-select")],_S);class yS extends hS{constructor(){super("status-bar")}}let vS=class extends yS{};vS=e([le("frigate-card-status-bar-icon")],vS);let bS=class extends yS{};bS=e([le("frigate-card-status-bar-image")],bS);let wS=class extends yS{};wS=e([le("frigate-card-status-bar-string")],wS);let xS=class extends oe{render(){return q` `}static get styles(){return s(":host {\n width: intrinsic;\n height: intrinsic;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\nimg {\n width: 10%;\n animation: rotate 8s linear infinite;\n}\n\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}")}};xS=e([le("frigate-card-loading")],xS);const CS=(e,t)=>{Vm(e,"action:execution-request",t)};class MS{constructor(e){this._config=null,this._buttons=[],this._expanded=!1,this._host=e}setMenuConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-menu-button-size",`${e.button_size}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),this._host.setAttribute("data-alignment",e.alignment),this._sortButtons(),this._host.requestUpdate()}getMenuConfig(){return this._config}isExpanded(){return this._expanded}setButtons(e){this._buttons=e,this._sortButtons(),this._host.requestUpdate()}getButtons(e){const t=e=>!this._isHidingMenu()||this._expanded||!!e.permanent;return this._buttons.filter((n=>(e=>!1!==e.enabled)(n)&&(t=>t.alignment===e||"matching"===e&&!t.alignment)(n)&&t(n)))}setExpanded(e){this._expanded=e,af(this._host,e,"expanded"),this._host.requestUpdate()}toggleExpanded(){this.setExpanded(!this._expanded)}actionHandler(e,t){if(e.stopPropagation(),e.detail.config&&(t=e.detail.config),!t)return;const n=e.detail.action,i=_f(n,t);if(!i)return;const a=qm(i);let r=!1;const s=a.filter((e=>rf(e)&&!this._isUnknownActionMenuToggleAction(e)));if(s.length!=a.length&&(r=!0),s.length&&CS(this._host,{action:a,config:t}),this._isHidingMenu())if(r)this.setExpanded(!this._expanded);else{const e=_f("hold",t),i=_f("double_tap",t),a=_f("tap",t),r=_f("end_tap",t);"end_tap"!==n&&("start_tap"!==n||e||i||a||r)&&("end_tap"===n||r)||this.setExpanded(!1)}}_sortButtons(){this._buttons=Sy(this._buttons,(e=>(e.priority??0)+(this._isHidingMenu()&&e.permanent?Bo:0)),["desc"])}_isHidingMenu(){return"hidden"===this._config?.style}_isUnknownActionMenuToggleAction(e){const t=hf(e);return!!t&&"menu_toggle"==t.frigate_card_action}}const SS=(e,t,n)=>{const i=e.states[t],a=n?.state?n.state:i?i.state:null;if(!a)return null;const r=Ye(t),s=i?i.attributes:null;return n?.entity?.translation_key&&e.localize(`component.${n.entity.platform}.entity.${r}.${n.entity.translation_key}.state.${a}`)||s?.device_class&&e.localize(`component.${r}.state.${s.device_class}.${a}`)||e.localize(`component.${r}.state._.${a}`)||a};let kS=class extends oe{_renderItem(e){if(!this.hass)return;const t=e.title??bb(this.hass,e.entity);return q` + {t.detail.config=e}} + .actionHandler=${Cf({hasHold:yf(e.hold_action),hasDoubleClick:yf(e.double_tap_action)})} + > + ${t??""} + ${e.subtitle?q`${e.subtitle}`:""} + + + `}render(){if(!this.submenu)return q``;const e=this.submenu.items;return q` + e.stopPropagation()} + @click=${e=>vf(e)} + > + + + + ${e.map(this._renderItem.bind(this))} + + `}static get styles(){return s("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n:host {\n pointer-events: auto;\n}\n\nmwc-list-item {\n z-index: 20;\n}")}};e([he({attribute:!1})],kS.prototype,"hass",void 0),e([he({attribute:!1})],kS.prototype,"submenu",void 0),kS=e([le("frigate-card-submenu")],kS);let ES=class extends oe{shouldUpdate(e){const t=e.get("hass");return!e.has("hass")||!t||!this.submenuSelect||vb(this.hass,t,[this.submenuSelect.entity])}async _refreshOptionTitles(){if(!this.hass||!this.submenuSelect)return;const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options,i=await(this.entityRegistryManager?.getEntity(this.hass,e))??null,a={};for(const t of n){const n=SS(this.hass,e,{...i&&{entity:i},state:t});n&&(a[t]=n)}this._optionTitles=a}willUpdate(){if(!this.submenuSelect||!this.hass)return;this._optionTitles||this._refreshOptionTitles();const e=this.submenuSelect.entity,t=this.hass.states[e],n=t?.attributes?.options;if(!t||!n)return;const i=bb(this.hass,e),a={...i&&{title:i},...this.submenuSelect,icon:{icon:this.submenuSelect.icon,entity:e,fallback:"mdi:format-list-bulleted"},type:"custom:frigate-card-menu-submenu",items:[]};delete a.options;const r=a.items;for(const i of n){const n=this._optionTitles?.[i]??i;r.push({state_color:!0,selected:t.state===i,enabled:!0,title:n||i,...(e.startsWith("select.")||e.startsWith("input_select."))&&{tap_action:{action:"perform-action",perform_action:e.startsWith("select.")?"select.select_option":"input_select.select_option",target:{entity_id:e},data:{option:i}}},...this.submenuSelect.options&&this.submenuSelect.options[i]})}this._generatedSubmenu=a}render(){return q` `}};e([he({attribute:!1})],ES.prototype,"hass",void 0),e([he({attribute:!1})],ES.prototype,"submenuSelect",void 0),e([he({attribute:!1})],ES.prototype,"entityRegistryManager",void 0),e([pe()],ES.prototype,"_optionTitles",void 0),ES=e([le("frigate-card-submenu-select")],ES);let $S=class extends oe{constructor(){super(...arguments),this._controller=new MS(this)}set menuConfig(e){this._controller.setMenuConfig(e)}set buttons(e){this._controller.setButtons(e)}set expanded(e){this._controller.setExpanded(e)}toggleMenu(){this._controller.toggleExpanded()}_renderButton(e){if(!this.hass)return;if("custom:frigate-card-menu-submenu"===e.type)return q` this._controller.actionHandler(e)} + > + `;if("custom:frigate-card-menu-submenu-select"===e.type)return q` this._controller.actionHandler(e)} + > + `;const t=this.hass&&"custom:frigate-card-menu-state-icon"===e.type&&!e.title?bb(this.hass,e.entity):e.title;return q` this._controller.actionHandler(t,e)} + > + + `}render(){const e=this._controller.getMenuConfig(),t=e?.style;if(!e||"none"===t)return;const n=this._controller.getButtons("matching"),i=this._controller.getButtons("opposing");return q`
+ ${n.map((e=>this._renderButton(e)))} +
+
+ ${i.map((e=>this._renderButton(e)))} +
`}static get styles(){return s('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n:host {\n --frigate-card-menu-button-size: 40px;\n --mdc-icon-button-size: var(--frigate-card-menu-button-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n pointer-events: auto;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n overflow: visible;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***********************************\n * Aligned divs: matching & opposing\n ***********************************/\ndiv.matching,\ndiv.opposing {\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: flex-start;\n min-width: 0px;\n min-height: 0px;\n}\n\ndiv.matching {\n justify-content: flex-start;\n}\n\ndiv.opposing {\n justify-content: flex-end;\n}\n\n/********************\n * Outside menu style\n ********************/\n:host([data-style=outside]) {\n width: 100%;\n background: var(--secondary-background-color);\n}\n\n/********************************************************\n * Hack: Ensure host & div expand for column flex layouts\n ********************************************************/\n:host(:not([data-style=outside])[data-position=left]) {\n writing-mode: vertical-lr;\n}\n\n:host(:not([data-style=outside])[data-position=right]) {\n writing-mode: vertical-rl;\n}\n\n:host(:not([data-style=outside])[data-style=overlay][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=overlay][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style*=hover][data-position=right]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=left]) div > *,\n:host(:not([data-style=outside])[data-style=hidden][data-position=right]) div > * {\n writing-mode: horizontal-tb;\n}\n\n/**********************\n * "Reverse" alignments\n **********************/\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]),\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]),\n:host([data-position=top][data-alignment=right]),\n:host([data-position=bottom][data-alignment=right]),\n:host(:not([data-style=outside])[data-position=left][data-alignment=bottom]) div,\n:host(:not([data-style=outside])[data-position=right][data-alignment=bottom]) div,\n:host([data-position=top][data-alignment=right]) div,\n:host([data-position=bottom][data-alignment=right]) div {\n flex-direction: row-reverse;\n}\n\n/****************************\n * Wrap upwards on the bottom\n ****************************/\n:host(:not([data-style=outside])[data-position=bottom]) div {\n flex-wrap: wrap-reverse;\n}\n\n/********************************************\n * Positioning for absolute based menu styles\n ********************************************/\n:host([data-style=overlay][data-position=top]),\n:host([data-style=overlay][data-position=bottom]),\n:host([data-style*=hover][data-position=top]),\n:host([data-style*=hover][data-position=bottom]),\n:host([data-style=hidden][data-position=top]),\n:host([data-style=hidden][data-position=bottom]) {\n width: 100%;\n height: auto;\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=left]),\n:host([data-style=overlay][data-position=bottom][data-alignment=left]),\n:host([data-style*=hover][data-position=top][data-alignment=left]),\n:host([data-style*=hover][data-position=bottom][data-alignment=left]),\n:host([data-style=hidden][data-position=top][data-alignment=left][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=left][expanded]) {\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=top][data-alignment=right]),\n:host([data-style=overlay][data-position=bottom][data-alignment=right]),\n:host([data-style*=hover][data-position=top][data-alignment=right]),\n:host([data-style*=hover][data-position=bottom][data-alignment=right]),\n:host([data-style=hidden][data-position=top][data-alignment=right][expanded]),\n:host([data-style=hidden][data-position=bottom][data-alignment=right][expanded]) {\n background: linear-gradient(270deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left]),\n:host([data-style=overlay][data-position=right]),\n:host([data-style*=hover][data-position=left]),\n:host([data-style*=hover][data-position=right]),\n:host([data-style=hidden][data-position=left]),\n:host([data-style=hidden][data-position=right]) {\n width: auto;\n height: 100%;\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=top]),\n:host([data-style=overlay][data-position=right][data-alignment=top]),\n:host([data-style*=hover][data-position=left][data-alignment=top]),\n:host([data-style*=hover][data-position=right][data-alignment=top]),\n:host([data-style=hidden][data-position=left][data-alignment=top][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=top][expanded]) {\n background: linear-gradient(180deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=overlay][data-position=left][data-alignment=bottom]),\n:host([data-style=overlay][data-position=right][data-alignment=bottom]),\n:host([data-style*=hover][data-position=left][data-alignment=bottom]),\n:host([data-style*=hover][data-position=right][data-alignment=bottom]),\n:host([data-style=hidden][data-position=left][data-alignment=bottom][expanded]),\n:host([data-style=hidden][data-position=right][data-alignment=bottom][expanded]) {\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}')}};e([he({attribute:!1})],$S.prototype,"entityRegistryManager",void 0),e([he({attribute:!1})],$S.prototype,"hass",void 0),$S=e([le("frigate-card-menu")],$S);let AS=class extends oe{render(){return q` + + + + + `}static get styles(){return s("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n:host {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\nslot {\n position: absolute;\n display: flex;\n}\n\n/***************\n * Slot position\n ***************/\nslot[name=top] {\n top: 0px;\n}\n\nslot[name=bottom] {\n bottom: 0px;\n}\n\nslot[name=left] {\n left: 0px;\n}\n\nslot[name=right] {\n right: 0px;\n}\n\n/***********\n * Slot size\n ***********/\nslot[name=top],\nslot[name=bottom] {\n width: 100%;\n flex-direction: column;\n}\n\nslot[name=left],\nslot[name=right] {\n height: 100%;\n flex-direction: row;\n}\n\nslot[name=top],\nslot[name=left] {\n justify-content: flex-start;\n}\n\nslot[name=bottom],\nslot[name=right] {\n justify-content: flex-end;\n}\n\n/*******************************\n * Match rounded corners to card\n *******************************/\n::slotted([slot=top]:first-child),\n::slotted([slot=left]:first-child) {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=top]:first-child),\n::slotted([slot=right]:first-child) {\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=left]:last-child) {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n}\n\n::slotted([slot=bottom]:last-child),\n::slotted([slot=right]:last-child) {\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}")}};AS=e([le("frigate-card-overlay")],AS);class IS{constructor(e){this._config=null,this._popupTimer=new bf,this._items=[],this._host=e}getRenderItems(){return this._items}setItems(e){const t=e.filter((e=>!!e.exclusive)),n=Sy(t.length?t:e,(e=>e.priority??50),"desc"),i=this._getSufficientValues(this._items),a=this._getSufficientValues(n);this._items=n,"popup"!==this._config?.style||jy(i,a)||(this._show(),this._popupTimer.start(this._config.popup_seconds,(()=>this._hide()))),this._host.requestUpdate()}setConfig(e){this._config=e,this._host.style.setProperty("--frigate-card-status-bar-height",`${e.height}px`),this._host.setAttribute("data-style",e.style),this._host.setAttribute("data-position",e.position),"popup"!==this._config?.style&&this._show(),this._host.requestUpdate()}shouldRender(){return this._items.some((e=>!1!==e.enabled&&e.sufficient))}actionHandler(e,t){e.stopPropagation();const n=_f(e.detail.action,t);n&&CS(this._host,{action:qm(n),config:t})}_getSufficientValue(e){ +/* istanbul ignore else: cannot happen -- @preserve */ +return"custom:frigate-card-status-bar-icon"===e.type?e.icon:"custom:frigate-card-status-bar-string"===e.type?e.string:"custom:frigate-card-status-bar-image"===e.type?e.image:null}_getSufficientValues(e){return e.filter((e=>!1!==e.enabled&&e.sufficient)).map((e=>this._getSufficientValue(e)))}_show(){af(this._host,!1,"hide")}_hide(){af(this._host,!0,"hide")}}let zS=class extends oe{constructor(){super(...arguments),this._controller=new IS(this)}willUpdate(e){e.has("config")&&this.config&&this._controller.setConfig(this.config),e.has("items")&&this._controller.setItems(this.items??[])}render(){if(this._controller.shouldRender())return q` +
+ ${this._controller.getRenderItems().map((e=>{if(!1===e.enabled)return;const t=_e({item:!0,expand:!!e.expand,action:!!Object.keys(e.actions??{}).length}),n=Cf({hasHold:yf(e.actions?.hold_action),hasDoubleClick:yf(e.actions?.double_tap_action)});return"custom:frigate-card-status-bar-string"===e.type?q`
this._controller.actionHandler(t,e.actions)} + > + ${e.string} +
`:"custom:frigate-card-status-bar-icon"===e.type?q`this._controller.actionHandler(t,e.actions)} + >`:"custom:frigate-card-status-bar-image"===e.type?q`this._controller.actionHandler(t,e.actions)} + />`:void 0}))} +
+ `}static get styles(){return s("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n:host {\n --mdc-icon-size: calc(var(--frigate-card-status-bar-height) - 6px);\n display: block;\n width: 100%;\n pointer-events: auto;\n opacity: 1;\n transition: opacity 1s;\n}\n\n/*******************************************************\n * Non-hover styles should not interact with the pointer\n *******************************************************/\n:host(:not([data-style*=hover])) {\n pointer-events: none;\n}\n\n/***************\n * Outside style\n ***************/\n:host([data-style=outside]) {\n color: var(--primary-text-color);\n background: var(--secondary-background-color);\n}\n\n/*******************\n * Non-outside style\n *******************/\n:host(:not([data-style=outside])) {\n color: white;\n background: linear-gradient(90deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));\n}\n\n:host([data-style=popup][hide]) {\n opacity: 0;\n}\n\n/*********************\n * Status bar contents\n *********************/\n.status {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n overflow: hidden;\n width: 100%;\n height: var(--frigate-card-status-bar-height);\n}\n\n.item {\n display: inline-block;\n margin: 3px 5px;\n align-content: center;\n opacity: 0.7;\n}\n\n.item:first-child {\n margin-left: 10px;\n}\n\n.item:last-child {\n margin-right: 10px;\n}\n\n.item.expand {\n flex: 1;\n}\n\n.item.action {\n cursor: pointer;\n}\n\nimg.item {\n display: block;\n height: var(--mdc-icon-size, 24px);\n width: auto;\n}")}};e([he({attribute:!1})],zS.prototype,"items",void 0),e([he({attribute:!1})],zS.prototype,"config",void 0),zS=e([le("frigate-card-status-bar")],zS);function TS(e){return"number"==typeof e}function jS(e){return"string"==typeof e}function OS(e){return"boolean"==typeof e}function DS(e){return"[object Object]"===Object.prototype.toString.call(e)}function RS(e){return Math.abs(e)}function PS(e){return Math.sign(e)}function LS(e,t){return RS(e-t)}function NS(e){return qS(e).map(Number)}function FS(e){return e[VS(e)]}function VS(e){return Math.max(0,e.length-1)}function HS(e,t){return t===VS(e)}function BS(e,t=0){return Array.from(Array(e),((e,n)=>t+n))}function qS(e){return Object.keys(e)}function US(e,t){return[e,t].reduce(((e,t)=>(qS(t).forEach((n=>{const i=e[n],a=t[n],r=DS(i)&&DS(a);e[n]=r?US(i,a):a})),e)),{})}function WS(e,t){return void 0!==t.MouseEvent&&e instanceof t.MouseEvent}function ZS(){let e=[];const t={add:function(n,i,a,r={passive:!0}){let s;if("addEventListener"in n)n.addEventListener(i,a,r),s=()=>n.removeEventListener(i,a,r);else{const e=n;e.addListener(a),s=()=>e.removeListener(a)}return e.push(s),t},clear:function(){e=e.filter((e=>e()))}};return t}function QS(e,t,n,i){const a=ZS(),r=1e3/60;let s=null,o=0,c=0;function l(e){if(!c)return;s||(s=e);const a=e-s;for(s=e,o+=a;o>=r;)n(r),o-=r;i(o/r),c&&t.requestAnimationFrame(l)}function d(){t.cancelAnimationFrame(c),s=null,o=0,c=0}return{init:function(){a.add(e,"visibilitychange",(()=>{e.hidden&&(s=null,o=0)}))},destroy:function(){d(),a.clear()},start:function(){c||(c=t.requestAnimationFrame(l))},stop:d,update:()=>n(r),render:i}}function GS(e=0,t=0){const n=RS(e-t);function i(t){return tt}function r(e){return i(e)||a(e)}const s={length:n,max:t,min:e,constrain:function(n){return r(n)?i(n)?e:t:n},reachedAny:r,reachedMax:a,reachedMin:i,removeOffset:function(e){return n?e-n*Math.ceil((e-t)/n):e}};return s}function YS(e,t,n){const{constrain:i}=GS(0,e),a=e+1;let r=s(t);function s(e){return n?RS((a+e)%a):i(e)}function o(){return r}function c(){return YS(e,o(),n)}const l={get:o,set:function(e){return r=s(e),l},add:function(e){return c().set(o()+e)},clone:c};return l}function KS(e,t,n,i,a,r,s,o,c,l,d,u,h,p,g,m,f,_,y){const{cross:v,direction:b}=e,w=["INPUT","SELECT","TEXTAREA"],x={passive:!1},C=ZS(),M=ZS(),S=GS(50,225).constrain(p.measure(20)),k={mouse:300,touch:400},E={mouse:500,touch:600},$=g?43:25;let A=!1,I=0,z=0,T=!1,j=!1,O=!1,D=!1;function R(e){if(!WS(e,i)&&e.touches.length>=2)return P(e);const t=r.readPoint(e),n=r.readPoint(e,v),s=LS(t,I),c=LS(n,z);if(!j&&!D){if(!e.cancelable)return P(e);if(j=s>c,!j)return P(e)}const d=r.pointerMove(e);s>m&&(O=!0),l.useFriction(.3).useDuration(.75),o.start(),a.add(b(d)),e.preventDefault()}function P(e){const t=d.byDistance(0,!1).index!==u.get(),n=r.pointerUp(e)*(g?E:k)[D?"mouse":"touch"],i=function(e,t){const n=u.add(-1*PS(e)),i=d.byDistance(e,!g).distance;return g||RS(e)=2,o&&0!==e.button)return;if(function(e){const t=e.nodeName||"";return w.includes(t)}(e.target))return;T=!0,r.pointerDown(e),l.useFriction(0).useDuration(0),a.set(s),function(){const e=D?n:t;M.add(e,"touchmove",R,x).add(e,"touchend",P).add(e,"mousemove",R,x).add(e,"mouseup",P)}(),I=r.readPoint(e),z=r.readPoint(e,v),h.emit("pointerDown")}(o)}const c=t;C.add(c,"dragstart",(e=>e.preventDefault()),x).add(c,"touchmove",(()=>{}),x).add(c,"touchend",(()=>{})).add(c,"touchstart",o).add(c,"mousedown",o).add(c,"touchcancel",P).add(c,"contextmenu",P).add(c,"click",L,!0)},destroy:function(){C.clear(),M.clear()},pointerDown:function(){return T}}}function XS(e,t){let n,i;function a(e){return e.timeStamp}function r(n,i){const a="client"+("x"===(i||e.scroll)?"X":"Y");return(WS(n,t)?n:n.touches[0])[a]}return{pointerDown:function(e){return n=e,i=e,r(e)},pointerMove:function(e){const t=r(e)-r(i),s=a(e)-a(n)>170;return i=e,s&&(n=e),t},pointerUp:function(e){if(!n||!i)return 0;const t=r(i)-r(n),s=a(e)-a(n),o=a(e)-a(i)>170,c=t/s;return s&&!o&&RS(c)>.1?c:0},readPoint:r}}function JS(e,t,n,i,a,r,s){const o=[e].concat(i);let c,l,d=[],u=!1;function h(e){return a.measureSize(s.measure(e))}return{init:function(a){r&&(l=h(e),d=i.map(h),c=new ResizeObserver((n=>{(OS(r)||r(a,n))&&function(n){for(const r of n){if(u)return;const n=r.target===e,s=i.indexOf(r.target),o=n?l:d[s];if(RS(h(n?e:i[s])-o)>=.5){a.reInit(),t.emit("resize");break}}}(n)})),n.requestAnimationFrame((()=>{o.forEach((e=>c.observe(e)))})))},destroy:function(){u=!0,c&&c.disconnect()}}}function ek(e,t,n,i,a){const r=a.measure(10),s=a.measure(50),o=GS(.1,.99);let c=!1;function l(){return!c&&(!!e.reachedAny(n.get())&&!!e.reachedAny(t.get()))}return{shouldConstrain:l,constrain:function(a){if(!l())return;const c=e.reachedMin(t.get())?"min":"max",d=RS(e[c]-t.get()),u=n.get()-t.get(),h=o.constrain(d/s);n.subtract(u*h),!a&&RS(u)e.add(a)))}};return c}function nk(e,t,n,i,a){const{reachedAny:r,removeOffset:s,constrain:o}=i;function c(e){return e.concat().sort(((e,t)=>RS(e)-RS(t)))[0]}function l(t,i){const a=[t,t+n,t-n];if(!e)return t;if(!i)return c(a);const r=a.filter((e=>PS(e)===i));return r.length?c(r):FS(a)-n}return{byDistance:function(n,i){const c=a.get()+n,{index:d,distance:u}=function(n){const i=e?s(n):o(n),a=t.map(((e,t)=>({diff:l(e-i,0),index:t}))).sort(((e,t)=>RS(e.diff)-RS(t.diff))),{index:r}=a[0];return{index:r,distance:i}}(c),h=!e&&r(c);return!i||h?{index:d,distance:n}:{index:d,distance:n+l(t[d]-u,0)}},byIndex:function(e,n){return{index:e,distance:l(t[e]-a.get(),n)}},shortcut:l}}function ik(e,t,n,i,a,r,s,o){const c={passive:!0,capture:!0};let l=0;function d(e){"Tab"===e.code&&(l=(new Date).getTime())}return{init:function(u){o&&(r.add(document,"keydown",d,!1),t.forEach(((t,d)=>{r.add(t,"focus",(t=>{(OS(o)||o(u,t))&&function(t){if((new Date).getTime()-l>10)return;s.emit("slideFocusStart"),e.scrollLeft=0;const r=n.findIndex((e=>e.includes(t)));TS(r)&&(a.useDuration(0),i.index(r,0),s.emit("slideFocus"))}(d)}),c)})))}}}function ak(e){let t=e;function n(e){return TS(e)?e:e.get()}const i={get:function(){return t},set:function(e){t=n(e)},add:function(e){t+=n(e)},subtract:function(e){t-=n(e)}};return i}function rk(e,t){const n="x"===e.scroll?function(e){return`translate3d(${e}px,0px,0px)`}:function(e){return`translate3d(0px,${e}px,0px)`},i=t.style;let a=!1;return{clear:function(){a||(i.transform="",t.getAttribute("style")||t.removeAttribute("style"))},to:function(t){a||(i.transform=n(e.direction(t)))},toggleActive:function(e){a=!e}}}function sk(e,t,n,i,a,r,s,o,c){const l=.5,d=NS(a),u=NS(a).reverse(),h=function(){const e=s[0];return m(g(u,e),n,!1)}().concat(function(){const e=t-s[0]-1;return m(g(d,e),-n,!0)}());function p(e,t){return e.reduce(((e,t)=>e-a[t]),t)}function g(e,t){return e.reduce(((e,n)=>p(e,t)>0?e.concat([n]):e),[])}function m(a,s,d){const u=function(e){return r.map(((n,a)=>({start:n-i[a]+l+e,end:n+t-l+e})))}(s);return a.map((t=>{const i=d?0:-n,a=d?n:0,r=d?"end":"start",s=u[t][r];return{index:t,loopPoint:s,slideLocation:ak(-1),translate:rk(e,c[t]),target:()=>o.get()>s?i:a}}))}const f={canLoop:function(){return h.every((({index:e})=>{const n=d.filter((t=>t!==e));return p(n,t)<=.1}))},clear:function(){h.forEach((e=>e.translate.clear()))},loop:function(){h.forEach((e=>{const{target:t,translate:n,slideLocation:i}=e,a=t();a!==i.get()&&(n.to(a),i.set(a))}))},loopPoints:h};return f}function ok(e,t,n){let i,a=!1;return{init:function(r){n&&(i=new MutationObserver((e=>{a||(OS(n)||n(r,e))&&function(e){for(const n of e)if("childList"===n.type){r.reInit(),t.emit("slidesChanged");break}}(e)})),i.observe(e,{childList:!0}))},destroy:function(){i&&i.disconnect(),a=!0}}}function ck(e,t,n,i){const a={};let r,s=null,o=null,c=!1;return{init:function(){r=new IntersectionObserver((e=>{c||(e.forEach((e=>{const n=t.indexOf(e.target);a[n]=e})),s=null,o=null,n.emit("slidesInView"))}),{root:e.parentElement,threshold:i}),t.forEach((e=>r.observe(e)))},destroy:function(){r&&r.disconnect(),c=!0},get:function(e=!0){if(e&&s)return s;if(!e&&o)return o;const t=function(e){return qS(a).reduce(((t,n)=>{const i=parseInt(n),{isIntersecting:r}=a[i];return(e&&r||!e&&!r)&&t.push(i),t}),[])}(e);return e&&(s=t),e||(o=t),t}}}function lk(e,t,n,i,a,r,s,o,c){const{startEdge:l,endEdge:d,direction:u}=e,h=TS(n);const p={groupSlides:function(e){return h?function(e,t){return NS(e).filter((e=>e%t==0)).map((n=>e.slice(n,n+t)))}(e,n):function(e){return e.length?NS(e).reduce(((n,h,p)=>{const g=FS(n)||0,m=0===g,f=h===VS(e),_=a[l]-r[g][l],y=a[l]-r[h][d],v=!i&&m?u(s):0,b=RS(y-(!i&&f?u(o):0)-(_+v));return p&&b>t+c&&n.push(h),f&&n.push(e.length),n}),[]).map(((t,n,i)=>{const a=Math.max(i[n-1]||0);return e.slice(a,t)})):[]}(e)}};return p}function dk(e,t,n,i,a,r,s){const{align:o,axis:c,direction:l,startIndex:d,loop:u,duration:h,dragFree:p,dragThreshold:g,inViewThreshold:m,slidesToScroll:f,skipSnaps:_,containScroll:y,watchResize:v,watchSlides:b,watchDrag:w,watchFocus:x}=r,C={measure:function(e){const{offsetTop:t,offsetLeft:n,offsetWidth:i,offsetHeight:a}=e;return{top:t,right:n+i,bottom:t+a,left:n,width:i,height:a}}},M=C.measure(t),S=n.map(C.measure),k=function(e,t){const n="rtl"===t,i="y"===e,a=!i&&n?-1:1,r={scroll:i?"y":"x",cross:i?"x":"y",startEdge:i?"top":n?"right":"left",endEdge:i?"bottom":n?"left":"right",measureSize:function(e){const{height:t,width:n}=e;return i?t:n},direction:function(e){return e*a}};return r}(c,l),E=k.measureSize(M),$=function(e){const t={measure:function(t){return e*(t/100)}};return t}(E),A=function(e,t){const n={start:function(){return 0},center:function(e){return i(e)/2},end:i};function i(e){return t-e}const a={measure:function(i,a){return jS(e)?n[e](i):e(t,i,a)}};return a}(o,E),I=!u&&!!y,z=u||!!y,{slideSizes:T,slideSizesWithGaps:j,startGap:O,endGap:D}=function(e,t,n,i,a,r){const{measureSize:s,startEdge:o,endEdge:c}=e,l=n[0]&&a,d=function(){if(!l)return 0;const e=n[0];return RS(t[o]-e[o])}(),u=function(){if(!l)return 0;const e=r.getComputedStyle(FS(i));return parseFloat(e.getPropertyValue(`margin-${c}`))}(),h=n.map(s),p=n.map(((e,t,n)=>{const i=!t,a=HS(n,t);return i?h[t]+d:a?h[t]+u:n[t+1][o]-e[o]})).map(RS);return{slideSizes:h,slideSizesWithGaps:p,startGap:d,endGap:u}}(k,M,S,n,z,a),R=lk(k,E,f,u,M,S,O,D,2),{snaps:P,snapsAligned:L}=function(e,t,n,i,a){const{startEdge:r,endEdge:s}=e,{groupSlides:o}=a,c=o(i).map((e=>FS(e)[s]-e[0][r])).map(RS).map(t.measure),l=i.map((e=>n[r]-e[r])).map((e=>-RS(e))),d=o(l).map((e=>e[0])).map(((e,t)=>e+c[t]));return{snaps:l,snapsAligned:d}}(k,A,M,S,R),N=-FS(P)+FS(j),{snapsContained:F,scrollContainLimit:V}=function(e,t,n,i,a){const r=GS(-t+e,0),s=n.map(((e,t)=>{const{min:i,max:a}=r,s=r.constrain(e),o=!t,l=HS(n,t);return o?a:l||c(i,s)?i:c(a,s)?a:s})).map((e=>parseFloat(e.toFixed(3)))),o=function(){const e=s[0],t=FS(s);return GS(s.lastIndexOf(e),s.indexOf(t)+1)}();function c(e,t){return LS(e,t)<1}return{snapsContained:function(){if(t<=e+a)return[r.max];if("keepSnaps"===i)return s;const{min:n,max:c}=o;return s.slice(n,c)}(),scrollContainLimit:o}}(E,N,L,y,2),H=I?F:L,{limit:B}=function(e,t,n){const i=t[0];return{limit:GS(n?i-e:FS(t),i)}}(N,H,u),q=YS(VS(H),d,u),U=q.clone(),W=NS(n),Z=QS(i,a,(e=>(({dragHandler:e,scrollBody:t,scrollBounds:n,options:{loop:i}},a)=>{i||n.constrain(e.pointerDown()),t.seek(a)})(oe,e)),(e=>(({scrollBody:e,translate:t,location:n,offsetLocation:i,scrollLooper:a,slideLooper:r,dragHandler:s,animation:o,eventHandler:c,scrollBounds:l,options:{loop:d}},u)=>{const h=e.settled(),p=!l.shouldConstrain(),g=d?h:h&&p;g&&!s.pointerDown()&&(o.stop(),c.emit("settle")),g||c.emit("scroll");const m=n.get()*u+Y.get()*(1-u);i.set(m),d&&(a.loop(e.direction()),r.loop()),t.to(i.get())})(oe,e))),Q=H[q.get()],G=ak(Q),Y=ak(Q),K=ak(Q),X=ak(Q),J=function(e,t,n,i,a,r){let s=0,o=0,c=a,l=r,d=e.get(),u=0;function h(e){return c=e,g}function p(e){return l=e,g}const g={direction:function(){return o},duration:function(){return c},velocity:function(){return s},seek:function(t){const a=t/1e3,r=c*a,h=i.get()-e.get();let p=0;return c?(n.set(e),s+=h/r,s*=l,d+=s,e.add(s*a),p=d-u):(s=0,n.set(i),e.set(i),p=h),o=PS(p),u=d,g},settled:function(){return RS(i.get()-t.get())<.001},useBaseFriction:function(){return p(r)},useBaseDuration:function(){return h(a)},useFriction:p,useDuration:h};return g}(G,K,Y,X,h,.68),ee=nk(u,H,N,B,X),te=function(e,t,n,i,a,r,s){function o(a){const o=a.distance,c=a.index!==t.get();r.add(o),o&&(i.duration()?e.start():(e.update(),e.render(1),e.update())),c&&(n.set(t.get()),t.set(a.index),s.emit("select"))}const c={distance:function(e,t){o(a.byDistance(e,t))},index:function(e,n){const i=t.clone().set(e);o(a.byIndex(i.get(),n))}};return c}(Z,q,U,J,ee,X,s),ne=function(e){const{max:t,length:n}=e,i={get:function(e){return n?(e-t)/-n:0}};return i}(B),ie=ZS(),ae=ck(t,n,s,m),{slideRegistry:re}=function(e,t,n,i,a,r){const{groupSlides:s}=a,{min:o,max:c}=i;return{slideRegistry:function(){const i=s(r),a=!e||"keepSnaps"===t;return 1===n.length?[r]:a?i:i.slice(o,c).map(((e,t,n)=>{const i=!t,a=HS(n,t);return i?BS(FS(n[0])+1):a?BS(VS(r)-FS(n)[0]+1,FS(n)[0]):e}))}()}}(I,y,H,V,R,W),se=ik(e,n,re,te,J,ie,s,x),oe={ownerDocument:i,ownerWindow:a,eventHandler:s,containerRect:M,slideRects:S,animation:Z,axis:k,dragHandler:KS(k,e,i,a,X,XS(k,a),G,Z,te,J,ee,q,s,$,p,g,_,.68,w),eventStore:ie,percentOfView:$,index:q,indexPrevious:U,limit:B,location:G,offsetLocation:K,previousLocation:Y,options:r,resizeHandler:JS(t,s,a,n,k,v,C),scrollBody:J,scrollBounds:ek(B,K,X,J,$),scrollLooper:tk(N,B,K,[G,K,Y,X]),scrollProgress:ne,scrollSnapList:H.map(ne.get),scrollSnaps:H,scrollTarget:ee,scrollTo:te,slideLooper:sk(k,E,N,T,j,P,H,K,n),slideFocus:se,slidesHandler:ok(t,s,b),slidesInView:ae,slideIndexes:W,slideRegistry:re,slidesToScroll:R,target:X,translate:rk(k,t)};return oe}const uk={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function hk(e){function t(e,t){return US(e,t||{})}const n={mergeOptions:t,optionsAtMedia:function(n){const i=n.breakpoints||{},a=qS(i).filter((t=>e.matchMedia(t).matches)).map((e=>i[e])).reduce(((e,n)=>t(e,n)),{});return t(n,a)},optionsMediaQueries:function(t){return t.map((e=>qS(e.breakpoints||{}))).reduce(((e,t)=>e.concat(t)),[]).map(e.matchMedia)}};return n}function pk(e,t,n){const i=e.ownerDocument,a=i.defaultView,r=hk(a),s=function(e){let t=[];const n={init:function(n,i){return t=i.filter((({options:t})=>!1!==e.optionsAtMedia(t).active)),t.forEach((t=>t.init(n,e))),i.reduce(((e,t)=>Object.assign(e,{[t.name]:t})),{})},destroy:function(){t=t.filter((e=>e.destroy()))}};return n}(r),o=ZS(),c=function(){let e,t={};function n(e){return t[e]||[]}const i={init:function(t){e=t},emit:function(t){return n(t).forEach((n=>n(e,t))),i},off:function(e,a){return t[e]=n(e).filter((e=>e!==a)),i},on:function(e,a){return t[e]=n(e).concat([a]),i},clear:function(){t={}}};return i}(),{mergeOptions:l,optionsAtMedia:d,optionsMediaQueries:u}=r,{on:h,off:p,emit:g}=c,m=k;let f,_,y,v,b=!1,w=l(uk,pk.globalOptions),x=l(w),C=[];function M(t){const n=dk(e,y,v,i,a,t,c);if(t.loop&&!n.slideLooper.canLoop()){return M(Object.assign({},t,{loop:!1}))}return n}function S(t,n){b||(w=l(w,t),x=d(w),C=n||C,function(){const{container:t,slides:n}=x,i=jS(t)?e.querySelector(t):t;y=i||e.children[0];const a=jS(n)?y.querySelectorAll(n):n;v=[].slice.call(a||y.children)}(),f=M(x),u([w,...C.map((({options:e})=>e))]).forEach((e=>o.add(e,"change",k))),x.active&&(f.translate.to(f.location.get()),f.animation.init(),f.slidesInView.init(),f.slideFocus.init(I),f.eventHandler.init(I),f.resizeHandler.init(I),f.slidesHandler.init(I),f.options.loop&&f.slideLooper.loop(),y.offsetParent&&v.length&&f.dragHandler.init(I),_=s.init(I,C)))}function k(e,t){const n=A();E(),S(l({startIndex:n},e),t),c.emit("reInit")}function E(){f.dragHandler.destroy(),f.eventStore.clear(),f.translate.clear(),f.slideLooper.clear(),f.resizeHandler.destroy(),f.slidesHandler.destroy(),f.slidesInView.destroy(),f.animation.destroy(),s.destroy(),o.clear()}function $(e,t,n){x.active&&!b&&(f.scrollBody.useBaseFriction().useDuration(!0===t?0:x.duration),f.scrollTo.index(e,n||0))}function A(){return f.index.get()}const I={canScrollNext:function(){return f.index.add(1).get()!==A()},canScrollPrev:function(){return f.index.add(-1).get()!==A()},containerNode:function(){return y},internalEngine:function(){return f},destroy:function(){b||(b=!0,o.clear(),E(),c.emit("destroy"),c.clear())},off:p,on:h,emit:g,plugins:function(){return _},previousScrollSnap:function(){return f.indexPrevious.get()},reInit:m,rootNode:function(){return e},scrollNext:function(e){$(f.index.add(1).get(),e,-1)},scrollPrev:function(e){$(f.index.add(-1).get(),e,1)},scrollProgress:function(){return f.scrollProgress.get(f.location.get())},scrollSnapList:function(){return f.scrollSnapList},scrollTo:$,selectedScrollSnap:A,slideNodes:function(){return v},slidesInView:function(){return f.slidesInView.get()},slidesNotInView:function(){return f.slidesInView.get(!1)}};return S(t,n),setTimeout((()=>c.emit("init")),0),I}function gk(){return gk=Object.assign||function(e){for(var t=1;t=e;case"y":return Math.abs(a)>=e;case"z":return Math.abs(r)>=e;default:return!1}}(r,i)&&e.preventDefault(),l.isStarted?l.isMomentum&&r>Math.max(2,2*l.lastAbsDelta)&&(M(!0),x()):x(),0===r&&Object.is&&Object.is(e.deltaX,-0)?d=!0:(t=e,l.axisMovement=fk(l.axisMovement,i),l.lastAbsDelta=r,l.scrollPointsToMerge.push({axisDelta:i,timeStamp:a}),m(),p({axisDelta:i,isStart:!l.isStartPublished}),l.isStartPublished=!0,C())},m=function(){var e;l.scrollPointsToMerge.length===Mk?(l.scrollPoints.unshift({axisDeltaSum:l.scrollPointsToMerge.map((function(e){return e.axisDelta})).reduce(fk),timeStamp:(e=l.scrollPointsToMerge.map((function(e){return e.timeStamp})),e.reduce((function(e,t){return e+t}))/e.length)}),_(),l.scrollPointsToMerge.length=0,l.scrollPoints.length=1,l.isMomentum||b()):l.isStartPublished||f()},f=function(){var e;l.axisVelocity=(e=l.scrollPointsToMerge,e[e.length-1]).axisDelta.map((function(e){return e/l.willEndTimeout}))},_=function(){var e=l.scrollPoints,t=e[0],n=e[1];if(n&&t){var i=t.timeStamp-n.timeStamp;if(!(i<=0)){var a=t.axisDeltaSum.map((function(e){return e/i})),r=a.map((function(e,t){return e/(l.axisVelocity[t]||1)}));l.axisVelocity=a,l.accelerationFactors.push(r),y(i)}}},y=function(e){var t=10*Math.ceil(e/10)*1.2;l.isMomentum||(t=Math.max(100,2*t)),l.willEndTimeout=Math.min(1e3,Math.round(t))},v=function(e){return 0===e||e<=Ck&&e>=xk},b=function(){if(l.accelerationFactors.length>=Sk){if(d&&(d=!1,_k(l.axisVelocity)>=.2))return void w();var e=l.accelerationFactors.slice(-1*Sk);e.every((function(e){var t=!!e.reduce((function(e,t){return e&&e<1&&e===t?1:0})),n=e.filter(v).length===e.length;return t||n}))&&w(),l.accelerationFactors=e}},w=function(){l.isMomentum=!0},x=function(){(l=$k()).isStarted=!0,l.startTime=Date.now(),n=void 0,d=!1},C=function(){clearTimeout(i),i=setTimeout(M,l.willEndTimeout)},M=function(e){void 0===e&&(e=!1),l.isStarted&&(l.isMomentum&&e?p({isEnding:!0,isMomentumCancel:!0}):p({isEnding:!0}),l.isMomentum=!1,l.isStarted=!1)},S=function(e){var t=[],n=function(n){n.removeEventListener("wheel",e),t=t.filter((function(e){return e!==n}))};return yk({observe:function(i){return i.addEventListener("wheel",e,{passive:!1}),t.push(i),function(){return n(i)}},unobserve:n,disconnect:function(){t.forEach(n)}})}(u),k=S.observe,E=S.unobserve,$=S.disconnect;return h(e),yk({on:r,off:s,observe:k,unobserve:E,disconnect:$,feedWheel:u,updateOptions:h})}var Ik={active:!0,breakpoints:{},wheelDraggingClass:"is-wheel-dragging",forceWheelAxis:void 0,target:void 0};function zk(e){var t;void 0===e&&(e={});var n=function(){};var i={name:"wheelGestures",options:e,init:function(i,a){var r,s,o=a.mergeOptions,c=a.optionsAtMedia,l=o(Ik,zk.globalOptions),d=o(l,e);t=c(d);var u,h=i.internalEngine(),p=null!=(r=t.target)?r:i.containerNode().parentNode,g=null!=(s=t.forceWheelAxis)?s:h.options.axis,m=Ak({preventWheelAction:g,reverseSign:[!0,!0,!1]}),f=m.observe(p),_=m.on("wheel",(function(e){var i=e.axisDelta,a=i[0],r=i[1],s="x"===g?a:r,o="x"===g?r:a,c=e.isMomentum&&e.previous&&!e.previous.isMomentum,l=e.isEnding&&!e.isMomentum||c;Math.abs(s)>Math.abs(o)&&!y&&!e.isMomentum&&function(e){try{x(u=new MouseEvent("mousedown",e.event))}catch(e){return n()}y=!0,document.documentElement.addEventListener("mousemove",b,!0),document.documentElement.addEventListener("mouseup",b,!0),void document.documentElement.addEventListener("mousedown",b,!0),t.wheelDraggingClass&&p.classList.add(t.wheelDraggingClass)}(e);if(!y)return;l?function(e){y=!1,x(w("mouseup",e)),v(),t.wheelDraggingClass&&p.classList.remove(t.wheelDraggingClass)}(e):x(w("mousemove",e))})),y=!1;function v(){document.documentElement.removeEventListener("mousemove",b,!0),document.documentElement.removeEventListener("mouseup",b,!0),document.documentElement.removeEventListener("mousedown",b,!0)}function b(e){y&&e.isTrusted&&e.stopImmediatePropagation()}function w(e,t){var n,i;if(g===h.options.axis){var a=t.axisMovement;n=a[0],i=a[1]}else{var r=t.axisMovement;i=r[0],n=r[1]}if(!h.options.skipSnaps&&!h.options.dragFree){var s=h.containerRect.width,o=h.containerRect.height;n=n<0?Math.max(n,-s):Math.min(n,s),i=i<0?Math.max(i,-o):Math.min(i,o)}return new MouseEvent(e,{clientX:u.clientX+n,clientY:u.clientY+i,screenX:u.screenX+n,screenY:u.screenY+i,movementX:n,movementY:i,button:0,bubbles:!0,cancelable:!0,composed:!0})}function x(e){i.containerNode().dispatchEvent(e)}n=function(){f(),_(),v()}},destroy:function(){return n()}};return i}zk.globalOptions=void 0;class Tk{constructor(e,t,n){this._mutationObserver=new MutationObserver(((e,t)=>this._refreshCarouselContents())),this._refreshCarouselContents=()=>{const e=of(this._parent);!jy(this._carousel.slideNodes(),e)&&(this._carousel.destroy(),this._carousel=this._createCarousel(e))},this._root=e,this._parent=t,this._direction=n?.direction??"horizontal",this._transitionEffect=n?.transitionEffect??"slide",this._startIndex=n?.startIndex??0,this._dragFree=n?.dragFree??!1,this._loop=n?.loop??!1,this._draggable=n?.dragEnabled??!0,this._plugins=n?.plugins??[],this._textDirection=n?.textDirection??"ltr",this._carousel=this._createCarousel(of(this._parent)),t instanceof HTMLSlotElement&&t.addEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.observe(this._parent,{childList:!0})}destroy(){this._parent instanceof HTMLSlotElement&&this._parent.removeEventListener("slotchange",this._refreshCarouselContents),this._mutationObserver.disconnect(),this._carousel.destroy()}getSlide(e){return this._carousel.slideNodes()[e]??null}getSelectedSlide(){return this.getSlide(this.getSelectedIndex())}getSelectedIndex(){return this._carousel.selectedScrollSnap()}selectSlide(e){this._carousel.scrollTo(e,"none"===this._transitionEffect);const t=this.getSlide(e);t&&Vm(this._parent,"carousel:force-select",{index:e,element:t})}_createCarousel(e){const t=pk(this._root,{slides:e,axis:"horizontal"===this._direction?"x":"y",duration:20,startIndex:this._startIndex,dragFree:this._dragFree,loop:this._loop,containScroll:"trimSnaps",watchSlides:!1,watchResize:!0,watchDrag:this._draggable,direction:this._textDirection},[...this._plugins,...e.length>1?[zk({forceWheelAxis:"y"})]:[]]),n=()=>{const e=(()=>{const e=t.selectedScrollSnap(),n=t.slideNodes()[e]??null;return n?{index:e,element:n}:null})();e&&Vm(this._parent,"carousel:select",e)};return t.on("select",(()=>n())),t}}const jk=e=>"rtl"===getComputedStyle(e).direction?"rtl":"ltr";let Ok=class extends oe{constructor(){super(...arguments),this.direction="horizontal",this.dragEnabled=!0,this.selected=0,this._refParent=Ie(),this._refRoot=Ie(),this._carousel=null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._carousel?.destroy(),this._carousel=null,super.disconnectedCallback()}willUpdate(e){e.has("direction")&&this.setAttribute("direction",this.direction);["direction","dragEnabled","dragFree","loop","plugins","transitionEffect"].some((t=>e.has(t)))&&(this._carousel?.destroy(),this._carousel=null)}render(){return q`
+ +
+
+ +
+
+ +
`}updated(e){!this._carousel&&this._refRoot.value&&this._refParent.value?this._carousel=new Tk(this._refRoot.value,this._refParent.value,{direction:this.direction,dragEnabled:this.dragEnabled,dragFree:this.dragFree,startIndex:this.selected,transitionEffect:this.transitionEffect,loop:this.loop,plugins:this.plugins,textDirection:jk(this)}):e.has("selected")&&this._carousel?.selectSlide(this.selected)}static get styles(){return s(":host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.embla {\n width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.embla__container {\n display: flex;\n width: 100%;\n height: 100%;\n user-select: none;\n -webkit-touch-callout: none;\n -khtml-user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n:host([direction=vertical]) .embla__container {\n flex-direction: column;\n}\n\n:host([direction=horizontal]) .embla__container {\n flex-direction: row;\n}\n\n.embla__viewport {\n width: 100%;\n height: 100%;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n.embla__viewport.is-draggable {\n cursor: move;\n cursor: grab;\n}\n\n.embla__viewport.is-dragging {\n cursor: grabbing;\n}\n\n:host([direction=vertical]) ::slotted(.embla__slide) {\n margin-bottom: 5px;\n}\n\n:host([direction=horizontal]) ::slotted(.embla__slide) {\n margin-right: 5px;\n}")}};e([he({attribute:!0,reflect:!0})],Ok.prototype,"direction",void 0),e([he({attribute:!0})],Ok.prototype,"transitionEffect",void 0),e([he({attribute:!1})],Ok.prototype,"loop",void 0),e([he({attribute:!1})],Ok.prototype,"dragFree",void 0),e([he({attribute:!1})],Ok.prototype,"dragEnabled",void 0),e([he({attribute:!1})],Ok.prototype,"plugins",void 0),e([he({attribute:!1})],Ok.prototype,"selected",void 0),Ok=e([le("frigate-card-carousel")],Ok); +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const Dk=window,Rk=Dk.ShadowRoot&&(void 0===Dk.ShadyCSS||Dk.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Pk=Symbol(),Lk=new WeakMap;let Nk=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Pk)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Rk&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=Lk.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Lk.set(t,e))}return e}toString(){return this.cssText}};const Fk=(e,t)=>{Rk?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const n=document.createElement("style"),i=Dk.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=t.cssText,e.appendChild(n)}))},Vk=Rk?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new Nk("string"==typeof e?e:e+"",void 0,Pk))(t)})(e):e +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;var Hk;const Bk=window,qk=Bk.trustedTypes,Uk=qk?qk.emptyScript:"",Wk=Bk.reactiveElementPolyfillSupport,Zk={toAttribute(e,t){switch(t){case Boolean:e=e?Uk:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},Qk=(e,t)=>t!==e&&(t==t||e==e),Gk={attribute:!0,type:String,converter:Zk,reflect:!1,hasChanged:Qk},Yk="finalized";class Kk extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,n)=>{const i=this._$Ep(n,t);void 0!==i&&(this._$Ev.set(i,n),e.push(i))})),e}static createProperty(e,t=Gk){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n="symbol"==typeof e?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Gk}static finalize(){if(this.hasOwnProperty(Yk))return!1;this[Yk]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const n of t)this.createProperty(n,e[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(Vk(e))}else void 0!==e&&t.push(Vk(e));return t}static _$Ep(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,n;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return Fk(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=Gk){var i;const a=this.constructor._$Ep(e,n);if(void 0!==a&&!0===n.reflect){const r=(void 0!==(null===(i=n.converter)||void 0===i?void 0:i.toAttribute)?n.converter:Zk).toAttribute(t,n.type);this._$El=e,null==r?this.removeAttribute(a):this.setAttribute(a,r),this._$El=null}}_$AK(e,t){var n;const i=this.constructor,a=i._$Ev.get(e);if(void 0!==a&&this._$El!==a){const e=i.getPropertyOptions(a),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(n=e.converter)||void 0===n?void 0:n.fromAttribute)?e.converter:Zk;this._$El=a,this[a]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,n){let i=!0;void 0!==e&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Qk)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(n)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}Kk[Yk]=!0,Kk.elementProperties=new Map,Kk.elementStyles=[],Kk.shadowRootOptions={mode:"open"},null==Wk||Wk({ReactiveElement:Kk}),(null!==(Hk=Bk.reactiveElementVersions)&&void 0!==Hk?Hk:Bk.reactiveElementVersions=[]).push("1.6.3"); +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const Xk=0,Jk=Symbol();class eE{constructor(e,t,n){this.o=0,this.status=0,this.autoRun=!0,this.i=e,this.i.addController(this);const i="object"==typeof t?t:{task:t,args:n};this.t=i.task,this.h=i.args,void 0!==i.autoRun&&(this.autoRun=i.autoRun),this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))}hostUpdated(){this.performTask()}async performTask(){var e;const t=null===(e=this.h)||void 0===e?void 0:e.call(this);this.shouldRun(t)&&this.run(t)}shouldRun(e){return this.autoRun&&this.v(e)}async run(e){var t;let n,i;null!=e||(e=null===(t=this.h)||void 0===t?void 0:t.call(this)),2!==this.status&&3!==this.status||(this.taskComplete=new Promise(((e,t)=>{this.l=e,this.u=t}))),this.status=1,this._=void 0,this.m=void 0,this.i.requestUpdate();const a=++this.o;try{n=await this.t(e)}catch(e){i=e}this.o===a&&(n===Jk?this.status=0:(void 0===i?(this.status=2,this.l(n)):(this.status=3,this.u(i)),this.m=n,this._=i),this.i.requestUpdate())}get value(){return this.m}get error(){return this._}render(e){var t,n,i,a;switch(this.status){case 0:return null===(t=e.initial)||void 0===t?void 0:t.call(e);case 1:return null===(n=e.pending)||void 0===n?void 0:n.call(e);case 2:return null===(i=e.complete)||void 0===i?void 0:i.call(e,this.value);case 3:return null===(a=e.error)||void 0===a?void 0:a.call(e,this.error);default:this.status}}v(e){const t=this.T;return this.T=e,Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.some(((e,n)=>Qk(e,t[n]))):e!==t}}class tE{constructor(e){this._keys=e}modify(e){this._keys.forEach((t=>e.removeContext(t)))}}var nE=":host {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-left: 5px;\n padding: 5px;\n color: var(--primary-text-color);\n overflow: hidden;\n column-gap: 5%;\n}\n\ndiv.title {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\ndiv.details {\n flex: 1;\n justify-content: center;\n display: flex;\n flex-direction: column;\n flex-wrap: wrap;\n --mdc-icon-size: 16px;\n min-height: 0px;\n}\n\ndiv.details div {\n display: flex;\n align-items: center;\n}\n\ndiv.details div * {\n margin: 0px 3px;\n}";const iE=(e,t,n)=>{const i={...n?.cardWideConfig&&{cardWideConfig:n.cardWideConfig}};return q` ${e.render({initial:()=>n?.inProgressFunc?.()??sS(i),pending:()=>n?.inProgressFunc?.()??sS(i),error:e=>{Zm(e),n?.errorFunc&&n.errorFunc(e)},complete:t})}`},aE=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,rE=(e,t,n,i=!0)=>new eE(e,{args:()=>[!!t(),n()],task:async([e,n])=>{const i=t();return e&&i&&n?(async(e,t)=>e&&t?t.startsWith("data:")||t.match(aE)?t:new Promise(((n,i)=>{e?e.fetchWithAuth(t).then((e=>e.blob())).then((e=>{const t=new FileReader;t.onload=()=>{const e=t.result;n("string"==typeof e?e:null)},t.onerror=e=>i(e),t.readAsDataURL(e)})).catch((e=>i(e))):i()})):null)(i,n):null},autoRun:i}),sE=300;let oE=class extends oe{constructor(){super(),this._thumbnailError=!1,this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}willUpdate(e){e.has("thumbnail")&&(this._embedThumbnailTask=rE(this,(()=>this.hass),(()=>this.thumbnail),!1),this._intersectionObserver.unobserve(this),this._intersectionObserver.observe(this))}_intersectionHandler(e){this._embedThumbnailTask?.status===Xk&&e.some((e=>e.isIntersecting))&&this._embedThumbnailTask?.run()}render(){const e=q` `;return!this._embedThumbnailTask||this._thumbnailError?e:q`${this.thumbnail?iE(this._embedThumbnailTask,(e=>e?q``:q``),{inProgressFunc:()=>e,errorFunc:()=>{this._thumbnailError=!0}}):e} `}static get styles(){return s(":host {\n display: block;\n overflow: hidden;\n aspect-ratio: 1/1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\nimg {\n display: block;\n}\n\nimg,\nfrigate-card-icon {\n display: inline-block;\n vertical-align: top;\n margin: 0;\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n width: var(--frigate-card-thumbnail-size);\n max-height: 100%;\n aspect-ratio: 1/1;\n object-fit: cover;\n}\n\nfrigate-card-icon {\n --mdc-icon-size: 50%;\n color: var(--primary-text-color);\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-sizing: border-box;\n opacity: 0.2;\n}")}};e([he({attribute:!1})],oE.prototype,"thumbnail",void 0),e([he({attribute:!1})],oE.prototype,"hass",void 0),e([pe()],oE.prototype,"_thumbnailError",void 0),oE=e([le("frigate-card-thumbnail-feature-thumbnail")],oE);let cE=class extends oe{render(){if(this.date)return q` + ${this.cameraMetadata?.engineIcon?q``:""} +
+
${qu(this.date,"HH:mm")}
+
${qu(this.date,"MMM do")}
+ ${this.showCameraTitle&&this.cameraMetadata?.title?q`
${this.cameraMetadata.title}
`:q``} +
+ `}static get styles(){return s(":host {\n display: block;\n max-width: var(--frigate-card-thumbnail-size);\n max-height: var(--frigate-card-thumbnail-size);\n aspect-ratio: 1/1;\n border: 1px solid var(--secondary-color);\n background-color: var(--secondary-background-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n overflow: hidden;\n padding: 10px;\n box-sizing: border-box;\n position: relative;\n}\n\nfrigate-card-icon.background {\n display: block;\n width: 100%;\n height: 100%;\n position: absolute;\n inset: 0;\n padding: 10%;\n box-sizing: border-box;\n pointer-events: none;\n opacity: 0.1;\n}\n\ndiv.content {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color: var(--primary-text-color);\n}\n\ndiv {\n text-align: center;\n}\n\ndiv.title {\n font-size: 1.5rem;\n}\n\ndiv.camera {\n font-size: 0.7em;\n}")}};e([he({attribute:!1})],cE.prototype,"date",void 0),e([he({attribute:!1})],cE.prototype,"cameraMetadata",void 0),e([he({attribute:!1})],cE.prototype,"showCameraTitle",void 0),cE=e([le("frigate-card-thumbnail-feature-text")],cE);let lE=class extends oe{render(){if(!this.media)return;const e=this.media.getScore(),t=e?(100*e).toFixed(2)+"%":null,n=this.media.getStartTime(),i=n?Gm(n):null,a=this.media.getEndTime(),r=n&&a?Xm(n,a):null,s=this.media.inProgress()?N_("event.in_progress"):null,o=Hm(this.media.getWhat()?.join(", "))??null,c=Hm(this.media.getWhere()?.join(", "))??null,l=Hm(this.media.getTags()?.join(", "))??null,d=o||l?(o??"")+(o&&l?": ":"")+(l??""):null,u=this.seek?qu(this.seek,"HH:mm:ss"):null;return q` + ${d?q`
+ ${d} + ${t?q`${t}`:""} +
`:""} +
+ ${i?q`
+ + ${i} +
+ ${r||s?q`
+ + ${r?q`${r}`:""} + ${s?q`${s}`:""} +
`:""}`:""} + ${this.cameraTitle?q`
+ + ${this.cameraTitle} +
`:""} + ${c?q`
+ + ${c} +
`:q``} + ${l?q`
+ + ${l} +
`:q``} + ${u?q`
+ + ${u} +
`:q``} +
+ `}static get styles(){return s(nE)}};e([he({attribute:!1})],lE.prototype,"media",void 0),e([he({attribute:!1})],lE.prototype,"seek",void 0),e([he({attribute:!1})],lE.prototype,"cameraTitle",void 0),lE=e([le("frigate-card-thumbnail-details-event")],lE);let dE=class extends oe{render(){if(!this.media)return;const e=this.media.getStartTime(),t=e?Gm(e):null,n=this.media.getEndTime(),i=e&&n?Xm(e,n):null,a=this.media.inProgress()?N_("recording.in_progress"):null,r=this.seek?qu(this.seek,"HH:mm:ss"):null,s=this.media.getEventCount();return q` + ${this.cameraTitle?q`
+ ${this.cameraTitle} +
`:""} +
+ ${t?q`
+ + ${t} +
+ ${i||a?q`
+ + ${i?q`${i}`:""} + ${a?q`${a}`:""} +
`:""}`:""} + ${r?q`
+ + ${r} +
`:q``} + ${null!==s?q`
+ + ${s} +
`:""} +
+ `}static get styles(){return s(nE)}};e([he({attribute:!1})],dE.prototype,"media",void 0),e([he({attribute:!1})],dE.prototype,"seek",void 0),e([he({attribute:!1})],dE.prototype,"cameraTitle",void 0),dE=e([le("frigate-card-thumbnail-details-recording")],dE);let uE=class extends oe{constructor(){super(...arguments),this.details=!1,this.show_favorite_control=!1,this.show_timeline_control=!1,this.show_download_control=!1}render(){if(!this.media||!this.cameraManager||!this.hass)return;const e=this.media.getThumbnail(),t=this.media.getTitle()??"",n={star:!0,starred:!!this.media?.isFavorite()},i=this.show_timeline_control&&(!Pw.isRecording(this.media)||this.media.getStartTime()&&this.media.getEndTime()),a=this.cameraManager?.getMediaCapabilities(this.media),r=this.show_favorite_control&&this.media&&this.hass&&a?.canFavorite,s=this.show_download_control&&this.hass&&this.media.getID()&&a?.canDownload,o=this.cameraManager.getCameraMetadata(this.media.getCameraID());return q` + ${Pw.isEvent(this.media)&&e?q``:Pw.isEvent(this.media)||Pw.isRecording(this.media)?q``:q``} + ${r?q` {if(vf(e),this.hass&&this.media){try{await(this.cameraManager?.favoriteMedia(this.media,!this.media?.isFavorite()))}catch(e){return void Zm(e)}this.requestUpdate()}}} + />`:""} + ${this.details&&Pw.isEvent(this.media)?q``:this.details&&Pw.isRecording(this.media)?q``:q``} + ${i?q`{vf(e),this.viewManagerEpoch&&this.media&&this.viewManagerEpoch.manager.setViewByParameters({params:{view:"timeline",queryResults:this.viewManagerEpoch?.manager.getView()?.queryResults?.clone().selectResultIfFound((e=>e===this.media))},modifiers:[new tE(["timeline"])]})}} + >`:""} + ${s?q` {if(vf(e),this.hass&&this.cameraManager&&this.media)try{await lw(this.hass,this.cameraManager,this.media)}catch(e){cS(this,e)}}} + >`:""} + `}static get styles(){return s(":host {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n transition: transform 0.2s linear;\n}\n\n:host(:not([details])) {\n aspect-ratio: 1/1;\n}\n\n:host([details]) {\n border: 1px solid var(--primary-color);\n border-radius: var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px));\n padding: 2px;\n background-color: var(--primary-background-color, black);\n}\n\n:host(:hover) {\n transform: scale(1.04);\n}\n\nfrigate-card-icon {\n position: absolute;\n border-radius: 50%;\n opacity: 0.5;\n color: var(--primary-color);\n cursor: pointer;\n transition: opacity 0.2s ease-in-out, color 0.2s ease-in-out;\n}\n\nfrigate-card-icon:hover {\n opacity: 1;\n}\n\nfrigate-card-icon.star {\n top: 3px;\n left: 3px;\n}\n\nfrigate-card-icon.star.starred {\n color: gold;\n}\n\nfrigate-card-icon.timeline {\n top: 3px;\n right: 3px;\n}\n\nfrigate-card-icon.download {\n right: 3px;\n bottom: 3px;\n}\n\nfrigate-card-thumbnail-details-event,\nfrigate-card-thumbnail-details-recording {\n flex: 1;\n}")}};e([he({attribute:!1})],uE.prototype,"cameraManager",void 0),e([he({attribute:!1})],uE.prototype,"media",void 0),e([he({attribute:!0,type:Boolean})],uE.prototype,"details",void 0),e([he({attribute:!0,type:Boolean})],uE.prototype,"show_favorite_control",void 0),e([he({attribute:!0,type:Boolean})],uE.prototype,"show_timeline_control",void 0),e([he({attribute:!0,type:Boolean})],uE.prototype,"show_download_control",void 0),e([he({attribute:!1})],uE.prototype,"seek",void 0),uE=e([le("frigate-card-thumbnail")],uE);let hE=class extends oe{constructor(){super(...arguments),this.fadeThumbnails=!1,this._thumbnailSlides=[]}willUpdate(e){if(e.has("config")){this.config?.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.config.size}px`);const e=this._getDirection();e?this.setAttribute("direction",e):this.removeAttribute("direction")}["cameraManager","config","transitionEffect","viewManagerEpoch"].some((t=>e.has(t)))&&(this._thumbnailSlides=this._renderSlides()),e.has("viewManagerEpoch")&&this.style.setProperty("--frigate-card-carousel-thumbnail-opacity",this.fadeThumbnails&&null!==this._getSelectedSlide()?"0.4":"1.0")}_getSelectedSlide(){return this.viewManagerEpoch?.manager.getView()?.queryResults?.getSelectedIndex()??null}_renderSlides(){const e=[],t=this.viewManagerEpoch?.manager.getView(),n=t?.context?.mediaViewer?.seek,i=this._getSelectedSlide();for(const a of t?.queryResults?.getResults()??[]){const t=e.length,r={embla__slide:!0,"slide-selected":i===t};e.push(q` {const n=this.viewManagerEpoch?.manager.getView();n&&n.queryResults&&Vm(this,"thumbnail-carousel:tap",{queryResults:n.queryResults.clone().selectIndex(t)}),vf(e)}} + > + `)}return e}_getDirection(){return"left"===this.config?.mode||"right"===this.config?.mode?"vertical":"above"===this.config?.mode||"below"===this.config?.mode?"horizontal":null}render(){const e=this._getDirection();if(this._thumbnailSlides.length&&this.config&&e)return q` + ${this._thumbnailSlides} + `}static get styles(){return s(":host {\n --frigate-card-thumbnail-size-max: 300px;\n --frigate-card-thumbnail-details-width: calc(\n var(--frigate-card-thumbnail-size) + 200px\n );\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n --frigate-card-carousel-thumbnail-opacity: 1;\n}\n\n:host([direction=vertical]) {\n height: 100%;\n}\n\n:host([direction=horizontal]) {\n height: auto;\n}\n\n.embla__slide {\n flex: 0 0 auto;\n opacity: var(--frigate-card-carousel-thumbnail-opacity);\n}\n\n.embla__slide.slide-selected {\n opacity: 1;\n}\n\nfrigate-card-thumbnail {\n width: var(--frigate-card-thumbnail-size);\n height: var(--frigate-card-thumbnail-size);\n max-width: 100%;\n}\n\nfrigate-card-thumbnail[details] {\n width: var(--frigate-card-thumbnail-details-width);\n}")}};e([he({attribute:!1})],hE.prototype,"hass",void 0),e([he({attribute:!1})],hE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],hE.prototype,"cameraManager",void 0),e([he({attribute:!1})],hE.prototype,"config",void 0),e([he({attribute:!1})],hE.prototype,"fadeThumbnails",void 0),hE=e([le("frigate-card-thumbnail-carousel")],hE);var pE=":host {\n width: 100%;\n height: 100%;\n display: block;\n}";const gE=document.createElement("template");gE.innerHTML='\n
\n
\n';class mE extends HTMLElement{constructor(){super();const e=this.attachShadow({mode:"open"});e.appendChild(gE.content.cloneNode(!0)),this._freeSpaceDiv=e.getElementById("fs")}connectedCallback(){this._freeSpaceDiv&&this._freeSpaceDiv.addEventListener("click",this.handleFreeSpaceDivClick),this.upgradeProperty("open")}disconnectedCallback(){document.removeEventListener("keyup",this.handleKeyUp)}upgradeProperty(e){if(this.hasOwnProperty(e)){let t=this[e];delete this[e],this[e]=t}}handleKeyUp=e=>{if(!e.altKey&&"Escape"===e.key)e.preventDefault(),this.open=!1};get open(){return this.hasAttribute("open")}set open(e){e?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}static get observedAttributes(){return["open"]}attributeChangedCallback(e,t,n){"open"===e&&(this.open?(this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.focus({preventScroll:!0}),document.addEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("open",{bubbles:!0}))):(this.setAttribute("tabindex","-1"),this.setAttribute("aria-disabled","true"),document.removeEventListener("keyup",this.handleKeyUp),this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))))}handleFreeSpaceDivClick=()=>{this.open=!1}}customElements.define("side-drawer",mE);let fE=class extends oe{constructor(){super(...arguments),this.location="left",this.control=!0,this.open=!1,this.empty=!0,this._refDrawer=Ie(),this._refSlot=Ie(),this._resizeObserver=new ResizeObserver((()=>this._hideDrawerIfNecessary())),this._isHoverableDevice=Qm()}firstUpdated(e){super.firstUpdated(e);const t=document.createElement("style");t.innerHTML=":host {\n width: unset;\n}\n\n#fs {\n display: none;\n width: 100%;\n inset: 0;\n}\n\n#d,\n#fs {\n height: 100%;\n position: absolute;\n}\n\n#d {\n overflow: visible;\n max-width: 90%;\n z-index: 10;\n}\n\n:host([location=right]) #d {\n left: unset;\n right: 0;\n transform: translateX(100%);\n}\n\n:host([location=right][open]) #d {\n transform: none;\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 25px 0px black);\n}\n\n#ifs {\n height: 100%;\n}",this._refDrawer.value?.shadowRoot?.appendChild(t)}_slotChanged(){const e=this._refSlot.value?of(this._refSlot.value):[];this._resizeObserver.disconnect();for(const t of e)this._resizeObserver.observe(t);this._hideDrawerIfNecessary()}_hideDrawerIfNecessary(){if(!this._refDrawer.value)return;const e=this._refSlot.value?of(this._refSlot.value):null;this.empty=!e||!e.length||e.every((e=>{const t=e.getBoundingClientRect();return!t.width||!t.height}))}render(){return q` + {this.open&&(this.open=!1)}} + > + ${this.control?q` +
{vf(e),this.open=!this.open}} + > + {this._isHoverableDevice&&!this.open&&(this.open=!0)}} + > + +
+ `:""} + this._slotChanged()}> +
+ `}static get styles(){return s("side-drawer {\n background-color: var(--card-background-color);\n}\n\ndiv.control-surround {\n position: absolute;\n bottom: 50%;\n transform: translateY(50%);\n z-index: 0;\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n:host([location=left]) div.control-surround {\n padding-right: 12px;\n left: 100%;\n}\n\n:host([location=right]) div.control-surround {\n padding-left: 12px;\n right: 100%;\n}\n\n:host([empty]),\n:host([empty]) > * {\n visibility: hidden;\n}\n\n:host(:not([empty])),\n:host(:not([empty])) > * {\n visibility: visible;\n}\n\nfrigate-card-icon.control {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.7);\n opacity: 0.5;\n pointer-events: all;\n --mdc-icon-size: 20px;\n padding-top: 20px;\n padding-bottom: 20px;\n transition: opacity 0.5s ease;\n}\n\n:host([open]) frigate-card-icon.control,\nfrigate-card-icon.control:hover {\n opacity: 1;\n background-color: black;\n}\n\n:host([location=left]) frigate-card-icon.control {\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n}\n\n:host([location=right]) frigate-card-icon.control {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n}")}};e([he({attribute:!0,reflect:!0})],fE.prototype,"location",void 0),e([he({attribute:!0,reflect:!0,type:Boolean})],fE.prototype,"control",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],fE.prototype,"open",void 0),e([he({attribute:!1})],fE.prototype,"icons",void 0),e([he({type:Boolean,reflect:!0,attribute:!0})],fE.prototype,"empty",void 0),fE=e([le("frigate-card-drawer")],fE);let _E=class extends oe{constructor(){super(...arguments),this._refDrawerLeft=Ie(),this._refDrawerRight=Ie(),this._boundDrawerHandler=this._drawerHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.addEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("frigate-card:drawer:open",this._boundDrawerHandler),this.removeEventListener("frigate-card:drawer:close",this._boundDrawerHandler)}_drawerHandler(e){const t=e.detail.drawer,n=e.type.endsWith(":open");"left"===t&&this._refDrawerLeft.value?this._refDrawerLeft.value.open=n:"right"===t&&this._refDrawerRight.value&&(this._refDrawerRight.value.open=n)}render(){return q` + + + + + + + + `}static get styles(){return s(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n overflow: hidden;\n}\n\n::slotted(:not([slot])) {\n flex: 1;\n min-height: 0px;\n}")}};e([he({attribute:!1})],_E.prototype,"drawerIcons",void 0),_E=e([le("frigate-card-surround-basic")],_E);let yE=class extends oe{_hasDrawer(){return!!this.thumbnailConfig&&["left","right"].includes(this.thumbnailConfig.mode)}willUpdate(e){this.timelineConfig?.mode&&"none"!==this.timelineConfig.mode&&import("./timeline-core-14147786.js");const t=this.viewManagerEpoch?.manager.getView();e.has("viewManagerEpoch")&&(this.viewManagerEpoch?.manager.hasMajorMediaChange(this.viewManagerEpoch?.oldView)||this.viewManagerEpoch?.oldView?.displayMode!==t?.displayMode)&&(this._cameraIDsForTimeline=this._getCameraIDsForTimeline()??void 0)}_getCameraIDsForTimeline(){const e=this.viewManagerEpoch?.manager.getView();if(!e||!this.cameraManager)return null;if(e.is("live")){const t={anyCapabilities:["clips","snapshots","recordings"]};return e.supportsMultipleDisplayModes()&&e.isGrid()?this.cameraManager.getStore().getCameraIDsWithCapability(t):this.cameraManager.getStore().getAllDependentCameras(e.camera,t)}return e.isViewerView()?e.query?.getQueryCameraIDs()??null:null}render(){const e=this.viewManagerEpoch?.manager.getView();if(!this.hass||!e)return;const t=(e,t)=>{this.thumbnailConfig&&this._hasDrawer()&&Vm(e.composedPath()[0],"drawer:"+t,{drawer:this.thumbnailConfig.mode})};return q` t(e,"open")} + @frigate-card:thumbnails:close=${e=>t(e,"close")} + > + ${this.thumbnailConfig&&"none"!==this.thumbnailConfig.mode?q` {const n=e.detail.queryResults.getSelectedResult();n&&(this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.detail.queryResults,...n.getCameraID()&&{camera:n.getCameraID()}},modifiers:[new tE(["timeline","mediaViewer"])]}),t(e,"close"))}} + > + `:""} + ${this.timelineConfig&&"none"!==this.timelineConfig.mode?q` + `:""} + + `}static get styles(){return s(pE)}};e([he({attribute:!1})],yE.prototype,"hass",void 0),e([he({attribute:!1})],yE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1,hasChanged:Wm})],yE.prototype,"thumbnailConfig",void 0),e([he({attribute:!1,hasChanged:Wm})],yE.prototype,"timelineConfig",void 0),e([he({attribute:!1})],yE.prototype,"cameraManager",void 0),e([he({attribute:!1})],yE.prototype,"cardWideConfig",void 0),yE=e([le("frigate-card-surround")],yE);var vE="Tue, 24 Dec 2024 00:23:18 GMT",bE="bc95f55",wE="Mon, 23 Dec 2024 16:22:10 -0800";const xE=bi.object({domain:bi.string(),version:bi.string().optional()}).passthrough(),CE="hass_web_proxy",ME=(e,t)=>`/api/${CE}/v${t??0}/?url=${encodeURIComponent(e)}`,SE=(e,t,n="media")=>(e=>e.config.components.includes(CE))(e)&&!!t[n];async function kE(e,t,n){await e.callService(CE,"create_proxied_url",{url_pattern:t,...n&&{url_id:n.urlID,ssl_verification:n.sslVerification,ssl_ciphers:n.sslCiphers,open_limit:n.openLimit,ttl:n.ttl,allow_unauthenticated:n.allowUnauthenticated}})}const EE=async(e,t)=>{let n=null;if(t)try{n=await(async(e,t)=>await ky(e,xE,{type:"manifest/get",integration:t}))(t,e)}catch(e){}return{detected:!!n,...n?.version&&{version:n.version}}};let $E=class extends oe{constructor(){super(...arguments),this._diagnostics=null}async _fetchDiagnostics(){this._diagnostics=await(async(e,t,n)=>{const i=e&&t?await t.getMatchingDevices(e,(e=>"Frigate"===e.manufacturer)):[],a=new Map;return i?.forEach((e=>{e.config_entries.forEach((t=>{e.model&&a.set(t,e.model)}))})),{card_version:"6.1.2",browser:navigator.userAgent,date:new Date,lang:L_(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,git:{hash:bE,build_date:vE,commit_date:wE},...e&&{ha_version:e.config.version},custom_integrations:{frigate:{...await EE("frigate",e),...a.size&&{devices:Object.fromEntries(a)}},hass_web_proxy:await EE(CE,e)},...n&&{config:n}}})(this.hass,this.deviceRegistryManager,this.rawConfig)}shouldUpdate(){return!!this._diagnostics||(this._fetchDiagnostics().then((()=>this.requestUpdate())),!1)}render(){return rS({message:N_("error.diagnostics"),type:"diagnostics",icon:"mdi:information",context:this._diagnostics})}static get styles(){return s(pE)}};e([he({attribute:!1})],$E.prototype,"hass",void 0),e([he({attribute:!1})],$E.prototype,"deviceRegistryManager",void 0),e([he({attribute:!1})],$E.prototype,"rawConfig",void 0),e([pe()],$E.prototype,"_diagnostics",void 0),$E=e([le("frigate-card-diagnostics")],$E);let AE=class extends oe{willUpdate(e){if(e.has("viewManagerEpoch")||e.has("config")){const e=this.viewManagerEpoch?.manager.getView();(e?.is("live")||this._shouldLivePreload())&&import("./index-dd357256.js"),e?.isGalleryView()?import("./gallery-f478918c.js"):e?.isViewerView()?import("./index-befc50c0.js"):e?.is("image")?import("./image-04d4df35.js"):e?.is("timeline")&&import("./timeline-b24153cf.js")}e.has("hide")&&(this.hide?this.setAttribute("hidden",""):this.removeAttribute("hidden"))}shouldUpdate(e){return!0}_shouldLivePreload(){const e=this.viewManagerEpoch?.manager.getView();return!!this.overriddenConfig?.live.preload&&!e?.is("diagnostics")}render(){if(!(this.hass&&this.overriddenConfig&&this.nonOverriddenConfig&&this.cardWideConfig))return q``;const e=this.viewManagerEpoch?.manager.getView(),t={hidden:this._shouldLivePreload()&&!e?.is("live")},n={hidden:!!this.hide},i=e?.is("live")?this.overriddenConfig.live.controls.thumbnails:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.thumbnails:e?.is("timeline")?this.overriddenConfig.timeline.controls.thumbnails:void 0,a=e?.is("live")?this.overriddenConfig.live.controls.timeline:e?.isViewerView()?this.overriddenConfig.media_viewer.controls.timeline:void 0,r=e?this.cameraManager?.getStore().getCameraConfig(e.camera)??null:null;return q` + ${!this.hide&&e?.is("image")&&r?q` + `:""} + ${!this.hide&&e?.isGalleryView()?q` + `:""} + ${!this.hide&&e?.isViewerView()?q` + + + `:""} + ${!this.hide&&e?.is("timeline")?q` + `:""} + ${!this.hide&&e?.is("diagnostics")?q` + `:""} + ${this._shouldLivePreload()||!this.hide&&e?.is("live")?q` + + + `:""} + `}static get styles(){return s(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n:host([hidden]),\n.hidden {\n display: none;\n}")}};e([he({attribute:!1})],AE.prototype,"hass",void 0),e([he({attribute:!1})],AE.prototype,"viewManagerEpoch",void 0),e([he({attribute:!1})],AE.prototype,"cameraManager",void 0),e([he({attribute:!1})],AE.prototype,"nonOverriddenConfig",void 0),e([he({attribute:!1})],AE.prototype,"overriddenConfig",void 0),e([he({attribute:!1})],AE.prototype,"cardWideConfig",void 0),e([he({attribute:!1})],AE.prototype,"rawConfig",void 0),e([he({attribute:!1})],AE.prototype,"resolvedMediaCache",void 0),e([he({attribute:!1})],AE.prototype,"conditionsManagerEpoch",void 0),e([he({attribute:!1})],AE.prototype,"hide",void 0),e([he({attribute:!1})],AE.prototype,"microphoneManager",void 0),e([he({attribute:!1})],AE.prototype,"triggeredCameraIDs",void 0),e([he({attribute:!1})],AE.prototype,"deviceRegistryManager",void 0),AE=e([le("frigate-card-views")],AE);console.info(`%c FRIGATE-HASS-CARD \n%c ${N_("common.version")} 6.1.2`,"color: pink; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"frigate-card",name:N_("common.frigate_card"),description:N_("common.frigate_card_description"),preview:!0,documentationURL:"https://github.com/dermotduffy/frigate-hass-card"});let IE=class extends oe{constructor(){super(...arguments),this._controller=new ux(this,(()=>this._refMain.value?.scroll({top:0})),(()=>this._refMenu.value?.toggleMenu()),this._requestUpdateForComponentsThatUseConditions.bind(this)),this._menuButtonController=new hx,this._refMenu=Ie(),this._refOverlay=Ie(),this._refMain=Ie(),this._refElements=Ie(),this._refViews=Ie()}get _config(){return this._controller.getConfigManager().getConfig()}get _hass(){return this._controller.getHASSManager().getHASS()}set hass(e){this._controller.getHASSManager().setHASS(e),this._refMenu.value&&(this._refMenu.value.hass=e),this._refElements.value&&(this._refElements.value.hass=e),this._refViews.value&&(this._refViews.value.hass=e)}static async getConfigElement(){return await ux.getConfigElement()}static getStubConfig(e,t){return ux.getStubConfig(t)}_requestUpdateForComponentsThatUseConditions(){this._refViews.value&&(this._refViews.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0),this._refElements.value&&(this._refElements.value.conditionsManagerEpoch=this._controller.getConditionsManager().getEpoch()??void 0)}setConfig(e){this._controller.getConfigManager().setConfig(e)}shouldUpdate(){return!!this.isConnected&&(this._controller.getMessageManager().hasMessage()||this._controller.getInitializationManager().isInitializedMandatory()||this._controller.getInitializationManager().initializeMandatory(),!0)}_renderMenuStatusContainer(e){if(!this._config)return;const t=this._config.menu.style,n=this._config.menu.position,i=this._config.status_bar.style,a=this._config.status_bar.position;if("none"===t&&"none"===i||"overlay"===e&&"outside"===t&&"outside"===i||"overlay"!==e&&("outside"!==t||n!==e)&&("outside"!==i||a!==e))return;const r=e=>{const r="none"!==t&&("outside"===t&&"outerlay"===e||"outside"!==t&&"overlay"===e),s="none"!==i&&("outside"===i&&"outerlay"===e||"outside"!==i&&"overlay"===e),o="left"===n||"right"===n||"bottom"===n&&"hidden"===t&&"popup"!==i||"top"===n&&("hidden"!==t||"popup"===i);return q` + ${r&&o?this._renderMenu(n):""} + ${s?this._renderStatusBar(a):""} + ${r&&!o?this._renderMenu(n):""} + `};return q` + ${"overlay"===e?q`${r("overlay")}`:q`
+ ${r("outerlay")} +
`} + `}_renderMenu(e){const t=this._controller.getViewManager().getView();if(this._hass&&this._config)return q` + + `}_renderStatusBar(e){if(this._config)return q` + + `}updated(){this._controller.getInitializationManager().isInitializedMandatory()&&this._controller.getQueryStringManager().executeIfNecessary()}_renderInDialogIfNecessary(e){return this._controller.getExpandManager().isExpanded()?q` {this._controller.getExpandManager().setExpanded(!1)}} + > + ${e} + `:e}render(){if(!this._hass)return;const e={main:!0,"curve-top":"outside"!==this._config?.menu.style||"top"!==this._config?.menu.position,"curve-bottom":"outside"!==this._config?.menu.style||"top"===this._config?.menu.position},t=this._controller.getActionsManager().getMergedActions(),n=this._controller.getCameraManager(),i=!1!==this._config?.performance?.features.animated_progress_indicator&&!this._controller.getInitializationManager().wasEverInitialized()&&!this._controller.getMessageManager().hasMessage();return this._renderInDialogIfNecessary(q` this._controller.getMessageManager().setMessageIfHigherPriority(e.detail)} + @frigate-card:media:loaded=${e=>this._controller.getMediaLoadedInfoManager().set(e.detail)} + @frigate-card:media:unloaded=${()=>this._controller.getMediaLoadedInfoManager().clear()} + @frigate-card:media:volumechange=${()=>this.requestUpdate()} + @frigate-card:media:play=${()=>this.requestUpdate()} + @frigate-card:media:pause=${()=>this.requestUpdate()} + @frigate-card:focus=${()=>this.focus()} + > + ${i?q``:""} + ${this._renderMenuStatusContainer("top")} + ${this._renderMenuStatusContainer("overlay")} +
+ + ${rS(this._controller.getMessageManager().getMessage())} +
+ ${this._renderMenuStatusContainer("bottom")} + ${this._config?.elements?q` {this._menuButtonController.addDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:menu:remove=${e=>{this._menuButtonController.removeDynamicMenuButton(e.detail),this.requestUpdate()}} + @frigate-card:status-bar:add=${e=>{this._controller.getStatusBarItemManager().addDynamicStatusBarItem(e.detail)}} + @frigate-card:status-bar:remove=${e=>{this._controller.getStatusBarItemManager().removeDynamicStatusBarItem(e.detail)}} + @frigate-card:conditions:evaluate=${e=>{e.evaluation=this._controller.getConditionsManager()?.evaluateConditions(e.conditions)}} + > + `:""} +
`)}static get styles(){return s(':host {\n display: block;\n position: relative;\n background-color: var(--card-background-color);\n border-radius: var(--ha-card-border-radius, 4px);\n height: var(--frigate-card-height);\n min-height: 100px;\n pointer-events: all;\n --frigate-card-expand-max-height: calc((100vh - (2 * 56px)) * 0.85);\n --frigate-card-expand-max-width: 85vw;\n --frigate-card-expand-width: none;\n --frigate-card-expand-height: none;\n --frigate-card-expand-aspect-ratio: unset;\n --frigate-card-height: auto;\n}\n\nfrigate-card-loading {\n position: absolute;\n inset: 0;\n z-index: 1;\n}\n\n:host([dark]) {\n filter: brightness(75%);\n}\n\n:host([panel]:not([casted])) {\n height: calc(100vh - var(--header-height));\n}\n\n:host([panel][casted]) {\n height: 100%;\n}\n\ndiv.main {\n position: relative;\n overflow: auto;\n width: 100%;\n height: 100%;\n margin: auto;\n display: block;\n transform: translateZ(0);\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\ndiv.main::-webkit-scrollbar {\n display: none;\n}\n\ndiv.main.curve-top {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\ndiv.main.curve-bottom {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\nha-card {\n display: flex;\n flex-direction: column;\n margin: auto;\n border: 0px;\n overflow: visible;\n width: 100%;\n height: 100%;\n position: static;\n color: var(--secondary-text-color, white);\n}\n\n/************\n * Fullscreen\n *************/\n:host(:fullscreen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:-webkit-full-screen) #ha-card {\n border-radius: 0px;\n box-shadow: none;\n margin: 0;\n}\n\n:host(:fullscreen) div.main,\n:host(:fullscreen) frigate-card-menu {\n border-radius: 0px;\n}\n\n:host(:-webkit-full-screen) div.main,\n:host(:-webkit-full-screen) frigate-card-menu {\n border-radius: 0px;\n}\n\n/***************\n * Expanded mode\n ***************/\nweb-dialog {\n --dialog-padding: 0px;\n --dialog-container-padding: 0px;\n --dialog-max-height: var(--frigate-card-expand-max-height);\n --dialog-max-width: var(--frigate-card-expand-max-width);\n --dialog-width: var(--frigate-card-expand-width);\n --dialog-height: var(--frigate-card-expand-height);\n --dialog-overflow-x: visible;\n --dialog-overflow-y: visible;\n max-height: 100vh;\n}\n\nweb-dialog::part(dialog) {\n aspect-ratio: var(--frigate-card-expand-aspect-ratio);\n border-radius: 0px;\n background: transparent;\n}\n\n/*************************************\n * "Outside" style for menu/status bar\n *************************************/\n.outerlay[data-position=top] > *:first-child {\n border-top-left-radius: var(--ha-card-border-radius, 4px);\n border-top-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n.outerlay[data-position=bottom] > *:last-child {\n border-bottom-left-radius: var(--ha-card-border-radius, 4px);\n border-bottom-right-radius: var(--ha-card-border-radius, 4px);\n}\n\n/*******************\n * Menu hover styles\n *******************/\nfrigate-card-menu {\n z-index: 2;\n}\n\nfrigate-card-menu[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-menu[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-menu[data-style=hover-card] {\n opacity: 1;\n}\n\n/*************************\n * Status bar hover styles\n *************************/\nfrigate-card-status-bar {\n z-index: 1;\n}\n\nfrigate-card-status-bar[data-style*=hover] {\n transition: opacity 0.5s ease;\n opacity: 0;\n}\n\nfrigate-card-status-bar[data-style*=hover]:hover,\nha-card:hover > frigate-card-overlay > frigate-card-status-bar[data-style=hover-card] {\n opacity: 1;\n}')}getCardSize(){return 6}};IE=e([le("frigate-card")],IE);export{Al as $,Ja as A,er as B,Ua as C,tr as D,nr as E,ir as F,Da as G,Ra as H,Pa as I,La as J,Na as K,Fa as L,Va as M,Ha as N,Ba as O,po as P,qo as Q,Js as R,Bo as S,Vs as T,Ps as U,Ls as V,Ns as W,Fs as X,Vo as Y,$l as Z,e as _,oe as a,cr as a$,F_ as a0,Pb as a1,et as a2,Lb as a3,ko as a4,ja as a5,za as a6,Ta as a7,Oa as a8,qa as a9,Qr as aA,as as aB,rs as aC,os as aD,cs as aE,ss as aF,ts as aG,ns as aH,is as aI,us as aJ,gs as aK,ms as aL,ls as aM,ds as aN,ps as aO,hs as aP,Xr as aQ,es as aR,Jr as aS,Yr as aT,Kr as aU,Gr as aV,ks as aW,$s as aX,Es as aY,dr as aZ,sr as a_,Ks as aa,Ys as ab,Gs as ac,Xs as ad,lo as ae,co as af,ho as ag,Ho as ah,uo as ai,Cs as aj,bs as ak,As as al,ws as am,xs as an,Hr as ao,Br as ap,qr as aq,Ur as ar,Ms as as,Ss as at,fs as au,vs as av,_s as aw,ys as ax,Wr as ay,Zr as az,pe as b,ji as b$,lr as b0,or as b1,rr as b2,hr as b3,pr as b4,gr as b5,mr as b6,br as b7,Fr as b8,wr as b9,Os as bA,Bs as bB,qs as bC,Ws as bD,Zs as bE,Us as bF,Hs as bG,fo as bH,mo as bI,_o as bJ,bo as bK,wo as bL,Eo as bM,xo as bN,So as bO,Mo as bP,Db as bQ,jb as bR,Bm as bS,xi as bT,Ki as bU,Qi as bV,Ri as bW,Pi as bX,Ci as bY,Ti as bZ,zi as b_,Cr as ba,xr as bb,fr as bc,vr as bd,_r as be,yr as bf,Mr as bg,Sr as bh,kr as bi,Tr as bj,$r as bk,Ir as bl,zr as bm,Ar as bn,Er as bo,Dr as bp,Lr as bq,Nr as br,jr as bs,Or as bt,Pr as bu,Rr as bv,js as bw,Ds as bx,zs as by,Ts as bz,Rb as c,eu as c$,Ii as c0,Zi as c1,Bi as c2,qi as c3,Ui as c4,Wi as c5,ma as c6,ga as c7,Oi as c8,Di as c9,na as cA,Mi as cB,Si as cC,ua as cD,da as cE,pa as cF,ha as cG,Ld as cH,wi as cI,Co as cJ,zw as cK,Ie as cL,Tw as cM,cf as cN,rS as cO,je as cP,Wm as cQ,ew as cR,Jl as cS,cS as cT,Gv as cU,jk as cV,vf as cW,xv as cX,ye as cY,pE as cZ,Nd as c_,Fi as ca,Hi as cb,Li as cc,Ni as cd,Vi as ce,Gi as cf,Yi as cg,Ji as ch,Xi as ci,_a as cj,fa as ck,ya as cl,va as cm,ki as cn,Ei as co,$i as cp,Ai as cq,ea as cr,ia as cs,aa as ct,ra as cu,sa as cv,oa as cw,ca as cx,la as cy,ta as cz,Nb as d,Gy as d$,c as d0,Zw as d1,Wy as d2,Qw as d3,Uw as d4,Gw as d5,Zm as d6,Sy as d7,qu as d8,Ym as d9,Sw as dA,rE as dB,iE as dC,_f as dD,CS as dE,ff as dF,Cf as dG,yf as dH,u_ as dI,d_ as dJ,Dy as dK,Ry as dL,Bd as dM,Ny as dN,Qm as dO,Gm as dP,rx as dQ,Zv as dR,Kw as dS,ru as dT,rf as dU,Ly as dV,Fm as dW,bi as dX,ef as dY,ky as dZ,$o as d_,Wu as da,Vm as db,kw as dc,tf as dd,sE as de,ox as df,sS as dg,dw as dh,Pw as di,dv as dj,Mb as dk,Sb as dl,SE as dm,kE as dn,_b as dp,ME as dq,Iw as dr,jw as ds,Ow as dt,Dw as du,ix as dv,me as dw,fe as dx,U as dy,bf as dz,_e as e,qy as e0,U_ as e1,W_ as e2,Qy as e3,Km as e4,Jm as e5,Zy as e6,Fy as e7,nf as e8,Iy as e9,uf as eA,Wv as eB,Om as eC,Uv as eD,o as eE,Ae as eF,ve as eG,W as eH,Aw as eI,eE as eJ,ge as eK,be as eL,xe as eM,vb as eN,Ay as ea,$y as eb,zy as ec,Yd as ed,Fd as ee,Zd as ef,Wd as eg,Qd as eh,fu as ei,Kd as ej,Xd as ek,_u as el,mu as em,Vd as en,tu as eo,pu as ep,Tu as eq,Pu as er,Lu as es,Ru as et,xb as eu,Uy as ev,of as ew,Hv as ex,Bv as ey,qv as ez,iw as f,wb as g,Ob as h,jy as i,bb as j,Hm as k,N_ as l,Ga as m,he as n,Za as o,Rd as p,Wa as q,s as r,af as s,le as t,Qa as u,Cb as v,Ya as w,q as x,Xa as y,Ka as z}; diff --git a/www/community/frigate-hass-card/card-e5d55e5b.js.gz b/www/community/frigate-hass-card/card-e5d55e5b.js.gz new file mode 100644 index 00000000..8a8abc8d Binary files /dev/null and b/www/community/frigate-hass-card/card-e5d55e5b.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-3dacab82.js b/www/community/frigate-hass-card/date-picker-3dacab82.js new file mode 100644 index 00000000..e52587a0 --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-3dacab82.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-09c4bade.js";let p=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/www/community/frigate-hass-card/date-picker-3dacab82.js.gz b/www/community/frigate-hass-card/date-picker-3dacab82.js.gz new file mode 100644 index 00000000..f8f859d8 Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-3dacab82.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-40111fdc.js b/www/community/frigate-hass-card/date-picker-40111fdc.js new file mode 100644 index 00000000..304d5917 --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-40111fdc.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-45855f1f.js";let p=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/www/community/frigate-hass-card/date-picker-40111fdc.js.gz b/www/community/frigate-hass-card/date-picker-40111fdc.js.gz new file mode 100644 index 00000000..512cdcc3 Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-40111fdc.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-5708aa47.js b/www/community/frigate-hass-card/date-picker-5708aa47.js new file mode 100644 index 00000000..0f03760e --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-5708aa47.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cM as a,x as l,l as s,cQ as c,cX as o,r,dc as h}from"./card-0be2c6a9.js";let p=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {o(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return r(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/www/community/frigate-hass-card/date-picker-5708aa47.js.gz b/www/community/frigate-hass-card/date-picker-5708aa47.js.gz new file mode 100644 index 00000000..9627971c Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-5708aa47.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-576d50a8.js b/www/community/frigate-hass-card/date-picker-576d50a8.js new file mode 100644 index 00000000..b3acf888 --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-576d50a8.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cM as a,x as l,l as s,cQ as c,cX as o,r,dc as h}from"./card-320adb66.js";let p=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {o(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return r(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/www/community/frigate-hass-card/date-picker-576d50a8.js.gz b/www/community/frigate-hass-card/date-picker-576d50a8.js.gz new file mode 100644 index 00000000..15f2b760 Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-576d50a8.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-6ca5b3a6.js b/www/community/frigate-hass-card/date-picker-6ca5b3a6.js new file mode 100644 index 00000000..4a153dac --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-6ca5b3a6.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,d0 as r,r as c,dh as h}from"./card-4e88bdfb.js";let p=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/www/community/frigate-hass-card/date-picker-6ca5b3a6.js.gz b/www/community/frigate-hass-card/date-picker-6ca5b3a6.js.gz new file mode 100644 index 00000000..2acc9130 Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-6ca5b3a6.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-86e47001.js b/www/community/frigate-hass-card/date-picker-86e47001.js new file mode 100644 index 00000000..fdff505b --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-86e47001.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-7cd05290.js";let p=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/www/community/frigate-hass-card/date-picker-86e47001.js.gz b/www/community/frigate-hass-card/date-picker-86e47001.js.gz new file mode 100644 index 00000000..68561681 Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-86e47001.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-cfd85f75.js b/www/community/frigate-hass-card/date-picker-cfd85f75.js new file mode 100644 index 00000000..36375899 --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-cfd85f75.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cR as a,x as l,l as s,cV as o,c$ as r,r as c,dg as h}from"./card-c642ee74.js";let p=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {r(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return c(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/www/community/frigate-hass-card/date-picker-cfd85f75.js.gz b/www/community/frigate-hass-card/date-picker-cfd85f75.js.gz new file mode 100644 index 00000000..626c64ca Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-cfd85f75.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-d9927b87.js b/www/community/frigate-hass-card/date-picker-d9927b87.js new file mode 100644 index 00000000..b4b37fa3 --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-d9927b87.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cL as a,x as r,l,cP as s,cW as c,r as o,db as p}from"./card-e5d55e5b.js";let u=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;p(this,"date-picker:change",{date:e?new Date(e):null})};return r`e()} + @change=${()=>e()} + /> + {c(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return o(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nfrigate-card-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],u.prototype,"icon",void 0),u=e([n("frigate-card-date-picker")],u);export{u as F}; diff --git a/www/community/frigate-hass-card/date-picker-d9927b87.js.gz b/www/community/frigate-hass-card/date-picker-d9927b87.js.gz new file mode 100644 index 00000000..c6afb88e Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-d9927b87.js.gz differ diff --git a/www/community/frigate-hass-card/date-picker-f1b8df79.js b/www/community/frigate-hass-card/date-picker-f1b8df79.js new file mode 100644 index 00000000..6d47f9e0 --- /dev/null +++ b/www/community/frigate-hass-card/date-picker-f1b8df79.js @@ -0,0 +1,15 @@ +import{_ as e,n as t,t as n,a as i,cM as a,x as l,l as s,cQ as c,cX as o,r,dc as h}from"./card-19444f74.js";let p=class extends i{constructor(){super(...arguments),this._refInput=a()}get value(){return this._refInput.value?.value?new Date(this._refInput.value.value):null}reset(){this._refInput.value&&(this._refInput.value.value="")}render(){const e=()=>{const e=this._refInput.value?.value;h(this,"date-picker:change",{date:e?new Date(e):null})};return l`e()} + @change=${()=>e()} + /> + {o(e),this._refInput.value?.showPicker()}} + > + `}static get styles(){return r(":host {\n display: inline-block;\n position: relative;\n width: var(--mdc-icon-size, 24px);\n height: var(--mdc-icon-size, 24px);\n}\n\ninput {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n padding: 0px;\n border: 0px;\n}\n\n/**\n * Hack warning: Safari on iOS does not support showPicker with\n * datetime-local:\n * https://caniuse.com/mdn-api_htmlinputelement_showpicker_datetime_local_input\n *\n * The hack is to render the input element in front of the icon, with an\n * opacity of 0. This only works if the underlying input element accepts the\n * click at the exact place the user happens to click. From trial and error,\n * this seems to work better than expected / quite reliably, but had the user\n * manually changed icon sizes with Safari iOS their experience may vary.\n */\n@supports (-webkit-touch-callout: none) {\n input {\n opacity: 0;\n z-index: 1;\n }\n}\n@supports not (-webkit-touch-callout: none) {\n input {\n visibility: hidden;\n }\n}\nha-icon {\n display: block;\n height: 100%;\n width: 100%;\n position: absolute;\n}")}};e([t({attribute:!1})],p.prototype,"icon",void 0),p=e([n("frigate-card-date-picker")],p);export{p as F}; diff --git a/www/community/frigate-hass-card/date-picker-f1b8df79.js.gz b/www/community/frigate-hass-card/date-picker-f1b8df79.js.gz new file mode 100644 index 00000000..2e689227 Binary files /dev/null and b/www/community/frigate-hass-card/date-picker-f1b8df79.js.gz differ diff --git a/www/community/frigate-hass-card/dispatch-live-error-65d9f8de.js b/www/community/frigate-hass-card/dispatch-live-error-65d9f8de.js new file mode 100644 index 00000000..0669de4e --- /dev/null +++ b/www/community/frigate-hass-card/dispatch-live-error-65d9f8de.js @@ -0,0 +1,33 @@ +import{dx as t,dy as a,dz as n,dA as i,cL as o,dB as e,_ as r,n as s,b as l,t as d,a as c,dC as h,x as m,e as u,dD as p,r as g,dE as _,dF as f,dG as v,dH as b,dI as y,l as z,dc as w}from"./card-19444f74.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const C={},x=t(class extends a{constructor(){super(...arguments),this.ot=C}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class I{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const A={active:!0,breakpoints:{},lazyLoadCount:0};function L(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function l(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!l(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function c(){const t=n.previousScrollSnap();l(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,l){const{mergeOptions:h,optionsAtMedia:m}=l,u=h(A,t);a=m(u),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,c))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,c))),document.removeEventListener("visibilitychange",s)}}}function S(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class T{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function $(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new T(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let P=class extends c{constructor(){super(...arguments),this.disabled=!1,this.label="",this._thumbnailError=!1,this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return m``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style)||this._thumbnailError,a={controls:!0,left:"left"===this.side,right:"right"===this.side,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style&&!this._thumbnailError?this.icon:"left"===this.side?"mdi:chevron-left":"mdi:chevron-right";return m` + + `}return p(this._embedThumbnailTask,(t=>t?m``:m``),{inProgressFunc:()=>m`
`,errorFunc:t=>{this._thumbnailError=!0}})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-left-position: 45px;\n --frigate-card-right-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.left {\n left: var(--frigate-card-left-position);\n}\n\n.controls.right {\n right: var(--frigate-card-right-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.left.thumbnails:hover {\n left: calc(var(--frigate-card-left-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.right.thumbnails:hover {\n right: calc(var(--frigate-card-right-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],P.prototype,"side",void 0),r([s({attribute:!1})],P.prototype,"hass",void 0),r([l()],P.prototype,"_controlConfig",void 0),r([s({attribute:!1})],P.prototype,"thumbnail",void 0),r([s({attribute:!1})],P.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],P.prototype,"disabled",void 0),r([s()],P.prototype,"label",void 0),r([l()],P.prototype,"_thumbnailError",void 0),P=r([d("frigate-card-next-previous-control")],P);class k{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let E=class extends c{constructor(){super(...arguments),this._controller=new k(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?m`this._controller.handleAction(t,n)} + >`:m``,a=this._controller.getConfig();return m`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?m`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?m`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:m``} + ${!a?.hide_home&&this._actionPresence?.home?m`
+ ${t("home","mdi:home",this._actions.home)} +
`:m``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],E.prototype,"config",void 0),r([s({attribute:!1})],E.prototype,"cameraManager",void 0),r([s({attribute:!1})],E.prototype,"cameraID",void 0),r([s({attribute:!1})],E.prototype,"forceVisibility",void 0),E=r([d("frigate-card-ptz")],E);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},H=2,O=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},R=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;O(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{O(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{O(t,n)}))},N=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};function D(t){w(t,"live:error")}export{L as A,I as M,S as a,$ as b,H as c,D as d,R as h,x as i,N as p,O as s,M as u}; diff --git a/www/community/frigate-hass-card/dispatch-live-error-65d9f8de.js.gz b/www/community/frigate-hass-card/dispatch-live-error-65d9f8de.js.gz new file mode 100644 index 00000000..4d9ae165 Binary files /dev/null and b/www/community/frigate-hass-card/dispatch-live-error-65d9f8de.js.gz differ diff --git a/www/community/frigate-hass-card/dispatch-live-error-bba465cd.js b/www/community/frigate-hass-card/dispatch-live-error-bba465cd.js new file mode 100644 index 00000000..24514435 --- /dev/null +++ b/www/community/frigate-hass-card/dispatch-live-error-bba465cd.js @@ -0,0 +1,33 @@ +import{dx as t,dy as a,dz as n,dA as i,cL as o,dB as e,_ as r,n as s,b as l,t as d,a as c,dC as h,x as m,e as u,dD as p,r as g,dE as _,dF as f,dG as v,dH as b,dI as y,l as z,dc as w}from"./card-0be2c6a9.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const C={},x=t(class extends a{constructor(){super(...arguments),this.ot=C}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class I{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const A={active:!0,breakpoints:{},lazyLoadCount:0};function L(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function l(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!l(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function c(){const t=n.previousScrollSnap();l(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,l){const{mergeOptions:h,optionsAtMedia:m}=l,u=h(A,t);a=m(u),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,c))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,c))),document.removeEventListener("visibilitychange",s)}}}function S(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class T{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function $(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new T(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let P=class extends c{constructor(){super(...arguments),this.disabled=!1,this.label="",this._thumbnailError=!1,this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return m``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style)||this._thumbnailError,a={controls:!0,left:"left"===this.side,right:"right"===this.side,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style&&!this._thumbnailError?this.icon:"left"===this.side?"mdi:chevron-left":"mdi:chevron-right";return m` + + `}return p(this._embedThumbnailTask,(t=>t?m``:m``),{inProgressFunc:()=>m`
`,errorFunc:t=>{this._thumbnailError=!0}})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-left-position: 45px;\n --frigate-card-right-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.left {\n left: var(--frigate-card-left-position);\n}\n\n.controls.right {\n right: var(--frigate-card-right-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.left.thumbnails:hover {\n left: calc(var(--frigate-card-left-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.right.thumbnails:hover {\n right: calc(var(--frigate-card-right-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],P.prototype,"side",void 0),r([s({attribute:!1})],P.prototype,"hass",void 0),r([l()],P.prototype,"_controlConfig",void 0),r([s({attribute:!1})],P.prototype,"thumbnail",void 0),r([s({attribute:!1})],P.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],P.prototype,"disabled",void 0),r([s()],P.prototype,"label",void 0),r([l()],P.prototype,"_thumbnailError",void 0),P=r([d("frigate-card-next-previous-control")],P);class k{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let E=class extends c{constructor(){super(...arguments),this._controller=new k(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?m`this._controller.handleAction(t,n)} + >`:m``,a=this._controller.getConfig();return m`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?m`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?m`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:m``} + ${!a?.hide_home&&this._actionPresence?.home?m`
+ ${t("home","mdi:home",this._actions.home)} +
`:m``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],E.prototype,"config",void 0),r([s({attribute:!1})],E.prototype,"cameraManager",void 0),r([s({attribute:!1})],E.prototype,"cameraID",void 0),r([s({attribute:!1})],E.prototype,"forceVisibility",void 0),E=r([d("frigate-card-ptz")],E);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},H=2,O=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},R=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;O(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{O(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{O(t,n)}))},N=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};function D(t){w(t,"live:error")}export{L as A,I as M,S as a,$ as b,H as c,D as d,R as h,x as i,N as p,O as s,M as u}; diff --git a/www/community/frigate-hass-card/dispatch-live-error-bba465cd.js.gz b/www/community/frigate-hass-card/dispatch-live-error-bba465cd.js.gz new file mode 100644 index 00000000..0ee7f90c Binary files /dev/null and b/www/community/frigate-hass-card/dispatch-live-error-bba465cd.js.gz differ diff --git a/www/community/frigate-hass-card/dispatch-live-error-c649b480.js b/www/community/frigate-hass-card/dispatch-live-error-c649b480.js new file mode 100644 index 00000000..027ea950 --- /dev/null +++ b/www/community/frigate-hass-card/dispatch-live-error-c649b480.js @@ -0,0 +1,33 @@ +import{dx as t,dy as a,dz as n,dA as i,cL as o,dB as e,_ as r,n as s,b as l,t as d,a as c,dC as h,x as m,e as u,dD as p,r as g,dE as _,dF as f,dG as v,dH as b,dI as y,l as z,dc as w}from"./card-320adb66.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const C={},x=t(class extends a{constructor(){super(...arguments),this.ot=C}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class I{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const A={active:!0,breakpoints:{},lazyLoadCount:0};function L(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function l(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!l(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function c(){const t=n.previousScrollSnap();l(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,l){const{mergeOptions:h,optionsAtMedia:m}=l,u=h(A,t);a=m(u),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,c))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,c))),document.removeEventListener("visibilitychange",s)}}}function S(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class T{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function $(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new T(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let P=class extends c{constructor(){super(...arguments),this.disabled=!1,this.label="",this._thumbnailError=!1,this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return m``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style)||this._thumbnailError,a={controls:!0,left:"left"===this.side,right:"right"===this.side,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style&&!this._thumbnailError?this.icon:"left"===this.side?"mdi:chevron-left":"mdi:chevron-right";return m` + + `}return p(this._embedThumbnailTask,(t=>t?m``:m``),{inProgressFunc:()=>m`
`,errorFunc:t=>{this._thumbnailError=!0}})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-left-position: 45px;\n --frigate-card-right-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.left {\n left: var(--frigate-card-left-position);\n}\n\n.controls.right {\n right: var(--frigate-card-right-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.left.thumbnails:hover {\n left: calc(var(--frigate-card-left-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.right.thumbnails:hover {\n right: calc(var(--frigate-card-right-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],P.prototype,"side",void 0),r([s({attribute:!1})],P.prototype,"hass",void 0),r([l()],P.prototype,"_controlConfig",void 0),r([s({attribute:!1})],P.prototype,"thumbnail",void 0),r([s({attribute:!1})],P.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],P.prototype,"disabled",void 0),r([s()],P.prototype,"label",void 0),r([l()],P.prototype,"_thumbnailError",void 0),P=r([d("frigate-card-next-previous-control")],P);class k{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let E=class extends c{constructor(){super(...arguments),this._controller=new k(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?m`this._controller.handleAction(t,n)} + >`:m``,a=this._controller.getConfig();return m`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?m`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?m`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:m``} + ${!a?.hide_home&&this._actionPresence?.home?m`
+ ${t("home","mdi:home",this._actions.home)} +
`:m``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],E.prototype,"config",void 0),r([s({attribute:!1})],E.prototype,"cameraManager",void 0),r([s({attribute:!1})],E.prototype,"cameraID",void 0),r([s({attribute:!1})],E.prototype,"forceVisibility",void 0),E=r([d("frigate-card-ptz")],E);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},H=2,O=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},R=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;O(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{O(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{O(t,n)}))},N=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};function D(t){w(t,"live:error")}export{L as A,I as M,S as a,$ as b,H as c,D as d,R as h,x as i,N as p,O as s,M as u}; diff --git a/www/community/frigate-hass-card/dispatch-live-error-c649b480.js.gz b/www/community/frigate-hass-card/dispatch-live-error-c649b480.js.gz new file mode 100644 index 00000000..8cfff2f0 Binary files /dev/null and b/www/community/frigate-hass-card/dispatch-live-error-c649b480.js.gz differ diff --git a/www/community/frigate-hass-card/editor-0c0425c2.js b/www/community/frigate-hass-card/editor-0c0425c2.js new file mode 100644 index 00000000..2c7a83b1 --- /dev/null +++ b/www/community/frigate-hass-card/editor-0c0425c2.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-320adb66.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-0c0425c2.js.gz b/www/community/frigate-hass-card/editor-0c0425c2.js.gz new file mode 100644 index 00000000..ae9624fa Binary files /dev/null and b/www/community/frigate-hass-card/editor-0c0425c2.js.gz differ diff --git a/www/community/frigate-hass-card/editor-238b96c0.js b/www/community/frigate-hass-card/editor-238b96c0.js new file mode 100644 index 00000000..b55f7a1a --- /dev/null +++ b/www/community/frigate-hass-card/editor-238b96c0.js @@ -0,0 +1,472 @@ +import{i as e,s as i,_ as t,n,t as a,a as s,x as o,e as r,l,r as c,b as d,c as u,d as m,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ie,a2 as te,a3 as ne,a4 as ae,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as ue,ac as me,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ei,aT as ii,aU as ti,aV as ni,aW as ai,aX as si,aY as oi,aZ as ri,a_ as li,a$ as ci,b0 as di,b1 as ui,b2 as mi,b3 as hi,b4 as _i,b5 as gi,b6 as bi,b7 as pi,b8 as vi,b9 as fi,ba as $i,bb as yi,bc as wi,bd as Si,be as xi,bf as Mi,bg as Ii,bh as ki,bi as Oi,bj as Ci,bk as zi,bl as Ai,bm as Ni,bn as Ti,bo as Bi,bp as Ei,bq as Pi,br as Hi,bs as Li,bt as Vi,bu as Ki,bv as Ui,bw as ji,bx as qi,by as Ri,bz as Di,bA as Fi,bB as Gi,bC as Ji,bD as Qi,bE as Wi,bF as Xi,bG as Yi,bH as Zi,bI as et,bJ as it,bK as tt,bL as nt,bM as at,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as ut,bU as mt,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as en,cz as tn,cA as nn,cB as an,cC as sn,cD as on,cE as rn,cF as ln,cG as cn,cH as dn,cI as un,cJ as mn}from"./card-e5d55e5b.js";class hn{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(i){e(i,this._value)||(this._value=i,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,i(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _n=class extends s{constructor(){super(...arguments),this._controller=new hn(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?"":l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign frigate-card-icon {\n color: var(--warning-color);\n}\n\nfrigate-card-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([n({attribute:!1})],_n.prototype,"label",void 0),t([n({attribute:!1})],_n.prototype,"value",void 0),_n=t([a("frigate-card-key-assigner")],_n);const gn="cameras",bn="options",pn={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vn=class extends s{constructor(){super(...arguments),this._defaults=u(dn),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=m(e);const i=h.safeParse(this._config.profiles);if(i.success){const e=u(dn);_(this._config,e,i.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,i){const t=pn[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const i=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${i}`)}_renderEntitySelector(e,i){if(this._config)return o` + this._valueChangedHandler(e,i)} + > + + `}_renderOptionSelector(e,i=[],t){if(this._config)return o` + this._valueChangedHandler(e,i)} + > + + `}_renderIconSelector(e,i){if(this._config)return o` + this._valueChangedHandler(e,i)} + > + + `}_renderNumberInput(e,i){if(!this._config)return;const t=b(this._config,e),n=void 0===i?.max?"box":"slider";return o` + this._valueChangedHandler(e,i)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,i){return"string"==typeof i?.title&&i.title||("string"==typeof i?.camera_entity?p(this.hass,i.camera_entity):"")||"object"==typeof i?.webrtc_card&&i.webrtc_card&&"string"==typeof i.webrtc_card.entity&&i.webrtc_card.entity||("object"==typeof i?.frigate&&i.frigate&&"string"==typeof i?.frigate.camera_name&&i.frigate.camera_name?v(i.frigate.camera_name):"")||"string"==typeof i?.id&&i.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,i){return o` this._valueChangedHandler(e,i)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,i){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${i} + `)}`}_putInSubmenu(e,i,t,n,a){const s=this._expandedMenus[e]===i;return o`
+ + ${s?o`
${a}
`:""} +
`}_renderMediaLayout(e,i,t,n,a,s,r,c,d,u,m,h){return this._putInSubmenu(e,!0,i,"mdi:page-layout-body",o` + ${this._renderNumberInput(u,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(m,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(a,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,i,t,n,a,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(i,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(n,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(a,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,i,t,n,a,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(i,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,n,a,s,r,c,d)}`)}_renderViewDisplay(e,i,t,n,a){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(i,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(a,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,i,t,n){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(i,this._nextPreviousControlStyles.filter((e=>!(!n?.allowThumbnails&&"thumbnails"===e.value||!n?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,i,t,n,a,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(i,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(n,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(a,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,i){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${i?o`${this._renderOptionSelector(i,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,i,t,n,a){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(i,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(n,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(a,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,i,t,n){const a=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==i&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const i=u(this._config);e(i)&&this._updateConfig(i)}},d={submenu:!0,selected:this._expandedMenus[gn]===i};return o` +
+ + ${this._expandedMenus[gn]===i?o`
+
+ !n&&c((e=>!!(Array.isArray(e.cameras)&&i>0)&&(dt(e.cameras,i,i-1),this._openMenu(gn,i-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!n&&c((e=>!!(Array.isArray(e.cameras)&&i + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(i,1),this._closeMenu(gn),!0)))}} + > + + +
+ ${this._renderEntitySelector(ie(ut,i),"camera")} + ${this._renderOptionSelector(ie(mt,i),a)} + ${this._renderStringInput(ie(ht,i))} + ${this._renderIconSelector(ie(_t,i),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ie(gt,i))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",i,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ie(bt,i))} + ${this._renderStringInput(ie(pt,i))} + ${this._renderOptionSelector(ie(vt,i),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ie(ft,i),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ie($t,i))} + `)} + ${this._putInSubmenu("cameras.motioneye",i,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ie(yt,i))} + ${this._renderStringInput(ie(wt,i))} + ${this._renderStringInput(ie(St,i))} + ${this._renderStringInput(ie(xt,i))} + ${this._renderStringInput(ie(Mt,i))}`)} + ${this._putInSubmenu("cameras.reolink",i,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ie(It,i))} + ${this._renderOptionSelector(ie(kt,i),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",i,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ie(Ot,i),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ie(Ct,i))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ie(zt,i),ie(At,i),ie(Nt,i),ie(Tt,i),ie(Bt,i)))} + ${this._putInSubmenu("cameras.webrtc_card",i,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ie(Et,i),"camera")} + ${this._renderStringInput(ie(Pt,i))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",i,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ie(Ht,i),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ie(Lt,i),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",i,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ie(Vt,i),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ie(Kt,i),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ie(Ut,i),t,{multiple:!0})} + ${this._renderOptionSelector(ie(jt,i),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",i,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ie(qt,i),this._castMethods)} + ${this._renderStringInput(ie(Rt,i))} + ${this._renderStringInput(ie(Dt,i))} + `)} + ${this._putInSubmenu("cameras.dimensions",i,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ie(Ft,i))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ie(Gt,i),ie(Jt,i),ie(Qt,i),ie(Wt,i),ie(Xt,i),ie(Yt,i),ie(Zt,i),ie(en,i),ie(tn,i),ie(nn,i))} + `)} + ${this._putInSubmenu("cameras.capabilities",i,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ie(an,i),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ie(sn,i),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",i,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ie(on,i),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ie(rn,i),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ie(ln,i),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ie(cn,i),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,i){if(this._config)return o` + this._valueChangedHandler(e,i)} + > + + `}_renderSwitch(e,i,t){if(this._config)return o` + this._valueChangedHandler(e,i)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),i=b(this._config,un)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=u(this._config);ne(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bn]?o` +
+ ${i.map(((t,n)=>this._renderCamera(i,n,e)))} + ${this._renderCamera(i,i.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bn]?o`
+ ${this._renderOptionSelector(ae,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bn]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bn]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(ue,this._menuPositions)} + ${this._renderOptionSelector(me,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bn]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bn]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ei,this._ptzOrientations)} + ${this._renderSwitch(ii,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ti,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ni,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(ai)} + ${this._renderSwitch(si,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oi)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bn]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ri,li,ci,di,ui,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",mi)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bn]?o`
+ ${this._renderOptionSelector(hi,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_i,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(gi,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(bi,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pi,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(vi,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fi,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($i,this._transitionEffects)} + ${this._renderSwitch(yi,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wi,Si,xi,Mi)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ii,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ki,Oi,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ci,zi,Ai,Ni,Ti,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Bi})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ei,Pi,Hi,Li,Vi,Ki,this._defaults.media_viewer.controls.timeline.show_recordings,Ui)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bn]?o`
+ ${this._renderImageOptions(ji,qi,Ri,Di,Fi)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bn]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Gi,Ji,Qi,Wi,Xi,this._defaults.timeline.controls.thumbnails,{configPathMode:Yi})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bn]?o`
+ ${this._renderOptionSelector(Zi,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(it)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,mn)?"warning":void 0)} + ${"performance"===this._expandedMenus[bn]?o`
+ ${"low"===b(this._config,mn)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(nt,{max:at})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bn]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,i){this._expandedMenus[e]=i,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const i=e.target.domain,t=e.target.key;this._expandedMenus[i]===t?this._closeMenu(i):this._openMenu(i,t)}}_valueChangedHandler(e,i){if(!this._config||!this.hass)return;let t;if(i.detail&&void 0!==i.detail.value&&(t=i.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const n=u(this._config);""===t||void 0===t?lt(n,e):ct(n,e,t),this._updateConfig(n)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header frigate-card-icon {\n margin-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([n({attribute:!1})],vn.prototype,"hass",void 0),t([d()],vn.prototype,"_config",void 0),t([d()],vn.prototype,"_defaults",void 0),t([d()],vn.prototype,"_expandedMenus",void 0),vn=t([a("frigate-card-editor")],vn);export{vn as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-238b96c0.js.gz b/www/community/frigate-hass-card/editor-238b96c0.js.gz new file mode 100644 index 00000000..799a78f0 Binary files /dev/null and b/www/community/frigate-hass-card/editor-238b96c0.js.gz differ diff --git a/www/community/frigate-hass-card/editor-4ae2085a.js b/www/community/frigate-hass-card/editor-4ae2085a.js new file mode 100644 index 00000000..868217b0 --- /dev/null +++ b/www/community/frigate-hass-card/editor-4ae2085a.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-4e88bdfb.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-4ae2085a.js.gz b/www/community/frigate-hass-card/editor-4ae2085a.js.gz new file mode 100644 index 00000000..accee37c Binary files /dev/null and b/www/community/frigate-hass-card/editor-4ae2085a.js.gz differ diff --git a/www/community/frigate-hass-card/editor-5368ad86.js b/www/community/frigate-hass-card/editor-5368ad86.js new file mode 100644 index 00000000..4ff4cb47 --- /dev/null +++ b/www/community/frigate-hass-card/editor-5368ad86.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-45855f1f.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-5368ad86.js.gz b/www/community/frigate-hass-card/editor-5368ad86.js.gz new file mode 100644 index 00000000..647077db Binary files /dev/null and b/www/community/frigate-hass-card/editor-5368ad86.js.gz differ diff --git a/www/community/frigate-hass-card/editor-539261f9.js b/www/community/frigate-hass-card/editor-539261f9.js new file mode 100644 index 00000000..1c28dea1 --- /dev/null +++ b/www/community/frigate-hass-card/editor-539261f9.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-19444f74.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-539261f9.js.gz b/www/community/frigate-hass-card/editor-539261f9.js.gz new file mode 100644 index 00000000..ec94d729 Binary files /dev/null and b/www/community/frigate-hass-card/editor-539261f9.js.gz differ diff --git a/www/community/frigate-hass-card/editor-63147535.js b/www/community/frigate-hass-card/editor-63147535.js new file mode 100644 index 00000000..0669db45 --- /dev/null +++ b/www/community/frigate-hass-card/editor-63147535.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-0be2c6a9.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-63147535.js.gz b/www/community/frigate-hass-card/editor-63147535.js.gz new file mode 100644 index 00000000..d9367045 Binary files /dev/null and b/www/community/frigate-hass-card/editor-63147535.js.gz differ diff --git a/www/community/frigate-hass-card/editor-837da8b4.js b/www/community/frigate-hass-card/editor-837da8b4.js new file mode 100644 index 00000000..d6c85c42 --- /dev/null +++ b/www/community/frigate-hass-card/editor-837da8b4.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-09c4bade.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-837da8b4.js.gz b/www/community/frigate-hass-card/editor-837da8b4.js.gz new file mode 100644 index 00000000..4ad74b38 Binary files /dev/null and b/www/community/frigate-hass-card/editor-837da8b4.js.gz differ diff --git a/www/community/frigate-hass-card/editor-c3e576d8.js b/www/community/frigate-hass-card/editor-c3e576d8.js new file mode 100644 index 00000000..78ff1291 --- /dev/null +++ b/www/community/frigate-hass-card/editor-c3e576d8.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-c642ee74.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-c3e576d8.js.gz b/www/community/frigate-hass-card/editor-c3e576d8.js.gz new file mode 100644 index 00000000..8e4f64f4 Binary files /dev/null and b/www/community/frigate-hass-card/editor-c3e576d8.js.gz differ diff --git a/www/community/frigate-hass-card/editor-ce460dd0.js b/www/community/frigate-hass-card/editor-ce460dd0.js new file mode 100644 index 00000000..74131d68 --- /dev/null +++ b/www/community/frigate-hass-card/editor-ce460dd0.js @@ -0,0 +1,462 @@ +import{i as e,s as a,_ as t,n as i,t as n,a as s,x as o,e as r,l,r as c,b as d,c as m,d as u,p as h,f as _,g,h as b,j as p,k as v,C as f,m as $,o as y,q as w,u as S,v as x,w as M,y as I,z as k,A as O,B as C,D as z,E as A,F as N,G as T,H as B,I as E,J as P,K as H,L,M as V,N as K,O as U,P as j,Q as q,R,S as D,T as F,U as G,V as J,W as Q,X as W,Y as X,Z as Y,$ as Z,a0 as ee,a1 as ae,a2 as te,a3 as ie,a4 as ne,a5 as se,a6 as oe,a7 as re,a8 as le,a9 as ce,aa as de,ab as me,ac as ue,ad as he,ae as _e,af as ge,ag as be,ah as pe,ai as ve,aj as fe,ak as $e,al as ye,am as we,an as Se,ao as xe,ap as Me,aq as Ie,ar as ke,as as Oe,at as Ce,au as ze,av as Ae,aw as Ne,ax as Te,ay as Be,az as Ee,aA as Pe,aB as He,aC as Le,aD as Ve,aE as Ke,aF as Ue,aG as je,aH as qe,aI as Re,aJ as De,aK as Fe,aL as Ge,aM as Je,aN as Qe,aO as We,aP as Xe,aQ as Ye,aR as Ze,aS as ea,aT as aa,aU as ta,aV as ia,aW as na,aX as sa,aY as oa,aZ as ra,a_ as la,a$ as ca,b0 as da,b1 as ma,b2 as ua,b3 as ha,b4 as _a,b5 as ga,b6 as ba,b7 as pa,b8 as va,b9 as fa,ba as $a,bb as ya,bc as wa,bd as Sa,be as xa,bf as Ma,bg as Ia,bh as ka,bi as Oa,bj as Ca,bk as za,bl as Aa,bm as Na,bn as Ta,bo as Ba,bp as Ea,bq as Pa,br as Ha,bs as La,bt as Va,bu as Ka,bv as Ua,bw as ja,bx as qa,by as Ra,bz as Da,bA as Fa,bB as Ga,bC as Ja,bD as Qa,bE as Wa,bF as Xa,bG as Ya,bH as Za,bI as et,bJ as at,bK as tt,bL as it,bM as nt,bN as st,bO as ot,bP as rt,bQ as lt,bR as ct,bS as dt,bT as mt,bU as ut,bV as ht,bW as _t,bX as gt,bY as bt,bZ as pt,b_ as vt,b$ as ft,c0 as $t,c1 as yt,c2 as wt,c3 as St,c4 as xt,c5 as Mt,c6 as It,c7 as kt,c8 as Ot,c9 as Ct,ca as zt,cb as At,cc as Nt,cd as Tt,ce as Bt,cf as Et,cg as Pt,ch as Ht,ci as Lt,cj as Vt,ck as Kt,cl as Ut,cm as jt,cn as qt,co as Rt,cp as Dt,cq as Ft,cr as Gt,cs as Jt,ct as Qt,cu as Wt,cv as Xt,cw as Yt,cx as Zt,cy as ei,cz as ai,cA as ti,cB as ii,cC as ni,cD as si,cE as oi,cF as ri,cG as li,cH as ci,cI as di,cJ as mi,cK as ui}from"./card-7cd05290.js";class hi{constructor(e){this._assigning=!1,this._value=null,this._blurEventHandler=()=>{this._setAssigning(!1)},this._keydownEventHandler=e=>{e.key&&!["Control","Alt","Shift","Meta"].includes(e.key)&&(this.setValue({key:e.key,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey}),this._setAssigning(!1))},this._host=e,this._host.addController(this)}setValue(a){e(a,this._value)||(this._value=a,this._host.requestUpdate(),this._host.dispatchEvent(new CustomEvent("value-changed",{detail:{value:this._value}})))}getValue(){return this._value}hasValue(){return!!this._value}isAssigning(){return this._assigning}toggleAssigning(){this._setAssigning(!this._assigning)}_setAssigning(e){this._assigning=e,a(this._host,this._assigning,"assigning"),this._assigning?this._host.addEventListener("keydown",this._keydownEventHandler):this._host.removeEventListener("keydown",this._keydownEventHandler),this._host.requestUpdate()}hostConnected(){this._host.addEventListener("blur",this._blurEventHandler)}hostDisconnected(){this._host.removeEventListener("blur",this._blurEventHandler)}}let _i=class extends s{constructor(){super(...arguments),this._controller=new hi(this)}willUpdate(e){e.has("value")&&this._controller.setValue(this.value??null)}render(){if(!this.label)return;const e=e=>o`
+
${e}
+
`;return o` +
${this.label}
+ {this._controller.toggleAssigning()}} + > + + + ${this._controller.isAssigning()?l("key_assigner.assigning"):l("key_assigner.assign")} + + + ${this._controller.hasValue()?o`{this._controller.setValue(null)}} + > + + ${l("key_assigner.unassign")} + `:""} +
+ ${this.value?.ctrl?e(l("key_assigner.modifiers.ctrl")):""} + ${this.value?.shift?e(l("key_assigner.modifiers.shift")):""} + ${this.value?.meta?e(l("key_assigner.modifiers.meta")):""} + ${this.value?.alt?e(l("key_assigner.modifiers.alt")):""} + ${this.value?.key?e(this.value.key):""} +
+ `}static get styles(){return c('.dotdotdot:after {\n animation: dots 2s linear infinite;\n content: "";\n display: inline-block;\n width: 3em;\n}\n@keyframes dots {\n 0%, 20% {\n content: ".";\n }\n 40% {\n content: "..";\n }\n 60% {\n content: "...";\n }\n 90%, 100% {\n content: "";\n }\n}\n\n:host {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 10px;\n height: 56px;\n border: 1px solid var(--divider-color);\n}\n\n:host([assigning]) ha-button.assign span,\n:host([assigning]) ha-button.assign ha-icon {\n color: var(--warning-color);\n}\n\nha-icon {\n padding: 10px;\n}\n\ndiv.label {\n width: 100px;\n margin-left: 4px;\n}\n\ndiv.key-row {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n padding-left: 10px;\n padding-right: 10px;\n}\n\ndiv.key {\n display: flex;\n align-items: center;\n height: 90%;\n width: min-content;\n margin-left: 5px;\n margin-right: 5px;\n}\n\ndiv.key-inner {\n height: 100%;\n width: 100%;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 4px;\n padding-right: 4px;\n border: 2px;\n border-radius: 4px;\n border-style: outset;\n border-color: var(--divider-color);\n font-family: monospace;\n text-transform: capitalize;\n}\n\ndiv.unassigned {\n font-style: italic;\n}\n\ndiv.key + div.key:before {\n display: flex;\n align-items: center;\n margin-right: 5px;\n content: " + ";\n}')}};t([i({attribute:!1})],_i.prototype,"label",void 0),t([i({attribute:!1})],_i.prototype,"value",void 0),_i=t([n("frigate-card-key-assigner")],_i);const gi="cameras",bi="options",pi={cameras:{icon:"video",name:l("editor.cameras"),secondary:l("editor.cameras_secondary")},view:{icon:"eye",name:l("editor.view"),secondary:l("editor.view_secondary")},menu:{icon:"menu",name:l("editor.menu"),secondary:l("editor.menu_secondary")},status_bar:{icon:"sign-text",name:l("editor.status_bar"),secondary:l("editor.status_bar_secondary")},live:{icon:"cctv",name:l("editor.live"),secondary:l("editor.live_secondary")},media_gallery:{icon:"grid",name:l("editor.media_gallery"),secondary:l("editor.media_gallery_secondary")},media_viewer:{icon:"filmstrip",name:l("editor.media_viewer"),secondary:l("editor.media_viewer_secondary")},image:{icon:"image",name:l("editor.image"),secondary:l("editor.image_secondary")},timeline:{icon:"chart-gantt",name:l("editor.timeline"),secondary:l("editor.timeline_secondary")},dimensions:{icon:"aspect-ratio",name:l("editor.dimensions"),secondary:l("editor.dimensions_secondary")},performance:{icon:"speedometer",name:l("editor.performance"),secondary:l("editor.performance_secondary")},profiles:{icon:"folder-wrench-outline",name:l("editor.profiles"),secondary:l("editor.profiles_secondary")},overrides:{icon:"file-replace",name:l("editor.overrides"),secondary:l("editor.overrides_secondary")}};let vi=class extends s{constructor(){super(...arguments),this._defaults=m(di),this._initialized=!1,this._configUpgradeable=!1,this._expandedMenus={},this._viewModes=[{value:"",label:""},{value:"live",label:l("config.view.views.live")},{value:"clips",label:l("config.view.views.clips")},{value:"snapshots",label:l("config.view.views.snapshots")},{value:"recordings",label:l("config.view.views.recordings")},{value:"clip",label:l("config.view.views.clip")},{value:"snapshot",label:l("config.view.views.snapshot")},{value:"recording",label:l("config.view.views.recording")},{value:"image",label:l("config.view.views.image")},{value:"timeline",label:l("config.view.views.timeline")}],this._cameraSelectViewModes=[...this._viewModes,{value:"current",label:l("config.view.views.current")}],this._filterModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.filter.modes.none")},{value:"left",label:l("config.common.controls.filter.modes.left")},{value:"right",label:l("config.common.controls.filter.modes.right")}],this._menuStyles=[{value:"",label:""},{value:"none",label:l("config.menu.styles.none")},{value:"hidden",label:l("config.menu.styles.hidden")},{value:"overlay",label:l("config.menu.styles.overlay")},{value:"hover",label:l("config.menu.styles.hover")},{value:"hover-card",label:l("config.menu.styles.hover-card")},{value:"outside",label:l("config.menu.styles.outside")}],this._menuPositions=[{value:"",label:""},{value:"left",label:l("config.menu.positions.left")},{value:"right",label:l("config.menu.positions.right")},{value:"top",label:l("config.menu.positions.top")},{value:"bottom",label:l("config.menu.positions.bottom")}],this._menuAlignments=[{value:"",label:""},{value:"left",label:l("config.menu.alignments.left")},{value:"right",label:l("config.menu.alignments.right")},{value:"top",label:l("config.menu.alignments.top")},{value:"bottom",label:l("config.menu.alignments.bottom")}],this._nextPreviousControlStyles=[{value:"",label:""},{value:"chevrons",label:l("config.common.controls.next_previous.styles.chevrons")},{value:"icons",label:l("config.common.controls.next_previous.styles.icons")},{value:"none",label:l("config.common.controls.next_previous.styles.none")},{value:"thumbnails",label:l("config.common.controls.next_previous.styles.thumbnails")}],this._aspectRatioModes=[{value:"",label:""},{value:"dynamic",label:l("config.dimensions.aspect_ratio_modes.dynamic")},{value:"static",label:l("config.dimensions.aspect_ratio_modes.static")},{value:"unconstrained",label:l("config.dimensions.aspect_ratio_modes.unconstrained")}],this._thumbnailModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.thumbnails.modes.none")},{value:"above",label:l("config.common.controls.thumbnails.modes.above")},{value:"below",label:l("config.common.controls.thumbnails.modes.below")},{value:"left",label:l("config.common.controls.thumbnails.modes.left")},{value:"right",label:l("config.common.controls.thumbnails.modes.right")}],this._thumbnailMediaTypes=[{value:"",label:""},{value:"events",label:l("config.common.controls.thumbnails.media_types.events")},{value:"recordings",label:l("config.common.controls.thumbnails.media_types.recordings")}],this._thumbnailEventsMediaTypes=[{value:"",label:""},{value:"clips",label:l("config.common.controls.thumbnails.events_media_types.clips")},{value:"snapshots",label:l("config.common.controls.thumbnails.events_media_types.snapshots")}],this._transitionEffects=[{value:"",label:""},{value:"none",label:l("config.media_viewer.transition_effects.none")},{value:"slide",label:l("config.media_viewer.transition_effects.slide")}],this._imageModes=[{value:"",label:""},{value:"camera",label:l("config.common.image.modes.camera")},{value:"entity",label:l("config.common.image.modes.entity")},{value:"screensaver",label:l("config.common.image.modes.screensaver")},{value:"url",label:l("config.common.image.modes.url")}],this._timelineEventsMediaTypes=[{value:"",label:""},{value:"all",label:l("config.common.timeline.events_media_types.all")},{value:"clips",label:l("config.common.timeline.events_media_types.clips")},{value:"snapshots",label:l("config.common.timeline.events_media_types.snapshots")}],this._timelineStyleTypes=[{value:"",label:""},{value:"ribbon",label:l("config.common.timeline.styles.ribbon")},{value:"stack",label:l("config.common.timeline.styles.stack")}],this._darkModes=[{value:"",label:""},{value:"on",label:l("config.view.dark_modes.on")},{value:"off",label:l("config.view.dark_modes.off")},{value:"auto",label:l("config.view.dark_modes.auto")}],this._mediaActionNegativeConditions=[{value:"",label:""},{value:"unselected",label:l("config.common.media_action_conditions.unselected")},{value:"hidden",label:l("config.common.media_action_conditions.hidden")}],this._mediaActionPositiveConditions=[{value:"",label:""},{value:"selected",label:l("config.common.media_action_conditions.selected")},{value:"visible",label:l("config.common.media_action_conditions.visible")}],this._mediaLiveUnmuteConditions=[...this._mediaActionPositiveConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_unmute")}],this._mediaLiveMuteConditions=[...this._mediaActionNegativeConditions,{value:"microphone",label:l("config.common.media_action_conditions.microphone_mute")}],this._layoutFits=[{value:"",label:""},{value:"contain",label:l("config.cameras.dimensions.layout.fits.contain")},{value:"cover",label:l("config.cameras.dimensions.layout.fits.cover")},{value:"fill",label:l("config.cameras.dimensions.layout.fits.fill")}],this._miniTimelineModes=[{value:"",label:""},{value:"none",label:l("config.common.controls.timeline.modes.none")},{value:"above",label:l("config.common.controls.timeline.modes.above")},{value:"below",label:l("config.common.controls.timeline.modes.below")}],this._profiles=[{value:"",label:""},{value:"casting",label:l("config.profiles.casting")},{value:"low-performance",label:l("config.profiles.low-performance")},{value:"scrubbing",label:l("config.profiles.scrubbing")}],this._go2rtcModes=[{value:"",label:""},{value:"mse",label:l("config.cameras.go2rtc.modes.mse")},{value:"webrtc",label:l("config.cameras.go2rtc.modes.webrtc")},{value:"mp4",label:l("config.cameras.go2rtc.modes.mp4")},{value:"mjpeg",label:l("config.cameras.go2rtc.modes.mjpeg")}],this._microphoneButtonTypes=[{value:"",label:""},{value:"momentary",label:l("config.menu.buttons.types.momentary")},{value:"toggle",label:l("config.menu.buttons.types.toggle")}],this._displayModes=[{value:"",label:""},{value:"single",label:l("display_modes.single")},{value:"grid",label:l("display_modes.grid")}],this._castMethods=[{value:"",label:""},{value:"standard",label:l("config.cameras.cast.methods.standard")},{value:"dashboard",label:l("config.cameras.cast.methods.dashboard")}],this._ptzModes=[{value:"",label:""},{value:"on",label:l("config.live.controls.ptz.modes.on")},{value:"off",label:l("config.live.controls.ptz.modes.off")}],this._ptzOrientations=[{value:"",label:""},{value:"vertical",label:l("config.live.controls.ptz.orientations.vertical")},{value:"horizontal",label:l("config.live.controls.ptz.orientations.horizontal")}],this._ptzPositions=[{value:"",label:""},{value:"top-left",label:l("config.live.controls.ptz.positions.top-left")},{value:"top-right",label:l("config.live.controls.ptz.positions.top-right")},{value:"bottom-left",label:l("config.live.controls.ptz.positions.bottom-left")},{value:"bottom-right",label:l("config.live.controls.ptz.positions.bottom-right")}],this._triggersActionsInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.triggers.actions.interaction_modes.all")},{value:"inactive",label:l("config.view.triggers.actions.interaction_modes.inactive")},{value:"active",label:l("config.view.triggers.actions.interaction_modes.active")}],this._triggersActionsTrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.triggers.default")},{value:"live",label:l("config.view.triggers.actions.triggers.live")},{value:"media",label:l("config.view.triggers.actions.triggers.media")},{value:"none",label:l("config.view.triggers.actions.triggers.none")}],this._triggersActionsUntrigger=[{value:"",label:""},{value:"default",label:l("config.view.triggers.actions.untriggers.default")},{value:"none",label:l("config.view.triggers.actions.untriggers.none")}],this._triggersEvents=[{value:"",label:""},{value:"events",label:l("config.cameras.triggers.events.events")},{value:"clips",label:l("config.cameras.triggers.events.clips")},{value:"snapshots",label:l("config.cameras.triggers.events.snapshots")}],this._timelinePanModes=[{value:"",label:""},{value:"pan",label:l("config.common.controls.timeline.pan_modes.pan")},{value:"seek",label:l("config.common.controls.timeline.pan_modes.seek")},{value:"seek-in-media",label:l("config.common.controls.timeline.pan_modes.seek-in-media")},{value:"seek-in-camera",label:l("config.common.controls.timeline.pan_modes.seek-in-camera")}],this._capabilities=[{value:"",label:""},{value:"live",label:l("config.cameras.capabilities.capabilities.live")},{value:"substream",label:l("config.cameras.capabilities.capabilities.substream")},{value:"clips",label:l("config.cameras.capabilities.capabilities.clips")},{value:"recordings",label:l("config.cameras.capabilities.capabilities.recordings")},{value:"snapshots",label:l("config.cameras.capabilities.capabilities.snapshots")},{value:"favorite-events",label:l("config.cameras.capabilities.capabilities.favorite-events")},{value:"favorite-recordings",label:l("config.cameras.capabilities.capabilities.favorite-recordings")},{value:"seek",label:l("config.cameras.capabilities.capabilities.seek")},{value:"ptz",label:l("config.cameras.capabilities.capabilities.ptz")},{value:"menu",label:l("config.cameras.capabilities.capabilities.menu")}],this._defaultResetInteractionModes=[{value:"",label:""},{value:"all",label:l("config.view.default_reset.interaction_modes.all")},{value:"inactive",label:l("config.view.default_reset.interaction_modes.inactive")},{value:"active",label:l("config.view.default_reset.interaction_modes.active")}],this._proxyMedia=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.media.auto")},{value:!0,label:l("config.cameras.proxy.media.true")},{value:!1,label:l("config.cameras.proxy.media.false")}],this._proxySSLCiphers=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_ciphers.auto")},{value:"default",label:l("config.cameras.proxy.ssl_ciphers.default")},{value:"insecure",label:l("config.cameras.proxy.ssl_ciphers.insecure")},{value:"intermediate",label:l("config.cameras.proxy.ssl_ciphers.intermediate")},{value:"modern",label:l("config.cameras.proxy.ssl_ciphers.modern")}],this._proxySSLVerification=[{value:"",label:""},{value:"auto",label:l("config.cameras.proxy.ssl_verification.auto")},{value:!0,label:l("config.cameras.proxy.ssl_verification.true")},{value:!1,label:l("config.cameras.proxy.ssl_verification.false")}],this._reolinkMediaResolution=[{value:"",label:""},{value:"high",label:l("config.cameras.reolink.media_resolution.high")},{value:"low",label:l("config.cameras.reolink.media_resolution.low")}],this._statusBarStyles=[{value:"",label:""},{value:"hover",label:l("config.status_bar.styles.hover")},{value:"hover-card",label:l("config.status_bar.styles.hover-card")},{value:"none",label:l("config.status_bar.styles.none")},{value:"outside",label:l("config.status_bar.styles.outside")},{value:"overlay",label:l("config.status_bar.styles.overlay")},{value:"popup",label:l("config.status_bar.styles.popup")}],this._statusBarPositions=[{value:"",label:""},{value:"top",label:l("config.status_bar.positions.top")},{value:"bottom",label:l("config.status_bar.positions.bottom")}]}setConfig(e){this._config=e,this._configUpgradeable=u(e);const a=h.safeParse(this._config.profiles);if(a.success){const e=m(di);_(this._config,e,a.data),this._defaults=e}}willUpdate(){this._initialized||g().then((e=>{e&&(this._initialized=!0)}))}_renderOptionSetHeader(e,a){const t=pi[e];return o` +
+
+ +
${t.name}
+
+
${t.secondary}
+
+ `}_getLabel(e){const a=e.split(".").filter((e=>!e.match(/^\[[0-9]+\]$/))).join(".");return l(`config.${a}`)}_renderEntitySelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderOptionSelector(e,a=[],t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderIconSelector(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderNumberInput(e,a){if(!this._config)return;const t=b(this._config,e),i=void 0===a?.max?"box":"slider";return o` + this._valueChangedHandler(e,a)} + > + + `}_renderInfo(e){return o` ${e}`}_getEditorCameraTitle(e,a){return"string"==typeof a?.title&&a.title||("string"==typeof a?.camera_entity?p(this.hass,a.camera_entity):"")||"object"==typeof a?.webrtc_card&&a.webrtc_card&&"string"==typeof a.webrtc_card.entity&&a.webrtc_card.entity||("object"==typeof a?.frigate&&a.frigate&&"string"==typeof a?.frigate.camera_name&&a.frigate.camera_name?v(a.frigate.camera_name):"")||"string"==typeof a?.id&&a.id||l("editor.camera")+" #"+e}_renderViewDefaultResetMenu(){return this._putInSubmenu("view.default_reset",!0,`config.${f}.editor_label`,"mdi:restart",o` + ${this._renderSwitch($,this._defaults.view.default_reset.after_interaction)} + ${this._renderNumberInput(y)} + ${this._renderOptionSelector(w,this._defaultResetInteractionModes,{label:l("config.view.default_reset.interaction_mode")})}, + ${this._renderOptionSelector(S,this.hass?x(this.hass):[],{multiple:!0})} + `)}_renderViewTriggersMenu(){return this._putInSubmenu("view.triggers",!0,`config.${M}.editor_label`,"mdi:target-account",o` + ${this._renderSwitch(I,this._defaults.view.triggers.filter_selected_camera,{label:l(`config.${I}`)})} + ${this._renderSwitch(k,this._defaults.view.triggers.show_trigger_status,{label:l(`config.${k}`)})} + ${this._renderNumberInput(O,{default:this._defaults.view.triggers.untrigger_seconds})} + ${this._putInSubmenu("view.triggers.actions",!0,`config.${C}.editor_label`,"mdi:cogs",o` ${this._renderOptionSelector(z,this._triggersActionsTrigger,{label:l("config.view.triggers.actions.trigger")})} + ${this._renderOptionSelector(A,this._triggersActionsUntrigger,{label:l("config.view.triggers.actions.untrigger")})} + ${this._renderOptionSelector(N,this._triggersActionsInteractionModes,{label:l("config.view.triggers.actions.interaction_mode")})}`)} + `)}_renderKeyAssigner(e,a){return o` this._valueChangedHandler(e,a)} + >`}_renderViewKeyboardShortcutMenu(){return this._putInSubmenu("view.keyboard_shortcuts",!0,`config.${T}.editor_label`,"mdi:keyboard",o` + ${this._renderSwitch(B,this._defaults.view.keyboard_shortcuts.enabled,{label:l(`config.${B}`)})} + ${this._renderKeyAssigner(E,this._defaults.view.keyboard_shortcuts.ptz_left)} + ${this._renderKeyAssigner(P,this._defaults.view.keyboard_shortcuts.ptz_right)} + ${this._renderKeyAssigner(H,this._defaults.view.keyboard_shortcuts.ptz_up)} + ${this._renderKeyAssigner(L,this._defaults.view.keyboard_shortcuts.ptz_down)} + ${this._renderKeyAssigner(V,this._defaults.view.keyboard_shortcuts.ptz_zoom_in)} + ${this._renderKeyAssigner(K,this._defaults.view.keyboard_shortcuts.ptz_zoom_out)} + ${this._renderKeyAssigner(U,this._defaults.view.keyboard_shortcuts.ptz_home)} + `)}_renderStatusBarItem(e){return o` ${this._putInSubmenu("status_bar.items",e,`config.status_bar.items.${e}`,"mdi:feature-search",o` + ${this._renderSwitch(`${j}.${e}.enabled`,this._defaults.status_bar.items[e]?.enabled??!0,{label:l("config.status_bar.items.enabled")})} + ${this._renderNumberInput(`${j}.${e}.priority`,{max:q,default:this._defaults.status_bar.items[e]?.priority,label:l("config.status_bar.items.priority")})} + `)}`}_renderMenuButton(e,a){const t=[{value:"",label:""},{value:"matching",label:l("config.menu.buttons.alignments.matching")},{value:"opposing",label:l("config.menu.buttons.alignments.opposing")}];return o` ${this._putInSubmenu("menu.buttons",e,`config.menu.buttons.${e}`,"mdi:gesture-tap-button",o` + ${this._renderSwitch(`${R}.${e}.enabled`,this._defaults.menu.buttons[e]?.enabled??!0,{label:l("config.menu.buttons.enabled")})} + ${this._renderOptionSelector(`${R}.${e}.alignment`,t,{label:l("config.menu.buttons.alignment")})} + ${this._renderSwitch(`${R}.${e}.permanent`,this._defaults.menu.buttons[e]?.permanent??!1,{label:l("config.menu.buttons.permanent")})} + ${this._renderNumberInput(`${R}.${e}.priority`,{max:D,default:this._defaults.menu.buttons[e]?.priority,label:l("config.menu.buttons.priority")})} + ${this._renderIconSelector(`${R}.${e}.icon`,{label:l("config.menu.buttons.icon")})} + ${a} + `)}`}_putInSubmenu(e,a,t,i,n){const s=this._expandedMenus[e]===a,c={submenu:!0,selected:s},d=dt(i);return o`
+ + ${s?o`
${n}
`:""} +
`}_renderMediaLayout(e,a,t,i,n,s,r,c,d,m,u,h){return this._putInSubmenu(e,!0,a,"mdi:page-layout-body",o` + ${this._renderNumberInput(m,{min:0,max:10,label:l("config.cameras.dimensions.layout.zoom"),step:.1})} + ${this._renderNumberInput(u,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.x")})} + ${this._renderNumberInput(h,{min:0,max:100,label:l("config.cameras.dimensions.layout.pan.y")})} + ${this._renderOptionSelector(t,this._layoutFits,{label:l("config.cameras.dimensions.layout.fit")})} + ${this._putInSubmenu(`${e}.position`,!0,"config.cameras.dimensions.layout.position.editor_label","mdi:aspect-ratio",o` ${this._renderNumberInput(i,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.x")})} + ${this._renderNumberInput(n,{min:0,max:100,label:l("config.cameras.dimensions.layout.position.y")})}`)} + ${this._putInSubmenu(`${e}.view_box`,!0,"config.cameras.dimensions.layout.view_box.editor_label","mdi:crop",o` + ${this._renderNumberInput(s,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.top")})} + ${this._renderNumberInput(r,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.bottom")})} + ${this._renderNumberInput(c,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.left")})} + ${this._renderNumberInput(d,{min:0,max:100,label:l("config.cameras.dimensions.layout.view_box.right")})} + `)} + `)}_renderTimelineCoreControls(e,a,t,i,n,s,r){return o` + ${this._renderOptionSelector(e,this._timelineStyleTypes,{label:l(`config.common.${F}`)})} + ${r?this._renderOptionSelector(r,this._timelinePanModes,{label:l("config.common.controls.timeline.pan_mode")}):""} + ${this._renderNumberInput(a,{label:l(`config.common.${G}`)})} + ${this._renderNumberInput(t,{label:l(`config.common.${J}`)})} + ${this._renderOptionSelector(i,this._timelineEventsMediaTypes,{label:l(`config.common.${Q}`)})} + ${this._renderSwitch(n,s,{label:l(`config.common.${W}`)})} + `}_renderMiniTimeline(e,a,t,i,n,s,r,c,d){return this._putInSubmenu(e,!0,"config.common.controls.timeline.editor_label","mdi:chart-gantt",o` ${this._renderOptionSelector(a,this._miniTimelineModes,{label:l("config.common.controls.timeline.mode")})} + ${this._renderTimelineCoreControls(t,i,n,s,r,c,d)}`)}_renderViewDisplay(e,a,t,i,n){return this._putInSubmenu(e,!0,"config.common.display.editor_label","mdi:palette-swatch",o` + ${this._renderOptionSelector(a,this._displayModes,{label:l("config.common.display.mode")})} + ${this._renderNumberInput(t,{min:0,label:l("config.common.display.grid_selected_width_factor")})} + ${this._renderNumberInput(i,{min:0,label:l("config.common.display.grid_columns")})} + ${this._renderNumberInput(n,{min:0,label:l("config.common.display.grid_max_columns")})} + `)}_renderNextPreviousControls(e,a,t,i){return this._putInSubmenu(e,!0,"config.common.controls.next_previous.editor_label","mdi:arrow-right-bold-circle",o` + ${this._renderOptionSelector(a,this._nextPreviousControlStyles.filter((e=>!(!i?.allowThumbnails&&"thumbnails"===e.value||!i?.allowIcons&&"icons"===e.value))),{label:l("config.common.controls.next_previous.style")})} + ${this._renderNumberInput(t,{min:X,label:l("config.common.controls.next_previous.size")})} + `)}_renderThumbnailsControls(e,a,t,i,n,s,r,c){return this._putInSubmenu(e,!0,"config.common.controls.thumbnails.editor_label","mdi:image-text",o` + ${c?.configPathMode?o`${this._renderOptionSelector(c.configPathMode,this._thumbnailModes,{label:l("config.common.controls.thumbnails.mode")})}`:o``} + ${c?.configPathMediaType?o`${this._renderOptionSelector(c.configPathMediaType,this._thumbnailMediaTypes,{label:l("config.common.controls.thumbnails.media_type")})}`:o``} + ${c?.configPathEventsMediaType?o`${this._renderOptionSelector(c.configPathEventsMediaType,this._thumbnailEventsMediaTypes,{label:l("config.common.controls.thumbnails.events_media_type")})}`:o``} + ${this._renderNumberInput(a,{min:Y,max:Z,label:l("config.common.controls.thumbnails.size")})} + ${this._renderSwitch(t,r.show_details,{label:l("config.common.controls.thumbnails.show_details")})} + ${this._renderSwitch(i,r.show_favorite_control,{label:l("config.common.controls.thumbnails.show_favorite_control")})} + ${this._renderSwitch(n,r.show_timeline_control,{label:l("config.common.controls.thumbnails.show_timeline_control")})} + ${this._renderSwitch(s,r.show_download_control,{label:l("config.common.controls.thumbnails.show_download_control")})} + `)}_renderFilterControls(e,a){return this._putInSubmenu(e,!0,"config.common.controls.filter.editor_label","mdi:filter-cog",o` + ${a?o`${this._renderOptionSelector(a,this._filterModes,{label:l("config.common.controls.filter.mode")})}`:o``} + `)}_renderImageOptions(e,a,t,i,n){return o` + ${this._renderOptionSelector(e,this._imageModes,{label:l("config.common.image.mode")})} + ${this._renderStringInput(a,{label:l("config.common.image.url")})} + ${this._renderOptionSelector(t,this.hass?x(this.hass):[],{label:l("config.common.image.entity")})} + ${this._renderStringInput(i,{label:l("config.common.image.entity_parameters")})} + ${this._renderNumberInput(n,{label:l("config.common.image.refresh_seconds")})} + `}_renderCamera(e,a,t,i){const n=[{value:"",label:""},{value:"auto",label:l("config.cameras.live_providers.auto")},{value:"ha",label:l("config.cameras.live_providers.ha")},{value:"image",label:l("config.cameras.live_providers.image")},{value:"jsmpeg",label:l("config.cameras.live_providers.jsmpeg")},{value:"go2rtc",label:l("config.cameras.live_providers.go2rtc")},{value:"webrtc-card",label:l("config.cameras.live_providers.webrtc-card")}],s=[];e.forEach(((e,t)=>{t!==a&&s.push({value:ee(e),label:this._getEditorCameraTitle(t,e)})}));const c=e=>{if(this._config){const a=m(this._config);e(a)&&this._updateConfig(a)}},d={submenu:!0,selected:this._expandedMenus[gi]===a};return o` +
+ + ${this._expandedMenus[gi]===a?o`
+
+ !i&&c((e=>!!(Array.isArray(e.cameras)&&a>0)&&(mt(e.cameras,a,a-1),this._openMenu(gi,a-1),!0)))} + > + + + =this._config.cameras.length-1} + @click=${()=>!i&&c((e=>!!(Array.isArray(e.cameras)&&a + + + {c((e=>!!Array.isArray(e.cameras)&&(e.cameras.splice(a,1),this._closeMenu(gi),!0)))}} + > + + +
+ ${this._renderEntitySelector(ae(ut,a),"camera")} + ${this._renderOptionSelector(ae(ht,a),n)} + ${this._renderStringInput(ae(_t,a))} + ${this._renderIconSelector(ae(gt,a),{label:l("config.cameras.icon")})} + ${this._renderStringInput(ae(bt,a))} + ${this._putInSubmenu("cameras.engine",!0,"config.cameras.engines.editor_label","mdi:engine",o`${this._putInSubmenu("cameras.frigate",a,"config.cameras.frigate.editor_label","frigate",o` + ${this._renderStringInput(ae(pt,a))} + ${this._renderStringInput(ae(vt,a))} + ${this._renderOptionSelector(ae(ft,a),[],{multiple:!0,label:l("config.cameras.frigate.labels")})} + ${this._renderOptionSelector(ae($t,a),[],{multiple:!0,label:l("config.cameras.frigate.zones")})} + ${this._renderStringInput(ae(yt,a))} + `)} + ${this._putInSubmenu("cameras.motioneye",a,"config.cameras.motioneye.editor_label","motioneye",o` ${this._renderStringInput(ae(wt,a))} + ${this._renderStringInput(ae(St,a))} + ${this._renderStringInput(ae(xt,a))} + ${this._renderStringInput(ae(Mt,a))} + ${this._renderStringInput(ae(It,a))}`)} + ${this._putInSubmenu("cameras.reolink",a,"config.cameras.reolink.editor_label","reolink",o` ${this._renderStringInput(ae(kt,a))} + ${this._renderOptionSelector(ae(Ot,a),this._reolinkMediaResolution,{label:l("config.cameras.reolink.media_resolution.editor_label")})}`)}`)} + ${this._putInSubmenu("cameras.live_provider",!0,"config.cameras.live_provider_options.editor_label","mdi:cctv",o` ${this._putInSubmenu("cameras.go2rtc",a,"config.cameras.go2rtc.editor_label","mdi:alpha-g-circle",o`${this._renderOptionSelector(ae(Ct,a),this._go2rtcModes,{multiple:!0,label:l("config.cameras.go2rtc.modes.editor_label")})} + ${this._renderStringInput(ae(zt,a))}`)} + ${this._putInSubmenu("cameras.image",!0,"config.cameras.image.editor_label","mdi:image",this._renderImageOptions(ae(At,a),ae(Nt,a),ae(Tt,a),ae(Bt,a),ae(Et,a)))} + ${this._putInSubmenu("cameras.webrtc_card",a,"config.cameras.webrtc_card.editor_label","mdi:webrtc",o`${this._renderEntitySelector(ae(Pt,a),"camera")} + ${this._renderStringInput(ae(Ht,a))}`)}`)} + ${this._putInSubmenu("cameras.dependencies",a,"config.cameras.dependencies.editor_label","mdi:graph",o` ${this._renderSwitch(ae(Lt,a),this._defaults.cameras.dependencies.all_cameras)} + ${this._renderOptionSelector(ae(Vt,a),s,{multiple:!0})}`)} + ${this._putInSubmenu("cameras.triggers",a,"config.cameras.triggers.editor_label","mdi:magnify-scan",o` + ${this._renderSwitch(ae(Kt,a),this._defaults.cameras.triggers.occupancy)} + ${this._renderSwitch(ae(Ut,a),this._defaults.cameras.triggers.motion)} + ${this._renderOptionSelector(ae(jt,a),t,{multiple:!0})} + ${this._renderOptionSelector(ae(qt,a),this._triggersEvents,{multiple:!0,label:l("config.cameras.triggers.events.editor_label")})} + `)} + ${this._putInSubmenu("cameras.cast",a,"config.cameras.cast.editor_label","mdi:cast",o` + ${this._renderOptionSelector(ae(Rt,a),this._castMethods)} + ${this._renderStringInput(ae(Dt,a))} + ${this._renderStringInput(ae(Ft,a))} + `)} + ${this._putInSubmenu("cameras.dimensions",a,"config.cameras.dimensions.editor_label","mdi:aspect-ratio",o` + ${this._renderStringInput(ae(Gt,a))} + ${this._renderMediaLayout("cameras.dimensions.layout","config.cameras.dimensions.layout.editor_label",ae(Jt,a),ae(Qt,a),ae(Wt,a),ae(Xt,a),ae(Yt,a),ae(Zt,a),ae(ei,a),ae(ai,a),ae(ti,a),ae(ii,a))} + `)} + ${this._putInSubmenu("cameras.capabilities",a,"config.cameras.capabilities.editor_label","mdi:cog-stop",o` + ${this._renderOptionSelector(ae(ni,a),this._capabilities,{multiple:!0})} + ${this._renderOptionSelector(ae(si,a),this._capabilities,{multiple:!0})} + `)} + ${this._putInSubmenu("cameras.proxy",a,"config.cameras.proxy.editor_label","mdi:arrow-decision",o` + ${this._renderOptionSelector(ae(oi,a),this._proxyMedia,{label:l("config.cameras.proxy.media.editor_label")})} + ${this._renderSwitch(ae(ri,a),this._defaults.cameras.proxy.dynamic)} + ${this._renderOptionSelector(ae(li,a),this._proxySSLVerification,{label:l("config.cameras.proxy.ssl_verification.editor_label")})} + ${this._renderOptionSelector(ae(ci,a),this._proxySSLCiphers,{label:l("config.cameras.proxy.ssl_ciphers.editor_label")})} + `)} +
`:""} +
+ `}_renderStringInput(e,a){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_renderSwitch(e,a,t){if(this._config)return o` + this._valueChangedHandler(e,a)} + > + + `}_updateConfig(e){this._config=e,te(this,"config-changed",{config:this._config})}render(){if(!this.hass||!this._config)return o``;const e=x(this.hass),a=b(this._config,mi)||[];return o` + ${this._configUpgradeable?o`
+ ${l("editor.upgrade_available")} + + {if(this._config){const e=m(this._config);ie(e),this._updateConfig(e)}}} + > + + +
+
`:o``} +
+ ${this._renderOptionSetHeader("cameras")} + ${"cameras"===this._expandedMenus[bi]?o` +
+ ${a.map(((t,i)=>this._renderCamera(a,i,e)))} + ${this._renderCamera(a,a.length,e,!0)} +
+ `:""} + ${this._renderOptionSetHeader("profiles")} + ${"profiles"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ne,this._profiles,{multiple:!0,label:l("config.profiles.editor_label")})} +
`:""} + ${this._renderOptionSetHeader("view")} + ${"view"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(se,this._viewModes)} + ${this._renderOptionSelector(oe,this._cameraSelectViewModes)} + ${this._renderOptionSelector(re,this._darkModes)} + ${this._renderNumberInput(le)} + ${this._renderSwitch(ce,this._defaults.view.default_cycle_camera)} + ${this._renderViewDefaultResetMenu()} ${this._renderViewTriggersMenu()} + ${this._renderViewKeyboardShortcutMenu()} +
+ `:""} + ${this._renderOptionSetHeader("menu")} + ${"menu"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(de,this._menuStyles)} + ${this._renderOptionSelector(me,this._menuPositions)} + ${this._renderOptionSelector(ue,this._menuAlignments)} + ${this._renderNumberInput(he,{min:X})} + ${this._renderMenuButton("frigate")} + ${this._renderMenuButton("cameras")} + ${this._renderMenuButton("substreams")} + ${this._renderMenuButton("live")} + ${this._renderMenuButton("clips")} + ${this._renderMenuButton("snapshots")} + ${this._renderMenuButton("recordings")} + ${this._renderMenuButton("image")} + ${this._renderMenuButton("download")} + ${this._renderMenuButton("camera_ui")} + ${this._renderMenuButton("fullscreen")} + ${this._renderMenuButton("expand")} + ${this._renderMenuButton("timeline")} + ${this._renderMenuButton("media_player")} + ${this._renderMenuButton("microphone",o`${this._renderOptionSelector(`${R}.microphone.type`,this._microphoneButtonTypes,{label:l("config.menu.buttons.type")})}`)} + ${this._renderMenuButton("play")} + ${this._renderMenuButton("mute")} + ${this._renderMenuButton("screenshot")} + ${this._renderMenuButton("display_mode")} + ${this._renderMenuButton("ptz_controls")} + ${this._renderMenuButton("ptz_home")} +
+ `:""} + ${this._renderOptionSetHeader("status_bar")} + ${"status_bar"===this._expandedMenus[bi]?o` +
+ ${this._renderOptionSelector(_e,this._statusBarStyles)} + ${this._renderOptionSelector(ge,this._statusBarPositions)} + ${this._renderNumberInput(be,{min:pe,label:l("config.status_bar.height")})} + ${this._renderNumberInput(ve,{min:0,max:60,default:this._defaults.status_bar.popup_seconds,label:l("config.status_bar.popup_seconds")})} + ${this._renderStatusBarItem("title")} + ${this._renderStatusBarItem("resolution")} + ${this._renderStatusBarItem("technology")} + ${this._renderStatusBarItem("engine")} +
+ `:""} + ${this._renderOptionSetHeader("live")} + ${"live"===this._expandedMenus[bi]?o` +
+ ${this._renderSwitch(fe,this._defaults.live.preload)} + ${this._renderSwitch($e,this._defaults.live.draggable)} + ${this._renderSwitch(ye,this._defaults.live.zoomable)} + ${this._renderSwitch(we,this._defaults.live.lazy_load)} + ${this._renderOptionSelector(Se,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(xe,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(Me,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(Ie,this._mediaLiveMuteConditions,{multiple:!0})} + ${this._renderOptionSelector(ke,this._mediaLiveUnmuteConditions,{multiple:!0})} + ${this._renderOptionSelector(Oe,this._transitionEffects)} + ${this._renderSwitch(Ce,this._defaults.live.show_image_during_load)} + ${this._renderViewDisplay("live.display",ze,Ae,Ne,Te)} + ${this._putInSubmenu("live.controls",!0,"config.live.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Be,this._defaults.live.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("live.controls.next_previous",Ee,Pe,{allowIcons:!0})} + ${this._renderThumbnailsControls("live.controls.thumbnails",He,Le,Ve,Ke,Ue,this._defaults.live.controls.thumbnails,{configPathMediaType:je,configPathEventsMediaType:qe,configPathMode:Re})} + ${this._renderMiniTimeline("live.controls.timeline",De,Fe,Ge,Je,Qe,We,this._defaults.live.controls.timeline.show_recordings,Xe)} + ${this._putInSubmenu("live.controls.ptz",!0,"config.live.controls.ptz.editor_label","mdi:pan",o` + ${this._renderOptionSelector(Ye,this._ptzModes)} + ${this._renderOptionSelector(Ze,this._ptzPositions)} + ${this._renderOptionSelector(ea,this._ptzOrientations)} + ${this._renderSwitch(aa,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_pan_tilt")})} + ${this._renderSwitch(ta,this._defaults.live.controls.ptz.hide_pan_tilt,{label:l("config.live.controls.ptz.hide_zoom")})} + ${this._renderSwitch(ia,this._defaults.live.controls.ptz.hide_home,{label:l("config.live.controls.ptz.hide_home")})} + `)} + `)} + ${this._putInSubmenu("live.microphone",!0,"config.live.microphone.editor_label","mdi:microphone",o` + ${this._renderNumberInput(na)} + ${this._renderSwitch(sa,this._defaults.live.microphone.always_connected)} + ${this._renderNumberInput(oa)} + `)} +
+ `:""} + ${this._renderOptionSetHeader("media_gallery")} + ${"media_gallery"===this._expandedMenus[bi]?o`
+ ${this._renderThumbnailsControls("media_gallery.controls.thumbnails",ra,la,ca,da,ma,this._defaults.media_gallery.controls.thumbnails)} + ${this._renderFilterControls("media_gallery.controls.filter",ua)} +
`:""} + ${this._renderOptionSetHeader("media_viewer")} + ${"media_viewer"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(ha,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderOptionSelector(_a,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ga,this._mediaActionNegativeConditions,{multiple:!0})} + ${this._renderOptionSelector(ba,this._mediaActionPositiveConditions,{multiple:!0})} + ${this._renderSwitch(pa,this._defaults.media_viewer.draggable)} + ${this._renderSwitch(va,this._defaults.media_viewer.zoomable)} + ${this._renderSwitch(fa,this._defaults.media_viewer.lazy_load)} + ${this._renderOptionSelector($a,this._transitionEffects)} + ${this._renderSwitch(ya,this._defaults.media_viewer.snapshot_click_plays_clip)} + ${this._renderViewDisplay("media_viewer.display",wa,Sa,xa,Ma)} + ${this._putInSubmenu("media_viewer.controls",!0,"config.media_viewer.controls.editor_label","mdi:gamepad",o` + ${this._renderSwitch(Ia,this._defaults.media_viewer.controls.builtin,{label:l("config.common.controls.builtin")})} + ${this._renderNextPreviousControls("media_viewer.controls.next_previous",ka,Oa,{allowThumbnails:!0})} + ${this._renderThumbnailsControls("media_viewer.controls.thumbnails",Ca,za,Aa,Na,Ta,this._defaults.media_viewer.controls.thumbnails,{configPathMode:Ba})} + ${this._renderMiniTimeline("media_viewer.controls.timeline",Ea,Pa,Ha,La,Va,Ka,this._defaults.media_viewer.controls.timeline.show_recordings,Ua)} + `)} +
`:""} + ${this._renderOptionSetHeader("image")} + ${"image"===this._expandedMenus[bi]?o`
+ ${this._renderImageOptions(ja,qa,Ra,Da,Fa)} +
`:""} + ${this._renderOptionSetHeader("timeline")} + ${"timeline"===this._expandedMenus[bi]?o`
+ ${this._renderTimelineCoreControls(F,G,J,Q,W,this._defaults.timeline.show_recordings)} + ${this._renderThumbnailsControls("timeline.controls.thumbnails",Ga,Ja,Qa,Wa,Xa,this._defaults.timeline.controls.thumbnails,{configPathMode:Ya})} +
`:""} + ${this._renderOptionSetHeader("dimensions")} + ${"dimensions"===this._expandedMenus[bi]?o`
+ ${this._renderOptionSelector(Za,this._aspectRatioModes)} + ${this._renderStringInput(et)} + ${this._renderStringInput(at)} +
`:""} + ${this._renderOptionSetHeader("performance","low"===b(this._config,ui)?"warning":void 0)} + ${"performance"===this._expandedMenus[bi]?o`
+ ${"low"===b(this._config,ui)?this._renderInfo(l("config.performance.warning")):o``} + ${this._putInSubmenu("performance.features",!0,"config.performance.features.editor_label","mdi:feature-search",o` + ${this._renderSwitch(tt,this._defaults.performance.features.animated_progress_indicator)} + ${this._renderNumberInput(it,{max:nt})} + ${this._renderNumberInput(st,{min:1})} + `)} + ${this._putInSubmenu("performance.style",!0,"config.performance.style.editor_label","mdi:palette-swatch-variant",o` + ${this._renderSwitch(ot,this._defaults.performance.style.border_radius)} + ${this._renderSwitch(rt,this._defaults.performance.style.box_shadow)} + `)} +
`:""} + ${void 0!==this._config.overrides?o` ${this._renderOptionSetHeader("overrides")} + ${"overrides"===this._expandedMenus[bi]?o`
+ ${this._renderInfo(l("config.overrides.info"))} +
`:""}`:o``} +
+ `}_closeMenu(e){delete this._expandedMenus[e],this.requestUpdate()}_openMenu(e,a){this._expandedMenus[e]=a,this.requestUpdate()}_toggleMenu(e){if(e&&e.target){const a=e.target.domain,t=e.target.key;this._expandedMenus[a]===t?this._closeMenu(a):this._openMenu(a,t)}}_valueChangedHandler(e,a){if(!this._config||!this.hass)return;let t;if(a.detail&&void 0!==a.detail.value&&(t=a.detail.value,"string"==typeof t&&(t=t.trim())),b(this._config,e)===t)return;const i=m(this._config);""===t||void 0===t?lt(i,e):ct(i,e,t),this._updateConfig(i)}static get styles(){return c('ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n.option {\n padding: 4px 4px;\n cursor: pointer;\n}\n\n.option.option-overrides .title {\n color: var(--warning-color);\n}\n\n.row {\n display: flex;\n margin-bottom: -14px;\n pointer-events: none;\n}\n\n.title {\n padding-left: 16px;\n margin-top: -6px;\n pointer-events: none;\n}\n\n.title.warning {\n color: var(--warning-color);\n}\n\n.secondary {\n padding-left: 40px;\n color: var(--secondary-text-color);\n pointer-events: none;\n}\n\n.values {\n background: var(--secondary-background-color);\n display: grid;\n}\n\n.values + .option,\n.submenu + .option {\n margin-top: 10px;\n}\n\ndiv.upgrade {\n width: auto;\n border: 1px dotted var(--primary-color);\n margin: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\ndiv.upgrade span {\n padding: 10px;\n}\n\n.submenu-header {\n display: flex;\n padding: 10px;\n cursor: pointer;\n}\n\n.submenu.selected > .submenu-header {\n background-color: var(--primary-color);\n color: var(--primary-text-color);\n}\n\n.submenu-header * {\n flex-basis: auto;\n pointer-events: none;\n}\n\n.submenu-header .new-camera {\n font-style: italic;\n}\n\n.submenu:not(.selected) > .submenu-header .new-camera {\n color: var(--secondary-text-color, "black");\n}\n\n.submenu-header ha-icon,\n.submenu-header img {\n padding-right: 15px;\n}\n\n.submenu.selected {\n border: 1px solid var(--primary-color);\n}\n\n.submenu {\n width: calc(100% - 20px);\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 10px;\n}\n\n.submenu:first-child,\n:not(.submenu) + .submenu {\n margin-top: 10px;\n}\n\n.submenu .controls {\n display: inline-block;\n margin-left: auto;\n margin-right: 0px;\n margin-bottom: 5px;\n}\n\n.submenu .controls ha-icon-button.button {\n --mdc-icon-button-size: 32px;\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\nspan.info {\n padding: 10px;\n}\n\nha-selector {\n padding: 10px;\n border: 1px solid var(--divider-color);\n}')}};t([i({attribute:!1})],vi.prototype,"hass",void 0),t([d()],vi.prototype,"_config",void 0),t([d()],vi.prototype,"_defaults",void 0),t([d()],vi.prototype,"_expandedMenus",void 0),vi=t([n("frigate-card-editor")],vi);export{vi as FrigateCardEditor}; diff --git a/www/community/frigate-hass-card/editor-ce460dd0.js.gz b/www/community/frigate-hass-card/editor-ce460dd0.js.gz new file mode 100644 index 00000000..66c308d7 Binary files /dev/null and b/www/community/frigate-hass-card/editor-ce460dd0.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-086a6977.js b/www/community/frigate-hass-card/endOfDay-086a6977.js new file mode 100644 index 00000000..21673a2a --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-086a6977.js @@ -0,0 +1 @@ +import{c$ as r}from"./card-320adb66.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-086a6977.js.gz b/www/community/frigate-hass-card/endOfDay-086a6977.js.gz new file mode 100644 index 00000000..614b68dd Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-086a6977.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-0c5086cb.js b/www/community/frigate-hass-card/endOfDay-0c5086cb.js new file mode 100644 index 00000000..9f7c52e3 --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-0c5086cb.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-7cd05290.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-0c5086cb.js.gz b/www/community/frigate-hass-card/endOfDay-0c5086cb.js.gz new file mode 100644 index 00000000..020a929c Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-0c5086cb.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-24d35e3f.js b/www/community/frigate-hass-card/endOfDay-24d35e3f.js new file mode 100644 index 00000000..94c721c6 --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-24d35e3f.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-45855f1f.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-24d35e3f.js.gz b/www/community/frigate-hass-card/endOfDay-24d35e3f.js.gz new file mode 100644 index 00000000..791c651b Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-24d35e3f.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-8be4da1b.js b/www/community/frigate-hass-card/endOfDay-8be4da1b.js new file mode 100644 index 00000000..2363a99e --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-8be4da1b.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-09c4bade.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-8be4da1b.js.gz b/www/community/frigate-hass-card/endOfDay-8be4da1b.js.gz new file mode 100644 index 00000000..30269669 Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-8be4da1b.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-97ae2cc7.js b/www/community/frigate-hass-card/endOfDay-97ae2cc7.js new file mode 100644 index 00000000..3e58ebe8 --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-97ae2cc7.js @@ -0,0 +1 @@ +import{d3 as r}from"./card-c642ee74.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-97ae2cc7.js.gz b/www/community/frigate-hass-card/endOfDay-97ae2cc7.js.gz new file mode 100644 index 00000000..df180664 Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-97ae2cc7.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-a0fc225b.js b/www/community/frigate-hass-card/endOfDay-a0fc225b.js new file mode 100644 index 00000000..3250553d --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-a0fc225b.js @@ -0,0 +1 @@ +import{c$ as r}from"./card-0be2c6a9.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-a0fc225b.js.gz b/www/community/frigate-hass-card/endOfDay-a0fc225b.js.gz new file mode 100644 index 00000000..63116593 Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-a0fc225b.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-a3114e3f.js b/www/community/frigate-hass-card/endOfDay-a3114e3f.js new file mode 100644 index 00000000..21eb775b --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-a3114e3f.js @@ -0,0 +1 @@ +import{d4 as r}from"./card-4e88bdfb.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-a3114e3f.js.gz b/www/community/frigate-hass-card/endOfDay-a3114e3f.js.gz new file mode 100644 index 00000000..0843a9ce Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-a3114e3f.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-cfc9c86c.js b/www/community/frigate-hass-card/endOfDay-cfc9c86c.js new file mode 100644 index 00000000..21a501ad --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-cfc9c86c.js @@ -0,0 +1 @@ +import{c_ as r}from"./card-e5d55e5b.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-cfc9c86c.js.gz b/www/community/frigate-hass-card/endOfDay-cfc9c86c.js.gz new file mode 100644 index 00000000..711de402 Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-cfc9c86c.js.gz differ diff --git a/www/community/frigate-hass-card/endOfDay-da61af46.js b/www/community/frigate-hass-card/endOfDay-da61af46.js new file mode 100644 index 00000000..d0be7ef8 --- /dev/null +++ b/www/community/frigate-hass-card/endOfDay-da61af46.js @@ -0,0 +1 @@ +import{c$ as r}from"./card-19444f74.js";function o(o){const s=r(o);return s.setHours(23,59,59,999),s}export{o as e}; diff --git a/www/community/frigate-hass-card/endOfDay-da61af46.js.gz b/www/community/frigate-hass-card/endOfDay-da61af46.js.gz new file mode 100644 index 00000000..6423a3ad Binary files /dev/null and b/www/community/frigate-hass-card/endOfDay-da61af46.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-30ea0cd0.js b/www/community/frigate-hass-card/endpoint-30ea0cd0.js new file mode 100644 index 00000000..0bc1db5d --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-30ea0cd0.js @@ -0,0 +1 @@ +import{dq as t,d7 as n}from"./card-0be2c6a9.js";const r=async(r,a,e)=>{if(!a.sign)return a.endpoint;let s;try{s=await t(r,a.endpoint,e)}catch(t){n(t)}return s?s.replace(/^http/i,"ws"):null};export{r as c}; diff --git a/www/community/frigate-hass-card/endpoint-30ea0cd0.js.gz b/www/community/frigate-hass-card/endpoint-30ea0cd0.js.gz new file mode 100644 index 00000000..8352609f Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-30ea0cd0.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-760ea36f.js b/www/community/frigate-hass-card/endpoint-760ea36f.js new file mode 100644 index 00000000..530d2b54 --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-760ea36f.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-7cd05290.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/www/community/frigate-hass-card/endpoint-760ea36f.js.gz b/www/community/frigate-hass-card/endpoint-760ea36f.js.gz new file mode 100644 index 00000000..ebb9dc77 Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-760ea36f.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-a6d38c7a.js b/www/community/frigate-hass-card/endpoint-a6d38c7a.js new file mode 100644 index 00000000..408311d9 --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-a6d38c7a.js @@ -0,0 +1 @@ +import{dq as t,d7 as n}from"./card-320adb66.js";const r=async(r,a,e)=>{if(!a.sign)return a.endpoint;let s;try{s=await t(r,a.endpoint,e)}catch(t){n(t)}return s?s.replace(/^http/i,"ws"):null};export{r as c}; diff --git a/www/community/frigate-hass-card/endpoint-a6d38c7a.js.gz b/www/community/frigate-hass-card/endpoint-a6d38c7a.js.gz new file mode 100644 index 00000000..0c34b712 Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-a6d38c7a.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-c9cec68c.js b/www/community/frigate-hass-card/endpoint-c9cec68c.js new file mode 100644 index 00000000..9ba5a795 --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-c9cec68c.js @@ -0,0 +1 @@ +import{dp as t,d6 as n}from"./card-e5d55e5b.js";const r=async(r,a,e)=>{if(!a.sign)return a.endpoint;let s;try{s=await t(r,a.endpoint,e)}catch(t){n(t)}return s?s.replace(/^http/i,"ws"):null};export{r as c}; diff --git a/www/community/frigate-hass-card/endpoint-c9cec68c.js.gz b/www/community/frigate-hass-card/endpoint-c9cec68c.js.gz new file mode 100644 index 00000000..3f8e1391 Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-c9cec68c.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-cc3caf82.js b/www/community/frigate-hass-card/endpoint-cc3caf82.js new file mode 100644 index 00000000..187ccce3 --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-cc3caf82.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-c642ee74.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/www/community/frigate-hass-card/endpoint-cc3caf82.js.gz b/www/community/frigate-hass-card/endpoint-cc3caf82.js.gz new file mode 100644 index 00000000..8273b728 Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-cc3caf82.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-cd945bd3.js b/www/community/frigate-hass-card/endpoint-cd945bd3.js new file mode 100644 index 00000000..7aa47b86 --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-cd945bd3.js @@ -0,0 +1 @@ +import{dq as t,d7 as n}from"./card-19444f74.js";const r=async(r,a,e)=>{if(!a.sign)return a.endpoint;let s;try{s=await t(r,a.endpoint,e)}catch(t){n(t)}return s?s.replace(/^http/i,"ws"):null};export{r as c}; diff --git a/www/community/frigate-hass-card/endpoint-cd945bd3.js.gz b/www/community/frigate-hass-card/endpoint-cd945bd3.js.gz new file mode 100644 index 00000000..91fd3b36 Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-cd945bd3.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-e6c464c5.js b/www/community/frigate-hass-card/endpoint-e6c464c5.js new file mode 100644 index 00000000..53695937 --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-e6c464c5.js @@ -0,0 +1 @@ +import{dv as r,dc as t,cQ as n,l as a}from"./card-4e88bdfb.js";const e=async(e,s,i,c)=>{if(!i.sign)return i.endpoint;let l;try{l=await r(s,i.endpoint,c)}catch(r){return t(r),null}return l?l.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/www/community/frigate-hass-card/endpoint-e6c464c5.js.gz b/www/community/frigate-hass-card/endpoint-e6c464c5.js.gz new file mode 100644 index 00000000..7ec56284 Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-e6c464c5.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-e9cb8034.js b/www/community/frigate-hass-card/endpoint-e9cb8034.js new file mode 100644 index 00000000..a15c8d0b --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-e9cb8034.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-09c4bade.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/www/community/frigate-hass-card/endpoint-e9cb8034.js.gz b/www/community/frigate-hass-card/endpoint-e9cb8034.js.gz new file mode 100644 index 00000000..29743d78 Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-e9cb8034.js.gz differ diff --git a/www/community/frigate-hass-card/endpoint-f74ef6db.js b/www/community/frigate-hass-card/endpoint-f74ef6db.js new file mode 100644 index 00000000..757d0868 --- /dev/null +++ b/www/community/frigate-hass-card/endpoint-f74ef6db.js @@ -0,0 +1 @@ +import{du as r,db as t,cQ as n,l as a}from"./card-45855f1f.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g}; diff --git a/www/community/frigate-hass-card/endpoint-f74ef6db.js.gz b/www/community/frigate-hass-card/endpoint-f74ef6db.js.gz new file mode 100644 index 00000000..598d62a5 Binary files /dev/null and b/www/community/frigate-hass-card/endpoint-f74ef6db.js.gz differ diff --git a/www/community/frigate-hass-card/engine-86b0096c.js b/www/community/frigate-hass-card/engine-86b0096c.js new file mode 100644 index 00000000..e0a518f7 --- /dev/null +++ b/www/community/frigate-hass-card/engine-86b0096c.js @@ -0,0 +1 @@ +const e=1e4;export{e as C}; diff --git a/www/community/frigate-hass-card/engine-86b0096c.js.gz b/www/community/frigate-hass-card/engine-86b0096c.js.gz new file mode 100644 index 00000000..0ebfccb7 Binary files /dev/null and b/www/community/frigate-hass-card/engine-86b0096c.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js b/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js new file mode 100644 index 00000000..2e8470b0 --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-c642ee74.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-bb62ddef.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-4de961cf.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js.gz b/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js.gz new file mode 100644 index 00000000..246e4beb Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-1cc4bb56.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-3f150159.js b/www/community/frigate-hass-card/engine-frigate-3f150159.js new file mode 100644 index 00000000..24965393 --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-3f150159.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-45855f1f.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-31c14ad9.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-5e3c525d.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-3f150159.js.gz b/www/community/frigate-hass-card/engine-frigate-3f150159.js.gz new file mode 100644 index 00000000..a87fa286 Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-3f150159.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-6500f302.js b/www/community/frigate-hass-card/engine-frigate-6500f302.js new file mode 100644 index 00000000..62598473 --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-6500f302.js @@ -0,0 +1,3 @@ +import{c$ as e,dX as t,dY as n,dZ as a,d_ as r,d$ as i,l as s,e0 as o,e1 as c,e2 as g,e3 as l,d7 as u,dQ as m,k as d,i as f,dd as h,e4 as p,dj as _,d5 as y,d3 as b,e5 as w,e6 as D,e7 as C,dN as v,j as T,e8 as I,d8 as S,da as M,d9 as F}from"./card-0be2c6a9.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-9f6fcaee.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-a7cc256c.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function X(e,t){const n=function(e){if(!K[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;K[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return K[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-6500f302.js.gz b/www/community/frigate-hass-card/engine-frigate-6500f302.js.gz new file mode 100644 index 00000000..8f43fa70 Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-6500f302.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-69a32a9e.js b/www/community/frigate-hass-card/engine-frigate-69a32a9e.js new file mode 100644 index 00000000..57802294 --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-69a32a9e.js @@ -0,0 +1,3 @@ +import{c$ as e,dX as t,dY as n,dZ as a,d_ as r,d$ as i,l as s,e0 as o,e1 as c,e2 as g,e3 as l,d7 as u,dQ as m,k as d,i as f,dd as h,e4 as p,dj as _,d5 as y,d3 as b,e5 as w,e6 as D,e7 as C,dN as v,j as T,e8 as I,d8 as S,da as M,d9 as F}from"./card-320adb66.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-39deaa91.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-b41e160a.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function X(e,t){const n=function(e){if(!K[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;K[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return K[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-69a32a9e.js.gz b/www/community/frigate-hass-card/engine-frigate-69a32a9e.js.gz new file mode 100644 index 00000000..cfe1eb07 Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-69a32a9e.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-7cd5392b.js b/www/community/frigate-hass-card/engine-frigate-7cd5392b.js new file mode 100644 index 00000000..3c65f46b --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-7cd5392b.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-09c4bade.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-458c9005.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-7a3519fb.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-7cd5392b.js.gz b/www/community/frigate-hass-card/engine-frigate-7cd5392b.js.gz new file mode 100644 index 00000000..f8c3771a Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-7cd5392b.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js b/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js new file mode 100644 index 00000000..52621318 --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js @@ -0,0 +1,3 @@ +import{d3 as e,d_ as t,d$ as n,e0 as a,e1 as r,e2 as i,l as s,e3 as o,e4 as c,e5 as g,e6 as l,db as u,dT as m,k as d,i as f,dh as h,e7 as p,dn as _,d9 as y,d7 as b,e8 as w,e9 as D,ea as C,dQ as v,j as T,eb as I,dc as S,de as M,dd as F}from"./card-7cd05290.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-96b32038.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-f3ea02fd.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js.gz b/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js.gz new file mode 100644 index 00000000..acafcbb6 Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-a6e3bd9e.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-b057d766.js b/www/community/frigate-hass-card/engine-frigate-b057d766.js new file mode 100644 index 00000000..323a919f --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-b057d766.js @@ -0,0 +1,3 @@ +import{c$ as e,dX as t,dY as n,dZ as a,d_ as r,d$ as i,l as s,e0 as o,e1 as c,e2 as g,e3 as l,d7 as u,dQ as m,k as d,i as f,dd as h,e4 as p,dj as _,d5 as y,d3 as b,e5 as w,e6 as D,e7 as C,dN as v,j as T,e8 as I,d8 as S,da as M,d9 as F}from"./card-19444f74.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-7a4c33a6.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-6c14b2a5.js";function j(t){return e(1e3*t)}const Z=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),q=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),U=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:q.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,Z,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function X(e,t){const n=function(e){if(!K[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;K[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return K[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,U,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-b057d766.js.gz b/www/community/frigate-hass-card/engine-frigate-b057d766.js.gz new file mode 100644 index 00000000..b96902d7 Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-b057d766.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-be325e58.js b/www/community/frigate-hass-card/engine-frigate-be325e58.js new file mode 100644 index 00000000..d3a3d6b8 --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-be325e58.js @@ -0,0 +1,3 @@ +import{c_ as e,dW as t,dX as n,dY as a,dZ as r,d_ as i,l as s,d$ as o,e0 as c,e1 as g,e2 as l,d6 as u,dP as m,k as d,i as f,dc as h,e3 as p,di as _,d4 as y,d2 as b,e4 as w,e5 as D,e6 as C,dM as v,j as T,d7 as I,d9 as S,d8 as M}from"./card-e5d55e5b.js";import{C as F}from"./engine-86b0096c.js";import{C as $,G as z,g as N}from"./engine-generic-93cdbee6.js";import{a as E,V as R}from"./media-c9012082.js";import{s as Y,e as x}from"./startOfHour-34edc6a8.js";function H(t){return e(1e3*t)}const j=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),Z=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),q=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:Z.array()}).array(),U=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),W=n.object({success:n.boolean(),message:n.string()}),Q=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),k=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),A=n.object({before:k,after:k,type:n.enum(["new","update","end"])});const O=async(e,t)=>await r(e,j,{type:"frigate/events/get",...t},!0),L=e=>"birdseye"===e.frigate.camera_name;class V extends ${constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=L(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||L(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class G{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=A.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function J(e,t){const n=function(e){if(!B[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;B[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return B[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function ie(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const se={};function oe(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ce=36e5,ge=6e4,le=2,ue={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function me(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?le:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=ue.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=ue.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=ue.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=ue.YYY[t],a=ue.YYYYY[t];let r=ue.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=ue.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=ue.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,_e(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=ue.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=pe(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=ue.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return _e(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=ue.Www.exec(e),i)return r=parseInt(i[1],10)-1,ye(r)?de(t,r):new Date(NaN);if(i=ue.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return ye(r,e)?de(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=ue.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),be(t)?t%24*ce:NaN;if(a=ue.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),be(t,n)?t%24*ce+n*ge:NaN;if(a=ue.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return be(t,n,e)?t%24*ce+n*ge+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=ae(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=oe(new Date(e+r)),n=oe(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function de(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const fe=[31,28,31,30,31,30,31,31,30,31,30,31],he=[31,29,31,30,31,30,31,31,30,31,30,31];function pe(e){return e%400==0||e%4==0&&e%100!=0}function _e(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=pe(e);if(a&&n>he[t])return!1;if(!a&&n>fe[t])return!1}return!0}function ye(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function be(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const we=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=ae(t,e=me(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class De extends E{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return H(this._event.start_time)}getEndTime(){return this._event.end_time?H(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return R.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return we(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class Ce extends E{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return R.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class ve{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new De(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new Ce("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Te{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof De}static isFrigateRecording(e){return e instanceof Ce}}class Ie{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Se extends z{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new G,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new V(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Te.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Te.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Te.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,W,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??F},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await O(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,q,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=Y(n),r=x(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=I(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,U,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Ie.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=ve.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Ie.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=ve.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||L(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,Q,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Ie.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(S(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Ie.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,H(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=H(r.start_time);if(n>t)break;const i=H(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",engineIcon:"frigate"}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+M(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=N(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Se as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-be325e58.js.gz b/www/community/frigate-hass-card/engine-frigate-be325e58.js.gz new file mode 100644 index 00000000..b712df21 Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-be325e58.js.gz differ diff --git a/www/community/frigate-hass-card/engine-frigate-f4a9d103.js b/www/community/frigate-hass-card/engine-frigate-f4a9d103.js new file mode 100644 index 00000000..266c1b1c --- /dev/null +++ b/www/community/frigate-hass-card/engine-frigate-f4a9d103.js @@ -0,0 +1,3 @@ +import{d4 as e,d$ as t,e0 as n,e1 as a,e2 as r,e3 as i,l as s,e4 as o,e5 as c,e6 as g,e7 as l,dc as u,dU as m,k as d,i as f,di as h,e8 as p,dp as _,da as y,d8 as b,e9 as w,ea as D,eb as C,dR as v,j as T,ec as I,dd as S,df as M,de as F}from"./card-4e88bdfb.js";import{C as $}from"./engine-86b0096c.js";import{C as z,G as N,g as E}from"./engine-generic-16943492.js";import{a as R,V as Y}from"./media-c9012082.js";import{s as x,e as H}from"./startOfHour-25fb979a.js";function j(t){return e(1e3*t)}const U=n.object({camera:n.string(),end_time:n.number().nullable(),false_positive:n.boolean().nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),id:n.string(),label:n.string(),sub_label:n.string().nullable(),start_time:n.number(),top_score:n.number().nullable(),zones:n.string().array(),retain_indefinitely:n.boolean().optional()}).array(),Z=n.object({hour:n.preprocess((e=>Number(e)),n.number().min(0).max(23)),duration:n.number().min(0),events:n.number().min(0)}),q=n.object({day:n.preprocess((e=>"string"==typeof e?a(e):e),n.date()),events:n.number(),hours:Z.array()}).array(),W=n.object({start_time:n.number(),end_time:n.number(),id:n.string()}).array(),Q=n.object({success:n.boolean(),message:n.string()}),k=n.object({camera:n.string(),day:n.string(),label:n.string(),sub_label:n.string().nullable(),zones:n.string().array()}).array(),P=n.object({name:n.string().optional(),features:n.string().array().optional(),presets:n.string().array().optional()}),A=n.object({camera:n.string(),snapshot:n.object({frame_time:n.number()}).nullable(),has_clip:n.boolean(),has_snapshot:n.boolean(),label:n.string(),current_zones:n.string().array()}),O=n.object({before:A,after:A,type:n.enum(["new","update","end"])});const L=async(e,t)=>await r(e,U,{type:"frigate/events/get",...t},!0),V=e=>"birdseye"===e.frigate.camera_name;class G extends z{constructor(e,t,n){super(e,t,n),this._frigateEventHandler=e=>{const t=!e.before.has_snapshot&&e.after.has_snapshot||e.before.snapshot?.frame_time!==e.after.snapshot?.frame_time,n=!e.before.has_clip&&e.after.has_clip,a=this.getConfig();if(a.frigate.zones?.length&&!a.frigate.zones.some((t=>e.after.current_zones.includes(t)))||a.frigate.labels?.length&&!a.frigate.labels.includes(e.after.label))return;const r=a.triggers.events;(r.includes("events")||r.includes("snapshots")&&t||r.includes("clips")&&n)&&this._eventCallback?.({fidelity:"high",cameraID:this.getID(),type:e.type,clip:n&&r.includes("clips"),snapshot:t&&r.includes("snapshots")})}}async initialize(e){return await this._initializeConfig(e.hass,e.entityRegistryManager),await this._initializeCapabilities(e.hass),await this._subscribeToEvents(e.hass,e.frigateEventWatcher),await super.initialize(e)}async _initializeConfig(e,n){const a=this.getConfig(),r=!!a.frigate?.camera_name,i=a.triggers.motion||a.triggers.occupancy;let g=null;const l=o(a);if(l&&(!r||i)&&(g=await n.getEntity(e,l),!g))throw new c(s("error.no_camera_entity"),a);if(g&&!r){const e=this._getFrigateCameraNameFromEntity(g);e&&(this._config.frigate.camera_name=e)}if(i){const r=await n.getMatchingEntities(e,(e=>e.config_entry_id===g?.config_entry_id&&!e.disabled_by&&e.entity_id.startsWith("binary_sensor.")));if(a.triggers.motion){const e=this._getMotionSensor(a,[...r.values()]);e&&a.triggers.entities.push(e)}if(a.triggers.occupancy){const e=this._getOccupancySensor(a,[...r.values()]);e&&a.triggers.entities.push(...e)}a.triggers.entities=(u=a.triggers.entities)&&u.length?t(u):[]}var u}async _initializeCapabilities(e){const t=this.getConfig(),n=g(this.getConfig()),a=await this._getPTZCapabilities(e,t),r=n||a?{...a,...n}:null,i=V(t);this._capabilities=new l({"favorite-events":!i,"favorite-recordings":!1,seek:!i,clips:!i,snapshots:!i,recordings:!i,live:!0,menu:!0,substream:!0,...r&&{ptz:r}},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except})}_getFrigateCameraNameFromEntity(e){if("frigate"===e.platform&&e.unique_id&&"string"==typeof e.unique_id){const t=e.unique_id.match(/:camera:(?[^:]+)$/);if(t&&t.groups)return t.groups.camera}return null}async _getPTZCapabilities(e,t){if(!t.frigate.camera_name||V(t))return null;let n=null;try{n=await(async(e,t,n)=>await r(e,P,{type:"frigate/ptz/info",instance_id:t,camera:n},!0))(e,t.frigate.client_id,t.frigate.camera_name)}catch(e){return u(e),null}const a=[...n.features?.includes("pt")?["continuous"]:[]],i=[...n.features?.includes("zoom")?["continuous"]:[]],s=n.presets;return a.length||i.length||s?.length?{...a&&{left:a,right:a,up:a,down:a},...i&&{zoomIn:i,zoomOut:i},...s&&{presets:s}}:null}_getMotionSensor(e,t){return e.frigate.camera_name?t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:motion_sensor:${e.frigate.camera_name}`))))?.entity_id??null:null}_getOccupancySensor(e,t){const n=[],a=(e,a)=>{const r=t.find((t=>"string"==typeof t.unique_id&&!!t.unique_id?.match(new RegExp(`:occupancy_sensor:${e}_${a}`))))?.entity_id??null;r&&n.push(r)};if(e.frigate.camera_name){const t=e.frigate.zones?.length?e.frigate.zones:[e.frigate.camera_name],r=e.frigate.labels?.length?e.frigate.labels:["all"];for(const e of t)for(const t of r)a(e,t);if(n.length)return n}return null}async _subscribeToEvents(e,t){const n=this.getConfig();if(!n.triggers.events.length||!n.frigate.camera_name)return; +/* istanbul ignore next -- exercising the matcher is not possible when the + test uses an event watcher -- @preserve */const a={instanceID:n.frigate.client_id,callback:e=>this._frigateEventHandler(e),matcher:e=>e.after.camera===n.frigate.camera_name};await t.subscribe(e,a),this._onDestroy((()=>t.unsubscribe(a)))}}class J{constructor(){this._requests=[],this._unsubscribeCallback={}}async subscribe(e,t){const n=!this._hasSubscribers(t.instanceID);this._requests.push(t),n&&(this._unsubscribeCallback[t.instanceID]=await e.connection.subscribeMessage((e=>this._receiveHandler(t.instanceID,e)),{type:"frigate/events/subscribe",instance_id:t.instanceID}))}async unsubscribe(e){this._requests=this._requests.filter((t=>t!==e)),this._hasSubscribers(e.instanceID)||(await this._unsubscribeCallback[e.instanceID](),delete this._unsubscribeCallback[e.instanceID])}_hasSubscribers(e){return!!this._requests.filter((t=>t.instanceID===e)).length}_receiveHandler(e,t){let n;try{n=JSON.parse(t)}catch(e){return void console.warn("Received non-JSON payload as Frigate event",t)}const a=O.safeParse(n);if(a.success)for(const t of this._requests)t.instanceID!==e||t.matcher&&!t.matcher(a.data)||t.callback(a.data);else console.warn("Received malformed Frigate event from Home Assistant",t)}}function B(e,t){const n=function(e){if(!X[e]){const t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;X[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return X[e]}(t);return"formatToParts"in n?function(e,t){try{const n=e.formatToParts(t),a=[];for(let e=0;e=0?i:1e3+i,a-r}function se(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}const oe={};function ce(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const ge=36e5,le=6e4,ue=2,me={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function de(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);const n=null==t.additionalDigits?ue:Number(t.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);const a=function(e){const t={};let n,a=me.dateTimePattern.exec(e);a?(t.date=a[1],n=a[3]):(a=me.datePattern.exec(e),a?(t.date=a[1],n=a[2]):(t.date=null,n=e));if(n){const e=me.timeZone.exec(n);e?(t.time=n.replace(e[1],""),t.timeZone=e[1].trim()):t.time=n}return t}(e),{year:r,restDateString:i}=function(e,t){if(e){const n=me.YYY[t],a=me.YYYYY[t];let r=me.YYYY.exec(e)||a.exec(e);if(r){const t=r[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(r=me.YY.exec(e)||n.exec(e),r){const t=r[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(a.date,n),s=function(e,t){if(null===t)return null;let n,a,r;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=me.MM.exec(e);if(i)return n=new Date(0),a=parseInt(i[1],10)-1,ye(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(i=me.DDD.exec(e),i){n=new Date(0);const e=parseInt(i[1],10);return function(e,t){if(t<1)return!1;const n=_e(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(i=me.MMDD.exec(e),i){n=new Date(0),a=parseInt(i[1],10)-1;const e=parseInt(i[2],10);return ye(t,a,e)?(n.setUTCFullYear(t,a,e),n):new Date(NaN)}if(i=me.Www.exec(e),i)return r=parseInt(i[1],10)-1,be(r)?fe(t,r):new Date(NaN);if(i=me.WwwD.exec(e),i){r=parseInt(i[1],10)-1;const e=parseInt(i[2],10)-1;return be(r,e)?fe(t,r,e):new Date(NaN)}return null}(i,r);if(null===s||isNaN(s.getTime()))return new Date(NaN);if(s){const e=s.getTime();let n,r=0;if(a.time&&(r=function(e){let t,n,a=me.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),we(t)?t%24*ge:NaN;if(a=me.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),we(t,n)?t%24*ge+n*le:NaN;if(a=me.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const e=parseFloat(a[3].replace(",","."));return we(t,n,e)?t%24*ge+n*le+1e3*e:NaN}return null}(a.time),null===r||isNaN(r)))return new Date(NaN);if(a.timeZone||t.timeZone){if(n=re(a.timeZone||t.timeZone,new Date(e+r)),isNaN(n))return new Date(NaN)}else n=ce(new Date(e+r)),n=ce(new Date(e+r+n));return new Date(e+r+n)}return new Date(NaN)}function fe(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const r=7*t+n+1-(a.getUTCDay()||7);return a.setUTCDate(a.getUTCDate()+r),a}const he=[31,28,31,30,31,30,31,31,30,31,30,31],pe=[31,29,31,30,31,30,31,31,30,31,30,31];function _e(e){return e%400==0||e%4==0&&e%100!=0}function ye(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;const a=_e(e);if(a&&n>pe[t])return!1;if(!a&&n>he[t])return!1}return!0}function be(e,t){return!(e<0||e>52)&&(null==t||!(t<0||t>6))}function we(e,t,n){return!(e<0||e>=25)&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}const De=e=>{const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=Math.round(e.end_time?e.end_time-e.start_time:Date.now()/1e3-e.start_time),a=null!==e.top_score?` ${Math.round(100*e.top_score)}%`:"";return`${m(function(e,t,n){const a=re(t,e=de(e,n),!0),r=new Date(e.getTime()-a),i=new Date(0);return i.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),i.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),i}(1e3*e.start_time,t))} [${n}s, ${d(e.label)}${a}]`};class Ce extends R{constructor(e,t,n,a,r,i){super(e,t),this._event=n,this._contentID=a,this._thumbnail=r,this._subLabels=i??null}getStartTime(){return j(this._event.start_time)}getEndTime(){return this._event.end_time?j(this._event.end_time):null}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getID(){return this._event.id}getContentID(){return this._contentID}getTitle(){return De(this._event)}getThumbnail(){return this._thumbnail}isFavorite(){return this._event.retain_indefinitely??null}setFavorite(e){this._event.retain_indefinitely=e}getWhat(){return[this._event.label]}getWhere(){const e=this._event.zones;return e.length?e:null}getScore(){return this._event.top_score}getTags(){return this._subLabels}isGroupableWith(e){return this.getMediaType()===e.getMediaType()&&f(this.getWhere(),e.getWhere())&&f(this.getWhat(),e.getWhat())}}class ve extends R{constructor(e,t,n,a,r,i){super(e,t),this._recording=n,this._id=a,this._contentID=r,this._title=i}getID(){return this._id}getStartTime(){return this._recording.startTime}getEndTime(){return this._recording.endTime}inProgress(){return!this.getEndTime()}getVideoContentType(){return Y.HLS}getContentID(){return this._contentID}getTitle(){return this._title}getEventCount(){return this._recording.events}}class Te{static createEventViewMedia(e,t,n,a,r){return"clip"===e&&!a.has_clip||"snapshot"===e&&!a.has_snapshot||!n.frigate.client_id||!n.frigate.camera_name?null:new Ce(e,t,a,((e,t,n,a)=>`media-source://frigate/${e}/event/${a}/${t}/${n.id}`)(n.frigate.client_id,n.frigate.camera_name,a,"clip"===e?"clips":"snapshots"),((e,t)=>`/api/frigate/${e}/thumbnail/${t.id}`)(n.frigate.client_id,a),r)}static createRecordingViewMedia(e,t,n,a){return n.frigate.client_id&&n.frigate.camera_name?new ve("recording",e,t,((e,t)=>`${e.frigate?.client_id??""}/${e.frigate.camera_name??""}/${t.startTime.getTime()}/${t.endTime.getTime()}`)(n,t),((e,t,n)=>["media-source://frigate",e,"recordings",t,`${n.startTime.getFullYear()}-${String(n.startTime.getMonth()+1).padStart(2,"0")}-${String(String(n.startTime.getDate()).padStart(2,"0"))}`,String(n.startTime.getHours()).padStart(2,"0")].join("/"))(n.frigate.client_id,n.frigate.camera_name,t),((e,t)=>`${e} ${m(t.startTime)}`)(a,t)):null}}class Ie{static isFrigateMedia(e){return this.isFrigateEvent(e)||this.isFrigateRecording(e)}static isFrigateEvent(e){return e instanceof Ce}static isFrigateRecording(e){return e instanceof ve}}class Se{static isFrigateEventQueryResults(e){return e.engine===p.Frigate&&e.type===C.Event}static isFrigateRecordingQueryResults(e){return e.engine===p.Frigate&&e.type===C.Recording}static isFrigateRecordingSegmentsResults(e){return e.engine===p.Frigate&&e.type===C.RecordingSegments}}class Me extends N{constructor(e,t,n,a,r){super(t,r),this._throttledSegmentGarbageCollector=h(this._garbageCollectSegments.bind(this),36e5,{leading:!1,trailing:!0}),this._entityRegistryManager=e,this._frigateEventWatcher=new J,this._recordingSegmentsCache=n,this._requestCache=a}getEngineType(){return p.Frigate}async createCamera(e,t){const n=new G(t,this,{eventCallback:this._eventCallback});return await n.initialize({hass:e,entityRegistryManager:this._entityRegistryManager,stateWatcher:this._stateWatcher,frigateEventWatcher:this._frigateEventWatcher})}async getMediaDownloadPath(e,t,n){return Ie.isFrigateEvent(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/notifications/${n.getID()}/`+(_.isClip(n)?"clip.mp4":"snapshot.jpg")+"?download=true",sign:!0}:Ie.isFrigateRecording(n)?{endpoint:`/api/frigate/${t.frigate.client_id}/recording/${t.frigate.camera_name}/start/${Math.floor(n.getStartTime().getTime()/1e3)}/end/${Math.floor(n.getEndTime().getTime()/1e3)}?download=true`,sign:!0}:null}generateDefaultEventQuery(e,t,n){const a=[...e.getCameraConfigs(t)],r=y(a.map((e=>e?.frigate.zones)),f),i=y(a.map((e=>e?.frigate.labels)),f);if(1===r.length&&1===i.length)return[{type:b.Event,cameraIDs:t,...i[0]&&{what:new Set(i[0])},...r[0]&&{where:new Set(r[0])},...n}];const s=[];for(const a of t){const t=e.getCameraConfig(a);t&&s.push({type:b.Event,cameraIDs:new Set([a]),...t.frigate.labels&&{what:new Set(t.frigate.labels)},...t.frigate.zones&&{where:new Set(t.frigate.zones)},...n})}return s.length?s:null}generateDefaultRecordingQuery(e,t,n){return[{type:b.Recording,cameraIDs:t,...n}]}generateDefaultRecordingSegmentsQuery(e,t,n){return n.start&&n.end?[{type:b.RecordingSegments,cameraIDs:t,start:n.start,end:n.end,...n}]:null}async favoriteMedia(e,t,n,a){Ie.isFrigateEvent(n)&&(await async function(e,t,n,a){const o={type:"frigate/event/retain",instance_id:t,event_id:n,retain:a},c=await r(e,Q,o,!0);if(!c.success)throw new i(s("error.failed_retain"),{request:o,response:c})}(e,t.frigate.client_id,n.getID(),a),n.setFavorite(a))}_buildInstanceToCameraIDMapFromQuery(e,t){const n=new Map;for(const a of t){const t=this._getQueryableCameraConfig(e,a),r=t?.frigate.client_id;r&&(n.has(r)||n.set(r,new Set),n.get(r)?.add(a))}return n}_getFrigateCameraNamesForCameraIDs(e,t){const n=new Set;for(const a of t){const t=this._getQueryableCameraConfig(e,a);t?.frigate.camera_name&&n.add(t.frigate.camera_name)}return n}async getEvents(e,t,n,a){const r=new Map,i=async(i,s)=>{if(!s||!s.size)return;const o={...n,cameraIDs:s},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void r.set(n,c);const g={instance_id:i,cameras:Array.from(this._getFrigateCameraNamesForCameraIDs(t,s)),...n.what&&{labels:Array.from(n.what)},...n.where&&{zones:Array.from(n.where)},...n.tags&&{sub_labels:Array.from(n.tags)},...n.end&&{before:Math.floor(n.end.getTime()/1e3)},...n.start&&{after:Math.floor(n.start.getTime()/1e3)},...n.limit&&{limit:n.limit},...n.hasClip&&{has_clip:n.hasClip},...n.hasSnapshot&&{has_snapshot:n.hasSnapshot},...n.favorite&&{favorites:n.favorite},limit:n?.limit??$},l={type:C.Event,engine:p.Frigate,instanceID:i,events:await L(e,g),expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(n,{...l,cached:!0},l.expiry),r.set(o,l)},s=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs);return await Promise.all(Array.from(s.keys()).map((e=>i(e,s.get(e))))),r.size?r:null}async getRecordings(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=a?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const g=this._getQueryableCameraConfig(t,s);if(!g||!g.frigate.camera_name)return;const l=await(async(e,t,n)=>await r(e,q,{type:"frigate/recordings/summary",instance_id:t,camera:n,timezone:e.config.time_zone},!0))(e,g.frigate.client_id,g.frigate.camera_name);let u=[];for(const e of l??[])for(const t of e.hours){const n=v(e.day,{hours:t.hour}),a=x(n),r=H(n);(!o.start||a>=o.start)&&(!o.end||r<=o.end)&&u.push({cameraID:s,startTime:a,endTime:r,events:t.events})}void 0!==o.limit&&(u=S(u,(e=>e.startTime),"desc").slice(0,o.limit));const m={type:C.Recording,engine:p.Frigate,instanceID:g.frigate.client_id,recordings:u,expiry:v(new Date,{seconds:60}),cached:!1};(a?.useCache??1)&&this._requestCache.set(o,{...m,cached:!0},m.expiry),i.set(o,m)};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),i.size?i:null}async getRecordingSegments(e,t,n,a){const i=new Map,s=async(n,s)=>{const o={...n,cameraIDs:new Set([s])},c=this._getQueryableCameraConfig(t,s);if(!c||!c.frigate.camera_name)return;const g={start:o.start,end:o.end},l=a?.useCache??1?this._recordingSegmentsCache.get(s,g):null;if(l)return void i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:l,cached:!0});const u={instance_id:c.frigate.client_id,camera:c.frigate.camera_name,after:Math.floor(o.start.getTime()/1e3),before:Math.floor(o.end.getTime()/1e3)},m=await(async(e,t)=>await r(e,W,{type:"frigate/recordings/get",...t},!0))(e,u);(a?.useCache??1)&&this._recordingSegmentsCache.add(s,g,m),i.set(o,{type:C.RecordingSegments,engine:p.Frigate,instanceID:c.frigate.client_id,segments:m,cached:!1})};return await Promise.all(Array.from(n.cameraIDs).map((e=>s(n,e)))),w((()=>this._throttledSegmentGarbageCollector(e,t))),i.size?i:null}_getCameraIDMatch(e,t,n,a){if(1===t.cameraIDs.size)return[...t.cameraIDs][0];for(const[t,r]of e.getCameraConfigEntries())if(r.frigate.client_id===n&&r.frigate.camera_name===a)return t;return null}generateMediaFromEvents(e,t,n,a){if(!Se.isFrigateEventQueryResults(a))return null;const r=[];for(const e of a.events){const i=this._getCameraIDMatch(t,n,a.instanceID,e.camera);if(!i)continue;const s=this._getQueryableCameraConfig(t,i);if(!s)continue;let o=null;if(n.hasClip||n.hasSnapshot||!e.has_clip&&!e.has_snapshot?n.hasSnapshot&&e.has_snapshot?o="snapshot":n.hasClip&&e.has_clip&&(o="clip"):o=e.has_clip?"clip":"snapshot",!o)continue;const c=Te.createEventViewMedia(o,i,s,e,e.sub_label?this._splitSubLabels(e.sub_label):void 0);c&&r.push(c)}return r}generateMediaFromRecordings(e,t,n,a){if(!Se.isFrigateRecordingQueryResults(a))return null;const r=[];for(const n of a.recordings){const a=this._getQueryableCameraConfig(t,n.cameraID);if(!a)continue;const i=Te.createRecordingViewMedia(n.cameraID,n,a,this.getCameraMetadata(e,a).title);i&&r.push(i)}return r}getQueryResultMaxAge(e){return e.type===b.Event||e.type===b.Recording?60:null}async getMediaSeekTime(e,t,n,a,r){const i=n.getStartTime(),s=n.getEndTime();if(!i||!s||as)return null;const o=n.getCameraID(),c={cameraIDs:new Set([o]),start:i,end:s,type:b.RecordingSegments},g=await this.getRecordingSegments(e,t,c,r);return g?this._getSeekTimeInSegments(i,a,Array.from(g.values())[0].segments):null}_getQueryableCameraConfig(e,t){const n=e.getCameraConfig(t);return!n||V(n)?null:n}_splitSubLabels(e){return e.split(",").map((e=>e.trim()))}async getMediaMetadata(e,t,n,a){const i=new Map;if((a?.useCache??1)&&this._requestCache.has(n)){const e=this._requestCache.get(n);if(e)return i.set(n,e),i}const s=new Set,o=new Set,c=new Set,g=new Set,l=this._buildInstanceToCameraIDMapFromQuery(t,n.cameraIDs),u=async(n,a)=>{const i=this._getFrigateCameraNamesForCameraIDs(t,a);for(const t of await(async(e,t)=>await r(e,k,{type:"frigate/events/summary",instance_id:t,timezone:e.config.time_zone},!0))(e,n))i.has(t.camera)&&(t.label&&s.add(t.label),t.zones.length&&t.zones.forEach(o.add,o),t.day&&c.add(t.day),t.sub_label&&this._splitSubLabels(t.sub_label).forEach(g.add,g))},m=async n=>{const r=await this.getRecordings(e,t,{type:b.Recording,cameraIDs:n},a);if(r)for(const e of r.values())if(Se.isFrigateRecordingQueryResults(e))for(const t of e.recordings)c.add(M(t.startTime))};await D([...l.entries()],(([e,t])=>(async()=>{await Promise.all([u(e,t),m(t)])})()));const d={type:C.MediaMetadata,engine:p.Frigate,metadata:{...s.size&&{what:s},...o.size&&{where:o},...c.size&&{days:c},...g.size&&{tags:g}},expiry:v(new Date,{seconds:60}),cached:!1};return(a?.useCache??1)&&this._requestCache.set(n,{...d,cached:!0},d.expiry),i.set(n,d),i}async _garbageCollectSegments(e,t){const n=this._recordingSegmentsCache.getCameraIDs(),a={cameraIDs:new Set(n),type:b.Recording},r=(e,t)=>`${e}/${t.getDate()}/${t.getHours()}`,i=await this.getRecordings(e,t,a);if(i)for(const[e,t]of i){if(!Se.isFrigateRecordingQueryResults(t))continue;const n=new Set;for(const e of t.recordings)n.add(r(e.cameraID,e.startTime));const a=Array.from(e.cameraIDs)[0];this._recordingSegmentsCache.expireMatches(a,(e=>{const t=r(a,j(e.start_time));return!n.has(t)}))}}_getSeekTimeInSegments(e,t,n){if(!n.length)return null;let a=0;for(const r of n){const n=j(r.start_time);if(n>t)break;const i=j(r.end_time),s=nt?t:i).getTime()-s.getTime()}return a/1e3}getMediaCapabilities(e){return{canFavorite:_.isEvent(e),canDownload:!0}}getCameraMetadata(e,t){const n=super.getCameraMetadata(e,t);return{title:t.title??T(e,t.camera_entity)??T(e,t.webrtc_card?.entity)??d(t.frigate?.camera_name)??t.id??"",icon:n.icon,engineLogo:I}}getCameraEndpoints(e,t){const n=(()=>{if(!e.frigate.url)return null;if(!e.frigate.camera_name)return{endpoint:e.frigate.url};const n=`${e.frigate.url}/cameras/`+e.frigate.camera_name;if("live"===t?.view)return{endpoint:n};const a=`${e.frigate.url}/events?camera=`+e.frigate.camera_name,r=`${e.frigate.url}/recording/`+e.frigate.camera_name;switch(t?.media?.getMediaType()){case"clip":case"snapshot":return{endpoint:a};case"recording":const e=t.media.getStartTime();if(e)return{endpoint:r+F(e,"yyyy-MM-dd/HH")}}switch(t?.view){case"clip":case"clips":case"snapshots":case"snapshot":return{endpoint:a};case"recording":case"recordings":return{endpoint:r}}return{endpoint:n}})(),a=E(e,{url:e.go2rtc?.url??`/api/frigate/${e.frigate.client_id}/mse`,stream:e.go2rtc?.stream??e.frigate.camera_name}),r={endpoint:`/api/frigate/${e.frigate.client_id}/jsmpeg/${e.frigate.camera_name}`,sign:!0},i=(()=>{const t=e.frigate.camera_name?e.frigate.camera_name:null;return t?{endpoint:t}:null})();return{...super.getCameraEndpoints(e,t),...n&&{ui:n},...a&&{go2rtc:a},...r&&{jsmpeg:r},...i&&{webrtcCard:i}}}async executePTZAction(e,t,n,a){const r=t.camera_entity;("preset"!==n||a?.preset)&&await e.callService("frigate","ptz",{entity_id:r,action:"stop"===a?.phase?"stop":"zoom_in"===n||"zoom_out"===n?"zoom":"preset"===n?"preset":"move",..."stop"!==a?.phase&&{argument:"zoom_in"===n?"in":"zoom_out"===n?"out":"preset"===n?a?.preset:n}})}}export{Me as FrigateCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-frigate-f4a9d103.js.gz b/www/community/frigate-hass-card/engine-frigate-f4a9d103.js.gz new file mode 100644 index 00000000..53da22f8 Binary files /dev/null and b/www/community/frigate-hass-card/engine-frigate-f4a9d103.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-16943492.js b/www/community/frigate-hass-card/engine-generic-16943492.js new file mode 100644 index 00000000..9214986b --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-16943492.js @@ -0,0 +1 @@ +import{eC as e,eD as t,l as i,e8 as a,e7 as n,e6 as s,e4 as r,j as c,eE as l}from"./card-4e88bdfb.js";class o{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const u=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/www/community/frigate-hass-card/engine-generic-16943492.js.gz b/www/community/frigate-hass-card/engine-generic-16943492.js.gz new file mode 100644 index 00000000..21eeb8f4 Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-16943492.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-31c14ad9.js b/www/community/frigate-hass-card/engine-generic-31c14ad9.js new file mode 100644 index 00000000..6879389a --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-31c14ad9.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-45855f1f.js";class o{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const u=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/www/community/frigate-hass-card/engine-generic-31c14ad9.js.gz b/www/community/frigate-hass-card/engine-generic-31c14ad9.js.gz new file mode 100644 index 00000000..84c67f52 Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-31c14ad9.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-39deaa91.js b/www/community/frigate-hass-card/engine-generic-39deaa91.js new file mode 100644 index 00000000..4c590468 --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-39deaa91.js @@ -0,0 +1 @@ +import{ey as e,ez as t,l as i,e4 as a,e3 as n,e2 as s,e0 as r,j as c,eA as l}from"./card-320adb66.js";class o{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const u=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/www/community/frigate-hass-card/engine-generic-39deaa91.js.gz b/www/community/frigate-hass-card/engine-generic-39deaa91.js.gz new file mode 100644 index 00000000..418962b6 Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-39deaa91.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-458c9005.js b/www/community/frigate-hass-card/engine-generic-458c9005.js new file mode 100644 index 00000000..1245afbb --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-458c9005.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-09c4bade.js";class o{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const u=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/www/community/frigate-hass-card/engine-generic-458c9005.js.gz b/www/community/frigate-hass-card/engine-generic-458c9005.js.gz new file mode 100644 index 00000000..4756c437 Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-458c9005.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-7a4c33a6.js b/www/community/frigate-hass-card/engine-generic-7a4c33a6.js new file mode 100644 index 00000000..798446e2 --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-7a4c33a6.js @@ -0,0 +1 @@ +import{ey as e,ez as t,l as i,e4 as a,e3 as n,e2 as s,e0 as r,j as c,eA as l}from"./card-19444f74.js";class o{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const u=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/www/community/frigate-hass-card/engine-generic-7a4c33a6.js.gz b/www/community/frigate-hass-card/engine-generic-7a4c33a6.js.gz new file mode 100644 index 00000000..f51aaab5 Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-7a4c33a6.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-93cdbee6.js b/www/community/frigate-hass-card/engine-generic-93cdbee6.js new file mode 100644 index 00000000..a2e5baf0 --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-93cdbee6.js @@ -0,0 +1 @@ +import{eu as e,ev as t,l as i,e3 as a,e2 as n,e1 as s,d$ as r,j as c}from"./card-e5d55e5b.js";class l{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const o=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class u{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new l(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:{entity:i??void 0,icon:t.icon,fallback:"mdi:video"}}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=o(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var g=Object.freeze({__proto__:null,GenericCameraManagerEngine:u});export{l as C,u as G,g as e,o as g}; diff --git a/www/community/frigate-hass-card/engine-generic-93cdbee6.js.gz b/www/community/frigate-hass-card/engine-generic-93cdbee6.js.gz new file mode 100644 index 00000000..aad68db2 Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-93cdbee6.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-96b32038.js b/www/community/frigate-hass-card/engine-generic-96b32038.js new file mode 100644 index 00000000..3230f56d --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-96b32038.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-7cd05290.js";class o{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const u=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/www/community/frigate-hass-card/engine-generic-96b32038.js.gz b/www/community/frigate-hass-card/engine-generic-96b32038.js.gz new file mode 100644 index 00000000..fb72fa73 Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-96b32038.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-9f6fcaee.js b/www/community/frigate-hass-card/engine-generic-9f6fcaee.js new file mode 100644 index 00000000..397199d4 --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-9f6fcaee.js @@ -0,0 +1 @@ +import{ey as e,ez as t,l as i,e4 as a,e3 as n,e2 as s,e0 as r,j as c,eA as l}from"./card-0be2c6a9.js";class o{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const u=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/www/community/frigate-hass-card/engine-generic-9f6fcaee.js.gz b/www/community/frigate-hass-card/engine-generic-9f6fcaee.js.gz new file mode 100644 index 00000000..40c82e6d Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-9f6fcaee.js.gz differ diff --git a/www/community/frigate-hass-card/engine-generic-bb62ddef.js b/www/community/frigate-hass-card/engine-generic-bb62ddef.js new file mode 100644 index 00000000..7efc0bbe --- /dev/null +++ b/www/community/frigate-hass-card/engine-generic-bb62ddef.js @@ -0,0 +1 @@ +import{eB as e,eC as t,l as i,e7 as a,e6 as n,e5 as s,e3 as r,j as c,eD as l}from"./card-c642ee74.js";class o{constructor(t,i,a){this._destroyCallbacks=[],this._stateChangeHandler=t=>{this._eventCallback?.({cameraID:this.getID(),type:e(t.newState.state)?"new":"end"})},this._config=t,this._engine=i,this._capabilities=a?.capabilities,this._eventCallback=a?.eventCallback}async initialize(e){return e.stateWatcher.subscribe(this._stateChangeHandler,this._config.triggers.entities),this._onDestroy((()=>e.stateWatcher.unsubscribe(this._stateChangeHandler))),this}async destroy(){this._destroyCallbacks.forEach((e=>e()))}getConfig(){return this._config}setID(e){this._config.id=e}getID(){if(this._config.id)return this._config.id;throw new t(i("error.no_camera_id"))}getEngine(){return this._engine}getCapabilities(){return this._capabilities??null}getProxyConfig(){return{dynamic:this._config.proxy.dynamic,media:"auto"!==this._config.proxy.media&&this._config.proxy.media,ssl_verification:!1!==this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"default":this._config.proxy.ssl_ciphers}}_onDestroy(e){this._destroyCallbacks.push(e)}}const u=(e,t)=>{const i=t?.url??e.go2rtc?.url,a=t?.stream??e.go2rtc?.stream;if(!i||!a)return null;const n=`${i}/api/ws?src=${a}`;return{endpoint:n,sign:n.startsWith("/")}};class g{constructor(e,t){this._stateWatcher=e,this._eventCallback=t}getEngineType(){return a.Generic}async createCamera(e,t){return await new o(t,this,{capabilities:new n({"favorite-events":!1,"favorite-recordings":!1,clips:!1,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback}).initialize({stateWatcher:this._stateWatcher})}generateDefaultEventQuery(e,t,i){return null}generateDefaultRecordingQuery(e,t,i){return null}generateDefaultRecordingSegmentsQuery(e,t,i){return null}async getEvents(e,t,i,a){return null}async getRecordings(e,t,i,a){return null}async getRecordingSegments(e,t,i,a){return null}generateMediaFromEvents(e,t,i,a){return null}generateMediaFromRecordings(e,t,i,a){return null}async getMediaDownloadPath(e,t,i){return null}async favoriteMedia(e,t,i,a){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,t,i,a,n){return null}async getMediaMetadata(e,t,i,a){return null}getCameraMetadata(e,t){const i=r(t);return{title:t.title??c(e,t.camera_entity)??c(e,t.webrtc_card?.entity)??t.id??"",icon:t?.icon??(i?l(e,i,"mdi:video"):"mdi:video")}}getMediaCapabilities(e){return null}getCameraEndpoints(e,t){const i=u(e);return i?{go2rtc:i}:null}async executePTZAction(e,t,i,a){}}var d=Object.freeze({__proto__:null,GenericCameraManagerEngine:g});export{o as C,g as G,d as e,u as g}; diff --git a/www/community/frigate-hass-card/engine-generic-bb62ddef.js.gz b/www/community/frigate-hass-card/engine-generic-bb62ddef.js.gz new file mode 100644 index 00000000..d31ad644 Binary files /dev/null and b/www/community/frigate-hass-card/engine-generic-bb62ddef.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-1c667c17.js b/www/community/frigate-hass-card/engine-motioneye-1c667c17.js new file mode 100644 index 00000000..3a00901f --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-1c667c17.js @@ -0,0 +1 @@ +import{e9 as e,e4 as t,e3 as a,e2 as s,ea as i,d0 as n,e6 as r,e7 as o,dN as c,eb as d,ec as m,ed as l,ee as h,d8 as u,da as y}from"./card-19444f74.js";import{B as g,a as p,g as _,i as M}from"./within-dates-9c471d51.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-02360460.js";import{e as w}from"./endOfDay-da61af46.js";import"./engine-generic-7a4c33a6.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&M(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return E.isMotionEyeEventQueryResults(s)?_(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(y(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-1c667c17.js.gz b/www/community/frigate-hass-card/engine-motioneye-1c667c17.js.gz new file mode 100644 index 00000000..5b04b59a Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-1c667c17.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js b/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js new file mode 100644 index 00000000..4fd404ee --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js @@ -0,0 +1 @@ +import{e9 as e,e4 as t,e3 as a,e2 as s,ea as i,d0 as n,e6 as r,e7 as o,dN as c,eb as d,ec as m,ed as l,ee as h,d8 as u,da as y}from"./card-320adb66.js";import{B as g,a as p,g as _,i as M}from"./within-dates-c613e3cb.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-7f4a6e12.js";import{e as w}from"./endOfDay-086a6977.js";import"./engine-generic-39deaa91.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&M(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return E.isMotionEyeEventQueryResults(s)?_(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(y(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js.gz b/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js.gz new file mode 100644 index 00000000..d513b354 Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-205f9ce6.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-3521f17f.js b/www/community/frigate-hass-card/engine-motioneye-3521f17f.js new file mode 100644 index 00000000..a1310cd3 --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-3521f17f.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-09c4bade.js";import{B as g,a as p,g as _,i as M}from"./within-dates-cc9f8404.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-645a86cb.js";import{e as w}from"./endOfDay-8be4da1b.js";import"./engine-generic-458c9005.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&M(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return E.isMotionEyeEventQueryResults(s)?_(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(y(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-3521f17f.js.gz b/www/community/frigate-hass-card/engine-motioneye-3521f17f.js.gz new file mode 100644 index 00000000..e5686633 Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-3521f17f.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-381004ee.js b/www/community/frigate-hass-card/engine-motioneye-381004ee.js new file mode 100644 index 00000000..bcb4f70c --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-381004ee.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-c642ee74.js";import{B as g,a as p,g as _,i as M}from"./within-dates-cc65dfa5.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-a53fb39b.js";import{e as w}from"./endOfDay-97ae2cc7.js";import"./engine-generic-bb62ddef.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&M(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return E.isMotionEyeEventQueryResults(s)?_(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(y(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-381004ee.js.gz b/www/community/frigate-hass-card/engine-motioneye-381004ee.js.gz new file mode 100644 index 00000000..0dd9c4d9 Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-381004ee.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-9f2f0410.js b/www/community/frigate-hass-card/engine-motioneye-9f2f0410.js new file mode 100644 index 00000000..33870f82 --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-9f2f0410.js @@ -0,0 +1 @@ +import{e9 as e,e4 as t,e3 as a,e2 as s,ea as i,d0 as n,e6 as r,e7 as o,dN as c,eb as d,ec as m,ed as l,ee as h,d8 as u,da as y}from"./card-0be2c6a9.js";import{B as g,a as p,g as _,i as M}from"./within-dates-c0bc65f7.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-235dc1fc.js";import{e as w}from"./endOfDay-a0fc225b.js";import"./engine-generic-9f6fcaee.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&M(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return E.isMotionEyeEventQueryResults(s)?_(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(y(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-9f2f0410.js.gz b/www/community/frigate-hass-card/engine-motioneye-9f2f0410.js.gz new file mode 100644 index 00000000..a637fd89 Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-9f2f0410.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-aba6e54b.js b/www/community/frigate-hass-card/engine-motioneye-aba6e54b.js new file mode 100644 index 00000000..1d45d7ea --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-aba6e54b.js @@ -0,0 +1 @@ +import{e7 as e,e3 as t,e2 as a,e1 as s,e8 as i,c$ as n,e5 as r,e6 as o,dM as c,e9 as d,ea as m,eb as l,d7 as h,d9 as u}from"./card-e5d55e5b.js";import{B as y,a as g,g as p,i as _}from"./within-dates-446c6430.js";import{C as M}from"./engine-86b0096c.js";import{p as f}from"./parse-214d78af.js";import{e as C}from"./endOfDay-cfc9c86c.js";import"./engine-generic-93cdbee6.js";import"./media-c9012082.js";class w extends y{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class D{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const E={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},v=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class x extends g{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new w(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(v,((e,t)=>E[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=f(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=f(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??C(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof y&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&_(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const u=a.getCameraConfig(r);if(!u)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(u.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(u.motioneye.images.file_pattern),f=c.limit??M,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===m||e.media_class===l?this._motionEyeMetadataGeneratorFile(r,e.media_class===m?p:g,e,t):null,earlyExit:e=>e.length>=f,matcher:e=>!e.can_expand&&_(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=h(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??M),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return D.isMotionEyeEventQueryResults(s)?p(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(u(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineIcon:"motioneye"}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{x as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-aba6e54b.js.gz b/www/community/frigate-hass-card/engine-motioneye-aba6e54b.js.gz new file mode 100644 index 00000000..46003f4a Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-aba6e54b.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-becc05fc.js b/www/community/frigate-hass-card/engine-motioneye-becc05fc.js new file mode 100644 index 00000000..cb713857 --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-becc05fc.js @@ -0,0 +1 @@ +import{ed as e,e8 as t,e7 as a,e6 as s,ee as i,d5 as n,ea as r,eb as o,dR as c,ef as d,eg as m,eh as l,ei as h,dd as u,df as y}from"./card-4e88bdfb.js";import{B as g,a as p,g as _,i as M}from"./within-dates-545c5d93.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-e098fe54.js";import{e as w}from"./endOfDay-a3114e3f.js";import"./engine-generic-16943492.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&M(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return E.isMotionEyeEventQueryResults(s)?_(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(y(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-becc05fc.js.gz b/www/community/frigate-hass-card/engine-motioneye-becc05fc.js.gz new file mode 100644 index 00000000..903c6cf9 Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-becc05fc.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-d04d1919.js b/www/community/frigate-hass-card/engine-motioneye-d04d1919.js new file mode 100644 index 00000000..fe2becc3 --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-d04d1919.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-7cd05290.js";import{B as g,a as p,g as _,i as M}from"./within-dates-2bb98b10.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-feacefaa.js";import{e as w}from"./endOfDay-0c5086cb.js";import"./engine-generic-96b32038.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&M(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return E.isMotionEyeEventQueryResults(s)?_(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(y(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-d04d1919.js.gz b/www/community/frigate-hass-card/engine-motioneye-d04d1919.js.gz new file mode 100644 index 00000000..087e64c2 Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-d04d1919.js.gz differ diff --git a/www/community/frigate-hass-card/engine-motioneye-fa799851.js b/www/community/frigate-hass-card/engine-motioneye-fa799851.js new file mode 100644 index 00000000..06f83c89 --- /dev/null +++ b/www/community/frigate-hass-card/engine-motioneye-fa799851.js @@ -0,0 +1 @@ +import{ec as e,e7 as t,e6 as a,e5 as s,ed as i,d4 as n,e9 as r,ea as o,dQ as c,ee as d,ef as m,eg as l,eh as h,dc as u,de as y}from"./card-45855f1f.js";import{B as g,a as p,g as _,i as M}from"./within-dates-a663657f.js";import{C as f}from"./engine-86b0096c.js";import{p as C}from"./parse-114e8d53.js";import{e as w}from"./endOfDay-24d35e3f.js";import"./engine-generic-31c14ad9.js";import"./media-c9012082.js";class D extends g{getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media}}}class E{static isMotionEyeEventQueryResults(e){return e.engine===t.MotionEye&&e.type===o.Event}}const v={"%Y":"yyyy","%m":"MM","%d":"dd","%H":"HH","%M":"mm","%S":"ss"},x=new RegExp(/(%Y|%m|%d|%H|%M|%S)/g);class b extends p{constructor(){super(...arguments),this._directoryCache=new e,this._fileCache=new e}getEngineType(){return t.MotionEye}async createCamera(e,t){const i=new D(t,this,{capabilities:new a({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!0,substream:!0,ptz:s(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await i.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}_convertMotionEyeTimeFormatToDateFNS(e){return e.replace(x,((e,t)=>v[t]))}_motionEyeMetadataGeneratorFile(e,t,a,s){let n=s?._metadata?.startDate??new Date;if(t){const e=a.title.replace(/\.[^/.]+$/,"");if(n=C(e,t,n),!i(n))return null}return{cameraID:e,startDate:n,endDate:n}}_motionEyeMetadataGeneratorDirectory(e,t,a,s){let r=s?._metadata?.startDate??new Date;if(t){const e=C(a.title,t,r);if(!i(e))return null;r=n(e)}return{cameraID:e,startDate:r,endDate:s?._metadata?.endDate??w(r)}}async _getMatchingDirectories(e,t,a,s,i){const n=t.getCamera(a),r=n?.getConfig();if(!(n instanceof g&&r))return null;const o=n.getEntity(),c=o?.config_entry_id,d=o?.device_id;if(!c||!d)return null;const m=(e,t)=>{const i=e.shift();if(!i)return[];const n=i.includes("%")?this._convertMotionEyeTimeFormatToDateFNS(i):null;return[{targets:t,metadataGenerator:(e,t)=>this._motionEyeMetadataGeneratorDirectory(a,n,e,t),matcher:e=>e.can_expand&&(!!n||e.title===i)&&M(e,s?.start,s?.end),advance:t=>m(e,t)}]};return await this._browseMediaManager.walkBrowseMedias(e,[...!1===s?.hasClip||s?.hasSnapshot?[]:m(r.motioneye.movies.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#movies`]),...!1===s?.hasSnapshot||s?.hasClip?[]:m(r.motioneye.images.directory_pattern.split("/"),[`media-source://motioneye/${c}#${d}#images`])],{...!1!==i?.useCache&&{cache:this._directoryCache}})}async getEvents(e,a,s,i){if(s.favorite||s.tags?.size||s.what?.size||s.where?.size)return null;const n=new Map,c=async r=>{const c={...s,cameraIDs:new Set([r])},d=i?.useCache??1?this._requestCache.get(c):null;if(d)return void n.set(c,d);const m=a.getCameraConfig(r);if(!m)return;const y=await this._getMatchingDirectories(e,a,r,c,i);if(!y||!y.length)return;const g=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.movies.file_pattern),p=this._convertMotionEyeTimeFormatToDateFNS(m.motioneye.images.file_pattern),_=c.limit??f,C=await this._browseMediaManager.walkBrowseMedias(e,[{targets:y,metadataGenerator:(e,t)=>e.media_class===l||e.media_class===h?this._motionEyeMetadataGeneratorFile(r,e.media_class===l?p:g,e,t):null,earlyExit:e=>e.length>=_,matcher:e=>!e.can_expand&&M(e,c.start,c.end)}],{...!1!==i?.useCache&&{cache:this._fileCache}}),w=u(C,(e=>e._metadata?.startDate),"desc").slice(0,c.limit??f),D={type:o.Event,engine:t.MotionEye,browseMedia:w};(i?.useCache??1)&&this._requestCache.set(c,{...D,cached:!0},D.expiry),n.set(c,D)};return await r(s.cameraIDs,(e=>c(e))),n.size?n:null}generateMediaFromEvents(e,t,a,s){return E.isMotionEyeEventQueryResults(s)?_(s.browseMedia):null}async getMediaMetadata(e,a,s,i){const n=new Map;if((i?.useCache??1)&&this._requestCache.has(s)){const e=this._requestCache.get(s);if(e)return n.set(s,e),n}const m=new Set,l=async t=>{const s=await this._getMatchingDirectories(e,a,t,null,i);for(const e of s??[])e._metadata&&m.add(y(e._metadata?.startDate))};await r(s.cameraIDs,(e=>l(e)));const h={type:o.MediaMetadata,engine:t.MotionEye,metadata:{...m.size&&{days:m}},expiry:c(new Date,{seconds:d}),cached:!1};return(i?.useCache??1)&&this._requestCache.set(s,{...h,cached:!0},h.expiry),n.set(s,h),n}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.motioneye?.url?{endpoint:e.motioneye.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{b as MotionEyeCameraManagerEngine}; diff --git a/www/community/frigate-hass-card/engine-motioneye-fa799851.js.gz b/www/community/frigate-hass-card/engine-motioneye-fa799851.js.gz new file mode 100644 index 00000000..e2ee7be7 Binary files /dev/null and b/www/community/frigate-hass-card/engine-motioneye-fa799851.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-0f6e3569.js b/www/community/frigate-hass-card/engine-reolink-0f6e3569.js new file mode 100644 index 00000000..33d09684 --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-0f6e3569.js @@ -0,0 +1,8 @@ +import{l as e,e1 as t,e9 as a,e4 as n,ee as s,ea as i,dN as r,d0 as o,e3 as c,e2 as l,ef as u,e6 as h,e7 as d,eb as g,eg as m,d8 as _,da as p}from"./card-320adb66.js";import{B as y,a as f,i as w,g as C}from"./within-dates-c613e3cb.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-7f4a6e12.js";import{e as k}from"./endOfDay-086a6977.js";import"./engine-generic-39deaa91.js";import"./media-c9012082.js";class b extends t{}class x extends y{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new b(e("error.camera_initialization_reolink"),this.getConfig());this._channel=n}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class v{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._cache=new a}getEngineType(){return n.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==s)return null;const n=t.title.split(/ +/);if(2!==n.length)return null;const o=D(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:k(a)}:null}_reolinkCameraMetadataGenerator(e){const t=e.media_content_id.match(/^media-source:\/\/reolink\/CAM\|(?.+)\|(?\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new x(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,n){const s=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;if(null===t.getChannel()||!r)return null;const o=await this._browseMediaManager.walkBrowseMedias(e,[{targets:["media-source://reolink"],metadataGenerator:(e,t)=>this._reolinkCameraMetadataGenerator(e),matcher:e=>e._metadata?.channel===t.getChannel()&&e._metadata?.configEntryID===r}],{...!1!==n?.useCache&&{cache:this._cache}});return o?.length?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===s.reolink?.media_resolution?"sub":"main")],metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&w(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._cache}}):null}async getEvents(e,t,a,s){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=s?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof x?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??M;let m=[];h?.length&&(m=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&w(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._cache}}));const p=_(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:n.Reolink,browseMedia:p};(s?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,n){return v.isReolinkEventQueryResults(n)?C(n.browseMedia):null}async getMediaMetadata(e,t,a,s){const i=new Map,o=s?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const n=t.getCamera(a);if(!(n&&n instanceof x))return;const i=await this._getMatchingDirectories(e,n,null,s);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(p(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:n.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(s?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-0f6e3569.js.gz b/www/community/frigate-hass-card/engine-reolink-0f6e3569.js.gz new file mode 100644 index 00000000..3893913f Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-0f6e3569.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-5d642010.js b/www/community/frigate-hass-card/engine-reolink-5d642010.js new file mode 100644 index 00000000..fffc8d96 --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-5d642010.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as s,eh as n,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as p,de as _}from"./card-45855f1f.js";import{B as y,a as f,i as C,g as w}from"./within-dates-a663657f.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-114e8d53.js";import{e as x}from"./endOfDay-24d35e3f.js";import"./engine-generic-31c14ad9.js";import"./media-c9012082.js";class k extends t{}class b extends y{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,s=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===s)throw new k(e("error.camera_initialization_reolink"),this.getConfig());this._channel=s}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class v{static isReolinkEventQueryResults(e){return e.engine===s.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._directoryCache=new a,this._fileCache=new a}getEngineType(){return s.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==n)return null;const s=t.title.split(/ +/);if(2!==s.length)return null;const o=D(s[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=s[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:x(a)}:null}async createCamera(e,t){const a=new b(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,s){const n=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;return null!==t.getChannel()&&r?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===n.reolink?.media_resolution?"sub":"main")],concurrency:1/0,metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&C(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._directoryCache}}):null}async getEvents(e,t,a,n){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=n?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof b?await this._getMatchingDirectories(e,l,o,n):null,g=o.limit??M;let m=[];h?.length&&(m=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&C(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._fileCache}}));const _=p(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:s.Reolink,browseMedia:_};(n?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,s){return v.isReolinkEventQueryResults(s)?w(s.browseMedia):null}async getMediaMetadata(e,t,a,n){const i=new Map,o=n?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const s=t.getCamera(a);if(!(s&&s instanceof b))return;const i=await this._getMatchingDirectories(e,s,null,n);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(_(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:s.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(n?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-5d642010.js.gz b/www/community/frigate-hass-card/engine-reolink-5d642010.js.gz new file mode 100644 index 00000000..299a96f5 Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-5d642010.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-72a91bc6.js b/www/community/frigate-hass-card/engine-reolink-72a91bc6.js new file mode 100644 index 00000000..fcd97707 --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-72a91bc6.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as s,eh as n,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as p,de as _}from"./card-c642ee74.js";import{B as y,a as f,i as C,g as w}from"./within-dates-cc65dfa5.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-a53fb39b.js";import{e as x}from"./endOfDay-97ae2cc7.js";import"./engine-generic-bb62ddef.js";import"./media-c9012082.js";class k extends t{}class b extends y{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,s=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===s)throw new k(e("error.camera_initialization_reolink"),this.getConfig());this._channel=s}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class v{static isReolinkEventQueryResults(e){return e.engine===s.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._directoryCache=new a,this._fileCache=new a}getEngineType(){return s.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==n)return null;const s=t.title.split(/ +/);if(2!==s.length)return null;const o=D(s[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=s[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:x(a)}:null}async createCamera(e,t){const a=new b(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,s){const n=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;return null!==t.getChannel()&&r?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===n.reolink?.media_resolution?"sub":"main")],concurrency:1/0,metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&C(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._directoryCache}}):null}async getEvents(e,t,a,n){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=n?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof b?await this._getMatchingDirectories(e,l,o,n):null,g=o.limit??M;let m=[];h?.length&&(m=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&C(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._fileCache}}));const _=p(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:s.Reolink,browseMedia:_};(n?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,s){return v.isReolinkEventQueryResults(s)?w(s.browseMedia):null}async getMediaMetadata(e,t,a,n){const i=new Map,o=n?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const s=t.getCamera(a);if(!(s&&s instanceof b))return;const i=await this._getMatchingDirectories(e,s,null,n);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(_(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:s.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(n?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-72a91bc6.js.gz b/www/community/frigate-hass-card/engine-reolink-72a91bc6.js.gz new file mode 100644 index 00000000..ab866eb9 Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-72a91bc6.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-86c7521a.js b/www/community/frigate-hass-card/engine-reolink-86c7521a.js new file mode 100644 index 00000000..d1dd6b3d --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-86c7521a.js @@ -0,0 +1,8 @@ +import{l as e,e1 as t,e9 as a,e4 as n,ee as s,ea as i,dN as r,d0 as o,e3 as c,e2 as l,ef as u,e6 as h,e7 as d,eb as g,eg as m,d8 as _,da as p}from"./card-19444f74.js";import{B as y,a as f,i as w,g as C}from"./within-dates-9c471d51.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-02360460.js";import{e as k}from"./endOfDay-da61af46.js";import"./engine-generic-7a4c33a6.js";import"./media-c9012082.js";class b extends t{}class x extends y{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new b(e("error.camera_initialization_reolink"),this.getConfig());this._channel=n}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class v{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._cache=new a}getEngineType(){return n.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==s)return null;const n=t.title.split(/ +/);if(2!==n.length)return null;const o=D(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:k(a)}:null}_reolinkCameraMetadataGenerator(e){const t=e.media_content_id.match(/^media-source:\/\/reolink\/CAM\|(?.+)\|(?\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new x(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,n){const s=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;if(null===t.getChannel()||!r)return null;const o=await this._browseMediaManager.walkBrowseMedias(e,[{targets:["media-source://reolink"],metadataGenerator:(e,t)=>this._reolinkCameraMetadataGenerator(e),matcher:e=>e._metadata?.channel===t.getChannel()&&e._metadata?.configEntryID===r}],{...!1!==n?.useCache&&{cache:this._cache}});return o?.length?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===s.reolink?.media_resolution?"sub":"main")],metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&w(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._cache}}):null}async getEvents(e,t,a,s){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=s?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof x?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??M;let m=[];h?.length&&(m=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&w(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._cache}}));const p=_(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:n.Reolink,browseMedia:p};(s?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,n){return v.isReolinkEventQueryResults(n)?C(n.browseMedia):null}async getMediaMetadata(e,t,a,s){const i=new Map,o=s?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const n=t.getCamera(a);if(!(n&&n instanceof x))return;const i=await this._getMatchingDirectories(e,n,null,s);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(p(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:n.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(s?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-86c7521a.js.gz b/www/community/frigate-hass-card/engine-reolink-86c7521a.js.gz new file mode 100644 index 00000000..2117635e Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-86c7521a.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-8ab85d2e.js b/www/community/frigate-hass-card/engine-reolink-8ab85d2e.js new file mode 100644 index 00000000..ae14acf8 --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-8ab85d2e.js @@ -0,0 +1,8 @@ +import{l as e,e1 as t,e9 as a,e4 as n,ee as s,ea as i,dN as r,d0 as o,e3 as c,e2 as l,ef as u,e6 as h,e7 as d,eb as g,eg as m,d8 as _,da as p}from"./card-0be2c6a9.js";import{B as y,a as f,i as w,g as C}from"./within-dates-c0bc65f7.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-235dc1fc.js";import{e as k}from"./endOfDay-a0fc225b.js";import"./engine-generic-9f6fcaee.js";import"./media-c9012082.js";class b extends t{}class x extends y{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new b(e("error.camera_initialization_reolink"),this.getConfig());this._channel=n}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class v{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._cache=new a}getEngineType(){return n.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==s)return null;const n=t.title.split(/ +/);if(2!==n.length)return null;const o=D(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:k(a)}:null}_reolinkCameraMetadataGenerator(e){const t=e.media_content_id.match(/^media-source:\/\/reolink\/CAM\|(?.+)\|(?\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new x(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,n){const s=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;if(null===t.getChannel()||!r)return null;const o=await this._browseMediaManager.walkBrowseMedias(e,[{targets:["media-source://reolink"],metadataGenerator:(e,t)=>this._reolinkCameraMetadataGenerator(e),matcher:e=>e._metadata?.channel===t.getChannel()&&e._metadata?.configEntryID===r}],{...!1!==n?.useCache&&{cache:this._cache}});return o?.length?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===s.reolink?.media_resolution?"sub":"main")],metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&w(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._cache}}):null}async getEvents(e,t,a,s){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=s?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof x?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??M;let m=[];h?.length&&(m=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&w(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._cache}}));const p=_(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:n.Reolink,browseMedia:p};(s?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,n){return v.isReolinkEventQueryResults(n)?C(n.browseMedia):null}async getMediaMetadata(e,t,a,s){const i=new Map,o=s?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const n=t.getCamera(a);if(!(n&&n instanceof x))return;const i=await this._getMatchingDirectories(e,n,null,s);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(p(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:n.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(s?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-8ab85d2e.js.gz b/www/community/frigate-hass-card/engine-reolink-8ab85d2e.js.gz new file mode 100644 index 00000000..a5603c44 Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-8ab85d2e.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-a43e6d37.js b/www/community/frigate-hass-card/engine-reolink-a43e6d37.js new file mode 100644 index 00000000..7e570268 --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-a43e6d37.js @@ -0,0 +1,8 @@ +import{l as e,e0 as t,e7 as a,e3 as n,eb as s,e8 as i,dM as r,c$ as o,e2 as c,e1 as l,ec as u,e5 as h,e6 as d,e9 as g,d7 as m,d9 as _}from"./card-e5d55e5b.js";import{B as p,a as y,i as f,g as w}from"./within-dates-446c6430.js";import{C}from"./engine-86b0096c.js";import{p as M}from"./parse-214d78af.js";import{e as k}from"./endOfDay-cfc9c86c.js";import"./engine-generic-93cdbee6.js";import"./media-c9012082.js";class D extends t{}class b extends p{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new D(e("error.camera_initialization_reolink"),this.getConfig());this._channel=n}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class x{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class v extends y{constructor(){super(...arguments),this._cache=new a}getEngineType(){return n.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==s)return null;const n=t.title.split(/ +/);if(2!==n.length)return null;const o=M(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=M(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:k(a)}:null}_reolinkCameraMetadataGenerator(e){const t=e.media_content_id.match(/^media-source:\/\/reolink\/CAM\|(?.+)\|(?\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new b(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,n){const s=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;if(null===t.getChannel()||!r)return null;const o=await this._browseMediaManager.walkBrowseMedias(e,[{targets:["media-source://reolink"],metadataGenerator:(e,t)=>this._reolinkCameraMetadataGenerator(e),matcher:e=>e._metadata?.channel===t.getChannel()&&e._metadata?.configEntryID===r}],{...!1!==n?.useCache&&{cache:this._cache}});return o?.length?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===s.reolink?.media_resolution?"sub":"main")],metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&f(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._cache}}):null}async getEvents(e,t,a,s){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=s?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof b?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??C;let _=[];h?.length&&(_=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&f(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._cache}}));const p=m(_,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:n.Reolink,browseMedia:p};(s?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,n){return x.isReolinkEventQueryResults(n)?w(n.browseMedia):null}async getMediaMetadata(e,t,a,s){const i=new Map,o=s?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const n=t.getCamera(a);if(!(n&&n instanceof b))return;const i=await this._getMatchingDirectories(e,n,null,s);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(_(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:n.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(s?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineIcon:"reolink"}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{v as ReolinkCameraManagerEngine,x as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-a43e6d37.js.gz b/www/community/frigate-hass-card/engine-reolink-a43e6d37.js.gz new file mode 100644 index 00000000..efdc4273 Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-a43e6d37.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-b5a59dfe.js b/www/community/frigate-hass-card/engine-reolink-b5a59dfe.js new file mode 100644 index 00000000..ef4267fe --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-b5a59dfe.js @@ -0,0 +1,8 @@ +import{l as e,e5 as t,ed as a,e8 as n,ei as s,ee as i,dR as r,d5 as o,e7 as c,e6 as l,ej as u,ea as h,eb as d,ef as g,ek as m,dd as _,df as p}from"./card-4e88bdfb.js";import{B as y,a as f,i as w,g as C}from"./within-dates-545c5d93.js";import{C as M}from"./engine-86b0096c.js";import{p as k}from"./parse-e098fe54.js";import{e as D}from"./endOfDay-a3114e3f.js";import"./engine-generic-16943492.js";import"./media-c9012082.js";class b extends t{}class x extends y{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new b(e("error.camera_initialization_reolink"),this.getConfig());this._channel=n}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class v{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._cache=new a}getEngineType(){return n.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==s)return null;const n=t.title.split(/ +/);if(2!==n.length)return null;const o=k(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=k(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:D(a)}:null}_reolinkCameraMetadataGenerator(e){const t=e.media_content_id.match(/^media-source:\/\/reolink\/CAM\|(?.+)\|(?\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new x(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,n){const s=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;if(null===t.getChannel()||!r)return null;const o=await this._browseMediaManager.walkBrowseMedias(e,[{targets:["media-source://reolink"],metadataGenerator:(e,t)=>this._reolinkCameraMetadataGenerator(e),matcher:e=>e._metadata?.channel===t.getChannel()&&e._metadata?.configEntryID===r}],{...!1!==n?.useCache&&{cache:this._cache}});return o?.length?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===s.reolink?.media_resolution?"sub":"main")],metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&w(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._cache}}):null}async getEvents(e,t,a,s){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=s?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof x?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??M;let m=[];h?.length&&(m=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&w(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._cache}}));const p=_(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:n.Reolink,browseMedia:p};(s?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,n){return v.isReolinkEventQueryResults(n)?C(n.browseMedia):null}async getMediaMetadata(e,t,a,s){const i=new Map,o=s?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const n=t.getCamera(a);if(!(n&&n instanceof x))return;const i=await this._getMatchingDirectories(e,n,null,s);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(p(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:n.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(s?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-b5a59dfe.js.gz b/www/community/frigate-hass-card/engine-reolink-b5a59dfe.js.gz new file mode 100644 index 00000000..73cbe83a Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-b5a59dfe.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-c0a1587c.js b/www/community/frigate-hass-card/engine-reolink-c0a1587c.js new file mode 100644 index 00000000..79333c81 --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-c0a1587c.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as n,eh as s,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as _,de as p}from"./card-09c4bade.js";import{B as y,a as f,i as w,g as C}from"./within-dates-cc9f8404.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-645a86cb.js";import{e as k}from"./endOfDay-8be4da1b.js";import"./engine-generic-458c9005.js";import"./media-c9012082.js";class b extends t{}class x extends y{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,n=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===n)throw new b(e("error.camera_initialization_reolink"),this.getConfig());this._channel=n}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class v{static isReolinkEventQueryResults(e){return e.engine===n.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._cache=new a}getEngineType(){return n.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==s)return null;const n=t.title.split(/ +/);if(2!==n.length)return null;const o=D(n[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=n[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:k(a)}:null}_reolinkCameraMetadataGenerator(e){const t=e.media_content_id.match(/^media-source:\/\/reolink\/CAM\|(?.+)\|(?\d+)$/);return t?.groups?{configEntryID:t.groups.configEntryID,channel:Number(t.groups.channel)}:null}async createCamera(e,t){const a=new x(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,n){const s=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;if(null===t.getChannel()||!r)return null;const o=await this._browseMediaManager.walkBrowseMedias(e,[{targets:["media-source://reolink"],metadataGenerator:(e,t)=>this._reolinkCameraMetadataGenerator(e),matcher:e=>e._metadata?.channel===t.getChannel()&&e._metadata?.configEntryID===r}],{...!1!==n?.useCache&&{cache:this._cache}});return o?.length?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===s.reolink?.media_resolution?"sub":"main")],metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&w(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._cache}}):null}async getEvents(e,t,a,s){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=s?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof x?await this._getMatchingDirectories(e,l,o,s):null,g=o.limit??M;let m=[];h?.length&&(m=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&w(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._cache}}));const p=_(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:n.Reolink,browseMedia:p};(s?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,n){return v.isReolinkEventQueryResults(n)?C(n.browseMedia):null}async getMediaMetadata(e,t,a,s){const i=new Map,o=s?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const n=t.getCamera(a);if(!(n&&n instanceof x))return;const i=await this._getMatchingDirectories(e,n,null,s);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(p(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:n.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(s?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-c0a1587c.js.gz b/www/community/frigate-hass-card/engine-reolink-c0a1587c.js.gz new file mode 100644 index 00000000..cd9d6e46 Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-c0a1587c.js.gz differ diff --git a/www/community/frigate-hass-card/engine-reolink-ec1b4246.js b/www/community/frigate-hass-card/engine-reolink-ec1b4246.js new file mode 100644 index 00000000..b8f098fc --- /dev/null +++ b/www/community/frigate-hass-card/engine-reolink-ec1b4246.js @@ -0,0 +1,8 @@ +import{l as e,e4 as t,ec as a,e7 as s,eh as n,ed as i,dQ as r,d4 as o,e6 as c,e5 as l,ei as u,e9 as h,ea as d,ee as g,ej as m,dc as p,de as _}from"./card-7cd05290.js";import{B as y,a as f,i as C,g as w}from"./within-dates-2bb98b10.js";import{C as M}from"./engine-86b0096c.js";import{p as D}from"./parse-feacefaa.js";import{e as x}from"./endOfDay-0c5086cb.js";import"./engine-generic-96b32038.js";import"./media-c9012082.js";class k extends t{}class b extends y{constructor(){super(...arguments),this._channel=null}async initialize(e){return await super.initialize(e),this._initializeChannel(),this}_initializeChannel(){const t=this._entity?.unique_id,a=t?String(t).match(/(.*)_(?\d+)/):null,s=a&&a.groups?.channel?Number(a.groups.channel):null;if(null===s)throw new k(e("error.camera_initialization_reolink"),this.getConfig());this._channel=s}getChannel(){return this._channel}getProxyConfig(){return{...super.getProxyConfig(),media:"auto"===this._config.proxy.media||this._config.proxy.media,ssl_verification:"auto"!==this._config.proxy.ssl_verification&&this._config.proxy.ssl_verification,ssl_ciphers:"auto"===this._config.proxy.ssl_ciphers?"intermediate":this._config.proxy.ssl_ciphers}}}class v{static isReolinkEventQueryResults(e){return e.engine===s.Reolink&&e.type===d.Event}}class E extends f{constructor(){super(...arguments),this._directoryCache=new a,this._fileCache=new a}getEngineType(){return s.Reolink}_reolinkFileMetadataGenerator(e,t,a){ +/* istanbul ignore next: This situation cannot happen as the directory would + be rejected by _reolinkDirectoryMetadataGenerator if there was no start date + -- @preserve */ +if(!a?._metadata?.startDate||t.media_class!==n)return null;const s=t.title.split(/ +/);if(2!==s.length)return null;const o=D(s[0],"HH:mm:ss",a._metadata.startDate);if(!i(o))return null;const c=s[1].match(/(?\d+):(?\d+):(?\d+)/),l=c?.groups?{hours:Number(c.groups.hours),minutes:Number(c.groups.minutes),seconds:Number(c.groups.seconds)}:null;return{cameraID:e,startDate:o,endDate:l?r(o,l):o}}_reolinkDirectoryMetadataGenerator(e,t){const a=D(t.title,"yyyy/M/d",new Date);return i(a)?{cameraID:e,startDate:o(a),endDate:x(a)}:null}async createCamera(e,t){const a=new b(t,this,{capabilities:new c({"favorite-events":!1,"favorite-recordings":!1,clips:!0,live:!0,menu:!0,recordings:!1,seek:!1,snapshots:!1,substream:!0,ptz:l(t)??void 0},{disable:t.capabilities?.disable,disableExcept:t.capabilities?.disable_except}),eventCallback:this._eventCallback});return await a.initialize({entityRegistryManager:this._entityRegistryManager,hass:e,stateWatcher:this._stateWatcher})}async _getMatchingDirectories(e,t,a,s){const n=t.getConfig(),i=t.getEntity(),r=i?.config_entry_id;return null!==t.getChannel()&&r?await this._browseMediaManager.walkBrowseMedias(e,[{targets:[`media-source://reolink/RES|${r}|${t.getChannel()}|`+("low"===n.reolink?.media_resolution?"sub":"main")],concurrency:1/0,metadataGenerator:(e,a)=>this._reolinkDirectoryMetadataGenerator(t.getID(),e),matcher:e=>e.can_expand&&C(e,a?.start,a?.end),sorter:e=>u(e)}],{...!1!==s?.useCache&&{cache:this._directoryCache}}):null}async getEvents(e,t,a,n){if(a.favorite||a.tags?.size||a.what?.size||a.where?.size||a.hasSnapshot)return null;const i=new Map,r=async r=>{const o={...a,cameraIDs:new Set([r])},c=n?.useCache??1?this._requestCache.get(o):null;if(c)return void i.set(o,c);const l=t.getCamera(r),h=l&&l instanceof b?await this._getMatchingDirectories(e,l,o,n):null,g=o.limit??M;let m=[];h?.length&&(m=await this._browseMediaManager.walkBrowseMedias(e,[{targets:h,concurrency:1,metadataGenerator:(e,t)=>this._reolinkFileMetadataGenerator(r,e,t),earlyExit:e=>e.length>=g,matcher:e=>!e.can_expand&&C(e,o.start,o.end),sorter:e=>u(e)}],{...!1!==n?.useCache&&{cache:this._fileCache}}));const _=p(m,(e=>e._metadata?.startDate),"desc").slice(0,g),y={type:d.Event,engine:s.Reolink,browseMedia:_};(n?.useCache??1)&&this._requestCache.set(o,{...y,cached:!0},y.expiry),i.set(o,y)};return await h(a.cameraIDs,(e=>r(e))),i}generateMediaFromEvents(e,t,a,s){return v.isReolinkEventQueryResults(s)?w(s.browseMedia):null}async getMediaMetadata(e,t,a,n){const i=new Map,o=n?.useCache??1?this._requestCache.get(a):null;if(o)return i.set(a,o),i;const c=new Set,l=async a=>{const s=t.getCamera(a);if(!(s&&s instanceof b))return;const i=await this._getMatchingDirectories(e,s,null,n);for(const e of i??[]) +/* istanbul ignore next: This situation cannot happen as the directory + will not match without metadata -- @preserve */ +e._metadata&&c.add(_(e._metadata?.startDate))};await h(a.cameraIDs,(e=>l(e)));const u={type:d.MediaMetadata,engine:s.Reolink,metadata:{...c.size&&{days:c}},expiry:r(new Date,{seconds:g}),cached:!1};return(n?.useCache??1)&&this._requestCache.set(a,{...u,cached:!0},u.expiry),i.set(a,u),i}getCameraMetadata(e,t){return{...super.getCameraMetadata(e,t),engineLogo:m}}getCameraEndpoints(e,t){const a=e.reolink?.url?{endpoint:e.reolink.url}:null;return{...super.getCameraEndpoints(e,t),...a&&{ui:a}}}}export{E as ReolinkCameraManagerEngine,v as ReolinkQueryResultsClassifier}; diff --git a/www/community/frigate-hass-card/engine-reolink-ec1b4246.js.gz b/www/community/frigate-hass-card/engine-reolink-ec1b4246.js.gz new file mode 100644 index 00000000..f651c4c5 Binary files /dev/null and b/www/community/frigate-hass-card/engine-reolink-ec1b4246.js.gz differ diff --git a/www/community/frigate-hass-card/frigate-hass-card.js b/www/community/frigate-hass-card/frigate-hass-card.js index 764fd995..1a65fc76 100644 --- a/www/community/frigate-hass-card/frigate-hass-card.js +++ b/www/community/frigate-hass-card/frigate-hass-card.js @@ -1 +1 @@ -import"./card-555679fd.js"; +import"./card-e5d55e5b.js"; diff --git a/www/community/frigate-hass-card/frigate-hass-card.js.gz b/www/community/frigate-hass-card/frigate-hass-card.js.gz index 1222a2e0..368f9524 100644 Binary files a/www/community/frigate-hass-card/frigate-hass-card.js.gz and b/www/community/frigate-hass-card/frigate-hass-card.js.gz differ diff --git a/www/community/frigate-hass-card/frigate-hass-card.zip b/www/community/frigate-hass-card/frigate-hass-card.zip index 0475a05a..460ac025 100644 Binary files a/www/community/frigate-hass-card/frigate-hass-card.zip and b/www/community/frigate-hass-card/frigate-hass-card.zip differ diff --git a/www/community/frigate-hass-card/gallery-149d4f41.js b/www/community/frigate-hass-card/gallery-149d4f41.js new file mode 100644 index 00000000..30549d97 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-149d4f41.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-7cd05290.js";import{e as I}from"./endOfDay-0c5086cb.js";import{p as W}from"./parse-feacefaa.js";import{F as R}from"./date-picker-86e47001.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-149d4f41.js.gz b/www/community/frigate-hass-card/gallery-149d4f41.js.gz new file mode 100644 index 00000000..e068afbd Binary files /dev/null and b/www/community/frigate-hass-card/gallery-149d4f41.js.gz differ diff --git a/www/community/frigate-hass-card/gallery-1de615c4.js b/www/community/frigate-hass-card/gallery-1de615c4.js new file mode 100644 index 00000000..6d2b4b61 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-1de615c4.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-45855f1f.js";import{e as I}from"./endOfDay-24d35e3f.js";import{p as W}from"./parse-114e8d53.js";import{F as R}from"./date-picker-40111fdc.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-1de615c4.js.gz b/www/community/frigate-hass-card/gallery-1de615c4.js.gz new file mode 100644 index 00000000..f1d73329 Binary files /dev/null and b/www/community/frigate-hass-card/gallery-1de615c4.js.gz differ diff --git a/www/community/frigate-hass-card/gallery-2c34cd79.js b/www/community/frigate-hass-card/gallery-2c34cd79.js new file mode 100644 index 00000000..1e08ff19 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-2c34cd79.js @@ -0,0 +1,184 @@ +import{c$ as e,d0 as t,d1 as r,l as i,d2 as o,d3 as n,d4 as a,d5 as s,i as l,d6 as c,d7 as d,k as h,d8 as g,d9 as u,da as m,db as p,_ as f,n as v,cR as b,cM as y,dc as w,x as $,cQ as x,r as k,a as _,t as C,e as T,b as E,dd as O,de as S,cI as M,df as z,dg as L,cP as D,dh as A,cX as F}from"./card-19444f74.js";import{e as I}from"./endOfDay-da61af46.js";import{p as W}from"./parse-02360460.js";import{F as R}from"./date-picker-f1b8df79.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,P; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function q(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(P||(P={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:P.Clips,label:i("media_filter.media_types.clips")},{value:P.Snapshots,label:i("media_filter.media_types.snapshots")},{value:P.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===P.Clips||r.mediaType===P.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===P.Clips&&{hasClip:!0},...r.mediaType===P.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===P.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?P.Clips:i[0]?P.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=P.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=Pe(o,t?"componentWillLoad":"componentWillUpdate"),n=qe(n,(()=>Pe(o,"componentWillRender"))),i(),qe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,Pe(r,"componentDidRender"),64&e.$flags$?(Pe(r,"componentDidUpdate"),t()):(e.$flags$|=64,Pe(r,"componentDidLoad"),t())},Pe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},qe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",Pt="reference",qt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?Pt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?qt:qt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],P=mr(0,k[L],H[L]),q=y?k[L]/2-I-P-j-T.mainAxis:W-P-j-T.mainAxis,U=y?-k[L]/2+I+P+B+T.mainAxis:R+P+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+q-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var Pr={placement:"bottom",modifiers:[],strategy:"absolute"};function qr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(q(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(q(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-2c34cd79.js.gz b/www/community/frigate-hass-card/gallery-2c34cd79.js.gz new file mode 100644 index 00000000..931c54c0 Binary files /dev/null and b/www/community/frigate-hass-card/gallery-2c34cd79.js.gz differ diff --git a/www/community/frigate-hass-card/gallery-82bf4b2b.js b/www/community/frigate-hass-card/gallery-82bf4b2b.js new file mode 100644 index 00000000..c56f2178 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-82bf4b2b.js @@ -0,0 +1,184 @@ +import{d4 as e,d5 as t,d6 as r,l as i,d7 as o,d8 as n,d9 as a,da as s,i as l,db as c,dc as d,k as h,dd as g,de as u,df as m,dg as p,_ as f,n as v,cW as b,cR as y,dh as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,di as O,dj as S,cI as M,dk as z,dl as L,cU as D,dm as A,d0 as F}from"./card-4e88bdfb.js";import{e as I}from"./endOfDay-a3114e3f.js";import{p as W}from"./parse-e098fe54.js";import{F as R}from"./date-picker-6ca5b3a6.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-82bf4b2b.js.gz b/www/community/frigate-hass-card/gallery-82bf4b2b.js.gz new file mode 100644 index 00000000..41ff3fc1 Binary files /dev/null and b/www/community/frigate-hass-card/gallery-82bf4b2b.js.gz differ diff --git a/www/community/frigate-hass-card/gallery-9024cb87.js b/www/community/frigate-hass-card/gallery-9024cb87.js new file mode 100644 index 00000000..dfcd0754 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-9024cb87.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-09c4bade.js";import{e as I}from"./endOfDay-8be4da1b.js";import{p as W}from"./parse-645a86cb.js";import{F as R}from"./date-picker-3dacab82.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-9024cb87.js.gz b/www/community/frigate-hass-card/gallery-9024cb87.js.gz new file mode 100644 index 00000000..4a08450f Binary files /dev/null and b/www/community/frigate-hass-card/gallery-9024cb87.js.gz differ diff --git a/www/community/frigate-hass-card/gallery-bf3892f1.js b/www/community/frigate-hass-card/gallery-bf3892f1.js new file mode 100644 index 00000000..88ab9687 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-bf3892f1.js @@ -0,0 +1,184 @@ +import{c$ as e,d0 as t,d1 as r,l as i,d2 as o,d3 as n,d4 as a,d5 as s,i as l,d6 as c,d7 as d,k as h,d8 as g,d9 as u,da as m,db as p,_ as f,n as v,cR as b,cM as y,dc as w,x as $,cQ as x,r as k,a as _,t as C,e as T,b as E,dd as O,de as S,cI as M,df as z,dg as L,cP as D,dh as A,cX as F}from"./card-320adb66.js";import{e as I}from"./endOfDay-086a6977.js";import{p as W}from"./parse-7f4a6e12.js";import{F as R}from"./date-picker-576d50a8.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,P; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function q(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(P||(P={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:P.Clips,label:i("media_filter.media_types.clips")},{value:P.Snapshots,label:i("media_filter.media_types.snapshots")},{value:P.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===P.Clips||r.mediaType===P.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===P.Clips&&{hasClip:!0},...r.mediaType===P.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===P.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?P.Clips:i[0]?P.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=P.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=Pe(o,t?"componentWillLoad":"componentWillUpdate"),n=qe(n,(()=>Pe(o,"componentWillRender"))),i(),qe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,Pe(r,"componentDidRender"),64&e.$flags$?(Pe(r,"componentDidUpdate"),t()):(e.$flags$|=64,Pe(r,"componentDidLoad"),t())},Pe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},qe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",Pt="reference",qt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?Pt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?qt:qt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],P=mr(0,k[L],H[L]),q=y?k[L]/2-I-P-j-T.mainAxis:W-P-j-T.mainAxis,U=y?-k[L]/2+I+P+B+T.mainAxis:R+P+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+q-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var Pr={placement:"bottom",modifiers:[],strategy:"absolute"};function qr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(q(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(q(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-bf3892f1.js.gz b/www/community/frigate-hass-card/gallery-bf3892f1.js.gz new file mode 100644 index 00000000..16017b55 Binary files /dev/null and b/www/community/frigate-hass-card/gallery-bf3892f1.js.gz differ diff --git a/www/community/frigate-hass-card/gallery-c718155d.js b/www/community/frigate-hass-card/gallery-c718155d.js new file mode 100644 index 00000000..2cebd1d1 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-c718155d.js @@ -0,0 +1,184 @@ +import{d3 as e,d4 as t,d5 as r,l as i,d6 as o,d7 as n,d8 as a,d9 as s,i as l,da as c,db as d,k as h,dc as g,dd as u,de as m,df as p,_ as f,n as v,cW as b,cR as y,dg as w,x as $,cV as x,r as k,a as _,t as C,e as T,b as E,dh as O,di as S,cI as M,dj as z,dk as L,cU as D,dl as A,c$ as F}from"./card-c642ee74.js";import{e as I}from"./endOfDay-97ae2cc7.js";import{p as W}from"./parse-a53fb39b.js";import{F as R}from"./date-picker-cfd85f75.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,q; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function P(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(q||(q={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:q.Clips,label:i("media_filter.media_types.clips")},{value:q.Snapshots,label:i("media_filter.media_types.snapshots")},{value:q.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===q.Clips||r.mediaType===q.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===q.Clips&&{hasClip:!0},...r.mediaType===q.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===q.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?q.Clips:i[0]?q.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=q.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=qe(o,t?"componentWillLoad":"componentWillUpdate"),n=Pe(n,(()=>qe(o,"componentWillRender"))),i(),Pe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,qe(r,"componentDidRender"),64&e.$flags$?(qe(r,"componentDidUpdate"),t()):(e.$flags$|=64,qe(r,"componentDidLoad"),t())},qe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},Pe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",qt="reference",Pt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?qt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?Pt:Pt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],q=mr(0,k[L],H[L]),P=y?k[L]/2-I-q-j-T.mainAxis:W-q-j-T.mainAxis,U=y?-k[L]/2+I+q+B+T.mainAxis:R+q+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+P-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var qr={placement:"bottom",modifiers:[],strategy:"absolute"};function Pr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(P(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(P(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-c718155d.js.gz b/www/community/frigate-hass-card/gallery-c718155d.js.gz new file mode 100644 index 00000000..45e679d1 Binary files /dev/null and b/www/community/frigate-hass-card/gallery-c718155d.js.gz differ diff --git a/www/community/frigate-hass-card/gallery-cc224df7.js b/www/community/frigate-hass-card/gallery-cc224df7.js new file mode 100644 index 00000000..d6db9fe4 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-cc224df7.js @@ -0,0 +1,184 @@ +import{c$ as e,d0 as t,d1 as r,l as i,d2 as o,d3 as n,d4 as a,d5 as s,i as l,d6 as c,d7 as d,k as h,d8 as g,d9 as u,da as m,db as p,_ as f,n as v,cR as b,cM as y,dc as w,x as $,cQ as x,r as k,a as _,t as C,e as T,b as E,dd as O,de as S,cI as M,df as z,dg as L,cP as D,dh as A,cX as F}from"./card-0be2c6a9.js";import{e as I}from"./endOfDay-a0fc225b.js";import{p as W}from"./parse-235dc1fc.js";import{F as R}from"./date-picker-5708aa47.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,P; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function q(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(P||(P={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:P.Clips,label:i("media_filter.media_types.clips")},{value:P.Snapshots,label:i("media_filter.media_types.snapshots")},{value:P.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===P.Clips||r.mediaType===P.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===P.Clips&&{hasClip:!0},...r.mediaType===P.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===P.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?P.Clips:i[0]?P.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=P.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=Pe(o,t?"componentWillLoad":"componentWillUpdate"),n=qe(n,(()=>Pe(o,"componentWillRender"))),i(),qe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,Pe(r,"componentDidRender"),64&e.$flags$?(Pe(r,"componentDidUpdate"),t()):(e.$flags$|=64,Pe(r,"componentDidLoad"),t())},Pe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},qe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",Pt="reference",qt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?Pt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?qt:qt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],P=mr(0,k[L],H[L]),q=y?k[L]/2-I-P-j-T.mainAxis:W-P-j-T.mainAxis,U=y?-k[L]/2+I+P+B+T.mainAxis:R+P+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+q-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var Pr={placement:"bottom",modifiers:[],strategy:"absolute"};function qr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(q(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(q(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-cc224df7.js.gz b/www/community/frigate-hass-card/gallery-cc224df7.js.gz new file mode 100644 index 00000000..99b20aa7 Binary files /dev/null and b/www/community/frigate-hass-card/gallery-cc224df7.js.gz differ diff --git a/www/community/frigate-hass-card/gallery-f478918c.js b/www/community/frigate-hass-card/gallery-f478918c.js new file mode 100644 index 00000000..da0d97a6 --- /dev/null +++ b/www/community/frigate-hass-card/gallery-f478918c.js @@ -0,0 +1,184 @@ +import{c_ as e,c$ as t,d0 as r,l as i,d1 as o,d2 as n,d3 as a,d4 as s,i as l,d5 as c,d6 as d,k as h,d7 as g,d8 as u,d9 as m,da as p,_ as f,n as v,cQ as b,cL as y,db as w,x as $,cP as x,r as k,a as _,t as C,e as T,b as E,dc as O,dd as S,cH as M,de as z,df as L,cO as D,dg as A,cW as F}from"./card-e5d55e5b.js";import{e as I}from"./endOfDay-cfc9c86c.js";import{p as W}from"./parse-214d78af.js";import{F as R}from"./date-picker-d9927b87.js";function N(t){const r=e(t),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function H(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(23,59,59,999),o}function V(){const e=new Date,t=e.getFullYear(),r=e.getMonth(),i=e.getDate(),o=new Date(0);return o.setFullYear(t,r,i-1),o.setHours(0,0,0,0),o}var j,B,P; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function q(e){return class extends e{createRenderRoot(){const e=this.constructor,{registry:t,elementDefinitions:i,shadowRootOptions:o}=e;i&&!t&&(e.registry=new CustomElementRegistry,Object.entries(i).forEach((([t,r])=>e.registry.define(t,r))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:e.registry});return r(n,this.constructor.elementStyles),n}}}!function(e){e.Favorite="favorite",e.NotFavorite="not-favorite"}(j||(j={})),function(e){e.Today="today",e.Yesterday="yesterday",e.PastWeek="past-week",e.PastMonth="past-month",e.Custom="custom"}(B||(B={})),function(e){e.Clips="clips",e.Snapshots="snapshots",e.Recordings="recordings"}(P||(P={}));class U{constructor(e){this._cameraOptions=[],this._whenOptions=[],this._metaDataWhenOptions=[],this._whatOptions=[],this._whereOptions=[],this._tagsOptions=[],this._defaults=null,this._viewManager=null,this._host=e,this._favoriteOptions=[{value:j.Favorite,label:i("media_filter.favorite")},{value:j.NotFavorite,label:i("media_filter.not_favorite")}],this._mediaTypeOptions=[{value:P.Clips,label:i("media_filter.media_types.clips")},{value:P.Snapshots,label:i("media_filter.media_types.snapshots")},{value:P.Recordings,label:i("media_filter.media_types.recordings")}],this._staticWhenOptions=[{value:B.Today,label:i("media_filter.whens.today")},{value:B.Yesterday,label:i("media_filter.whens.yesterday")},{value:B.PastWeek,label:i("media_filter.whens.past_week")},{value:B.PastMonth,label:i("media_filter.whens.past_month")},{value:B.Custom,label:i("media_filter.whens.custom")}],this._computeWhenOptions()}getMediaTypeOptions(){return this._mediaTypeOptions}getCameraOptions(){return this._cameraOptions}getWhenOptions(){return this._whenOptions}getWhatOptions(){return this._whatOptions}getWhereOptions(){return this._whereOptions}getTagsOptions(){return this._tagsOptions}getFavoriteOptions(){return this._favoriteOptions}getDefaults(){return this._defaults}setViewManager(e){this._viewManager=e}async valueChangeHandler(e,t,r,i){const s=e=>e&&Array.isArray(e)&&e.length&&!e.includes("")?new Set([...e]):null,l=s(r.camera)??this._getAllCameraIDs(e);if(!l.size||!r.mediaType)return;const c=this._getWhen(r.when),d=r.favorite?r.favorite===j.Favorite:null,h=t.performance?.features.media_chunk_size;if(r.mediaType===P.Clips||r.mediaType===P.Snapshots){const e=s(r.where),t=s(r.what),i=s(r.tags),a=new o([{type:n.Event,cameraIDs:l,...i&&{tags:i},...t&&{what:t},...e&&{where:e},...null!==d&&{favorite:d},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...h&&{limit:h},...r.mediaType===P.Clips&&{hasClip:!0},...r.mediaType===P.Snapshots&&{hasSnapshot:!0}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:a,...1===l.size&&{camera:[...l][0]},view:r.mediaType===P.Clips?"clips":"snapshots"}})}else{const e=new a([{type:n.Recording,cameraIDs:l,...h&&{limit:h},...c&&{...c.start&&{start:c.start},...c.end&&{end:c.end}},...null!==d&&{favorite:d}}]);this._viewManager?.setViewByParametersWithExistingQuery({params:{query:e,...1===l.size&&{camera:[...l][0]},view:"recordings"}})}this._host.requestUpdate()}_getAllCameraIDs(e){return e.getStore().getCameraIDsWithCapability({anyCapabilities:["clips","snapshots","recordings"]})}computeInitialDefaultsFromView(e){const t=this._viewManager?.getView(),r=t?.query?.getQueries(),i=this._getAllCameraIDs(e);if(!t||!r||!i.size)return;let o,n,a,d,h,g;1!==s(r.map((e=>e.cameraIDs)),l).length||l(r[0].cameraIDs,i)||(n=[...r[0].cameraIDs]); +/* istanbul ignore else: the else path cannot be reached -- @preserve */ +if(1===s(r.map((e=>e.favorite)),l).length&&void 0!==r[0].favorite&&(h=r[0].favorite?j.Favorite:j.NotFavorite),c.areEventQueries(t.query)){const e=t.query.getQueries(); +/* istanbul ignore if: the if path cannot be reached -- @preserve */if(!e)return;const r=s(e.map((e=>e.hasClip)),l),i=s(e.map((e=>e.hasSnapshot)),l);1===r.length&&1===i.length&&(o=r[0]?P.Clips:i[0]?P.Snapshots:void 0);1===s(e.map((e=>e.what)),l).length&&e[0].what?.size&&(a=[...e[0].what]);1===s(e.map((e=>e.where)),l).length&&e[0].where?.size&&(d=[...e[0].where]);1===s(e.map((e=>e.tags)),l).length&&e[0].tags?.size&&(g=[...e[0].tags])}else c.areRecordingQueries(t.query)&&(o=P.Recordings);this._defaults={...o&&{mediaType:o},...n&&{cameraIDs:n},...a&&{what:a},...d&&{where:d},...void 0!==h&&{favorite:h},...g&&{tags:g}}}computeCameraOptions(e){this._cameraOptions=[...this._getAllCameraIDs(e)].map((t=>({value:t,label:e.getCameraMetadata(t)?.title??t})))}async computeMetadataOptions(e){let t=null;try{t=await e.getMediaMetadata()}catch(e){d(e)}if(t){if(t.what&&(this._whatOptions=[...t.what].sort().map((e=>({value:e,label:h(e)})))),t.where&&(this._whereOptions=[...t.where].sort().map((e=>({value:e,label:h(e)})))),t.tags&&(this._tagsOptions=[...t.tags].sort().map((e=>({value:e,label:h(e)})))),t.days){const e=new Set;[...t.days].forEach((t=>{e.add(t.substring(0,7))}));const r=[];e.forEach((e=>{r.push(W(e,"yyyy-MM",new Date))})),this._metaDataWhenOptions=g(r,(e=>e.getTime()),"desc").map((e=>({label:u(e,"MMMM yyyy"),value:this._dateRangeToString({start:e,end:N(e)})}))),this._computeWhenOptions()}this._host.requestUpdate()}}getControlsToShow(e){const t=this._viewManager?.getView(),r=c.areEventQueries(t?.query),i=c.areRecordingQueries(t?.query),o=e.getAggregateCameraCapabilities();return{events:r,recordings:i,favorites:r?o?.has("favorite-events"):!!i&&o?.has("favorite-recordings")}}_computeWhenOptions(){this._whenOptions=[...this._staticWhenOptions,...this._metaDataWhenOptions]}_dateRangeToString(e){return`${m(e.start)},${m(e.end)}`}_stringToDateRange(e){const t=e.split(",");return{start:W(t[0],"yyyy-MM-dd",new Date),end:I(W(t[1],"yyyy-MM-dd",new Date))}}_getWhen(e){if(e.from||e.to)return{...e.from&&{start:e.from},...e.to&&{end:e.to}};if(!e.selected||Array.isArray(e.selected))return null;const r=new Date;switch(e.selected){case B.Custom:return null;case B.Today:return{start:t(Date.now()),end:I(Date.now())};case B.Yesterday:return{start:V(),end:H()};case B.PastWeek:return{start:t(p(r,{days:7})),end:I(r)};case B.PastMonth:return{start:t(p(r,{months:1})),end:I(r)};default:return this._stringToDateRange(e.selected)}}}const K=!0,Y=!0,Q=!0,G=!1,X=!1;let Z,J,ee,te=!1,re=!1,ie=!1,oe=!1,ne=null,ae=!1;const se="http://www.w3.org/1999/xlink",le={},ce=e=>"object"===(e=typeof e)||"function"===e;const de=(e,t,...r)=>{let i=null,o=null,n=null,a=!1,s=!1;const l=[],c=t=>{for(let r=0;re[t])).join(" "))}}if("function"==typeof e)return e(null===t?{}:t,l,ue);const d=he(e,null);return d.$attrs$=t,l.length>0&&(d.$children$=l),d.$key$=o,d.$name$=n,d},he=(e,t)=>{const r={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null,$key$:null,$name$:null};return r},ge={},ue={forEach:(e,t)=>e.map(me).forEach(t),map:(e,t)=>e.map(me).map(t).map(pe)},me=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),pe=e=>{if("function"==typeof e.vtag){const t=Object.assign({},e.vattrs);return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}const t=he(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},fe=(e,t,r)=>{const i=e;return{emit:e=>ve(i,t,{bubbles:!!(4&r),composed:!!(2&r),cancelable:!!(1&r),detail:e})}},ve=(e,t,r)=>{const i=ht.ce(t,r);return e.dispatchEvent(i),i},be=new WeakMap,ye=e=>{const t=e.$cmpMeta$,r=e.$hostElement$,i=t.$flags$,o=(t.$tagName$,()=>{}),n=((e,t,r,i)=>{var o;let n=we(t,r);const a=at.get(n);if(e=11===e.nodeType?e:ct,a)if("string"==typeof a){e=e.head||e;let t,r=be.get(e);if(r||be.set(e,r=new Set),!r.has(n)){{t=ct.createElement("style"),t.innerHTML=a;const r=null!==(o=ht.$nonce$)&&void 0!==o?o:function(e){var t,r,i;return null!==(i=null===(r=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===r?void 0:r.getAttribute("content"))&&void 0!==i?i:void 0}(ct);null!=r&&t.setAttribute("nonce",r),e.insertBefore(t,e.querySelector("link"))}r&&r.add(n)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return n})(r.shadowRoot?r.shadowRoot:r.getRootNode(),t,e.$modeName$);10&i&&(r["s-sc"]=n,r.classList.add(n+"-h"),2&i&&r.classList.add(n+"-s")),o()},we=(e,t)=>"sc-"+(t&&32&e.$flags$?e.$tagName$+"-"+t:e.$tagName$),$e=(e,t,r,i,o,n)=>{if(r!==i){let a=ot(e,t),s=t.toLowerCase();if("class"===t){const t=e.classList,o=ke(r),n=ke(i);t.remove(...o.filter((e=>e&&!n.includes(e)))),t.add(...n.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in r)i&&null!=i[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in i)r&&i[t]===r[t]||(t.includes("-")?e.style.setProperty(t,i[t]):e.style[t]=i[t])}else if("key"===t);else if("ref"===t)i&&i(e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){const l=ce(i);if((a||l&&null!==i)&&!o)try{if(e.tagName.includes("-"))e[t]=i;else{const o=null==i?"":i;"list"===t?a=!1:null!=r&&e[t]==o||(e[t]=o)}}catch(e){}let c=!1;s!==(s=s.replace(/^xlink\:?/,""))&&(t=s,c=!0),null==i||!1===i?!1===i&&""!==e.getAttribute(t)||(c?e.removeAttributeNS(se,t):e.removeAttribute(t)):(!a||4&n||o)&&!l&&(i=!0===i?"":i,c?e.setAttributeNS(se,t,i):e.setAttribute(t,i))}else t="-"===t[2]?t.slice(3):ot(lt,s)?s.slice(2):s[2]+t.slice(3),r&&ht.rel(e,t,r,!1),i&&ht.ael(e,t,i,!1)}},xe=/\s/,ke=e=>e?e.split(xe):[],_e=(e,t,r,i)=>{const o=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,n=e&&e.$attrs$||le,a=t.$attrs$||le;for(i in n)i in a||$e(o,i,n[i],void 0,r,t.$flags$);for(i in a)$e(o,i,n[i],a[i],r,t.$flags$)},Ce=(e,t,r,i)=>{const o=t.$children$[r];let n,a,s,l=0;if(te||(ie=!0,"slot"===o.$tag$&&(Z&&i.classList.add(Z+"-s"),o.$flags$|=o.$children$?2:1)),null!==o.$text$)n=o.$elm$=ct.createTextNode(o.$text$);else if(1&o.$flags$)n=o.$elm$=ct.createTextNode("");else{if(oe||(oe="svg"===o.$tag$),n=o.$elm$=ct.createElementNS(oe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",2&o.$flags$?"slot-fb":o.$tag$),oe&&"foreignObject"===o.$tag$&&(oe=!1),_e(null,o,oe),null!=Z&&n["s-si"]!==Z&&n.classList.add(n["s-si"]=Z),o.$children$)for(l=0;l{ht.$flags$|=1;const r=e.childNodes;for(let e=r.length-1;e>=0;e--){const i=r[e];i["s-hn"]!==ee&&i["s-ol"]&&(ze(i).insertBefore(i,Me(i)),i["s-ol"].remove(),i["s-ol"]=void 0,ie=!0),t&&Te(i,t)}ht.$flags$&=-2},Ee=(e,t,r,i,o,n)=>{let a,s=e["s-cr"]&&e["s-cr"].parentNode||e;for(s.shadowRoot&&s.tagName===ee&&(s=s.shadowRoot);o<=n;++o)i[o]&&(a=Ce(null,r,o,e),a&&(i[o].$elm$=a,s.insertBefore(a,Me(t))))},Oe=(e,t,r,i,o)=>{for(;t<=r;++t)(i=e[t])&&(o=i.$elm$,We(i),re=!0,o["s-ol"]?o["s-ol"].remove():Te(o,!0),o.remove())},Se=(e,t)=>e.$tag$===t.$tag$&&("slot"===e.$tag$?e.$name$===t.$name$:e.$key$===t.$key$),Me=e=>e&&e["s-ol"]||e,ze=e=>(e["s-ol"]?e["s-ol"]:e).parentNode,Le=(e,t)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,n=t.$tag$,a=t.$text$;let s;null===a?(oe="svg"===n||"foreignObject"!==n&&oe,"slot"===n||_e(e,t,oe),null!==i&&null!==o?((e,t,r,i)=>{let o,n,a=0,s=0,l=0,c=0,d=t.length-1,h=t[0],g=t[d],u=i.length-1,m=i[0],p=i[u];for(;a<=d&&s<=u;)if(null==h)h=t[++a];else if(null==g)g=t[--d];else if(null==m)m=i[++s];else if(null==p)p=i[--u];else if(Se(h,m))Le(h,m),h=t[++a],m=i[++s];else if(Se(g,p))Le(g,p),g=t[--d],p=i[--u];else if(Se(h,p))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(h.$elm$.parentNode,!1),Le(h,p),e.insertBefore(h.$elm$,g.$elm$.nextSibling),h=t[++a],p=i[--u];else if(Se(g,m))"slot"!==h.$tag$&&"slot"!==p.$tag$||Te(g.$elm$.parentNode,!1),Le(g,m),e.insertBefore(g.$elm$,h.$elm$),g=t[--d],m=i[++s];else{for(l=-1,c=a;c<=d;++c)if(t[c]&&null!==t[c].$key$&&t[c].$key$===m.$key$){l=c;break}l>=0?(n=t[l],n.$tag$!==m.$tag$?o=Ce(t&&t[s],r,l,e):(Le(n,m),t[l]=void 0,o=n.$elm$),m=i[++s]):(o=Ce(t&&t[s],r,s,e),m=i[++s]),o&&ze(h.$elm$).insertBefore(o,Me(h.$elm$))}a>d?Ee(e,null==i[u+1]?null:i[u+1].$elm$,r,i,s,u):s>u&&Oe(t,a,d)})(r,i,t,o):null!==o?(null!==e.$text$&&(r.textContent=""),Ee(r,null,t,o,0,o.length-1)):null!==i&&Oe(i,0,i.length-1),oe&&"svg"===n&&(oe=!1)):(s=r["s-cr"])?s.parentNode.textContent=a:e.$text$!==a&&(r.data=a)},De=e=>{const t=e.childNodes;let r,i,o,n,a,s;for(i=0,o=t.length;i{let t,r,i,o,n,a,s=0;const l=e.childNodes,c=l.length;for(;s=0;a--)r=i[a],r["s-cn"]||r["s-nr"]||r["s-hn"]===t["s-hn"]||(Ie(r,o)?(n=Ae.find((e=>e.$nodeToRelocate$===r)),re=!0,r["s-sn"]=r["s-sn"]||o,n?n.$slotRefNode$=t:Ae.push({$slotRefNode$:t,$nodeToRelocate$:r}),r["s-sr"]&&Ae.map((e=>{Ie(e.$nodeToRelocate$,r["s-sn"])&&(n=Ae.find((e=>e.$nodeToRelocate$===r)),n&&!e.$slotRefNode$&&(e.$slotRefNode$=n.$slotRefNode$))}))):Ae.some((e=>e.$nodeToRelocate$===r))||Ae.push({$nodeToRelocate$:r}));1===t.nodeType&&Fe(t)}},Ie=(e,t)=>1===e.nodeType?null===e.getAttribute("slot")&&""===t||e.getAttribute("slot")===t:e["s-sn"]===t||""===t,We=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(We)},Re=(e,t)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||he(null,null),n=(a=t)&&a.$tag$===ge?t:de(null,null,t);var a;if(ee=r.tagName,i.$attrsToReflect$&&(n.$attrs$=n.$attrs$||{},i.$attrsToReflect$.map((([e,t])=>n.$attrs$[t]=r[e]))),n.$tag$=null,n.$flags$|=4,e.$vnode$=n,n.$elm$=o.$elm$=r.shadowRoot||r,Z=r["s-sc"],J=r["s-cr"],te=!!(1&i.$flags$),re=!1,Le(o,n),ht.$flags$|=1,ie){let e,t,r,i,o,a;Fe(n.$elm$);let s=0;for(;s{e.$flags$|=16,e.$ancestorComponent$;return $t((()=>He(e,t)))},He=(e,t)=>{const r=e.$hostElement$,i=(e.$cmpMeta$.$tagName$,()=>{}),o=r;let n;return n=Pe(o,t?"componentWillLoad":"componentWillUpdate"),n=qe(n,(()=>Pe(o,"componentWillRender"))),i(),qe(n,(()=>Ve(e,o,t)))},Ve=async(e,t,r)=>{const i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{});i["s-rc"],r&&ye(e);const n=(e.$cmpMeta$.$tagName$,()=>{});je(e,t,i),n(),o(),Be(e)},je=(e,t,r)=>{try{ne=t,t=t.render&&t.render(),e.$flags$&=-17,e.$flags$|=2,(K||Y)&&(Q||Y)&&(G||Re(e,t))}catch(t){nt(t,e.$hostElement$)}return ne=null,null},Be=e=>{e.$cmpMeta$.$tagName$;const t=()=>{},r=e.$hostElement$;e.$ancestorComponent$,Pe(r,"componentDidRender"),64&e.$flags$?(Pe(r,"componentDidUpdate"),t()):(e.$flags$|=64,Pe(r,"componentDidLoad"),t())},Pe=(e,t,r)=>{if(e&&e[t])try{return e[t](r)}catch(e){nt(e)}},qe=(e,t)=>e&&e.then?e.then(t):t(),Ue=(e,t,r,i)=>{const o=rt(e),n=e,a=o.$instanceValues$.get(t),s=o.$flags$,l=n;var c,d;c=r,d=i.$members$[t][0],r=null==c||ce(c)?c:4&d?"false"!==c&&(""===c||!!c):2&d?parseFloat(c):1&d?String(c):c;const h=Number.isNaN(a)&&Number.isNaN(r);if(r!==a&&!h){if(o.$instanceValues$.set(t,r),i.$watchers$&&128&s){const e=i.$watchers$[t];e&&e.map((e=>{try{l[e](r,a,t)}catch(e){nt(e,n)}}))}if(2==(18&s)){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(r,a,t))return;Ne(o,!1)}}},Ke=(e,t,r)=>{if(t.$members$){e.watchers&&(t.$watchers$=e.watchers);const r=Object.entries(t.$members$),i=e.prototype;r.map((([e,[r]])=>{(31&r||32&r)&&Object.defineProperty(i,e,{get(){return t=e,rt(this).$instanceValues$.get(t);var t},set(r){Ue(this,e,r,t)},configurable:!0,enumerable:!0})}));{const o=new Map;i.attributeChangedCallback=function(e,t,r){ht.jmp((()=>{const t=o.get(e);if(this.hasOwnProperty(t))r=this[t],delete this[t];else if(i.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==r)return;this[t]=(null!==r||"boolean"!=typeof this[t])&&r}))},e.observedAttributes=r.filter((([e,t])=>15&t[0])).map((([e,r])=>{const i=r[1]||e;return o.set(i,e),512&r[0]&&t.$attrsToReflect$.push([e,i]),i}))}}return e},Ye=async(e,t,r,i,o)=>{if(!(32&t.$flags$)&&(o=e.constructor,t.$flags$|=32,customElements.whenDefined(r.$tagName$).then((()=>t.$flags$|=128)),o.style)){let i=o.style;"string"!=typeof i&&(i=i[t.$modeName$=(e=>st.map((t=>t(e))).find((e=>!!e)))(e)]);const n=we(r,t.$modeName$);if(!at.has(n)){const e=(r.$tagName$,()=>{});((e,t,r)=>{let i=at.get(e);mt&&r?(i=i||new CSSStyleSheet,"string"==typeof i?i=t:i.replaceSync(t)):i=t,at.set(e,i)})(n,i,!!(1&r.$flags$)),e()}}t.$ancestorComponent$;Ne(t,!0)},Qe=e=>{const t=e["s-cr"]=ct.createComment("");t["s-cn"]=!0,e.insertBefore(t,e.firstChild)},Ge=(e,t)=>{const r={$flags$:t[0],$tagName$:t[1]};r.$members$=t[2],r.$listeners$=t[3],r.$watchers$=e.$watchers$,r.$attrsToReflect$=[],!gt&&1&r.$flags$&&(r.$flags$|=8);const i=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__registerHost(){it(this,r)},connectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e),r=t.$cmpMeta$,i=(r.$tagName$,()=>{});1&t.$flags$?(Xe(e,t,r.$listeners$),t.$lazyInstance$):(t.$flags$|=1,12&r.$flags$&&Qe(e),r.$members$&&Object.entries(r.$members$).map((([t,[r]])=>{if(31&r&&e.hasOwnProperty(t)){const r=e[t];delete e[t],e[t]=r}})),Ye(e,t,r)),i()}})(this),i&&i.call(this)},disconnectedCallback(){(e=>{if(!(1&ht.$flags$)){const t=rt(e);t.$rmListeners$&&(t.$rmListeners$.map((e=>e())),t.$rmListeners$=void 0)}})(this),o&&o.call(this)},__attachShadow(){gt?this.attachShadow({mode:"open",delegatesFocus:!!(16&r.$flags$)}):this.shadowRoot=this}}),e.is=r.$tagName$,Ke(e,r)},Xe=(e,t,r,i)=>{r&&r.map((([r,i,o])=>{const n=Je(e,r),a=Ze(t,o),s=et(r);ht.ael(n,i,a,s),(t.$rmListeners$=t.$rmListeners$||[]).push((()=>ht.rel(n,i,a,s)))}))},Ze=(e,t)=>r=>{try{X||e.$hostElement$[t](r)}catch(e){nt(e)}},Je=(e,t)=>4&t?ct:8&t?lt:16&t?ct.body:e,et=e=>ut?{passive:!!(1&e),capture:!!(2&e)}:!!(2&e),tt=new WeakMap,rt=e=>tt.get(e),it=(e,t)=>{const r={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return Xe(e,r,t.$listeners$),tt.set(e,r)},ot=(e,t)=>t in e,nt=(e,t)=>(0,console.error)(e,t),at=new Map,st=[],lt="undefined"!=typeof window?window:{},ct=lt.document||{head:{}},dt=lt.HTMLElement||class{},ht={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,r,i)=>e.addEventListener(t,r,i),rel:(e,t,r,i)=>e.removeEventListener(t,r,i),ce:(e,t)=>new CustomEvent(e,t)},gt=!0,ut=(()=>{let e=!1;try{ct.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(e){}return e})(),mt=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),pt=[],ft=[],vt=(e,t)=>r=>{e.push(r),ae||(ae=!0,t&&4&ht.$flags$?wt(yt):ht.raf(yt))},bt=e=>{for(let t=0;t{bt(pt),bt(ft),(ae=pt.length>0)&&ht.raf(yt)},wt=e=>{return Promise.resolve(t).then(e);var t},$t=vt(ft,!0),xt=(e,t)=>{const r=!!e.label||e.hasLabelSlot,i=!!e.helpText||e.hasHelpTextSlot,o=!!e.invalidText||e.hasInvalidTextSlot,n=!e.invalid,a=!!e.invalid;return de("div",{class:{"form-control":!0,[`form-control-${e.size}`]:!0,"form-control-has-label":r,"form-control-has-help-text":i,"form-control-has-invalid-text":o}},de("label",{id:e.labelId,class:"form-control-label",htmlFor:e.inputId,"aria-hidden":r?"false":"true",onClick:e.onLabelClick},de("slot",{name:"label"},e.label),e.requiredIndicator&&de("div",{class:"asterisk"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 1200 1200"},de("path",{fill:"currentColor",d:"M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z"})))),de("div",{class:"form-control-input"},t),n&&de("div",{id:e.helpTextId,class:"form-control-help-text","aria-hidden":i?"false":"true"},de("slot",{name:"help-text"},e.helpText)),a&&de("div",{id:e.invalidTextId,class:"form-control-invalid-text","aria-hidden":o?"false":"true"},de("div",{class:"icon"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Alert Circle"),de("path",{d:"M256,48C141.31,48,48,141.31,48,256s93.31,208,208,208,208-93.31,208-208S370.69,48,256,48Zm0,319.91a20,20,0,1,1,20-20A20,20,0,0,1,256,367.91Zm21.72-201.15-5.74,122a16,16,0,0,1-32,0l-5.74-121.94v-.05a21.74,21.74,0,1,1,43.44,0Z",fill:"currentColor"}))),de("div",{class:"text"},de("slot",{name:"invalid-text"},e.invalidText))))}; +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function kt(e){const t=e?e.assignedNodes({flatten:!0}):[];let r="";return[...t].map((e=>{e.nodeType===Node.TEXT_NODE&&(r+=e.textContent)})),r}function _t(e,t){return t?null!==e.querySelector(`[slot="${t}"]`):[...e.childNodes].some((e=>{if(e.nodeType===e.TEXT_NODE&&""!==e.textContent.trim())return!0;if(e.nodeType===e.ELEMENT_NODE){if(!e.hasAttribute("slot"))return!0}return!1}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */const Ct=(e,t=[])=>{const r={};return t.forEach((t=>{if(e.hasAttribute(t)){null!==e.getAttribute(t)&&(r[t]=e.getAttribute(t)),e.removeAttribute(t)}})),r},Tt=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow()}render(){return de("span",{class:"spinner","aria-busy":"true","aria-live":"polite"})}static get style(){return":host{--track-color:var(--gr-color-light-shade);--indicator-color:var(--gr-color-primary);--stroke-width:2px;display:inline-flex;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.spinner{display:inline-block;width:1em;height:1em;border-radius:50%;border:solid var(--stroke-width) var(--track-color);border-top-color:var(--indicator-color);border-right-color:var(--indicator-color);animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}"}},[1,"gr-spinner"]);function Et(){if("undefined"==typeof customElements)return;["gr-spinner"].forEach((e=>{if("gr-spinner"===e)customElements.get(e)||customElements.define(e,Tt)}))}Et(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Ot=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inheritedAttributes={},this.handleClick=e=>{if("button"!==this.type){const t=this.el.closest("form");if(t){e.preventDefault();const r=document.createElement("button");r.type=this.type,r.style.display="none",t.appendChild(r),r.click(),r.remove()}}},this.onFocus=()=>{this.grFocus.emit()},this.onBlur=()=>{this.grBlur.emit()},this.variant="default",this.disabled=!1,this.loading=!1,this.size="medium",this.caret=!1,this.pill=!1,this.expand=void 0,this.circle=!1,this.href=void 0,this.target=void 0,this.rel=void 0,this.type="button"}componentWillLoad(){this.inheritedAttributes=Ct(this.el,["aria-label","tabindex","title"])}async setFocus(e){this.button.focus(e)}async removeFocus(){this.button.blur()}render(){const{rel:e,target:t,href:r,variant:i,size:o,expand:n,type:a,inheritedAttributes:s,disabled:l}=this,c=void 0===r?"button":"a",d="button"===c?{type:a}:{href:r,rel:e,target:t};return de(ge,{onClick:this.handleClick,"aria-disabled":l?"true":null,class:{[`button-${i}`]:!0,[`button-${o}`]:!0,[`button-${n}`]:void 0!==n,"button-caret":this.caret,"button-circle":this.circle,"button-pill":this.pill,"button-disabled":l,"button-loading":this.loading}},de(c,Object.assign({ref:e=>this.button=e},d,{class:"button-native",disabled:l,onFocus:this.onFocus,onBlur:this.onBlur},s),de("span",{class:"button-inner"},de("slot",{name:"icon-only"}),de("slot",{name:"start"}),de("slot",null),de("slot",{name:"end"}),this.caret&&de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"})))),this.loading&&de("gr-spinner",null)))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{display:inline-block;width:auto;font-family:var(--gr-font-family);font-weight:var(--gr-font-weight-medium);font-size:var(--gr-form-element-font-size-medium);font-kerning:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;--height:var(--gr-form-element-height-medium);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--background:transparent;--background-hover:transparent;--background-focus:transparent;--color:var(--gr-color-dark-tint);--color-hover:var(--gr-color-dark-tint);--color-focus:var(--gr-color-dark-tint);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--padding-top:0;--padding-start:var(--gr-spacing-medium);--padding-end:var(--gr-spacing-medium);--padding-bottom:0;--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);--shadow:none;--transition:background-color 150ms linear, opacity 150ms linear, border 150ms linear, color 150ms linear}:host(.button-disabled){pointer-events:none;opacity:0.5}:host(.button-primary){--border-color:var(--gr-color-primary);--background:var(--gr-color-primary);--color:var(--gr-color-primary-contrast);--border-color-hover:var(--gr-color-primary-shade);--background-hover:var(--gr-color-primary-shade);--color-hover:var(--gr-color-primary-contrast);--border-color-focus:var(--gr-color-primary);--background-focus:var(--gr-color-primary-shade);--color-focus:var(--gr-color-primary-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-secondary){--border-color:var(--gr-color-light-shade);--background:transparent;--color:var(--gr-color-primary);--border-color-hover:var(--gr-color-primary);--background-hover:transparent;--color-hover:var(--gr-color-primary);--border-color-focus:var(--gr-color-primary);--background-focus:transparent;--color-focus:var(--gr-color-primary);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-danger){--border-color:var(--gr-color-danger);--background:transparent;--color:var(--gr-color-danger);--border-color-hover:var(--gr-color-danger);--background-hover:var(--gr-color-danger);--color-hover:var(--gr-color-danger-contrast);--border-color-focus:var(--gr-color-danger);--background-focus:var(--gr-color-danger);--color-focus:var(--gr-color-danger-contrast);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-danger-rgb), 0.33)}:host(.button-plain){--border-color:transparent;--background:transparent;--color:var(--gr-color-primary);--border-color-hover:transparent;--background-hover:transparent;--color-hover:var(--gr-color-primary-shade);--border-color-focus:transparent;--background-focus:transparent;--color-focus:var(--gr-color-primary-shade);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33)}:host(.button-small){--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--border-radius:var(--gr-form-element-border-radius-small);--height:var(--gr-form-element-height-small);font-size:var(--gr-form-element-font-size-small)}:host(.button-large){--padding-start:var(--gr-spacing-large);--padding-end:var(--gr-spacing-large);--border-radius:var(--gr-form-element-border-radius-large);--height:var(--gr-form-element-height-large);font-size:var(--gr-form-element-font-size-large)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content;border-radius:0;border-right-width:0;border-left-width:0}.button-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);width:100%;height:var(--height);transition:var(--transition);border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);color:var(--color);box-shadow:var(--shadow);line-height:1;cursor:pointer;z-index:0;text-decoration:none;box-sizing:border-box}.button-native::-moz-focus-inner{border:0}.button-native:focus{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-focus);color:var(--color-focus)}.button-native *,.button-native *:before,.button-native *:after{box-sizing:inherit}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}:host(.button-circle) .button-native{padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;border-radius:50%;width:var(--height)}@media (any-hover: hover){.button-native:hover{color:var(--color-hover);background:var(--background-hover);border-color:var(--border-color-hover)}}:host(.button-caret) .caret{display:flex;align-items:center;margin-left:0.3em}:host(.button-caret) .caret svg{width:1em;height:1em}:host(.button-pill) .button-native{border-radius:var(--height)}::slotted(*){pointer-events:none}::slotted([slot=start]){margin-top:0;margin-left:-0.3em;margin-right:0.3em;margin-bottom:0}::slotted([slot=end]){margin-top:0;margin-left:0.3em;margin-right:-0.2em;margin-bottom:0}::slotted([slot=icon-only]){font-size:1.4em;pointer-events:none}:host(.button-loading){position:relative;pointer-events:none}:host(.button-loading) .caret{visibility:hidden}:host(.button-loading) slot[name=start],:host(.button-loading) slot[name=end],:host(.button-loading) slot[name=icon-only],:host(.button-loading) slot:not([name]){visibility:hidden}:host(.button-loading) gr-spinner{--indicator-color:currentColor;position:absolute;height:1em;width:1em;top:calc(50% - 0.5em);left:calc(50% - 0.5em)}@media not all and (min-resolution: 0.001dpcm){@supports (-webkit-appearance: none) and (stroke-color: transparent){:host([type=button]),:host([type=reset]),:host([type=submit]){-webkit-appearance:none !important}}}"}},[1,"gr-button",{variant:[513],disabled:[516],loading:[516],size:[513],caret:[4],pill:[516],expand:[513],circle:[516],href:[1],target:[1],rel:[1],type:[1],setFocus:[64],removeFocus:[64]}]);function St(){if("undefined"==typeof customElements)return;["gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-button":customElements.get(e)||customElements.define(e,Ot);break;case"gr-spinner":customElements.get(e)||Et()}}))}function Mt(e,t,r="vertical",i="smooth"){const o= +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +function(e,t){return{top:Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top),left:Math.round(e.getBoundingClientRect().left-t.getBoundingClientRect().left)}}(e,t),n=o.top+t.scrollTop,a=o.left+t.scrollLeft,s=t.scrollLeft,l=t.scrollLeft+t.offsetWidth,c=t.scrollTop,d=t.scrollTop+t.offsetHeight;"horizontal"!==r&&"both"!==r||(al&&t.scrollTo({left:a-t.offsetWidth+e.clientWidth,behavior:i})),"vertical"!==r&&"both"!==r||(nd&&t.scrollTo({top:n-t.offsetHeight+e.clientHeight,behavior:i}))} +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */function zt(e){return e.tabIndex>-1}function Lt(e){if(zt(e))return e;if(e.shadowRoot){const t=[...e.shadowRoot.children].find(zt);if(t)return t}return e.children?[...e.children].map(Lt)[0]:null}St();var Dt="top",At="bottom",Ft="right",It="left",Wt="auto",Rt=[Dt,At,Ft,It],Nt="start",Ht="end",Vt="clippingParents",jt="viewport",Bt="popper",Pt="reference",qt=Rt.reduce((function(e,t){return e.concat([t+"-"+Nt,t+"-"+Ht])}),[]),Ut=[].concat(Rt,[Wt]).reduce((function(e,t){return e.concat([t,t+"-"+Nt,t+"-"+Ht])}),[]),Kt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Yt(e){return e?(e.nodeName||"").toLowerCase():null}function Qt(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Gt(e){return e instanceof Qt(e).Element||e instanceof Element}function Xt(e){return e instanceof Qt(e).HTMLElement||e instanceof HTMLElement}function Zt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof Qt(e).ShadowRoot||e instanceof ShadowRoot)}const Jt={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var r=t.styles[e]||{},i=t.attributes[e]||{},o=t.elements[e];Xt(o)&&Yt(o)&&(Object.assign(o.style,r),Object.keys(i).forEach((function(e){var t=i[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach((function(e){var i=t.elements[e],o=t.attributes[e]||{},n=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce((function(e,t){return e[t]="",e}),{});Xt(i)&&Yt(i)&&(Object.assign(i.style,n),Object.keys(o).forEach((function(e){i.removeAttribute(e)})))}))}},requires:["computeStyles"]};function er(e){return e.split("-")[0]}var tr=Math.max,rr=Math.min,ir=Math.round;function or(e,t){void 0===t&&(t=!1);var r=e.getBoundingClientRect(),i=1,o=1;if(Xt(e)&&t){var n=e.offsetHeight,a=e.offsetWidth;a>0&&(i=ir(r.width)/a||1),n>0&&(o=ir(r.height)/n||1)}return{width:r.width/i,height:r.height/o,top:r.top/o,right:r.right/i,bottom:r.bottom/o,left:r.left/i,x:r.left/i,y:r.top/o}}function nr(e){var t=or(e),r=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:i}}function ar(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Zt(r)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function sr(e){return Qt(e).getComputedStyle(e)}function lr(e){return["table","td","th"].indexOf(Yt(e))>=0}function cr(e){return((Gt(e)?e.ownerDocument:e.document)||window.document).documentElement}function dr(e){return"html"===Yt(e)?e:e.assignedSlot||e.parentNode||(Zt(e)?e.host:null)||cr(e)}function hr(e){return Xt(e)&&"fixed"!==sr(e).position?e.offsetParent:null}function gr(e){for(var t=Qt(e),r=hr(e);r&&lr(r)&&"static"===sr(r).position;)r=hr(r);return r&&("html"===Yt(r)||"body"===Yt(r)&&"static"===sr(r).position)?t:r||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&Xt(e)&&"fixed"===sr(e).position)return null;var r=dr(e);for(Zt(r)&&(r=r.host);Xt(r)&&["html","body"].indexOf(Yt(r))<0;){var i=sr(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(e)||t}function ur(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function mr(e,t,r){return tr(e,rr(t,r))}function pr(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function fr(e,t){return t.reduce((function(t,r){return t[r]=e,t}),{})}const vr={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,i=e.name,o=e.options,n=r.elements.arrow,a=r.modifiersData.popperOffsets,s=er(r.placement),l=ur(s),c=[It,Ft].indexOf(s)>=0?"height":"width";if(n&&a){var d=function(e,t){return pr("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:fr(e,Rt))}(o.padding,r),h=nr(n),g="y"===l?Dt:It,u="y"===l?At:Ft,m=r.rects.reference[c]+r.rects.reference[l]-a[l]-r.rects.popper[c],p=a[l]-r.rects.reference[l],f=gr(n),v=f?"y"===l?f.clientHeight||0:f.clientWidth||0:0,b=m/2-p/2,y=d[g],w=v-h[c]-d[u],$=v/2-h[c]/2+b,x=mr(y,$,w),k=l;r.modifiersData[i]=((t={})[k]=x,t.centerOffset=x-$,t)}},effect:function(e){var t=e.state,r=e.options.element,i=void 0===r?"[data-popper-arrow]":r;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&ar(t.elements.popper,i)&&(t.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function br(e){return e.split("-")[1]}var yr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function wr(e){var t,r=e.popper,i=e.popperRect,o=e.placement,n=e.variation,a=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,h=e.isFixed,g=a.x,u=void 0===g?0:g,m=a.y,p=void 0===m?0:m,f="function"==typeof d?d({x:u,y:p}):{x:u,y:p};u=f.x,p=f.y;var v=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),y=It,w=Dt,$=window;if(c){var x=gr(r),k="clientHeight",_="clientWidth";if(x===Qt(r)&&"static"!==sr(x=cr(r)).position&&"absolute"===s&&(k="scrollHeight",_="scrollWidth"),o===Dt||(o===It||o===Ft)&&n===Ht)w=At,p-=(h&&x===$&&$.visualViewport?$.visualViewport.height:x[k])-i.height,p*=l?1:-1;if(o===It||(o===Dt||o===At)&&n===Ht)y=Ft,u-=(h&&x===$&&$.visualViewport?$.visualViewport.width:x[_])-i.width,u*=l?1:-1}var C,T=Object.assign({position:s},c&&yr),E=!0===d?function(e){var t=e.x,r=e.y,i=window.devicePixelRatio||1;return{x:ir(t*i)/i||0,y:ir(r*i)/i||0}}({x:u,y:p}):{x:u,y:p};return u=E.x,p=E.y,l?Object.assign({},T,((C={})[w]=b?"0":"",C[y]=v?"0":"",C.transform=($.devicePixelRatio||1)<=1?"translate("+u+"px, "+p+"px)":"translate3d("+u+"px, "+p+"px, 0)",C)):Object.assign({},T,((t={})[w]=b?p+"px":"",t[y]=v?u+"px":"",t.transform="",t))}var $r={passive:!0};var xr={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e){return e.replace(/left|right|bottom|top/g,(function(e){return xr[e]}))}var _r={start:"end",end:"start"};function Cr(e){return e.replace(/start|end/g,(function(e){return _r[e]}))}function Tr(e){var t=Qt(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Er(e){return or(cr(e)).left+Tr(e).scrollLeft}function Or(e){var t=sr(e),r=t.overflow,i=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function Sr(e){return["html","body","#document"].indexOf(Yt(e))>=0?e.ownerDocument.body:Xt(e)&&Or(e)?e:Sr(dr(e))}function Mr(e,t){var r;void 0===t&&(t=[]);var i=Sr(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),n=Qt(i),a=o?[n].concat(n.visualViewport||[],Or(i)?i:[]):i,s=t.concat(a);return o?s:s.concat(Mr(dr(a)))}function zr(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Lr(e,t){return t===jt?zr(function(e){var t=Qt(e),r=cr(e),i=t.visualViewport,o=r.clientWidth,n=r.clientHeight,a=0,s=0;return i&&(o=i.width,n=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=i.offsetLeft,s=i.offsetTop)),{width:o,height:n,x:a+Er(e),y:s}}(e)):Gt(t)?function(e){var t=or(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):zr(function(e){var t,r=cr(e),i=Tr(e),o=null==(t=e.ownerDocument)?void 0:t.body,n=tr(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=tr(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-i.scrollLeft+Er(e),l=-i.scrollTop;return"rtl"===sr(o||r).direction&&(s+=tr(r.clientWidth,o?o.clientWidth:0)-n),{width:n,height:a,x:s,y:l}}(cr(e)))}function Dr(e,t,r){var i="clippingParents"===t?function(e){var t=Mr(dr(e)),r=["absolute","fixed"].indexOf(sr(e).position)>=0&&Xt(e)?gr(e):e;return Gt(r)?t.filter((function(e){return Gt(e)&&ar(e,r)&&"body"!==Yt(e)})):[]}(e):[].concat(t),o=[].concat(i,[r]),n=o[0],a=o.reduce((function(t,r){var i=Lr(e,r);return t.top=tr(i.top,t.top),t.right=rr(i.right,t.right),t.bottom=rr(i.bottom,t.bottom),t.left=tr(i.left,t.left),t}),Lr(e,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ar(e){var t,r=e.reference,i=e.element,o=e.placement,n=o?er(o):null,a=o?br(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(n){case Dt:t={x:s,y:r.y-i.height};break;case At:t={x:s,y:r.y+r.height};break;case Ft:t={x:r.x+r.width,y:l};break;case It:t={x:r.x-i.width,y:l};break;default:t={x:r.x,y:r.y}}var c=n?ur(n):null;if(null!=c){var d="y"===c?"height":"width";switch(a){case Nt:t[c]=t[c]-(r[d]/2-i[d]/2);break;case Ht:t[c]=t[c]+(r[d]/2-i[d]/2)}}return t}function Fr(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=void 0===i?e.placement:i,n=r.boundary,a=void 0===n?Vt:n,s=r.rootBoundary,l=void 0===s?jt:s,c=r.elementContext,d=void 0===c?Bt:c,h=r.altBoundary,g=void 0!==h&&h,u=r.padding,m=void 0===u?0:u,p=pr("number"!=typeof m?m:fr(m,Rt)),f=d===Bt?Pt:Bt,v=e.rects.popper,b=e.elements[g?f:d],y=Dr(Gt(b)?b:b.contextElement||cr(e.elements.popper),a,l),w=or(e.elements.reference),$=Ar({reference:w,element:v,strategy:"absolute",placement:o}),x=zr(Object.assign({},v,$)),k=d===Bt?x:w,_={top:y.top-k.top+p.top,bottom:k.bottom-y.bottom+p.bottom,left:y.left-k.left+p.left,right:k.right-y.right+p.right},C=e.modifiersData.offset;if(d===Bt&&C){var T=C[o];Object.keys(_).forEach((function(e){var t=[Ft,At].indexOf(e)>=0?1:-1,r=[Dt,At].indexOf(e)>=0?"y":"x";_[e]+=T[r]*t}))}return _}function Ir(e,t){void 0===t&&(t={});var r=t,i=r.placement,o=r.boundary,n=r.rootBoundary,a=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Ut:l,d=br(i),h=d?s?qt:qt.filter((function(e){return br(e)===d})):Rt,g=h.filter((function(e){return c.indexOf(e)>=0}));0===g.length&&(g=h);var u=g.reduce((function(t,r){return t[r]=Fr(e,{placement:r,boundary:o,rootBoundary:n,padding:a})[er(r)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}const Wr={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name;if(!t.modifiersData[i]._skip){for(var o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0===a||a,l=r.fallbackPlacements,c=r.padding,d=r.boundary,h=r.rootBoundary,g=r.altBoundary,u=r.flipVariations,m=void 0===u||u,p=r.allowedAutoPlacements,f=t.options.placement,v=er(f),b=l||(v===f||!m?[kr(f)]:function(e){if(er(e)===Wt)return[];var t=kr(e);return[Cr(e),t,Cr(t)]}(f)),y=[f].concat(b).reduce((function(e,r){return e.concat(er(r)===Wt?Ir(t,{placement:r,boundary:d,rootBoundary:h,padding:c,flipVariations:m,allowedAutoPlacements:p}):r)}),[]),w=t.rects.reference,$=t.rects.popper,x=new Map,k=!0,_=y[0],C=0;C=0,M=S?"width":"height",z=Fr(t,{placement:T,boundary:d,rootBoundary:h,altBoundary:g,padding:c}),L=S?O?Ft:It:O?At:Dt;w[M]>$[M]&&(L=kr(L));var D=kr(L),A=[];if(n&&A.push(z[E]<=0),s&&A.push(z[L]<=0,z[D]<=0),A.every((function(e){return e}))){_=T,k=!1;break}x.set(T,A)}if(k)for(var F=function(e){var t=y.find((function(t){var r=x.get(t);if(r)return r.slice(0,e).every((function(e){return e}))}));if(t)return _=t,"break"},I=m?3:1;I>0;I--){if("break"===F(I))break}t.placement!==_&&(t.modifiersData[i]._skip=!0,t.placement=_,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Rr(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Nr(e){return[Dt,Ft,At,It].some((function(t){return e[t]>=0}))}const Hr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.offset,n=void 0===o?[0,0]:o,a=Ut.reduce((function(e,r){return e[r]=function(e,t,r){var i=er(e),o=[It,Dt].indexOf(i)>=0?-1:1,n="function"==typeof r?r(Object.assign({},t,{placement:e})):r,a=n[0],s=n[1];return a=a||0,s=(s||0)*o,[It,Ft].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(r,t.rects,n),e}),{}),s=a[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=a}};const Vr={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,i=e.name,o=r.mainAxis,n=void 0===o||o,a=r.altAxis,s=void 0!==a&&a,l=r.boundary,c=r.rootBoundary,d=r.altBoundary,h=r.padding,g=r.tether,u=void 0===g||g,m=r.tetherOffset,p=void 0===m?0:m,f=Fr(t,{boundary:l,rootBoundary:c,padding:h,altBoundary:d}),v=er(t.placement),b=br(t.placement),y=!b,w=ur(v),$="x"===w?"y":"x",x=t.modifiersData.popperOffsets,k=t.rects.reference,_=t.rects.popper,C="function"==typeof p?p(Object.assign({},t.rects,{placement:t.placement})):p,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(x){if(n){var S,M="y"===w?Dt:It,z="y"===w?At:Ft,L="y"===w?"height":"width",D=x[w],A=D+f[M],F=D-f[z],I=u?-_[L]/2:0,W=b===Nt?k[L]:_[L],R=b===Nt?-_[L]:-k[L],N=t.elements.arrow,H=u&&N?nr(N):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[M],B=V[z],P=mr(0,k[L],H[L]),q=y?k[L]/2-I-P-j-T.mainAxis:W-P-j-T.mainAxis,U=y?-k[L]/2+I+P+B+T.mainAxis:R+P+B+T.mainAxis,K=t.elements.arrow&&gr(t.elements.arrow),Y=K?"y"===w?K.clientTop||0:K.clientLeft||0:0,Q=null!=(S=null==E?void 0:E[w])?S:0,G=D+U-Q,X=mr(u?rr(A,D+q-Q-Y):A,D,u?tr(F,G):F);x[w]=X,O[w]=X-D}if(s){var Z,J="x"===w?Dt:It,ee="x"===w?At:Ft,te=x[$],re="y"===$?"height":"width",ie=te+f[J],oe=te-f[ee],ne=-1!==[Dt,It].indexOf(v),ae=null!=(Z=null==E?void 0:E[$])?Z:0,se=ne?ie:te-k[re]-_[re]-ae+T.altAxis,le=ne?te+k[re]+_[re]-ae-T.altAxis:oe,ce=u&&ne?function(e,t,r){var i=mr(e,t,r);return i>r?r:i}(se,te,le):mr(u?se:ie,te,u?le:oe);x[$]=ce,O[$]=ce-te}t.modifiersData[i]=O}},requiresIfExists:["offset"]};function jr(e,t,r){void 0===r&&(r=!1);var i,o,n=Xt(t),a=Xt(t)&&function(e){var t=e.getBoundingClientRect(),r=ir(t.width)/e.offsetWidth||1,i=ir(t.height)/e.offsetHeight||1;return 1!==r||1!==i}(t),s=cr(t),l=or(e,a),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(n||!n&&!r)&&(("body"!==Yt(t)||Or(s))&&(c=(i=t)!==Qt(i)&&Xt(i)?{scrollLeft:(o=i).scrollLeft,scrollTop:o.scrollTop}:Tr(i)),Xt(t)?((d=or(t,!0)).x+=t.clientLeft,d.y+=t.clientTop):s&&(d.x=Er(s))),{x:l.left+c.scrollLeft-d.x,y:l.top+c.scrollTop-d.y,width:l.width,height:l.height}}function Br(e){var t=new Map,r=new Set,i=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!r.has(e)){var i=t.get(e);i&&o(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){r.has(e.name)||o(e)})),i}var Pr={placement:"bottom",modifiers:[],strategy:"absolute"};function qr(){for(var e=arguments.length,t=new Array(e),r=0;r{},onAfterHide:()=>{},onTransitionEnd:()=>{}},r),this.isVisible=!1,this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.popover.addEventListener("transitionend",this.handleTransitionEnd)}handleTransitionEnd(e){e.target===this.options.transitionElement&&(this.options.onTransitionEnd.call(this,e),this.isVisible||this.popover.hidden||(this.popover.hidden=!0,this.popover.classList.remove(this.options.visibleClass),this.options.onAfterHide.call(this)))}destroy(){this.popover.removeEventListener("transitionend",this.handleTransitionEnd),this.popper&&(this.popper.destroy(),this.popper=null)}show(){this.isVisible=!0,this.popover.hidden=!1,requestAnimationFrame((()=>this.popover.classList.add(this.options.visibleClass))),this.popper&&this.popper.destroy(),this.popper=Kr(this.anchor,this.popover,{placement:this.options.placement,strategy:this.options.strategy,modifiers:[{name:"flip",options:{boundary:"viewport"}},{name:"offset",options:{offset:[this.options.skidding,this.options.distance]}}]}),this.popover.addEventListener("transitionend",(()=>this.options.onAfterShow.call(this)),{once:!0}),requestAnimationFrame((()=>this.popper.update()))}hide(){this.isVisible=!1,this.popover.classList.remove(this.options.visibleClass)}setOptions(e){this.options=Object.assign(this.options,e),this.isVisible?this.popover.classList.add(this.options.visibleClass):this.popover.classList.remove(this.options.visibleClass),this.popper&&(this.popper.setOptions({placement:this.options.placement,strategy:this.options.strategy}),requestAnimationFrame((()=>this.popper.update())))}}let Qr=0;const Gr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grShow=fe(this,"gr-show",7),this.grAfterShow=fe(this,"gr-after-show",7),this.grHide=fe(this,"gr-hide",7),this.grAfterHide=fe(this,"gr-after-hide",7),this.componentId="dropdown-"+ ++Qr,this.isVisible=!1,this.open=!1,this.placement="bottom-start",this.closeOnSelect=!0,this.containingElement=void 0,this.distance=2,this.skidding=0,this.hoist=!1}handleOpenChange(){this.open?this.show():this.hide(),this.updateAccessibleTrigger()}handlePopoverOptionsChange(){this.popoverElement.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding})}connectedCallback(){this.containingElement||(this.containingElement=this.el),this.handleDocumentKeyDown=this.handleDocumentKeyDown.bind(this),this.handleDocumentMouseDown=this.handleDocumentMouseDown.bind(this),this.handleMenuItemActivate=this.handleMenuItemActivate.bind(this),this.handlePanelSelect=this.handlePanelSelect.bind(this),this.handleTriggerClick=this.handleTriggerClick.bind(this),this.handleTriggerKeyDown=this.handleTriggerKeyDown.bind(this),this.handleTriggerKeyUp=this.handleTriggerKeyUp.bind(this),this.handleTriggerSlotChange=this.handleTriggerSlotChange.bind(this)}componentDidLoad(){this.popoverElement=new Yr(this.trigger,this.positioner,{strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.panel,onAfterHide:()=>this.grAfterHide.emit(),onAfterShow:()=>this.grAfterShow.emit(),onTransitionEnd:()=>{this.open||(this.panel.scrollTop=0)}}),this.open&&this.show()}disconnectedCallback(){this.hide(),this.popoverElement.destroy()}async show(){if(this.isVisible)return;this.grShow.emit().defaultPrevented?this.open=!1:(this.panel.addEventListener("gr-activate",this.handleMenuItemActivate),this.panel.addEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.addEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!0,this.open=!0,this.popoverElement.show())}async hide(){if(!this.isVisible)return;this.grHide.emit().defaultPrevented?this.open=!0:(this.panel.removeEventListener("gr-activate",this.handleMenuItemActivate),this.panel.removeEventListener("gr-select",this.handlePanelSelect),document.addEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("mousedown",this.handleDocumentMouseDown),this.isVisible=!1,this.open=!1,this.popoverElement.hide())}async focusOnTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0})[0];e&&("function"==typeof e.setFocus?e.setFocus():"function"==typeof e.focus&&e.focus())}getMenu(){return this.panel.querySelector("slot").assignedElements({flatten:!0}).filter((e=>"gr-menu"===e.tagName.toLowerCase()))[0]}handleDocumentKeyDown(e){var t;if("Escape"===e.key)return this.hide(),void this.focusOnTrigger();if("Tab"===e.key){if(this.open&&"gr-menu-item"===(null===(t=document.activeElement)||void 0===t?void 0:t.tagName.toLowerCase()))return e.preventDefault(),this.hide(),void this.focusOnTrigger();setTimeout((()=>{var e;const t=this.containingElement.getRootNode()instanceof ShadowRoot?null===(e=document.activeElement.shadowRoot)||void 0===e?void 0:e.activeElement:document.activeElement;(null==t?void 0:t.closest(this.containingElement.tagName.toLowerCase()))===this.containingElement||this.hide()}))}}handleDocumentMouseDown(e){e.composedPath().includes(this.containingElement)||this.hide()}handleMenuItemActivate(e){Mt(e.target,this.panel)}handlePanelSelect(e){const t=e.target;this.closeOnSelect&&"gr-menu"===t.tagName.toLowerCase()&&(this.hide(),this.focusOnTrigger())}handleTriggerClick(){this.open?this.hide():this.show()}handleTriggerKeyDown(e){const t=this.getMenu(),r=t?[...t.querySelectorAll("gr-menu-item")]:null,i=r[0],o=r[r.length-1];if("Escape"===e.key)return this.focusOnTrigger(),void this.hide();if([" ","Enter"].includes(e.key))return e.preventDefault(),void(this.open?this.hide():this.show());if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.open||this.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.open&&t&&!["Tab","Shift","Meta","Ctrl","Alt"].includes(e.key)&&t.typeToSelect(e.key)}handleTriggerKeyUp(e){" "===e.key&&e.preventDefault()}handleTriggerSlotChange(){this.updateAccessibleTrigger()}updateAccessibleTrigger(){const e=this.trigger.querySelector("slot").assignedElements({flatten:!0}).map(Lt)[0];e&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded",this.open?"true":"false"))}render(){return de(ge,{id:this.componentId,class:{"dropdown-open":this.open}},de("span",{class:"dropdown-trigger",ref:e=>this.trigger=e,onClick:this.handleTriggerClick,onKeyDown:this.handleTriggerKeyDown,onKeyUp:this.handleTriggerKeyUp},de("slot",{name:"trigger",onSlotchange:this.handleTriggerSlotChange})),de("div",{ref:e=>this.positioner=e,class:"dropdown-positioner"},de("div",{ref:e=>this.panel=e,class:"dropdown-panel",role:"menu","aria-hidden":this.open?"false":"true","aria-labelledby":this.componentId},de("slot",null))))}get el(){return this}static get watchers(){return{open:["handleOpenChange"],distance:["handlePopoverOptionsChange"],hoist:["handlePopoverOptionsChange"],placement:["handlePopoverOptionsChange"],skidding:["handlePopoverOptionsChange"]}}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--panel-background-color:var(--gr-color-white);--panel-border-radius:var(--gr-border-radius-medium);--panel-border-color:var(--gr-panel-border-color);--panel-box-shadow:var(--gr-shadow-large);--transition:150ms opacity, 150ms transform;display:inline-block;position:relative;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.dropdown-trigger{display:block}.dropdown-positioner{position:absolute;z-index:var(--gr-z-index-dropdown)}.dropdown-panel{max-height:50vh;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);background-color:var(--panel-background-color);border:solid 1px var(--panel-border-color);border-radius:var(--panel-border-radius);box-shadow:var(--panel-box-shadow);opacity:0;overflow:auto;overscroll-behavior:none;pointer-events:none;transform:scale(0.9);transition:var(--transition)}.dropdown-positioner[data-popper-placement^=top] .dropdown-panel{transform-origin:bottom}.dropdown-positioner[data-popper-placement^=bottom] .dropdown-panel{transform-origin:top}.dropdown-positioner[data-popper-placement^=left] .dropdown-panel{transform-origin:right}.dropdown-positioner[data-popper-placement^=right] .dropdown-panel{transform-origin:left}.dropdown-positioner.popover-visible .dropdown-panel{opacity:1;transform:none;pointer-events:all}"}},[1,"gr-dropdown",{open:[1540],placement:[1],closeOnSelect:[4,"close-on-select"],containingElement:[1040],distance:[2],skidding:[2],hoist:[4],show:[64],hide:[64],focusOnTrigger:[64]}]);function Xr(){if("undefined"==typeof customElements)return;["gr-dropdown"].forEach((e=>{if("gr-dropdown"===e)customElements.get(e)||customElements.define(e,Gr)}))}Xr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const Zr=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grSelect=fe(this,"gr-select",7),this.typeToSelectString=""}connectedCallback(){this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}async typeToSelect(e){clearTimeout(this.typeToSelectTimeout),this.typeToSelectTimeout=setTimeout((()=>this.typeToSelectString=""),750),this.typeToSelectString+=e.toLowerCase();const t=this.getItems();for(const e of t){if(kt(e.shadowRoot.querySelector("slot:not([name])")).toLowerCase().trim().substring(0,this.typeToSelectString.length)===this.typeToSelectString){e.setFocus();break}}}getItems(){return[...this.menu.querySelector("slot").assignedElements({flatten:!0})].filter((e=>"gr-menu-item"===e.tagName.toLowerCase()&&!e.disabled))}getActiveItem(){return this.getItems().find((e=>e===document.activeElement))}setActiveItem(e){e.setFocus()}handleClick(e){const t=e.target.closest("gr-menu-item");t&&!t.disabled&&this.grSelect.emit({item:t})}handleKeyDown(e){if("Enter"===e.key){const t=this.getActiveItem();e.preventDefault(),t&&this.grSelect.emit({item:t})}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getItems(),r=this.getActiveItem();let i=t.indexOf(r);if(t.length)return e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=0),i>t.length-1&&(i=t.length-1),void this.setActiveItem(t[i])}this.typeToSelect(e.key)}render(){return de("div",{ref:e=>this.menu=e,class:"menu",role:"menu",onClick:this.handleClick,onKeyDown:this.handleKeyDown},de("slot",null))}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--padding-top:var(--gr-spacing-x-small);--padding-bottom:var(--gr-spacing-x-small);display:block;padding-top:var(--padding-top);padding-left:0;padding-right:0;padding-bottom:var(--padding-bottom);box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host:focus{outline:none}"}},[1,"gr-menu",{typeToSelect:[64]}]);function Jr(){if("undefined"==typeof customElements)return;["gr-menu"].forEach((e=>{if("gr-menu"===e)customElements.get(e)||customElements.define(e,Zr)}))}Jr(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ei=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grClear=fe(this,"gr-clear",7),this.type="primary",this.size="medium",this.pill=!1,this.clearable=!1,this.truncate=!1,this.title=""}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this)}handleClearClick(){this.grClear.emit()}render(){return de(ge,{class:{[`tag-${this.type}`]:!0,[`tag-${this.size}`]:!0,"tag-pill":this.pill,"tag-clearable":this.clearable}},de("span",{class:"tag"},de("span",{class:{"tag-truncate":this.truncate},title:this.title},de("slot",null)),this.clearable&&de("gr-button",{variant:"plain",size:this.size,class:"tag-clear","aria-label":"clear",onClick:this.handleClearClick},de("svg",{slot:"icon-only",role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 368L144 144M368 144L144 368"})))))}static get style(){return":host{--height:calc(var(--gr-form-element-height-medium) * 0.8);--line-height:calc(var(--gr-form-element-height-medium) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-medium);--border-width:1px;--border-style:solid;--padding-top:0;--padding-start:var(--gr-spacing-small);--padding-end:var(--gr-spacing-small);--padding-bottom:0;--font-size:var(--gr-form-element-font-size-medium);--background-color:rgba(var(--gr-color-primary-rgb), 0.05);--border-color:rgba(var(--gr-color-primary-rgb), 0.2);--color:var(--gr-color-primary-shade);--clear-color:var(--gr-color-primary);--clear-color-hover:var(--gr-color-primary-shade);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small));display:inline-block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.tag-success){--background-color:rgba(var(--gr-color-success-rgb), 0.05);--border-color:rgba(var(--gr-color-success-rgb), 0.2);--color:var(--gr-color-success-shade);--clear-color:var(--gr-color-success);--clear-color-hover:var(--gr-color-success-shade)}:host(.tag-info){--background-color:rgba(var(--gr-color-medium-rgb), 0.05);--border-color:rgba(var(--gr-color-medium-rgb), 0.2);--color:var(--gr-color-medium-shade);--clear-color:var(--gr-color-medium);--clear-color-hover:var(--gr-color-medium-shade)}:host(.tag-warning){--background-color:rgba(var(--gr-color-warning-rgb), 0.05);--border-color:rgba(var(--gr-color-warning-rgb), 0.2);--color:var(--gr-color-warning-shade);--clear-color:var(--gr-color-warning);--clear-color-hover:var(--gr-color-warning-shade)}:host(.tag-danger){--background-color:rgba(var(--gr-color-danger-rgb), 0.05);--border-color:rgba(var(--gr-color-danger-rgb), 0.2);--color:var(--gr-color-danger-shade);--clear-color:var(--gr-color-danger);--clear-color-hover:var(--gr-color-danger-shade)}:host(.tag-small){--font-size:var(--gr-form-element-font-size-small);--height:calc(var(--gr-form-element-height-small) * 0.8);--line-height:calc(var(--gr-form-element-height-small) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-small);--padding-start:var(--gr-spacing-x-small);--padding-end:var(--gr-spacing-x-small);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-xxx-small))}:host(.tag-large){--font-size:var(--gr-form-element-font-size-large);--height:calc(var(--gr-form-element-height-large) * 0.8);--line-height:calc(var(--gr-form-element-height-large) - 1px * 2);--border-radius:var(--gr-form-element-border-radius-large);--padding:0 var(--gr-spacing-medium);--clear-margin-left:var(--gr-spacing-xx-small);--clear-margin-right:calc(-1 * var(--gr-spacing-x-small))}.tag{display:flex;align-items:center;border-style:var(--border-style);border-width:var(--border-width);border-radius:var(--border-radius);white-space:nowrap;user-select:none;cursor:default;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--gr-font-weight-normal);height:var(--height);line-height:var(--line-height);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);background-color:var(--background-color);border-color:var(--border-color);color:var(--color)}.tag-clear{--color:var(--clear-color);--color-hover:var(--clear-color-hover);--padding-start:0;--padding-end:0;margin-left:var(--clear-margin-left);margin-right:var(--clear-margin-right);--height:1em}.tag-clear svg{font-size:0.7em}.tag-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag-clear svg{width:1.1em;height:1.1em}:host(.tag-pill) .tag{border-radius:var(--height)}"}},[1,"gr-tag",{type:[513],size:[513],pill:[516],clearable:[516],truncate:[516],title:[513]}]);function ti(){if("undefined"==typeof customElements)return;["gr-tag","gr-button","gr-spinner"].forEach((e=>{switch(e){case"gr-tag":customElements.get(e)||customElements.define(e,ei);break;case"gr-button":customElements.get(e)||St();break;case"gr-spinner":customElements.get(e)||Et()}}))}ti(); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */ +const ri="undefined"!=typeof HTMLElement?HTMLElement:class{};let ii=0;const oi=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.grChange=fe(this,"gr-change",7),this.grFocus=fe(this,"gr-focus",7),this.grBlur=fe(this,"gr-blur",7),this.inputId="select-"+ ++ii,this.labelId=`select-label-${ii}`,this.helpTextId=`select-help-text-${ii}`,this.invalidTextId=`select-invalid-text-${ii}`,this.inheritedAttributes={},this.handleBlur=()=>{this.isOpen||(this.hasFocus=!1,this.grBlur.emit())},this.handleFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.grFocus.emit())},this.hasFocus=!1,this.hasHelpTextSlot=!1,this.hasInvalidTextSlot=!1,this.hasLabelSlot=!1,this.isOpen=!1,this.items=[],this.displayLabel="",this.displayTags=[],this.multiple=!1,this.maxTagsVisible=3,this.disabled=!1,this.name="",this.placeholder="",this.size="medium",this.hoist=!1,this.value="",this.pill=!1,this.label="",this.requiredIndicator=!1,this.helpText="",this.invalidText="",this.invalid=!1,this.clearable=!1}handleDisabledChange(){this.disabled&&this.isOpen&&this.dropdown.hide()}handleLabelChange(){this.handleSlotChange()}handleMultipleChange(){const e=this.getValueAsArray();this.value=this.multiple?e:e[0]||"",this.syncItemsFromValue()}handleValueChange(){this.syncItemsFromValue(),this.grChange.emit()}connectedCallback(){this.handleClearClick=this.handleClearClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleLabelClick=this.handleLabelClick.bind(this),this.handleMenuHide=this.handleMenuHide.bind(this),this.handleMenuShow=this.handleMenuShow.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleSlotChange=this.handleSlotChange.bind(this),this.handleTagInteraction=this.handleTagInteraction.bind(this),this.el.shadowRoot.addEventListener("slotchange",this.handleSlotChange)}componentWillLoad(){this.handleSlotChange(),this.inheritedAttributes=Ct(this.el,["aria-label"])}componentDidLoad(){this.resizeObserver=new ResizeObserver((()=>this.resizeMenu())),this.reportDuplicateItemValues(),requestAnimationFrame((()=>this.syncItemsFromValue()))}disconnectedCallback(){this.el.shadowRoot.removeEventListener("slotchange",this.handleSlotChange)}async setFocus(){this.hasFocus=!0,this.grFocus.emit(),this.dropdown.focusOnTrigger()}getItemLabel(e){return kt(e.shadowRoot.querySelector("slot:not([name])"))}getItems(){return[...this.el.querySelectorAll("gr-menu-item")]}getValueAsArray(){return Array.isArray(this.value)?this.value:[this.value]}handleClearClick(e){e.stopPropagation(),this.value=this.multiple?[]:"",this.syncItemsFromValue()}handleKeyDown(e){const t=e.target,r=this.getItems(),i=r[0],o=r[r.length-1];if("gr-tag"!==t.tagName.toLowerCase())if("Tab"!==e.key){if(["ArrowDown","ArrowUp"].includes(e.key)){if(e.preventDefault(),this.isOpen||this.dropdown.show(),"ArrowDown"===e.key&&i)return void i.setFocus();if("ArrowUp"===e.key&&o)return void o.setFocus()}this.isOpen||1!==e.key.length||(e.stopPropagation(),e.preventDefault(),this.dropdown.show(),this.menu.typeToSelect(e.key))}else this.isOpen&&this.dropdown.hide()}handleLabelClick(){this.box.focus()}handleMenuSelect(e){const t=e.detail.item;this.multiple?this.value=this.value.includes(t.value)?this.value.filter((e=>e!==t.value)):[...this.value,t.value]:this.value=t.value,this.syncItemsFromValue()}handleMenuShow(e){this.disabled?e.preventDefault():(this.resizeMenu(),this.resizeObserver.observe(this.el),this.isOpen=!0)}handleMenuHide(){this.resizeObserver.unobserve(this.el),this.isOpen=!1,this.box.focus()}handleSlotChange(){this.hasHelpTextSlot=_t(this.el,"help-text"),this.hasInvalidTextSlot=_t(this.el,"invalid-text"),this.hasLabelSlot=_t(this.el,"label"),this.syncItemsFromValue(),this.reportDuplicateItemValues()}handleTagInteraction(e){e.composedPath().find((e=>{if(e instanceof ri)return e.classList.contains("tag-clear")}))&&e.stopPropagation()}reportDuplicateItemValues(){const e=this.getItems().map((e=>e.value)).filter(((e,t,r)=>r.indexOf(e)!==t));if(e.length)throw new Error('Duplicate value found on in : "'+e.join('", "')+'"')}resizeMenu(){this.menu.style.width=`${this.box.clientWidth}px`}syncItemsFromValue(){const e=this.getItems(),t=this.getValueAsArray();if(e.map((e=>e.checked=t.includes(e.value))),this.multiple){const r=[];if(t.map((t=>e.map((e=>e.value===t?r.push(e):null)))),this.displayTags=r.map((e=>de("gr-tag",{type:"info",size:this.size,pill:this.pill,clearable:!0,onClick:this.handleTagInteraction,onKeyDown:this.handleTagInteraction,"onGr-clear":t=>{t.stopPropagation(),this.disabled||(e.checked=!1,this.syncValueFromItems())}},this.getItemLabel(e)))),this.maxTagsVisible>0&&this.displayTags.length>this.maxTagsVisible){const e=this.displayTags.length;this.displayLabel="",this.displayTags=this.displayTags.slice(0,this.maxTagsVisible),this.displayTags.push(de("gr-tag",{type:"info",size:this.size,pill:this.pill},"+",e-this.maxTagsVisible))}}else{const r=e.filter((e=>e.value===t[0]))[0];this.displayLabel=r?this.getItemLabel(r):"",this.displayTags=[]}}syncValueFromItems(){const e=this.getItems().filter((e=>e.checked)).map((e=>e.value));this.multiple?this.value=this.value.filter((t=>e.includes(t))):this.value=e.length>0?e[0]:""}render(){var e;const t=this.multiple?this.value.length>0:""!==this.value,r=this.inheritedAttributes["aria-label"]?{"aria-label":this.inheritedAttributes["aria-label"]}:{"aria-labelledby":this.labelId};return((e,t,r,i)=>{let o=e.querySelector("input.aux-input");o||(o=e.ownerDocument.createElement("input"),o.type="hidden",o.classList.add("aux-input"),e.appendChild(o)),o.disabled=i,o.name=t,o.value=r||""})(this.el,this.name,ni(this.value),this.disabled),de(xt,{inputId:this.inputId,label:this.label,labelId:this.labelId,hasLabelSlot:this.hasLabelSlot,helpTextId:this.helpTextId,helpText:this.helpText,hasHelpTextSlot:this.hasHelpTextSlot,invalidTextId:this.invalidTextId,invalidText:this.invalidText,invalid:this.invalid,hasInvalidTextSlot:this.hasInvalidTextSlot,size:this.size,onLabelClick:this.handleLabelClick,requiredIndicator:this.requiredIndicator},de("gr-dropdown",{ref:e=>this.dropdown=e,hoist:this.hoist,closeOnSelect:!this.multiple,containingElement:this.el,class:{select:!0,"select-open":this.isOpen,"select-empty":0===(null===(e=this.value)||void 0===e?void 0:e.length),"select-focused":this.hasFocus,"select-clearable":this.clearable,"select-disabled":this.disabled,"select-multiple":this.multiple,"select-has-tags":this.multiple&&t,"select-placeholder-visible":""===this.displayLabel,[`select-${this.size}`]:!0,"select-pill":this.pill,"select-invalid":this.invalid},"onGr-show":this.handleMenuShow,"onGr-hide":this.handleMenuHide},de("div",Object.assign({slot:"trigger",ref:e=>this.box=e,id:this.inputId,class:"select-box",role:"combobox"},r,{"aria-describedby":this.invalid?this.invalidTextId:this.helpTextId,"aria-haspopup":"true","aria-expanded":this.isOpen?"true":"false","aria-invalid":this.invalid?"true":"false","aria-required":this.requiredIndicator?"true":"false",tabIndex:this.disabled?-1:0,onBlur:this.handleBlur,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown}),de("div",{class:"select-label"},this.displayTags.length?de("span",{class:"select-tags"},this.displayTags):this.displayLabel||this.placeholder),this.clearable&&t&&de("button",{class:"select-clear",type:"button",onClick:this.handleClearClick,"aria-label":"clear",tabindex:"-1"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Close Circle"),de("path",{d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M320 320L192 192M192 320l128-128"}))),de("span",{class:"caret"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Chevron Down"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"48",d:"M112 184l144 144 144-144"}))),de("input",{class:"select-hidden-select","aria-hidden":"true",value:t?"1":"",tabIndex:-1})),de("gr-menu",{ref:e=>this.menu=e,class:"select-menu","onGr-select":this.handleMenuSelect},de("slot",{onSlotchange:this.handleSlotChange}))))}get el(){return this}static get watchers(){return{disabled:["handleDisabledChange"],helpText:["handleLabelChange"],invalidText:["handleLabelChange"],label:["handleLabelChange"],multiple:["handleMultipleChange"],value:["handleValueChange"]}}static get style(){return".form-control .form-control-label{display:none}.form-control .form-control-help-text{display:none}.form-control .form-control-invalid-text{display:none}.form-control-has-label .form-control-label{display:flex;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-label-color);margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-label.form-control-small .form-control-label{font-size:var(--gr-form-element-label-font-size-small)}.form-control-has-label.form-control-medium .form-control-label{font-size:var(--gr-form-element-label-font-size-medium)}.form-control-has-label.form-control-large .form-control-label{font-size:var(--gr-form-element-label-font-size-large)}.form-control-has-label .form-control-label .asterisk{margin-left:var(--gr-spacing-x-small);color:var(--gr-color-medium)}.form-control-has-label .form-control-label .asterisk svg{width:0.6em;height:0.6em;margin-bottom:var(--gr-spacing-xxx-small)}.form-control-has-help-text .form-control-help-text{display:block;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-help-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-help-text.form-control-small .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-small);min-height:1.625rem}.form-control-has-help-text.form-control-medium .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-medium);min-height:1.875rem}.form-control-has-help-text.form-control-large .form-control-help-text{font-size:var(--gr-form-element-help-text-font-size-large);min-height:2.125rem}.form-control-has-invalid-text .form-control-invalid-text{display:flex;margin-left:-2px;line-height:var(--gr-line-height-normal);color:var(--gr-form-element-invalid-text-color);margin-top:var(--gr-spacing-xxx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon{margin-top:var(--gr-spacing-xxx-small);margin-right:var(--gr-spacing-xx-small)}.form-control-has-invalid-text .form-control-invalid-text .icon svg{width:1.4em;height:1.4em}.form-control-has-invalid-text.form-control-small .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-small);min-height:1.625rem}.form-control-has-invalid-text.form-control-medium .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-medium);min-height:1.875rem}.form-control-has-invalid-text.form-control-large .form-control-invalid-text{font-size:var(--gr-form-element-invalid-text-font-size-large);min-height:2.125rem}.gr-scroll-lock{overflow:hidden !important}:host{--font-size:var(--gr-form-element-font-size-medium);--font-weight:var(--gr-font-weight-normal);--background-color:var(--gr-color-white);--background-color-hover:var(--gr-color-white);--background-color-focus:var(--gr-color-white);--background-color-invalid:var(--gr-color-white);--background-color-invalid-hover:var(--gr-color-white);--border-radius:var(--gr-form-element-border-radius-small);--border-color:var(--gr-color-light-shade);--border-color-hover:var(--gr-color-medium);--border-color-focus:var(--gr-color-primary);--border-color-invalid:var(--gr-color-danger);--border-color-invalid-hover:var(--gr-color-danger-shade);--color:var(--gr-color-dark-tint);--placeholder-color:var(--gr-color-medium-tint);--min-height:var(--gr-form-element-height-medium);--label-margin-start:var(--gr-spacing-medium);--label-margin-end:var(--gr-spacing-medium);--clear-icon-margin-end:var(--gr-spacing-medium);--caret-margin-end:var(--gr-spacing-medium);--tags-padding-top:3px;--tags-padding-bottom:3px;--tags-margin-end:var(--gr-spacing-xx-small);--focus-ring:0 0 0 var(--gr-focus-ring-width) rgb(var(--gr-color-primary-rgb), 0.33);display:block;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.select-small{--font-size:var(--gr-form-element-font-size-small);--min-height:var(--gr-form-element-height-small);--label-margin-start:var(--gr-spacing-small);--label-margin-end:var(--gr-spacing-small);--clear-icon-margin-end:var(--gr-spacing-small);--caret-margin-end:var(--gr-spacing-small);--tags-padding-top:2px;--tags-padding-bottom:2px}.select-large{--font-size:var(--gr-form-element-font-size-large);--min-height:var(--gr-form-element-height-large);--label-margin-start:var(--gr-spacing-large);--label-margin-end:var(--gr-spacing-large);--clear-icon-margin-end:var(--gr-spacing-large);--caret-margin-end:var(--gr-spacing-large);--tags-padding-top:4px;--tags-padding-bottom:4px}.select{display:block}.select-box{display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;font-family:var(--gr-font-family);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:normal;background-color:var(--background-color);border:solid 1px var(--border-color);border-radius:var(--border-radius);min-height:var(--min-height);color:var(--color);vertical-align:middle;overflow:hidden;transition:150ms color, 150ms border, 150ms box-shadow;cursor:pointer}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select.select-invalid:not(.select-disabled):not(.select-focused) .select-box:hover{background-color:var(--background-color-invalid-hover);border-color:var(--border-color-invalid-hover)}.select.select-invalid:not(.select-disabled) .select-box{background-color:var(--background-color-invalid);border-color:var(--border-color-invalid)}.select:not(.select-disabled) .select-box:hover{background-color:var(--background-color-hover);border-color:var(--border-color-hover)}.select.select-focused:not(.select-disabled) .select-box{outline:none;box-shadow:var(--focus-ring);border-color:var(--border-color-focus);background-color:var(--background-color-focus)}.select-disabled .select-box{opacity:0.5;cursor:not-allowed;outline:none}.select-disabled .select-tags,.select-disabled .select-clear{pointer-events:none}.select-label{flex:1 1 auto;display:flex;align-items:center;user-select:none;margin-top:0;margin-left:var(--label-margin-start);margin-right:var(--label-margin-end);margin-bottom:0;scrollbar-width:none;-ms-overflow-style:none;overflow-x:auto;overflow-y:hidden;white-space:nowrap}.select-label::-webkit-scrollbar{width:0;height:0}.select-has-tags .select-label{margin-left:0}.select-clear{display:inline-flex;align-items:center;font-size:inherit;color:var(--gr-color-medium);border:none;background:none;padding:0;transition:150ms color;cursor:pointer;margin-right:var(--clear-icon-margin-end)}.select-clear:hover{color:var(--gr-color-dark)}.select-clear:focus{outline:none}.select-clear svg{width:1.2em;height:1.2em;font-size:var(--font-size)}.caret{flex:0 0 auto;display:inline-flex;transition:250ms transform ease;margin-right:var(--caret-margin-end)}.caret svg{width:1em;height:1em;font-size:var(--font-size)}.select-open .caret{transform:rotate(-180deg)}.select-placeholder-visible .select-label{color:var(--placeholder-color)}.select-tags{display:inline-flex;align-items:center;flex-wrap:wrap;justify-content:left;margin-left:var(--gr-spacing-xx-small);padding-bottom:var(--tags-padding-bottom)}.select-tags gr-tag{padding-top:var(--tags-padding-top)}.select-tags gr-tag:not(:last-of-type){margin-right:var(--tags-margin-end)}.select-hidden-select{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;position:absolute;top:0;left:0;width:100%;height:100%}.select-pill .select-box{border-radius:var(--min-height)}"}},[1,"gr-select",{multiple:[4],maxTagsVisible:[2,"max-tags-visible"],disabled:[4],name:[1],placeholder:[1],size:[1],hoist:[4],value:[1025],pill:[4],label:[1],requiredIndicator:[4,"required-indicator"],helpText:[1,"help-text"],invalidText:[1,"invalid-text"],invalid:[516],clearable:[4],hasFocus:[32],hasHelpTextSlot:[32],hasInvalidTextSlot:[32],hasLabelSlot:[32],isOpen:[32],items:[32],displayLabel:[32],displayTags:[32],setFocus:[64]}]),ni=e=>{if(null!=e)return Array.isArray(e)?e.join(","):e.toString()};!function(){if("undefined"==typeof customElements)return;["gr-select","gr-button","gr-dropdown","gr-menu","gr-spinner","gr-tag"].forEach((e=>{switch(e){case"gr-select":customElements.get(e)||customElements.define(e,oi);break;case"gr-button":customElements.get(e)||St();break;case"gr-dropdown":customElements.get(e)||Xr();break;case"gr-menu":customElements.get(e)||Jr();break;case"gr-spinner":customElements.get(e)||Et();break;case"gr-tag":customElements.get(e)||ti()}}))}();const ai=oi,si=Ge(class extends dt{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.hasFocus=!1,this.checked=!1,this.value="",this.disabled=!1}connectedCallback(){this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this)}async setFocus(e){this.el.focus(e)}async removeFocus(){this.el.blur()}handleBlur(){this.hasFocus=!1}handleFocus(){this.hasFocus=!0}handleMouseEnter(){this.setFocus()}handleMouseLeave(){this.removeFocus()}render(){return de(ge,{class:{"menu-item-checked":this.checked,"menu-item-disabled":this.disabled,"menu-item-focused":this.hasFocus},role:"menuitem","aria-disabled":this.disabled?"true":"false","aria-checked":this.checked?"true":"false",tabIndex:this.disabled?null:0,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},de("span",{class:"checkmark"},de("svg",{role:"img","aria-hidden":"true",viewBox:"0 0 512 512"},de("title",null,"Checkmark"),de("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"}))),de("span",{class:"start"},de("slot",{name:"start"})),de("span",{class:"label"},de("slot",null)),de("span",{class:"end"},de("slot",{name:"end"})))}get el(){return this}static get style(){return".gr-scroll-lock{overflow:hidden !important}:host{--line-height:var(--gr-line-height-normal);--background-color:transparent;--background-color-focused:var(--gr-color-primary);--color:var(--gr-color-dark);--color-focused:var(--gr-color-primary-contrast);--color-disabled:var(--gr-color-medium);--padding-top:var(--gr-spacing-xx-small);--padding-start:var(--gr-spacing-x-large);--padding-end:var(--gr-spacing-x-large);--padding-bottom:var(--gr-spacing-xx-small);--transition:background-color 150ms linear, color 150ms linear;position:relative;display:flex;align-items:stretch;font-family:var(--gr-font-family);font-size:var(--gr-font-size-medium);font-weight:var(--gr-font-weight-normal);line-height:var(--line-height);letter-spacing:var(--gr-letter-spacing-normal);text-align:left;background-color:var(--background-color);color:var(--color);padding-top:var(--padding-top);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-bottom:var(--padding-bottom);transition:var(--transition);user-select:none;white-space:nowrap;cursor:pointer;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}:host(.menu-item-focused:not(.menu-item-disabled)){outline:none;background-color:var(--background-color-focused);color:var(--color-focused)}:host(.menu-item-disabled){outline:none;color:var(--color-disabled);cursor:not-allowed}.checkmark{display:flex;position:absolute;left:0.5em;top:calc(50% - 0.5em);visibility:hidden;align-items:center;font-size:inherit}.checkmark svg{display:inline-block;width:1.1em;height:1.1em;contain:strict;fill:currentcolor;box-sizing:content-box !important}:host(.menu-item-checked) .checkmark{visibility:visible}.label{flex:1 1 auto}.start{flex:0 0 auto;display:flex;align-items:center}.start ::slotted(:last-child){margin-right:0.5em}.end{flex:0 0 auto;display:flex;align-items:center}.end ::slotted(:first-child){margin-left:0.5em}"}},[1,"gr-menu-item",{checked:[516],value:[513],disabled:[516],hasFocus:[32],setFocus:[64],removeFocus:[64]}]); +/*! + * (C) PAQT.com B.V. https://paqt.com - MIT License + */!function(){if("undefined"==typeof customElements)return;["gr-menu-item"].forEach((e=>{if("gr-menu-item"===e)customElements.get(e)||customElements.define(e,si)}))}();const li={"gr-select":ai,"gr-menu-item":si};class ci extends(q(_)){constructor(){super(...arguments),this.value=null,this.multiple=!1,this.clearable=!1,this._refSelect=y()}reset(){this.value=null}_valueChangedHandler(e){const t=this._refSelect.value?.value;if(void 0!==t&&!l(this.value,t)){const e=null===this.value;this.value=t,e||w(this,"select:change",t)}}willUpdate(e){e.has("initialValue")&&this.initialValue&&!this.value&&(this.value=this.initialValue)}render(){return $` + ${this.options?.map((e=>$`${e.label}`))} + `}static get styles(){return k(':root, :host {\n --gr-color-primary: #1079b2;\n --gr-color-primary-rgb: 16, 121, 178;\n --gr-color-primary-contrast: #ffffff;\n --gr-color-primary-contrast-rgb: 255, 255, 255;\n --gr-color-primary-shade: #0d6696;\n --gr-color-primary-tint: #1499e1;\n --gr-color-secondary: #051f2c;\n --gr-color-secondary-rgb: 5, 31, 44;\n --gr-color-secondary-contrast: #ffffff;\n --gr-color-secondary-contrast-rgb: 255, 255, 255;\n --gr-color-secondary-shade: #000000;\n --gr-color-secondary-tint: #0a415c;\n --gr-color-tertiary: #0c4a6e;\n --gr-color-tertiary-rgb: 12, 74, 110;\n --gr-color-tertiary-contrast: #ffffff;\n --gr-color-tertiary-contrast-rgb: 255, 255, 255;\n --gr-color-tertiary-shade: #083249;\n --gr-color-tertiary-tint: #106393;\n --gr-color-success: #0fbe78;\n --gr-color-success-rgb: 15, 190, 120;\n --gr-color-success-contrast: #000000;\n --gr-color-success-contrast-rgb: 0, 0, 0;\n --gr-color-success-shade: #057f4e;\n --gr-color-success-tint: #12e28f;\n --gr-color-warning: #fbbc4e;\n --gr-color-warning-rgb: 251, 188, 78;\n --gr-color-warning-contrast: #051f2c;\n --gr-color-warning-contrast-rgb: 5, 31, 44;\n --gr-color-warning-shade: #9e6400;\n --gr-color-warning-tint: #fdd187;\n --gr-color-danger: #e60017;\n --gr-color-danger-rgb: 230, 0, 23;\n --gr-color-danger-contrast: #ffffff;\n --gr-color-danger-contrast-rgb: 255, 255, 255;\n --gr-color-danger-shade: #cc0014;\n --gr-color-danger-tint: #ff1f35;\n --gr-color-light: #f4f5f8;\n --gr-color-light-rgb: 244, 245, 248;\n --gr-color-light-contrast: #051f2c;\n --gr-color-light-contrast-rgb: 5, 31, 44;\n --gr-color-light-shade: #d7d8da;\n --gr-color-light-tint: #f9fafb;\n --gr-color-medium: #5e6c78;\n --gr-color-medium-rgb: 94, 108, 120;\n --gr-color-medium-contrast: #ffffff;\n --gr-color-medium-contrast-rgb: 255, 255, 255;\n --gr-color-medium-shade: #48535b;\n --gr-color-medium-tint: #81909c;\n --gr-color-dark: #02131b;\n --gr-color-dark-rgb: 2, 19, 27;\n --gr-color-dark-contrast: #ffffff;\n --gr-color-dark-contrast-rgb: 255, 255, 255;\n --gr-color-dark-shade: #000000;\n --gr-color-dark-tint: #222428;\n --gr-color-white: #ffffff;\n --gr-color-black: #000000;\n --gr-border-radius-small: 0.125rem;\n --gr-border-radius-medium: 0.25rem;\n --gr-border-radius-large: 0.5rem;\n --gr-border-radius-x-large: 1rem;\n --gr-border-width-small: 0.063rem;\n --gr-border-width-medium: 0.125rem;\n --gr-border-width-large: 0.188rem;\n --gr-shadow-x-small: 0 1px 0 #0d131e0d;\n --gr-shadow-small: 0 1px 2px #0d131e1a;\n --gr-shadow-medium: 0 2px 4px #0d131e1a;\n --gr-shadow-large: 0 2px 8px #0d131e1a;\n --gr-shadow-x-large: 0 4px 16px #0d131e1a;\n --gr-spacing-xxx-small: 0.125rem;\n --gr-spacing-xx-small: 0.25rem;\n --gr-spacing-x-small: 0.5rem;\n --gr-spacing-small: 0.75rem;\n --gr-spacing-medium: 1rem;\n --gr-spacing-large: 1.25rem;\n --gr-spacing-x-large: 1.75rem;\n --gr-spacing-xx-large: 2.25rem;\n --gr-spacing-xxx-large: 3rem;\n --gr-spacing-xxxx-large: 4.5rem;\n --gr-font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,\n sans-serif;\n --gr-letter-spacing-dense: -0.015em;\n --gr-letter-spacing-normal: normal;\n --gr-letter-spacing-loose: 0.075em;\n --gr-line-height-dense: 1.4;\n --gr-line-height-normal: 1.8;\n --gr-line-height-loose: 2.2;\n --gr-font-size-xx-small: 0.625rem;\n --gr-font-size-x-small: 0.75rem;\n --gr-font-size-small: 0.875rem;\n --gr-font-size-medium: 1rem;\n --gr-font-size-large: 1.25rem;\n --gr-font-size-x-large: 1.5rem;\n --gr-font-size-xx-large: 2.25rem;\n --gr-font-size-xxx-large: 3rem;\n --gr-font-size-xxxx-large: 4.5rem;\n --gr-font-weight-thin: 100;\n --gr-font-weight-extra-light: 200;\n --gr-font-weight-light: 300;\n --gr-font-weight-normal: 400;\n --gr-font-weight-medium: 500;\n --gr-font-weight-semi-bold: 600;\n --gr-font-weight-bold: 700;\n --gr-font-weight-extra-bold: 800;\n --gr-font-weight-black: 900;\n --gr-form-element-font-size-x-small: var(--gr-font-size-x-small);\n --gr-form-element-font-size-small: var(--gr-font-size-small);\n --gr-form-element-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-font-size-large: var(--gr-font-size-large);\n --gr-form-element-height-small: 2.188rem;\n --gr-form-element-height-medium: 3.125rem;\n --gr-form-element-height-large: 4.063rem;\n --gr-form-element-border-radius-small: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-medium: var(--gr-border-radius-medium);\n --gr-form-element-border-radius-large: var(--gr-border-radius-medium);\n --gr-focus-ring-width: 2px;\n --gr-form-element-label-font-size-small: var(--gr-font-size-small);\n --gr-form-element-label-font-size-medium: var(--gr-font-size-medium);\n --gr-form-element-label-font-size-large: var(--gr-font-size-large);\n --gr-form-element-label-color: inherit;\n --gr-form-element-help-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-help-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-help-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-help-text-color: var(--gr-color-medium);\n --gr-form-element-invalid-text-font-size-small: var(--gr-font-size-x-small);\n --gr-form-element-invalid-text-font-size-medium: var(--gr-font-size-small);\n --gr-form-element-invalid-text-font-size-large: var(--gr-font-size-medium);\n --gr-form-element-invalid-text-color: var(--gr-color-danger);\n --gr-toggle-size: 1rem;\n --gr-panel-border-color: var(--gr-color-light-shade);\n --gr-z-index-dropdown: 900;\n}\n\n')}}ci.elementDefinitions={...li},f([v({attribute:!1,hasChanged:b})],ci.prototype,"options",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"value",void 0),f([v({attribute:!1,hasChanged:b})],ci.prototype,"initialValue",void 0),f([v({attribute:!0})],ci.prototype,"label",void 0),f([v({attribute:!0})],ci.prototype,"placeholder",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"multiple",void 0),f([v({attribute:!0,type:Boolean})],ci.prototype,"clearable",void 0);let di=class extends(q(_)){constructor(){super(...arguments),this._mediaFilterController=new U(this),this._refMediaType=y(),this._refCamera=y(),this._refWhen=y(),this._refWhenFrom=y(),this._refWhenTo=y(),this._refWhat=y(),this._refWhere=y(),this._refFavorite=y(),this._refTags=y()}willUpdate(e){e.has("viewManagerEpoch")&&this._mediaFilterController.setViewManager(this.viewManagerEpoch?.manager??null),e.has("cameraManager")&&this.cameraManager&&(this._mediaFilterController.computeCameraOptions(this.cameraManager),this._mediaFilterController.computeMetadataOptions(this.cameraManager)),!e.get("viewManager")&&this.viewManagerEpoch&&this.cameraManager&&this._mediaFilterController.computeInitialDefaultsFromView(this.cameraManager)}render(){const e=async()=>{this.cameraManager&&this.viewManagerEpoch&&this.cardWideConfig&&await this._mediaFilterController.valueChangeHandler(this.cameraManager,this.cardWideConfig,{camera:this._refCamera.value?.value??void 0,mediaType:this._refMediaType.value?.value??void 0,when:{selected:this._refWhen.value?.value??void 0,from:this._refWhenFrom.value?.value,to:this._refWhenTo.value?.value},favorite:this._refFavorite.value?.value??void 0,where:this._refWhere.value?.value??void 0,what:this._refWhat.value?.value??void 0,tags:this._refTags.value?.value??void 0})},t=async t=>{"custom"===t&&this._refWhen.value?this._refWhenFrom.value?.value||this._refWhenTo.value?.value?this._refWhen.value.value=B.Custom:this._refWhen.value.reset():this._refWhen.value?.value!==B.Custom&&(this._refWhenFrom.value?.reset(),this._refWhenTo.value?.reset()),await e()};if(!this.cameraManager||!this.viewManagerEpoch)return;const r=this._mediaFilterController.getControlsToShow(this.cameraManager),o=this._mediaFilterController.getDefaults(),n=this._mediaFilterController.getWhatOptions(),a=this._mediaFilterController.getTagsOptions(),s=this._mediaFilterController.getWhereOptions();return $` e()} + > + +
+ t("selected")} + > + + t("custom")} + > + + t("custom")} + > + +
+ e()} + > + + ${r.events&&n.length?$` e()} + > + `:""} + ${r.events&&a.length?$` e()} + > + `:""} + ${r.events&&s.length?$` e()} + > + `:""} + ${r.favorites?$` + e()} + > + + `:""}`}static get styles(){return k(":host {\n display: flex;\n flex-direction: column;\n overflow: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n height: 100%;\n width: 300px;\n margin: 5px;\n}\n\n/* Hide scrollbar for Chrome, Safari and Opera */\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-select {\n padding: 5px;\n}\n\ndiv.when {\n display: inline-flex;\n align-items: flex-end;\n}\n\ndiv.when frigate-card-select {\n flex: 1;\n}\n\ndiv.when frigate-card-date-picker {\n padding-bottom: 5px;\n transition: width 0.5s ease-in-out;\n}\n\ndiv.when frigate-card-date-picker {\n color: var(--secondary-color);\n}\n\ndiv.when frigate-card-date-picker.selected {\n color: var(--primary-color);\n}\n\ndiv.when frigate-card-date-picker.hidden {\n width: 0px;\n}")}};di.elementDefinitions={"frigate-card-select":ci,"frigate-card-date-picker":R},f([v({attribute:!1})],di.prototype,"hass",void 0),f([v({attribute:!1})],di.prototype,"cameraManager",void 0),f([v({attribute:!1})],di.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],di.prototype,"cardWideConfig",void 0),di=f([C("frigate-card-media-filter")],di);const hi={closed:"mdi:filter-cog-outline",open:"mdi:filter-cog"};let gi=class extends _{render(){const e=this.viewManagerEpoch?.manager.getView();if(this.hass&&e?.isGalleryView()&&this.cameraManager&&this.cardWideConfig)return $` + + ${this.galleryConfig&&"none"!==this.galleryConfig.controls.filter.mode?$` + `:""} + + + + `}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\nfrigate-card-surround-basic {\n max-height: 110dvh;\n}")}};f([v({attribute:!1})],gi.prototype,"hass",void 0),f([v({attribute:!1})],gi.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],gi.prototype,"galleryConfig",void 0),f([v({attribute:!1})],gi.prototype,"cameraManager",void 0),f([v({attribute:!1})],gi.prototype,"cardWideConfig",void 0),gi=f([C("frigate-card-gallery")],gi);let ui=class extends _{constructor(){super(),this._refLoaderBottom=y(),this._refSelected=y(),this._showLoaderBottom=!0,this._showLoaderTop=!1,this._boundWheelHandler=this._wheelHandler.bind(this),this._boundTouchStartHandler=this._touchStartHandler.bind(this),this._boundTouchEndHandler=this._touchEndHandler.bind(this),this._throttleExtendGalleryLater=O(this._extendGallery.bind(this),500,{leading:!0,trailing:!1}),this._touchScrollYPosition=null,this._resizeObserver=new ResizeObserver(this._resizeHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_touchStartHandler(e){1===e.touches.length?this._touchScrollYPosition=e.touches[0].screenY:this._touchScrollYPosition=null}async _touchEndHandler(e){!this.scrollTop&&1===e.changedTouches.length&&this._touchScrollYPosition&&e.changedTouches[0].screenY>this._touchScrollYPosition&&await this._extendLater(),this._touchScrollYPosition=null}async _wheelHandler(e){!this.scrollTop&&e.deltaY<0&&await this._extendLater()}async _extendLater(){const e=new Date;this._showLoaderTop=!0,await this._throttleExtendGalleryLater("later",!1);const t=(new Date).getTime()-e.getTime();t<500&&await S(.5-t/1e3),this._showLoaderTop=!1}connectedCallback(){super.connectedCallback(),this._resizeObserver.observe(this),this.addEventListener("wheel",this._boundWheelHandler,{passive:!0}),this.addEventListener("touchstart",this._boundTouchStartHandler,{passive:!0}),this.addEventListener("touchend",this._boundTouchEndHandler),this.requestUpdate()}disconnectedCallback(){this.removeEventListener("wheel",this._boundWheelHandler),this.removeEventListener("touchstart",this._boundTouchStartHandler),this.removeEventListener("touchend",this._boundTouchEndHandler),this._resizeObserver.disconnect(),this._intersectionObserver.disconnect(),super.disconnectedCallback()}_setColumnCount(){const e=this.galleryConfig?.controls.thumbnails.size??M.media_gallery.controls.thumbnails.size,t=this.galleryConfig?.controls.thumbnails.show_details?Math.max(1,Math.floor(this.clientWidth/z)):Math.max(1,Math.ceil(this.clientWidth/e));this.style.setProperty("--frigate-card-gallery-columns",String(t))}_resizeHandler(){this._setColumnCount()}async _intersectionHandler(e){e.every((e=>!e.isIntersecting))||(this._showLoaderBottom=!1,await this._extendGallery("earlier"))}async _extendGallery(e,t=!0){const r=this.viewManagerEpoch?.manager.getView();if(!this.cameraManager||!this.hass||!r)return;const i=r.query,n=i?.getQueries()??null,s=r.queryResults?.getResults();if(!i||!n||!s)return;let l;try{l=await this.cameraManager.extendMediaQueries(n,s,e,{useCache:t})}catch(e){return void d(e)}if(l){const e=c.areEventQueries(i)?new o(l.queries):c.areRecordingQueries(i)?new a(l.queries):null;e&&this.viewManagerEpoch?.manager.setViewByParameters({baseView:r,params:{query:e,queryResults:new L({results:l.results}).selectResultIfFound((e=>e===r.queryResults?.getSelectedResult()))}})}}willUpdate(e){if(e.has("galleryConfig")&&(this.galleryConfig?.controls.thumbnails.show_details?this.setAttribute("details",""):this.removeAttribute("details"),this._setColumnCount(),this.galleryConfig?.controls.thumbnails.size&&this.style.setProperty("--frigate-card-thumbnail-size",`${this.galleryConfig.controls.thumbnails.size}px`)),e.has("viewManagerEpoch")){this._showLoaderBottom=!0;const e=this.viewManagerEpoch?.manager.getView(),t=this.viewManagerEpoch?.oldView;this._media&&t?.queryResults?.getResults()===e?.queryResults?.getResults()||(this._media=[...e?.queryResults?.getResults()??[]].reverse())}}render(){if(!this._media||!this.hass)return $``;const e=this.viewManagerEpoch?.manager.getView();if(!e?.queryResults||0===e.queryResults.getResultsCount()){const t=!!e?.context?.loading?.query;return D({type:"info",message:i(t?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:t})}const t=e.queryResults.getSelectedResult();return $`
+ ${this._showLoaderTop?$`${A({cardWideConfig:this.cardWideConfig,classes:{top:!0},size:"small"})}`:""} + ${this._media.map(((r,i)=>$`{this._media&&this.viewManagerEpoch?.manager.setViewByParameters({params:{view:"media",queryResults:e.queryResults?.clone().selectIndex(this._media.length-i-1)}}),F(t)}} + > + `))} + ${this._showLoaderBottom?$`${A({cardWideConfig:this.cardWideConfig,componentRef:this._refLoaderBottom})}`:""} +
`}updated(e){this._refLoaderBottom.value&&(this._intersectionObserver.disconnect(),this._intersectionObserver.observe(this._refLoaderBottom.value)),this.updateComplete.then((()=>{e.has("viewManagerEpoch")&&!e.get("viewManagerEpoch")&&this._refSelected.value&&this._refSelected.value.scrollIntoView({block:"center"})}))}static get styles(){return k(":host {\n width: 100%;\n height: 100%;\n display: block;\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n --frigate-card-gallery-gap: 3px;\n --frigate-card-gallery-columns: 4;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(var(--frigate-card-gallery-columns), minmax(0, 1fr));\n grid-auto-rows: min-content;\n gap: var(--frigate-card-gallery-gap);\n}\n\n:host::-webkit-scrollbar {\n display: none;\n}\n\nfrigate-card-thumbnail {\n height: 100%;\n max-height: var(--frigate-card-thumbnail-size);\n}\n\nfrigate-card-thumbnail:not([details]) {\n width: 100%;\n}\n\nfrigate-card-thumbnail.selected {\n border: 4px solid var(--accent-color);\n border-radius: calc(var(--frigate-card-css-border-radius, var(--ha-card-border-radius, 4px)) + 4px);\n}\n\nfrigate-card-progress-indicator.top {\n grid-column: 1/-1;\n}")}};f([v({attribute:!1})],ui.prototype,"hass",void 0),f([v({attribute:!1})],ui.prototype,"viewManagerEpoch",void 0),f([v({attribute:!1})],ui.prototype,"galleryConfig",void 0),f([v({attribute:!1})],ui.prototype,"cameraManager",void 0),f([v({attribute:!1})],ui.prototype,"cardWideConfig",void 0),f([E()],ui.prototype,"_showLoaderBottom",void 0),f([E()],ui.prototype,"_showLoaderTop",void 0),ui=f([C("frigate-card-gallery-core")],ui);export{gi as FrigateCardGallery,ui as FrigateCardGalleryCore}; diff --git a/www/community/frigate-hass-card/gallery-f478918c.js.gz b/www/community/frigate-hass-card/gallery-f478918c.js.gz new file mode 100644 index 00000000..c79e2be4 Binary files /dev/null and b/www/community/frigate-hass-card/gallery-f478918c.js.gz differ diff --git a/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js b/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js new file mode 100644 index 00000000..8bcd1216 --- /dev/null +++ b/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js @@ -0,0 +1 @@ +const e=e=>{const s=[...e.pc?["webrtc"]:[],...!e.pc&&e.mseCodecs?["mse","hls"]:[]];return s.length?s:void 0};export{e as g}; diff --git a/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js.gz b/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js.gz new file mode 100644 index 00000000..2610bd2d Binary files /dev/null and b/www/community/frigate-hass-card/get-technology-for-video-rtc-778a0c05.js.gz differ diff --git a/www/community/frigate-hass-card/ha-1d1cb9a1.js b/www/community/frigate-hass-card/ha-1d1cb9a1.js new file mode 100644 index 00000000..4d9b2217 --- /dev/null +++ b/www/community/frigate-hass-card/ha-1d1cb9a1.js @@ -0,0 +1,61 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as r,dy as i,dz as o,r as h,eM as l,_ as n,t as u,a as d,cR as c,cU as y,l as p,cV as m,n as _}from"./card-45855f1f.js";import{c as v,e as g}from"./ha-hls-player-ad38a2a0.js";import{m as f}from"./audio-cf3a75aa.js";import{s as $,h as b,c as w}from"./media-1a34ac2c.js";import{g as R}from"./index-9bf80040.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let d=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&$(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h(v),l` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([g("#remote-stream")],d.prototype,"_video",void 0),d=n([u("frigate-card-ha-web-rtc-player")],d)})),customElements.whenDefined("ha-camera-stream").then((()=>{let e=class extends(customElements.get("ha-camera-stream")){async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}render(){return this.stateObj?this._shouldRenderMJPEG?s` + {a(this,e,{player:this,technology:["mjpeg"]})}} + .src=${void 0===this._connected||this._connected?(e=this.stateObj,`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`):""} + /> + `:"hls"===this.stateObj.attributes.frontend_stream_type?this._url?s` `:s``:"web_rtc"===this.stateObj.attributes.frontend_stream_type?s``:void 0:s``;var e}static get styles(){return[super.styles,h(v),l` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([g("#player")],e.prototype,"_player",void 0),e=n([u("frigate-card-ha-camera-stream")],e)}));let j=class extends d{constructor(){super(...arguments),this.controls=!0,this._playerRef=c()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(!this.hass)return;const e=R(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?y({message:p("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([_({attribute:!1})],j.prototype,"hass",void 0),n([_({attribute:!1})],j.prototype,"cameraConfig",void 0),n([_({attribute:!0,type:Boolean})],j.prototype,"controls",void 0),j=n([u("frigate-card-live-ha")],j);export{j as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-1d1cb9a1.js.gz b/www/community/frigate-hass-card/ha-1d1cb9a1.js.gz new file mode 100644 index 00000000..0d3d8f0d Binary files /dev/null and b/www/community/frigate-hass-card/ha-1d1cb9a1.js.gz differ diff --git a/www/community/frigate-hass-card/ha-31684cf1.js b/www/community/frigate-hass-card/ha-31684cf1.js new file mode 100644 index 00000000..2c56374b --- /dev/null +++ b/www/community/frigate-hass-card/ha-31684cf1.js @@ -0,0 +1,69 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as i,dy as r,dz as o,r as h,eM as d,_ as n,t as l,cN as c,eP as p,cP as u,a as y,cR as m,cU as _,l as f,cV as v,n as g}from"./card-c642ee74.js";import{c as $,e as b}from"./ha-hls-player-abb86874.js";import{m as w}from"./audio-cf3a75aa.js";import{s as R,h as L,c as P}from"./media-6eadcd60.js";import{g as I}from"./index-0a012f43.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let c=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&R(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([b("#remote-stream")],c.prototype,"_video",void 0),c=n([l("frigate-card-ha-web-rtc-player")],c)})),customElements.whenDefined("ha-camera-stream").then((()=>{const e="web_rtc",t="mjpeg";let a=class extends(customElements.get("ha-camera-stream")){constructor(){super(...arguments),this._mediaLoadedInfoPerStream={},this._mediaLoadedInfoDispatched=null}async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}_storeMediaLoadedInfoHandler(e,t){this._storeMediaLoadedInfo(e,t.detail),t.stopPropagation()}_storeMediaLoadedInfo(e,t){this._mediaLoadedInfoPerStream[e]=t,this.requestUpdate()}_renderStream(a){return this.stateObj?a.type===t?s` + this._storeMediaLoadedInfo(t,p(e,{player:this,technology:["mjpeg"]}))} + .src=${void 0===this._connected||this._connected?(i=this.stateObj,`/api/camera_proxy_stream/${i.entity_id}?token=${i.attributes.access_token}`):this._posterUrl||""} + /> + `:"hls"===a.type?s` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class=${a.visible?"":"hidden"} + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class=${a.visible?"":"hidden"} + >`:c:c;var i}updated(e){super.updated(e);const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams).find((e=>e.visible))??null;if(t){const e=this._mediaLoadedInfoPerStream[t.type];e&&e!==this._mediaLoadedInfoDispatched&&(this._mediaLoadedInfoDispatched=e,u(this,e))}}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([b("#player")],a.prototype,"_player",void 0),a=n([l("frigate-card-ha-camera-stream")],a)}));let S=class extends y{constructor(){super(...arguments),this.controls=!0,this._playerRef=m()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(!this.hass)return;const e=I(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?_({message:f("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([g({attribute:!1})],S.prototype,"hass",void 0),n([g({attribute:!1})],S.prototype,"cameraConfig",void 0),n([g({attribute:!0,type:Boolean})],S.prototype,"controls",void 0),S=n([l("frigate-card-live-ha")],S);export{S as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-31684cf1.js.gz b/www/community/frigate-hass-card/ha-31684cf1.js.gz new file mode 100644 index 00000000..c72c250c Binary files /dev/null and b/www/community/frigate-hass-card/ha-31684cf1.js.gz differ diff --git a/www/community/frigate-hass-card/ha-45d9145a.js b/www/community/frigate-hass-card/ha-45d9145a.js new file mode 100644 index 00000000..68475589 --- /dev/null +++ b/www/community/frigate-hass-card/ha-45d9145a.js @@ -0,0 +1,68 @@ +import{dh as e,cO as t,x as s,cY as a,ds as i,dt as r,du as o,dr as d,r as h,eE as n,_ as l,t as c,eH as p,eI as u,cK as y,a as m,cL as _,cP as f,n as v}from"./card-e5d55e5b.js";import{c as g,e as $}from"./ha-hls-player-1787796f.js";import{s as b,d as w,h as L,c as R}from"./media-921a03ae.js";import{m as I}from"./audio-cf3a75aa.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let p=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&b(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?(w(this),t({type:"error",message:this._error,context:{entity_id:this.entityid}})):s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:I(this._video)},technology:["webrtc"]})}static get styles(){return[super.styles,h(g),n` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([$("#remote-stream")],p.prototype,"_video",void 0),p=l([c("frigate-card-ha-web-rtc-player")],p)})),customElements.whenDefined("ha-camera-stream").then((()=>{const e="web_rtc",t="mjpeg";let a=class extends(customElements.get("ha-camera-stream")){constructor(){super(...arguments),this._mediaLoadedInfoPerStream={},this._mediaLoadedInfoDispatched=null}async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}_storeMediaLoadedInfoHandler(e,t){this._storeMediaLoadedInfo(e,t.detail),t.stopPropagation()}_storeMediaLoadedInfo(e,t){this._mediaLoadedInfoPerStream[e]=t,this.requestUpdate()}_renderStream(a){return this.stateObj?a.type===t?s` + this._storeMediaLoadedInfo(t,u(e,{player:this,technology:["mjpeg"]}))} + .src=${void 0===this._connected||this._connected?(i=this.stateObj,`/api/camera_proxy_stream/${i.entity_id}?token=${i.attributes.access_token}`):this._posterUrl||""} + /> + `:"hls"===a.type?s` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class="player ${a.visible?"":"hidden"}" + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class="player ${a.visible?"":"hidden"}" + >`:p:p;var i}updated(e){super.updated(e);const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams).find((e=>e.visible))??null;if(t){const e=this._mediaLoadedInfoPerStream[t.type];e&&e!==this._mediaLoadedInfoDispatched&&(this._mediaLoadedInfoDispatched=e,y(this,e))}}static get styles(){return[super.styles,h(g),n` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};l([$(".player:not(.hidden)")],a.prototype,"_player",void 0),a=l([c("frigate-card-ha-camera-stream")],a)}));let P=class extends m{constructor(){super(...arguments),this.controls=!1,this._playerRef=_()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(this.hass)return s` + `}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};l([v({attribute:!1})],P.prototype,"hass",void 0),l([v({attribute:!1})],P.prototype,"cameraConfig",void 0),l([v({attribute:!0,type:Boolean})],P.prototype,"controls",void 0),P=l([c("frigate-card-live-ha")],P);export{P as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-45d9145a.js.gz b/www/community/frigate-hass-card/ha-45d9145a.js.gz new file mode 100644 index 00000000..43ca35c2 Binary files /dev/null and b/www/community/frigate-hass-card/ha-45d9145a.js.gz differ diff --git a/www/community/frigate-hass-card/ha-4f7cd760.js b/www/community/frigate-hass-card/ha-4f7cd760.js new file mode 100644 index 00000000..45029929 --- /dev/null +++ b/www/community/frigate-hass-card/ha-4f7cd760.js @@ -0,0 +1,68 @@ +import{di as e,cP as t,x as s,cZ as a,dt as i,du as r,dv as o,ds as d,r as h,eJ as l,_ as n,t as c,eM as p,eN as u,cL as y,a as m,cM as _,cQ as f,n as v}from"./card-320adb66.js";import{c as g,e as $}from"./ha-hls-player-b195eaa1.js";import{s as b,d as w,h as L,c as R}from"./dispatch-live-error-c649b480.js";import{m as P}from"./audio-cf3a75aa.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let p=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&b(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?(w(this),t({type:"error",message:this._error,context:{entity_id:this.entityid}})):s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:P(this._video)},technology:["webrtc"]})}static get styles(){return[super.styles,h(g),l` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([$("#remote-stream")],p.prototype,"_video",void 0),p=n([c("frigate-card-ha-web-rtc-player")],p)})),customElements.whenDefined("ha-camera-stream").then((()=>{const e="web_rtc",t="mjpeg";let a=class extends(customElements.get("ha-camera-stream")){constructor(){super(...arguments),this._mediaLoadedInfoPerStream={},this._mediaLoadedInfoDispatched=null}async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}_storeMediaLoadedInfoHandler(e,t){this._storeMediaLoadedInfo(e,t.detail),t.stopPropagation()}_storeMediaLoadedInfo(e,t){this._mediaLoadedInfoPerStream[e]=t,this.requestUpdate()}_renderStream(a){return this.stateObj?a.type===t?s` + this._storeMediaLoadedInfo(t,u(e,{player:this,technology:["mjpeg"]}))} + .src=${void 0===this._connected||this._connected?(i=this.stateObj,`/api/camera_proxy_stream/${i.entity_id}?token=${i.attributes.access_token}`):this._posterUrl||""} + /> + `:"hls"===a.type?s` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class="player ${a.visible?"":"hidden"}" + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class="player ${a.visible?"":"hidden"}" + >`:p:p;var i}updated(e){super.updated(e);const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams).find((e=>e.visible))??null;if(t){const e=this._mediaLoadedInfoPerStream[t.type];e&&e!==this._mediaLoadedInfoDispatched&&(this._mediaLoadedInfoDispatched=e,y(this,e))}}static get styles(){return[super.styles,h(g),l` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([$(".player:not(.hidden)")],a.prototype,"_player",void 0),a=n([c("frigate-card-ha-camera-stream")],a)}));let I=class extends m{constructor(){super(...arguments),this.controls=!1,this._playerRef=_()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(this.hass)return s` + `}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([v({attribute:!1})],I.prototype,"hass",void 0),n([v({attribute:!1})],I.prototype,"cameraConfig",void 0),n([v({attribute:!0,type:Boolean})],I.prototype,"controls",void 0),I=n([c("frigate-card-live-ha")],I);export{I as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-4f7cd760.js.gz b/www/community/frigate-hass-card/ha-4f7cd760.js.gz new file mode 100644 index 00000000..fecdff2b Binary files /dev/null and b/www/community/frigate-hass-card/ha-4f7cd760.js.gz differ diff --git a/www/community/frigate-hass-card/ha-9af0bc47.js b/www/community/frigate-hass-card/ha-9af0bc47.js new file mode 100644 index 00000000..8e58f6c7 --- /dev/null +++ b/www/community/frigate-hass-card/ha-9af0bc47.js @@ -0,0 +1,61 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as r,dy as i,dz as o,r as h,eM as l,_ as n,t as u,a as d,cR as c,cU as y,l as p,cV as m,n as _}from"./card-7cd05290.js";import{c as v,e as g}from"./ha-hls-player-717bfdfd.js";import{m as f}from"./audio-cf3a75aa.js";import{s as $,h as b,c as w}from"./media-67c578aa.js";import{g as R}from"./index-3c9b9749.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let d=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&$(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h(v),l` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([g("#remote-stream")],d.prototype,"_video",void 0),d=n([u("frigate-card-ha-web-rtc-player")],d)})),customElements.whenDefined("ha-camera-stream").then((()=>{let e=class extends(customElements.get("ha-camera-stream")){async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}render(){return this.stateObj?this._shouldRenderMJPEG?s` + {a(this,e,{player:this,technology:["mjpeg"]})}} + .src=${void 0===this._connected||this._connected?(e=this.stateObj,`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`):""} + /> + `:"hls"===this.stateObj.attributes.frontend_stream_type?this._url?s` `:s``:"web_rtc"===this.stateObj.attributes.frontend_stream_type?s``:void 0:s``;var e}static get styles(){return[super.styles,h(v),l` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([g("#player")],e.prototype,"_player",void 0),e=n([u("frigate-card-ha-camera-stream")],e)}));let j=class extends d{constructor(){super(...arguments),this.controls=!0,this._playerRef=c()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(!this.hass)return;const e=R(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?y({message:p("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([_({attribute:!1})],j.prototype,"hass",void 0),n([_({attribute:!1})],j.prototype,"cameraConfig",void 0),n([_({attribute:!0,type:Boolean})],j.prototype,"controls",void 0),j=n([u("frigate-card-live-ha")],j);export{j as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-9af0bc47.js.gz b/www/community/frigate-hass-card/ha-9af0bc47.js.gz new file mode 100644 index 00000000..f1ecfd8f Binary files /dev/null and b/www/community/frigate-hass-card/ha-9af0bc47.js.gz differ diff --git a/www/community/frigate-hass-card/ha-a4f2c69e.js b/www/community/frigate-hass-card/ha-a4f2c69e.js new file mode 100644 index 00000000..42f8ec35 --- /dev/null +++ b/www/community/frigate-hass-card/ha-a4f2c69e.js @@ -0,0 +1,69 @@ +import{dm as e,cQ as t,x as s,dw as a,dx as i,dy as r,dz as o,r as h,eM as d,_ as n,t as l,cN as c,eP as p,cP as u,a as y,cR as m,cU as _,l as f,cV as v,n as g}from"./card-09c4bade.js";import{c as $,e as b}from"./ha-hls-player-ba5834a9.js";import{m as w}from"./audio-cf3a75aa.js";import{s as R,h as L,c as P}from"./media-aef44451.js";import{g as I}from"./index-e610f971.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let c=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&R(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([b("#remote-stream")],c.prototype,"_video",void 0),c=n([l("frigate-card-ha-web-rtc-player")],c)})),customElements.whenDefined("ha-camera-stream").then((()=>{const e="web_rtc",t="mjpeg";let a=class extends(customElements.get("ha-camera-stream")){constructor(){super(...arguments),this._mediaLoadedInfoPerStream={},this._mediaLoadedInfoDispatched=null}async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}_storeMediaLoadedInfoHandler(e,t){this._storeMediaLoadedInfo(e,t.detail),t.stopPropagation()}_storeMediaLoadedInfo(e,t){this._mediaLoadedInfoPerStream[e]=t,this.requestUpdate()}_renderStream(a){return this.stateObj?a.type===t?s` + this._storeMediaLoadedInfo(t,p(e,{player:this,technology:["mjpeg"]}))} + .src=${void 0===this._connected||this._connected?(i=this.stateObj,`/api/camera_proxy_stream/${i.entity_id}?token=${i.attributes.access_token}`):this._posterUrl||""} + /> + `:"hls"===a.type?s` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class=${a.visible?"":"hidden"} + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class=${a.visible?"":"hidden"} + >`:c:c;var i}updated(e){super.updated(e);const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams).find((e=>e.visible))??null;if(t){const e=this._mediaLoadedInfoPerStream[t.type];e&&e!==this._mediaLoadedInfoDispatched&&(this._mediaLoadedInfoDispatched=e,u(this,e))}}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([b("#player")],a.prototype,"_player",void 0),a=n([l("frigate-card-ha-camera-stream")],a)}));let S=class extends y{constructor(){super(...arguments),this.controls=!0,this._playerRef=m()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(!this.hass)return;const e=I(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?_({message:f("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([g({attribute:!1})],S.prototype,"hass",void 0),n([g({attribute:!1})],S.prototype,"cameraConfig",void 0),n([g({attribute:!0,type:Boolean})],S.prototype,"controls",void 0),S=n([l("frigate-card-live-ha")],S);export{S as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-a4f2c69e.js.gz b/www/community/frigate-hass-card/ha-a4f2c69e.js.gz new file mode 100644 index 00000000..e4fd4835 Binary files /dev/null and b/www/community/frigate-hass-card/ha-a4f2c69e.js.gz differ diff --git a/www/community/frigate-hass-card/ha-a94f6b28.js b/www/community/frigate-hass-card/ha-a94f6b28.js new file mode 100644 index 00000000..ef730475 --- /dev/null +++ b/www/community/frigate-hass-card/ha-a94f6b28.js @@ -0,0 +1,68 @@ +import{di as e,cP as t,x as s,cZ as a,dt as i,du as r,dv as o,ds as d,r as h,eJ as l,_ as n,t as c,eM as p,eN as u,cL as y,a as m,cM as _,cQ as f,n as v}from"./card-19444f74.js";import{c as g,e as $}from"./ha-hls-player-19f4a97a.js";import{s as b,d as w,h as L,c as R}from"./dispatch-live-error-65d9f8de.js";import{m as P}from"./audio-cf3a75aa.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let p=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&b(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?(w(this),t({type:"error",message:this._error,context:{entity_id:this.entityid}})):s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:P(this._video)},technology:["webrtc"]})}static get styles(){return[super.styles,h(g),l` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([$("#remote-stream")],p.prototype,"_video",void 0),p=n([c("frigate-card-ha-web-rtc-player")],p)})),customElements.whenDefined("ha-camera-stream").then((()=>{const e="web_rtc",t="mjpeg";let a=class extends(customElements.get("ha-camera-stream")){constructor(){super(...arguments),this._mediaLoadedInfoPerStream={},this._mediaLoadedInfoDispatched=null}async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}_storeMediaLoadedInfoHandler(e,t){this._storeMediaLoadedInfo(e,t.detail),t.stopPropagation()}_storeMediaLoadedInfo(e,t){this._mediaLoadedInfoPerStream[e]=t,this.requestUpdate()}_renderStream(a){return this.stateObj?a.type===t?s` + this._storeMediaLoadedInfo(t,u(e,{player:this,technology:["mjpeg"]}))} + .src=${void 0===this._connected||this._connected?(i=this.stateObj,`/api/camera_proxy_stream/${i.entity_id}?token=${i.attributes.access_token}`):this._posterUrl||""} + /> + `:"hls"===a.type?s` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class="player ${a.visible?"":"hidden"}" + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class="player ${a.visible?"":"hidden"}" + >`:p:p;var i}updated(e){super.updated(e);const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams).find((e=>e.visible))??null;if(t){const e=this._mediaLoadedInfoPerStream[t.type];e&&e!==this._mediaLoadedInfoDispatched&&(this._mediaLoadedInfoDispatched=e,y(this,e))}}static get styles(){return[super.styles,h(g),l` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([$(".player:not(.hidden)")],a.prototype,"_player",void 0),a=n([c("frigate-card-ha-camera-stream")],a)}));let I=class extends m{constructor(){super(...arguments),this.controls=!1,this._playerRef=_()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(this.hass)return s` + `}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([v({attribute:!1})],I.prototype,"hass",void 0),n([v({attribute:!1})],I.prototype,"cameraConfig",void 0),n([v({attribute:!0,type:Boolean})],I.prototype,"controls",void 0),I=n([c("frigate-card-live-ha")],I);export{I as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-a94f6b28.js.gz b/www/community/frigate-hass-card/ha-a94f6b28.js.gz new file mode 100644 index 00000000..86ae3efb Binary files /dev/null and b/www/community/frigate-hass-card/ha-a94f6b28.js.gz differ diff --git a/www/community/frigate-hass-card/ha-bcde5927.js b/www/community/frigate-hass-card/ha-bcde5927.js new file mode 100644 index 00000000..51574ee9 --- /dev/null +++ b/www/community/frigate-hass-card/ha-bcde5927.js @@ -0,0 +1,69 @@ +import{dn as e,cQ as t,x as s,dx as a,dy as i,dz as r,dA as o,r as h,eN as d,_ as n,t as l,cN as c,eQ as p,cP as u,a as y,cR as m,cU as _,l as f,cV as v,n as g}from"./card-4e88bdfb.js";import{c as $,e as b}from"./ha-hls-player-7f5d4dfb.js";import{m as w}from"./audio-cf3a75aa.js";import{s as R,h as L,c as P}from"./media-2a3bfaef.js";import{g as I}from"./index-add135a5.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let c=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&R(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s` + + `}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([b("#remote-stream")],c.prototype,"_video",void 0),c=n([l("frigate-card-ha-web-rtc-player")],c)})),customElements.whenDefined("ha-camera-stream").then((()=>{const e="web_rtc",t="mjpeg";let a=class extends(customElements.get("ha-camera-stream")){constructor(){super(...arguments),this._mediaLoadedInfoPerStream={},this._mediaLoadedInfoDispatched=null}async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}_storeMediaLoadedInfoHandler(e,t){this._storeMediaLoadedInfo(e,t.detail),t.stopPropagation()}_storeMediaLoadedInfo(e,t){this._mediaLoadedInfoPerStream[e]=t,this.requestUpdate()}_renderStream(a){return this.stateObj?a.type===t?s` + this._storeMediaLoadedInfo(t,p(e,{player:this,technology:["mjpeg"]}))} + .src=${void 0===this._connected||this._connected?(i=this.stateObj,`/api/camera_proxy_stream/${i.entity_id}?token=${i.attributes.access_token}`):this._posterUrl||""} + /> + `:"hls"===a.type?s` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class=${a.visible?"":"hidden"} + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class=${a.visible?"":"hidden"} + >`:c:c;var i}updated(e){super.updated(e);const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams).find((e=>e.visible))??null;if(t){const e=this._mediaLoadedInfoPerStream[t.type];e&&e!==this._mediaLoadedInfoDispatched&&(this._mediaLoadedInfoDispatched=e,u(this,e))}}static get styles(){return[super.styles,h($),d` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([b("#player")],a.prototype,"_player",void 0),a=n([l("frigate-card-ha-camera-stream")],a)}));let S=class extends y{constructor(){super(...arguments),this.controls=!1,this._playerRef=m()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(!this.hass)return;const e=I(this,this.hass,this.cameraConfig);return e?"unavailable"===e.state?_({message:f("error.live_camera_unavailable"),type:"error",icon:"mdi:connection",context:this.cameraConfig}):s` + `:void 0}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([g({attribute:!1})],S.prototype,"hass",void 0),n([g({attribute:!1})],S.prototype,"cameraConfig",void 0),n([g({attribute:!0,type:Boolean})],S.prototype,"controls",void 0),S=n([l("frigate-card-live-ha")],S);export{S as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-bcde5927.js.gz b/www/community/frigate-hass-card/ha-bcde5927.js.gz new file mode 100644 index 00000000..0f105ef9 Binary files /dev/null and b/www/community/frigate-hass-card/ha-bcde5927.js.gz differ diff --git a/www/community/frigate-hass-card/ha-f54d281b.js b/www/community/frigate-hass-card/ha-f54d281b.js new file mode 100644 index 00000000..1c13f877 --- /dev/null +++ b/www/community/frigate-hass-card/ha-f54d281b.js @@ -0,0 +1,68 @@ +import{di as e,cP as t,x as s,cZ as a,dt as i,du as r,dv as o,ds as d,r as h,eJ as l,_ as n,t as c,eM as p,eN as u,cL as y,a as m,cM as _,cQ as f,n as v}from"./card-0be2c6a9.js";import{c as g,e as $}from"./ha-hls-player-7f91fd5d.js";import{s as b,d as w,h as L,c as R}from"./dispatch-live-error-bba465cd.js";import{m as P}from"./audio-cf3a75aa.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let p=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&b(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?(w(this),t({type:"error",message:this._error,context:{entity_id:this.entityid}})):s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:P(this._video)},technology:["webrtc"]})}static get styles(){return[super.styles,h(g),l` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};n([$("#remote-stream")],p.prototype,"_video",void 0),p=n([c("frigate-card-ha-web-rtc-player")],p)})),customElements.whenDefined("ha-camera-stream").then((()=>{const e="web_rtc",t="mjpeg";let a=class extends(customElements.get("ha-camera-stream")){constructor(){super(...arguments),this._mediaLoadedInfoPerStream={},this._mediaLoadedInfoDispatched=null}async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}_storeMediaLoadedInfoHandler(e,t){this._storeMediaLoadedInfo(e,t.detail),t.stopPropagation()}_storeMediaLoadedInfo(e,t){this._mediaLoadedInfoPerStream[e]=t,this.requestUpdate()}_renderStream(a){return this.stateObj?a.type===t?s` + this._storeMediaLoadedInfo(t,u(e,{player:this,technology:["mjpeg"]}))} + .src=${void 0===this._connected||this._connected?(i=this.stateObj,`/api/camera_proxy_stream/${i.entity_id}?token=${i.attributes.access_token}`):this._posterUrl||""} + /> + `:"hls"===a.type?s` this._storeMediaLoadedInfoHandler("hls",e)} + @streams=${this._handleHlsStreams} + class="player ${a.visible?"":"hidden"}" + >`:a.type===e?s`this._storeMediaLoadedInfoHandler(e,t)} + @streams=${this._handleWebRtcStreams} + class="player ${a.visible?"":"hidden"}" + >`:p:p;var i}updated(e){super.updated(e);const t=this._streams(this._capabilities?.frontend_stream_types,this._hlsStreams,this._webRtcStreams).find((e=>e.visible))??null;if(t){const e=this._mediaLoadedInfoPerStream[t.type];e&&e!==this._mediaLoadedInfoDispatched&&(this._mediaLoadedInfoDispatched=e,y(this,e))}}static get styles(){return[super.styles,h(g),l` + :host { + width: 100%; + height: 100%; + } + img { + width: 100%; + height: 100%; + } + `]}};n([$(".player:not(.hidden)")],a.prototype,"_player",void 0),a=n([c("frigate-card-ha-camera-stream")],a)}));let I=class extends m{constructor(){super(...arguments),this.controls=!1,this._playerRef=_()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(this.hass)return s` + `}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};n([v({attribute:!1})],I.prototype,"hass",void 0),n([v({attribute:!1})],I.prototype,"cameraConfig",void 0),n([v({attribute:!0,type:Boolean})],I.prototype,"controls",void 0),I=n([c("frigate-card-live-ha")],I);export{I as FrigateCardLiveHA}; diff --git a/www/community/frigate-hass-card/ha-f54d281b.js.gz b/www/community/frigate-hass-card/ha-f54d281b.js.gz new file mode 100644 index 00000000..8d456cd0 Binary files /dev/null and b/www/community/frigate-hass-card/ha-f54d281b.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-1787796f.js b/www/community/frigate-hass-card/ha-hls-player-1787796f.js new file mode 100644 index 00000000..09309062 --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-1787796f.js @@ -0,0 +1,34 @@ +import{dh as t,cO as e,d6 as i,x as s,ds as a,dt as o,du as r,dr as d,r as n,eE as h,_ as l,t as u}from"./card-e5d55e5b.js";import{h as c,s as v,d as y,c as p}from"./media-921a03ae.js";import{m}from"./audio-cf3a75aa.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function f(t,e){return(i,s,a)=>{const o=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof s?i:a??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return _(i,s,{get(){let i=t.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&e.call(this,i)),i}})}return _(i,s,{get(){return o(this)}})}}var g="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let _=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(t){this._video&&(c(this._video),this._video.currentTime=t)}async setControls(t){this._video&&v(this._video,t??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?t(this._video):null}render(){if(this._error){if(this._errorIsFatal)return y(this),e({type:"error",message:this._error,context:{entity_id:this.entityid}});i(this._error,console.error)}return s` + + `}_loadedDataHandler(t){super._loadedData(),d(this,t,{player:this,capabilities:{supportsPause:!0,hasAudio:m(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(g),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([f("#video")],_.prototype,"_video",void 0),_=l([u("frigate-card-ha-hls-player")],_)}));export{g as c,f as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-1787796f.js.gz b/www/community/frigate-hass-card/ha-hls-player-1787796f.js.gz new file mode 100644 index 00000000..5febf6d5 Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-1787796f.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-19f4a97a.js b/www/community/frigate-hass-card/ha-hls-player-19f4a97a.js new file mode 100644 index 00000000..5fdcd480 --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-19f4a97a.js @@ -0,0 +1,34 @@ +import{di as t,cP as e,d7 as i,x as s,dt as a,du as o,dv as r,ds as d,r as n,eJ as h,_ as l,t as u}from"./card-19444f74.js";import{h as c,s as v,d as p,c as y}from"./dispatch-live-error-65d9f8de.js";import{m}from"./audio-cf3a75aa.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function f(t,e){return(i,s,a)=>{const o=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof s?i:a??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return _(i,s,{get(){let i=t.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&e.call(this,i)),i}})}return _(i,s,{get(){return o(this)}})}}var g="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let _=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(t){this._video&&(c(this._video),this._video.currentTime=t)}async setControls(t){this._video&&v(this._video,t??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?t(this._video):null}render(){if(this._error){if(this._errorIsFatal)return p(this),e({type:"error",message:this._error,context:{entity_id:this.entityid}});i(this._error,console.error)}return s` + + `}_loadedDataHandler(t){super._loadedData(),d(this,t,{player:this,capabilities:{supportsPause:!0,hasAudio:m(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(g),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([f("#video")],_.prototype,"_video",void 0),_=l([u("frigate-card-ha-hls-player")],_)}));export{g as c,f as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-19f4a97a.js.gz b/www/community/frigate-hass-card/ha-hls-player-19f4a97a.js.gz new file mode 100644 index 00000000..713e4d12 Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-19f4a97a.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js b/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js new file mode 100644 index 00000000..67838cba --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-7cd05290.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-67c578aa.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let m=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js.gz b/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js.gz new file mode 100644 index 00000000..6ba09337 Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-717bfdfd.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-7f5d4dfb.js b/www/community/frigate-hass-card/ha-hls-player-7f5d4dfb.js new file mode 100644 index 00000000..0b761a87 --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-7f5d4dfb.js @@ -0,0 +1,34 @@ +import{dn as e,cQ as t,dc as i,x as s,dy as a,dz as o,dA as r,dx as d,r as n,eN as h,_ as l,t as u}from"./card-4e88bdfb.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-2a3bfaef.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let m=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-7f5d4dfb.js.gz b/www/community/frigate-hass-card/ha-hls-player-7f5d4dfb.js.gz new file mode 100644 index 00000000..817ac949 Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-7f5d4dfb.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-7f91fd5d.js b/www/community/frigate-hass-card/ha-hls-player-7f91fd5d.js new file mode 100644 index 00000000..05d4f8e4 --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-7f91fd5d.js @@ -0,0 +1,34 @@ +import{di as t,cP as e,d7 as i,x as s,dt as a,du as o,dv as r,ds as d,r as n,eJ as h,_ as l,t as u}from"./card-0be2c6a9.js";import{h as c,s as v,d as p,c as y}from"./dispatch-live-error-bba465cd.js";import{m}from"./audio-cf3a75aa.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function f(t,e){return(i,s,a)=>{const o=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof s?i:a??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return _(i,s,{get(){let i=t.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&e.call(this,i)),i}})}return _(i,s,{get(){return o(this)}})}}var g="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let _=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(t){this._video&&(c(this._video),this._video.currentTime=t)}async setControls(t){this._video&&v(this._video,t??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?t(this._video):null}render(){if(this._error){if(this._errorIsFatal)return p(this),e({type:"error",message:this._error,context:{entity_id:this.entityid}});i(this._error,console.error)}return s` + + `}_loadedDataHandler(t){super._loadedData(),d(this,t,{player:this,capabilities:{supportsPause:!0,hasAudio:m(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(g),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([f("#video")],_.prototype,"_video",void 0),_=l([u("frigate-card-ha-hls-player")],_)}));export{g as c,f as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-7f91fd5d.js.gz b/www/community/frigate-hass-card/ha-hls-player-7f91fd5d.js.gz new file mode 100644 index 00000000..4ae6e907 Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-7f91fd5d.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-abb86874.js b/www/community/frigate-hass-card/ha-hls-player-abb86874.js new file mode 100644 index 00000000..e6a90422 --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-abb86874.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-c642ee74.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-6eadcd60.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let m=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-abb86874.js.gz b/www/community/frigate-hass-card/ha-hls-player-abb86874.js.gz new file mode 100644 index 00000000..d32a2466 Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-abb86874.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js b/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js new file mode 100644 index 00000000..00ea2c6b --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-45855f1f.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-1a34ac2c.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let m=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js.gz b/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js.gz new file mode 100644 index 00000000..388ff19a Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-ad38a2a0.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js b/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js new file mode 100644 index 00000000..9cc99dbd --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js @@ -0,0 +1,34 @@ +import{di as t,cP as e,d7 as i,x as s,dt as a,du as o,dv as r,ds as d,r as n,eJ as h,_ as l,t as u}from"./card-320adb66.js";import{h as c,s as v,d as p,c as y}from"./dispatch-live-error-c649b480.js";import{m}from"./audio-cf3a75aa.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const _=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function f(t,e){return(i,s,a)=>{const o=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof s?i:a??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return _(i,s,{get(){let i=t.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&e.call(this,i)),i}})}return _(i,s,{get(){return o(this)}})}}var g="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let _=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(t){this._video&&(c(this._video),this._video.currentTime=t)}async setControls(t){this._video&&v(this._video,t??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?t(this._video):null}render(){if(this._error){if(this._errorIsFatal)return p(this),e({type:"error",message:this._error,context:{entity_id:this.entityid}});i(this._error,console.error)}return s` + + `}_loadedDataHandler(t){super._loadedData(),d(this,t,{player:this,capabilities:{supportsPause:!0,hasAudio:m(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(g),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([f("#video")],_.prototype,"_video",void 0),_=l([u("frigate-card-ha-hls-player")],_)}));export{g as c,f as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js.gz b/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js.gz new file mode 100644 index 00000000..68621675 Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-b195eaa1.js.gz differ diff --git a/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js b/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js new file mode 100644 index 00000000..e82b5e7f --- /dev/null +++ b/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js @@ -0,0 +1,34 @@ +import{dm as e,cQ as t,db as i,x as s,dx as a,dy as o,dz as r,dw as d,r as n,eM as h,_ as l,t as u}from"./card-09c4bade.js";import{m as c}from"./audio-cf3a75aa.js";import{h as v,s as p,c as y}from"./media-aef44451.js"; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const m=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function _(e,t){return(i,s,a)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof s?i:a??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return m(i,s,{get(){let i=e.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return m(i,s,{get(){return o(this)}})}}var f="img,\nvideo {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}";customElements.whenDefined("ha-hls-player").then((()=>{let m=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(v(this._video),this._video.currentTime=e)}async setControls(e){this._video&&p(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);i(this._error,console.error)}return s` + + `}_loadedDataHandler(e){super._loadedData(),d(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:c(this._video)},technology:["hls"]})}static get styles(){return[super.styles,n(f),h` + :host { + width: 100%; + height: 100%; + } + video { + width: 100%; + height: 100%; + } + `]}};l([_("#video")],m.prototype,"_video",void 0),m=l([u("frigate-card-ha-hls-player")],m)}));export{f as c,_ as e}; diff --git a/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js.gz b/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js.gz new file mode 100644 index 00000000..6d65de44 Binary files /dev/null and b/www/community/frigate-hass-card/ha-hls-player-ba5834a9.js.gz differ diff --git a/www/community/frigate-hass-card/image-04d4df35.js b/www/community/frigate-hass-card/image-04d4df35.js new file mode 100644 index 00000000..2613a125 --- /dev/null +++ b/www/community/frigate-hass-card/image-04d4df35.js @@ -0,0 +1,13 @@ +import{dw as A,dx as e,eK as t,eL as i,dy as a,eH as r,eM as g,dz as s,_ as o,n as c,cQ as h,b as C,t as l,a as I,cL as n,eN as E,dt as u,du as m,cO as w,x as Q,cP as M,eI as B,i as d,cK as b,l as L,r as D}from"./card-e5d55e5b.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const p=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,s=A.name;if(A.type===t.PROPERTY){if(e===i[s])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(s))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(s)===e+"")return a;return g(A),e}});class k{constructor(A,e,t,i,a){this._timer=new s,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var U="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let y=class extends I{constructor(){super(...arguments),this._message=null,this._refImage=n(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(E(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new k(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>u(this)),(()=>m(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue(),["imageConfig","view"].some((e=>A.has(e)))&&(this._message=null)}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),this._message=null,document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):U}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:U)}render(){if(this._message)return w(this._message);const A=this._cachedValueController?.value;return A?Q` + {const e=B(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!d(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,b(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&(this._message={type:"error",message:L("error.image_load_error"),context:this.imageConfig})}} + /> + `:Q``}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};o([c({attribute:!1})],y.prototype,"hass",void 0),o([c({attribute:!1})],y.prototype,"view",void 0),o([c({attribute:!1})],y.prototype,"cameraConfig",void 0),o([c({attribute:!1})],y.prototype,"cameraManager",void 0),o([c({attribute:!1,hasChanged:h})],y.prototype,"imageConfig",void 0),o([C()],y.prototype,"_message",void 0),y=o([l("frigate-card-image")],y);export{y as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-04d4df35.js.gz b/www/community/frigate-hass-card/image-04d4df35.js.gz new file mode 100644 index 00000000..ca18b1cb Binary files /dev/null and b/www/community/frigate-hass-card/image-04d4df35.js.gz differ diff --git a/www/community/frigate-hass-card/image-1c1ebdfa.js b/www/community/frigate-hass-card/image-1c1ebdfa.js new file mode 100644 index 00000000..a9d7d40c --- /dev/null +++ b/www/community/frigate-hass-card/image-1c1ebdfa.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eR as t,eS as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eT as n,dy as E,dz as u,x as m,cV as w,eP as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-09c4bade.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-1c1ebdfa.js.gz b/www/community/frigate-hass-card/image-1c1ebdfa.js.gz new file mode 100644 index 00000000..080f8dda Binary files /dev/null and b/www/community/frigate-hass-card/image-1c1ebdfa.js.gz differ diff --git a/www/community/frigate-hass-card/image-1e2a0a79.js b/www/community/frigate-hass-card/image-1e2a0a79.js new file mode 100644 index 00000000..4923fbd0 --- /dev/null +++ b/www/community/frigate-hass-card/image-1e2a0a79.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eQ as t,eR as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eS as n,dy as E,dz as u,x as m,cV as w,eT as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-45855f1f.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-1e2a0a79.js.gz b/www/community/frigate-hass-card/image-1e2a0a79.js.gz new file mode 100644 index 00000000..143e096e Binary files /dev/null and b/www/community/frigate-hass-card/image-1e2a0a79.js.gz differ diff --git a/www/community/frigate-hass-card/image-26186c3a.js b/www/community/frigate-hass-card/image-26186c3a.js new file mode 100644 index 00000000..9d3b1988 --- /dev/null +++ b/www/community/frigate-hass-card/image-26186c3a.js @@ -0,0 +1,9 @@ +import{a as e,cM as a,x as t,cQ as s,r as i,c_ as r,_ as u,n as g,t as m}from"./card-0be2c6a9.js";import"./image-8d44d210.js";let n=class extends e{constructor(){super(...arguments),this._refImage=a()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(e){await(this._refImage.value?.seek(e))}async setControls(e){await(this._refImage.value?.setControls(e))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return t` + + + `}static get styles(){return i(r)}};u([g({attribute:!1})],n.prototype,"hass",void 0),u([g({attribute:!1})],n.prototype,"cameraConfig",void 0),n=u([m("frigate-card-live-image")],n);export{n as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-26186c3a.js.gz b/www/community/frigate-hass-card/image-26186c3a.js.gz new file mode 100644 index 00000000..61149ee7 Binary files /dev/null and b/www/community/frigate-hass-card/image-26186c3a.js.gz differ diff --git a/www/community/frigate-hass-card/image-4bbb911f.js b/www/community/frigate-hass-card/image-4bbb911f.js new file mode 100644 index 00000000..0f601f9e --- /dev/null +++ b/www/community/frigate-hass-card/image-4bbb911f.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d3 as r,_ as m,n as g,t as n}from"./card-4e88bdfb.js";import{g as u}from"./index-add135a5.js";import"./image-a9fe0a34.js";import"./media-2a3bfaef.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-4bbb911f.js.gz b/www/community/frigate-hass-card/image-4bbb911f.js.gz new file mode 100644 index 00000000..b2e5ea2e Binary files /dev/null and b/www/community/frigate-hass-card/image-4bbb911f.js.gz differ diff --git a/www/community/frigate-hass-card/image-5371a090.js b/www/community/frigate-hass-card/image-5371a090.js new file mode 100644 index 00000000..42ad70b0 --- /dev/null +++ b/www/community/frigate-hass-card/image-5371a090.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eQ as t,eR as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eS as n,dy as E,dz as u,x as m,cV as w,eT as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-7cd05290.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-5371a090.js.gz b/www/community/frigate-hass-card/image-5371a090.js.gz new file mode 100644 index 00000000..cca8c516 Binary files /dev/null and b/www/community/frigate-hass-card/image-5371a090.js.gz differ diff --git a/www/community/frigate-hass-card/image-5c577dc4.js b/www/community/frigate-hass-card/image-5c577dc4.js new file mode 100644 index 00000000..fadb0291 --- /dev/null +++ b/www/community/frigate-hass-card/image-5c577dc4.js @@ -0,0 +1,9 @@ +import{a as e,cM as a,x as t,cQ as s,r as i,c_ as r,_ as u,n as g,t as m}from"./card-19444f74.js";import"./image-a1f2dfcd.js";let n=class extends e{constructor(){super(...arguments),this._refImage=a()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(e){await(this._refImage.value?.seek(e))}async setControls(e){await(this._refImage.value?.setControls(e))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return t` + + + `}static get styles(){return i(r)}};u([g({attribute:!1})],n.prototype,"hass",void 0),u([g({attribute:!1})],n.prototype,"cameraConfig",void 0),n=u([m("frigate-card-live-image")],n);export{n as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-5c577dc4.js.gz b/www/community/frigate-hass-card/image-5c577dc4.js.gz new file mode 100644 index 00000000..c1158257 Binary files /dev/null and b/www/community/frigate-hass-card/image-5c577dc4.js.gz differ diff --git a/www/community/frigate-hass-card/image-678a8283.js b/www/community/frigate-hass-card/image-678a8283.js new file mode 100644 index 00000000..41bb54a7 --- /dev/null +++ b/www/community/frigate-hass-card/image-678a8283.js @@ -0,0 +1,9 @@ +import{a as e,cM as a,x as t,cQ as s,r as i,c_ as r,_ as u,n as g,t as m}from"./card-320adb66.js";import"./image-88fcb8ac.js";let n=class extends e{constructor(){super(...arguments),this._refImage=a()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(e){await(this._refImage.value?.seek(e))}async setControls(e){await(this._refImage.value?.setControls(e))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return t` + + + `}static get styles(){return i(r)}};u([g({attribute:!1})],n.prototype,"hass",void 0),u([g({attribute:!1})],n.prototype,"cameraConfig",void 0),n=u([m("frigate-card-live-image")],n);export{n as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-678a8283.js.gz b/www/community/frigate-hass-card/image-678a8283.js.gz new file mode 100644 index 00000000..87ffed31 Binary files /dev/null and b/www/community/frigate-hass-card/image-678a8283.js.gz differ diff --git a/www/community/frigate-hass-card/image-88fcb8ac.js b/www/community/frigate-hass-card/image-88fcb8ac.js new file mode 100644 index 00000000..c334a730 --- /dev/null +++ b/www/community/frigate-hass-card/image-88fcb8ac.js @@ -0,0 +1,13 @@ +import{dx as A,dy as e,eP as t,eQ as i,dz as a,eM as r,eR as g,dA as s,_ as o,n as c,cR as h,b as C,t as l,a as n,cM as I,eS as E,du as u,dv as m,cP as w,x as Q,cQ as M,eN as B,i as d,cL as b,l as L,r as D}from"./card-320adb66.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const p=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,s=A.name;if(A.type===t.PROPERTY){if(e===i[s])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(s))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(s)===e+"")return a;return g(A),e}});class k{constructor(A,e,t,i,a){this._timer=new s,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var U="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let y=class extends n{constructor(){super(...arguments),this._message=null,this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(E(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new k(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>u(this)),(()=>m(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue(),["imageConfig","view"].some((e=>A.has(e)))&&(this._message=null)}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),this._message=null,document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):U}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:U)}render(){if(this._message)return w(this._message);const A=this._cachedValueController?.value;return A?Q` + {const e=B(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!d(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,b(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&(this._message={type:"error",message:L("error.image_load_error"),context:this.imageConfig})}} + /> + `:Q``}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};o([c({attribute:!1})],y.prototype,"hass",void 0),o([c({attribute:!1})],y.prototype,"view",void 0),o([c({attribute:!1})],y.prototype,"cameraConfig",void 0),o([c({attribute:!1})],y.prototype,"cameraManager",void 0),o([c({attribute:!1,hasChanged:h})],y.prototype,"imageConfig",void 0),o([C()],y.prototype,"_message",void 0),y=o([l("frigate-card-image")],y);export{y as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-88fcb8ac.js.gz b/www/community/frigate-hass-card/image-88fcb8ac.js.gz new file mode 100644 index 00000000..b7044b9b Binary files /dev/null and b/www/community/frigate-hass-card/image-88fcb8ac.js.gz differ diff --git a/www/community/frigate-hass-card/image-8d44d210.js b/www/community/frigate-hass-card/image-8d44d210.js new file mode 100644 index 00000000..5e7e68f8 --- /dev/null +++ b/www/community/frigate-hass-card/image-8d44d210.js @@ -0,0 +1,13 @@ +import{dx as A,dy as e,eP as t,eQ as i,dz as a,eM as r,eR as g,dA as s,_ as o,n as c,cR as h,b as C,t as l,a as n,cM as I,eS as E,du as u,dv as m,cP as w,x as Q,cQ as M,eN as B,i as d,cL as b,l as L,r as D}from"./card-0be2c6a9.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const p=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,s=A.name;if(A.type===t.PROPERTY){if(e===i[s])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(s))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(s)===e+"")return a;return g(A),e}});class k{constructor(A,e,t,i,a){this._timer=new s,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var U="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let y=class extends n{constructor(){super(...arguments),this._message=null,this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(E(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new k(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>u(this)),(()=>m(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue(),["imageConfig","view"].some((e=>A.has(e)))&&(this._message=null)}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),this._message=null,document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):U}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:U)}render(){if(this._message)return w(this._message);const A=this._cachedValueController?.value;return A?Q` + {const e=B(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!d(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,b(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&(this._message={type:"error",message:L("error.image_load_error"),context:this.imageConfig})}} + /> + `:Q``}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};o([c({attribute:!1})],y.prototype,"hass",void 0),o([c({attribute:!1})],y.prototype,"view",void 0),o([c({attribute:!1})],y.prototype,"cameraConfig",void 0),o([c({attribute:!1})],y.prototype,"cameraManager",void 0),o([c({attribute:!1,hasChanged:h})],y.prototype,"imageConfig",void 0),o([C()],y.prototype,"_message",void 0),y=o([l("frigate-card-image")],y);export{y as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-8d44d210.js.gz b/www/community/frigate-hass-card/image-8d44d210.js.gz new file mode 100644 index 00000000..566039e4 Binary files /dev/null and b/www/community/frigate-hass-card/image-8d44d210.js.gz differ diff --git a/www/community/frigate-hass-card/image-a1f2dfcd.js b/www/community/frigate-hass-card/image-a1f2dfcd.js new file mode 100644 index 00000000..bcd168a5 --- /dev/null +++ b/www/community/frigate-hass-card/image-a1f2dfcd.js @@ -0,0 +1,13 @@ +import{dx as A,dy as e,eP as t,eQ as i,dz as a,eM as r,eR as g,dA as s,_ as o,n as c,cR as h,b as C,t as l,a as n,cM as I,eS as E,du as u,dv as m,cP as w,x as Q,cQ as M,eN as B,i as d,cL as b,l as L,r as D}from"./card-19444f74.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const p=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,s=A.name;if(A.type===t.PROPERTY){if(e===i[s])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(s))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(s)===e+"")return a;return g(A),e}});class k{constructor(A,e,t,i,a){this._timer=new s,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var U="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let y=class extends n{constructor(){super(...arguments),this._message=null,this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(E(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new k(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>u(this)),(()=>m(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue(),["imageConfig","view"].some((e=>A.has(e)))&&(this._message=null)}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),this._message=null,document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):U}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:U)}render(){if(this._message)return w(this._message);const A=this._cachedValueController?.value;return A?Q` + {const e=B(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!d(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,b(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&(this._message={type:"error",message:L("error.image_load_error"),context:this.imageConfig})}} + /> + `:Q``}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};o([c({attribute:!1})],y.prototype,"hass",void 0),o([c({attribute:!1})],y.prototype,"view",void 0),o([c({attribute:!1})],y.prototype,"cameraConfig",void 0),o([c({attribute:!1})],y.prototype,"cameraManager",void 0),o([c({attribute:!1,hasChanged:h})],y.prototype,"imageConfig",void 0),o([C()],y.prototype,"_message",void 0),y=o([l("frigate-card-image")],y);export{y as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-a1f2dfcd.js.gz b/www/community/frigate-hass-card/image-a1f2dfcd.js.gz new file mode 100644 index 00000000..d1b34aae Binary files /dev/null and b/www/community/frigate-hass-card/image-a1f2dfcd.js.gz differ diff --git a/www/community/frigate-hass-card/image-a9fe0a34.js b/www/community/frigate-hass-card/image-a9fe0a34.js new file mode 100644 index 00000000..fda844c1 --- /dev/null +++ b/www/community/frigate-hass-card/image-a9fe0a34.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eS as t,eT as i,dD as a,cN as r,cO as g,dE as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eU as n,dz as E,dA as u,x as m,cV as w,eQ as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-4e88bdfb.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-a9fe0a34.js.gz b/www/community/frigate-hass-card/image-a9fe0a34.js.gz new file mode 100644 index 00000000..573b0526 Binary files /dev/null and b/www/community/frigate-hass-card/image-a9fe0a34.js.gz differ diff --git a/www/community/frigate-hass-card/image-b5d57727.js b/www/community/frigate-hass-card/image-b5d57727.js new file mode 100644 index 00000000..97c60e50 --- /dev/null +++ b/www/community/frigate-hass-card/image-b5d57727.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-7cd05290.js";import{g as u}from"./index-3c9b9749.js";import"./image-5371a090.js";import"./media-67c578aa.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-b5d57727.js.gz b/www/community/frigate-hass-card/image-b5d57727.js.gz new file mode 100644 index 00000000..19f85b11 Binary files /dev/null and b/www/community/frigate-hass-card/image-b5d57727.js.gz differ diff --git a/www/community/frigate-hass-card/image-c0a8dc12.js b/www/community/frigate-hass-card/image-c0a8dc12.js new file mode 100644 index 00000000..ba4755f7 --- /dev/null +++ b/www/community/frigate-hass-card/image-c0a8dc12.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-45855f1f.js";import{g as u}from"./index-9bf80040.js";import"./image-1e2a0a79.js";import"./media-1a34ac2c.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-c0a8dc12.js.gz b/www/community/frigate-hass-card/image-c0a8dc12.js.gz new file mode 100644 index 00000000..46ae0889 Binary files /dev/null and b/www/community/frigate-hass-card/image-c0a8dc12.js.gz differ diff --git a/www/community/frigate-hass-card/image-c4c28ccb.js b/www/community/frigate-hass-card/image-c4c28ccb.js new file mode 100644 index 00000000..7f878690 --- /dev/null +++ b/www/community/frigate-hass-card/image-c4c28ccb.js @@ -0,0 +1,9 @@ +import{a as e,cL as a,x as t,cP as s,r as i,cZ as r,_ as u,n as g,t as m}from"./card-e5d55e5b.js";import"./image-04d4df35.js";let n=class extends e{constructor(){super(...arguments),this._refImage=a()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(e){await(this._refImage.value?.seek(e))}async setControls(e){await(this._refImage.value?.setControls(e))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return t` + + + `}static get styles(){return i(r)}};u([g({attribute:!1})],n.prototype,"hass",void 0),u([g({attribute:!1})],n.prototype,"cameraConfig",void 0),n=u([m("frigate-card-live-image")],n);export{n as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-c4c28ccb.js.gz b/www/community/frigate-hass-card/image-c4c28ccb.js.gz new file mode 100644 index 00000000..3edff13c Binary files /dev/null and b/www/community/frigate-hass-card/image-c4c28ccb.js.gz differ diff --git a/www/community/frigate-hass-card/image-c6a10ba0.js b/www/community/frigate-hass-card/image-c6a10ba0.js new file mode 100644 index 00000000..88e6ca9e --- /dev/null +++ b/www/community/frigate-hass-card/image-c6a10ba0.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-c642ee74.js";import{g as u}from"./index-0a012f43.js";import"./image-cbfd7ccb.js";import"./media-6eadcd60.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-c6a10ba0.js.gz b/www/community/frigate-hass-card/image-c6a10ba0.js.gz new file mode 100644 index 00000000..187efcbc Binary files /dev/null and b/www/community/frigate-hass-card/image-c6a10ba0.js.gz differ diff --git a/www/community/frigate-hass-card/image-cbfd7ccb.js b/www/community/frigate-hass-card/image-cbfd7ccb.js new file mode 100644 index 00000000..e0833450 --- /dev/null +++ b/www/community/frigate-hass-card/image-cbfd7ccb.js @@ -0,0 +1,13 @@ +import{cL as A,cM as e,eR as t,eS as i,dC as a,cN as r,cO as g,dD as o,_ as c,n as s,cW as h,t as C,a as l,cR as I,eT as n,dy as E,dz as u,x as m,cV as w,eP as Q,i as M,cP as B,cQ as d,l as b,r as L}from"./card-c642ee74.js"; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const D=A(class extends e{constructor(A){if(super(A),A.type!==t.PROPERTY&&A.type!==t.ATTRIBUTE&&A.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!i(A))throw Error("`live` bindings can only contain a single expression")}render(A){return A}update(A,[e]){if(e===a||e===r)return e;const i=A.element,o=A.name;if(A.type===t.PROPERTY){if(e===i[o])return a}else if(A.type===t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return a}else if(A.type===t.ATTRIBUTE&&i.getAttribute(o)===e+"")return a;return g(A),e}});class p{constructor(A,e,t,i,a){this._timer=new o,this._timerSeconds=e,this._callback=t,this._timerStartCallback=i,this._timerStopCallback=a,(this._host=A).addController(this)}removeController(){this.stopTimer(),this._host.removeController(this)}get value(){return this._value}updateValue(){this._value=this._callback()}clearValue(){this._value=void 0}stopTimer(){this._timer.isRunning()&&(this._timer.stop(),this._timerStopCallback?.())}startTimer(){this.stopTimer(),this._timerStartCallback?.(),this._timer.startRepeated(this._timerSeconds,(()=>{this.updateValue(),this._host.requestUpdate()}))}hasTimer(){return this._timer.isRunning()}hostConnected(){this.updateValue(),this.startTimer(),this._host.requestUpdate()}hostDisconnected(){this.clearValue(),this.stopTimer()}}var k="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wgARCAEVAewDAREAAhEBAxEB/8QAGwAAAwEAAwEAAAAAAAAAAAAAAAECAwQFBgf/xAAaAQEBAQEBAQEAAAAAAAAAAAAAAQIDBAUG/9oADAMBAAIQAxAAAAHu/wBF+fKuKWoua2zblcOpTDeJqLJsVgAACCiNQEKJRCmEoMAhy1FzThq4VrCHDWbHCoilBWQKqzaa2xeTz3Uumd+Z+h4Sxy0VGmdbzV5AybMdZjUz1kEFA4AAEAAdEFAAEVKBDVxc1UtSgiaY1cSI4nPfl/N6eZrHp/Rw11mLJq83XO9c2ovO+Ry6ea+j4FY1uKl1zrSAAIucd5mlYUoBggA1ACiRiVgiCiW81w6JQqWpazQVTQCo6fz9vH+L2ec83o937PJ7P6HgsBAaZ1vjemdJNcb5HLr536PgACrioqFU2RZFkWLcAgAAokdoEhRKwgoHCCgrKpWrlQ1ctQpVU0jovN38P4fZ1HDta+y9HD3f1Pm2jEBrm78+muNXNVnW2N6Z15z6fz7zWSlDEkVnrMWKyaVgOCkA6AkBipwKBDhgIa1AC3KoaiuJtmPP+b0eM8Ps6Pl01lprsenL6V9T5vadMUJEa41y+XXXGqmrzrTOrzamvNfU+brnThgRrOdk2Z6yqSKxBTAQAgojBBRQAHDhhDViRLc1cpKhV5rzd/nnz/dw+PbkIqheXrH036nz+578LipVY42xvl8u14uk1pjeuNXNB5f6vzNc6uERc56znokjUEBBYAFACGAIAAAAKDyoqaEJRWVNOOn5dfnXz/b5rz9he1zutRGtfSvo/O731+aoYwjTOuRz6b893nW2N6Z3ebpnTXyf1/laZ0xM5azGpFioQAVgCiAAKmgAAoCAhgpDHLctZoNUvh/H6vnfzvfjHJl56taNNT6L9L5voPT59s1UAVLti8nl2rN1zrbn00zq860zoPJ/Y+SDM7nPUmxWIBiQoAKABAAAAAFEQ1BIBFTV5uktTXnOXX4/8n6euNbnYzWVjXkdMfR/qfL7X0cNM63xqpagKl5PLrrjdy643rjeuN641cpL4n73xUFmdzNCAACFAAFAAgAAogACCiQCiUlqWoqa0zfkXzvo+Z8fq7XnvmVx9Zmu27cvon1Pmcrvwcu+N6S689a51pnWmdb8+m/PppjeuNbZ3ea5QZ4H9D8JWISKhAKIApgAAgAK0SCiiACCwCEooOWocvTcuvx74v1+RjfZmk1jrPp/Z4/cfU+a9QHHIxupeRz3tjXJ5dXLvz6crl11570zqpXRDVnz39F8BwqlDUSCgwABgMIVORqkLEoAAJAFQAqsakOX5T8j6nQ+P19xNTc8nHXk9uP1L7fxI3hUK5d8a2xrk8+muNcnj25HPptjfI59NM6AHDVqHz79D+fCbFokAoHAAwAcEFEMWghKgALEgoAhaCiPLznm9Py3431+djXay8TU7vty919L5/YejzTYhDl3xrl8+nJ5dd+XTkc+nJ5ddcavOnKqCotoA+efovz9RGorEFMIYQUDQlYBAAtQAIKIVgoqRiqbAcuWNfH/AIv2ev4du3zrSqj6R9L5/fezxRYqRUC65vL5dOTx7crl15PLrtjd5tTRBTilagHzr9H+eZNgAwpwAADgGAQUAKwUQAQArjLG+s83p7P3+BhnXy/5H1vN+T1b5vPa1s9r34+++h87PWc9RwE2TV5cjn05vDvz/P6N+e9MbuWlBqAAQHzn9N+ecKwgGFjlBhBRDAIACkMSClEi0UOXTNpfN+L3ec+D+k7z6Xx+r8/o8FvlWddkbHP6Y+vfT+VyZqUmzTOtcbZnrNTXK49eVy67c9643rnVNAAAAAR84/TfnmgADgGADgAKcFEIBolKAEiRWhWbyMbivi3wf0EcuvKmuH38mWNdrbon036fy+768dsbcumd6Y1rjfL5dalBy0ry1zvXG6UAAAAA+cfpPzrAdAAMIcEFAACFoAISlCJSxQrUjl1zry3l9Pyz5P1MY1O72wxruK9F6vL7j6PzNc6359N8dORy6a43rje+NuAnRDjTGts7uaAAAAAPnH6T886IaFAQwGOEAAFAgAAAAAQ5Vm+D8Pt8J873xLKJeyrntdpL9I+n8vse/m1zvTOtM65vn9G/PpvjdQE1lrKRrUuuNbY3pNgAAAB85/S/niAdhBRDGAQUIKIgBSkEACpwEYvmPH7fCeH2dVx2mmVLFNnvLruq+o/R+ZyOvCprTO2c3z+jmce2uNMipsz1nPeHNa41rne3PWudtQAAAPnH6T86DAB0Q6IcFFJCBSwhKCBBQ43PfQ+fv5zyerzfl9XGzYRy6LCCiKucdxqfZPs/Fcu+OnJ5dUmmd87z+jkc9hOk2QznuXm6Z1pnWuN6501AEJGofOf0v51wAADGAQWCiClAgEEB13Lr82+T9TpOHaEUOXlzVmlaDlzlmzg3N12J9p+x8blaztjfJ5dtcbqORz68nl1cKgmxI2rmqy1xrSbYEiZais+c/pfzzQgAdOAAAAAKQQgpRwuXX5N8X6/X8+hHLObNaLnZRUFVL3HLp6P0eXzPSddJ0fPp9G4693+g+Lvm8nl15fHtU1rjV5rWpqoBDVxebpndytUJEjVqz5x+k/PMEFKcjAIKEFAAQhBWeNfJ/ifY6Xh25kvPWrMiluXVexzPQ/Q8HoPf4OT24llZvH8vp+X/ABPt9fqfSvT5fX/R8PL49eXx7OUVoS1LUuudENai860ztqwAEFAPnf6P88QtFRIU4YQUAOFaCRUiZfmHxvreb8vp5Evay1YWcatJe+9Pn9f7/ndp6fPGiSpRKl359PM/N9/kvN6uQfSvX5O81ORy63mxqTrNZ1rnTl0zqoqW86qaqVq4KAAAPnX6P8+IrFTHKIwhUwHCpWkIVnhPmfQ8N876HNl3rQYrnkdM/QfpfM7f1+VWCkXLedXCNcbvN+a/K+p6j0+fpPL6vqnq82+NXnUazNjNcbvOrlcC1LedXm0rUCAAoPm/6X88SA6ZWaBQhDBUipFZpb53y+r538f6txnWpVmusfTfqfL7D0cTWVQhDmtZrTN0zrTLfn00zrjY38u8fs+gduPF59PadMXmgE2VLctTSRq5by1zu86pQMgKAPm36b86wh2seQjUokqUEToi83qePb5b8b6153QrGdv25fRvq/K5PTDSLA0zqpXDW5dcXk8+nI5ddM6cvTZ347n07BPb9McrNqVjlcquW05QqXXFvOtJpqBAEAHzf9P+dACCql0zXEWMagkjSs3jc+nyf4/1sOfTSWyLO87+f6N9X5fJ1EBNjipdJalqWjbnvlce2/PprndZoeXzvgmlnsrnTN0zsVWRc3NXmuXTOtM6pQAAAAI+bfpfzgNUMoZWarCWgWbIoxr5b8f6/V8O2hcvYaz636Hz/Sezyck0zpWJLlZFgJbl0zeTy6czj25HLrU040zpnQY6d9rFDilCUVaY1rnVzTUAAAAAAPmv6T86wBGrCiAocriNJTwHyfq+U8Xr2NK9j6fN7j6Pz63ijk8+jgBBdsaqWUw6Yqa2xrXG+Xx7b8+ly1nVy6Z1WaCqNZVjzWVLpndKAAAAAAAB81/SfnC1hIDtBhDHKQjy/k9fgPk/V7beO69HD1Hp8/e+jz6ZrSbNM60zdM6i5z3nbn05fHtpnXH6c1W2N6Y1tjemdXnWmbedaZ2xIiNZjWQrOtc6poAAAAAAAAPmf6X845XRIwV2uAqLzoTi8uvnvH7O16c+768uRrNDluHGeo0vOtsbjWYueRz68nl10zus1rebct51UrlqNM7uVqIEmW+cay5rTGrmqUAAAAAAAD5l+l/OMYQwKtcripdc6uJ8nr7a5DXG9M6x3zy3loLFyJlvJLUa53yeXXbHTfnu86ZedVm6TQCOW5qpWoAJnc5ayy5qs22gAAAAAAAPmX6b825QcOiKtakmmdVLpm9t5PTyOfSprfnu86z1ni9uMazGs5bzFzjvIuubyuPXkcuu+OmmNXLeNbY1U01STqVLebTQAAJJQGtAoEFAAAAAAf/EACkQAAEEAgIBBAIDAQEBAAAAAAEAAgMEBREQIBITIUBQFCIGMDFBFSP/2gAIAQEAAQUC6hDofrwE1D+gIdDwfpNqxZggbNnAXQQ5Kwom+DOQgEBwEFrjXGkOpKJ+kuZKrWVvMWJUXeTsDVsMQ6gIDjSa1ALS8VpaWlrqfo7uUrVlcytqwhG8rwaFim0GzjqAgFpaQCA50tLS19Pcy9SBXMpYsrW0PZHax1J1ySjViqxjo0JoQHAC0tcBD6MdcjloKqu5GzaMMZI1pa4q1ZrMmMpMpxBDoxDkIchDk/R38hXptv5izYTimAl2zx4uKirSyyYim6pBpa6BNHAQCCHIQ5P0GuM1mPTT3lxUUJcgGtQCLXKNs7zhq81eu3s0IcBDgdifov5Db/GpOO1FE6VRQ/s4+y0CoK80rsZXdWqhBDjS0g1NatIBBqAQCAWlrja388chfyC3+TeVD/5Sy68/bijSltGnB+NXQQ4bwAgE0IBBqAQC19PtZu3+LRJ2q0fm4f7M0sQCxWMc6VrWsbwE3hqCAWkwIBAIfVZy3+TbYNuDWta9VnhyoVX2LX/OjUE1BNQag1AfV565+PVcdqkP3sBoR9xg6vqZCrTirSdAmhAJoTQmhBD6ueVkMN+y6zZHuWjxa8pgWDpehWIWuNLS0moJqaEAh119FJ5+Fa4JJOJHMijy+RdbkKrj9h/p91hcc90WkQtLS8V48NCaFGE0ID6cLSzNYPhNyz6dHMQyr+T+qXJo2QxrQG6VCo+1aiaGMCKAQCDV6a9JNjTWINQQ+nBQKc0OEkz6tya5t8V10jJmaMTSSxvtolYmr+LWCHDWrxTAgF4rxWuQh9O1ZvKNga874YdKPUsNc6k0Y34Wn52EE1BNCAQCHYIfTPLWMymb2nHyK1xVk0+WLb2bLMZCIqAagEE1NTUOu1tAoFD6OSRkTbmcgjV29YtO6FN9jE/yZjx52arDFXQWk1MTUOh5CCCHz5bEESsZupGrGctPUs75XE8BBjii0hNBJWlDoNx0xFkoIJqITE0odCtIBBBBD5t+3FUiu5OxYJcSt8AEoV3kCshGGoex9t+jomPyJBaWHRpvNexDI2aJqCaeAE1DrrkIfNu2Y6sF61Jan4ZXcQxjGD9db415BjduLC12Mr2JF/48L68uJsvnyGKsVZfJYa/tjSgmhNHA433CHzJZGRR5O263YUcBeoowxErSA9gAS6N8clenudmHb6sUEER2toFWofWiyNdvlVc6E4e2HhqYh12h1HzCQ1uYyBtSbUTNljkTobBBPu1U8XPMq9CrAieoQWaq+TcYIzas1pcbYxdgWa7Qh0HA/v38L+Q3/f3Ka1qPuWeyemD9Y60srocZTiPTSAXivFNavFZqia0uMljymOpSSYvJNIIHQcDqPl5e+K0etqb3LRzHDPIG1YparWhjOw4DUGoNVqsyxAPWxOTuwR36n8es7a3+sIIfIyVxlOB73zSjpjqL7hqwsrwddLS0gEAmBAIBaWVoMu18FZfTtZmF9O1XlbNDzrkchDgf3BHuFbnjrQXLEluf/gQTP2diKTprUUbI2865HRqaEBzpZrGC2zFWhbhwfq1rKCA6BaWkAtfB33c5rGZW665OOB/lWnNPHg6H47WMa0NatLS0vFeK1yEE1NQ5AWlexcdicMG9LXTSAWlr5Wcv+q5vuf8AuiXQYSQsjYGN0mhALS0tcNC8EYkWJrUGprUwIcaQWlpa7AIfLzdwwsmjeySWg+vRw2JLlSxsFZ4WlrgIcHhiHDmoNQagEAgEOB1PIQ+XcmbWrYyjM5UMXHA51dj3+C8V4rXGuBweGBDjS8UAtIDkIdSjyEPjjhn+zUhYm9NeCaxemnM77W0AmoIdNf1noPjjiP8A2M+yCHDgiODw7lqagghwAgOw+R//xAAsEQABBAEEAQQCAQQDAAAAAAABAAIDERAEEiAhMRMwQFAiQQUUQlFhIzIz/9oACAEDAQE/AfaPwB7Y+KPZHC0flj3GsLvCbpT/AHFF8bP+oRO43yGBms19WyB7kzSsHlCgtTM0jbypDLQgMUq+rZp3O89JkLWeFRVKXdR7rkEFSpUgM19VHpnO89JkLWeM0VI8Mbaklc/zxAQCrACr3L+gjgc/tRxtZ4QGaT3BnZU05k6/XIIZCH0tYGWROf4UcLWYGaTjtFlaicSdDm0YCpDA+mrEEO7s5rAVFF+3yVqJmyHpDgMAIYCGAPqImb3VgC0ETik+RrPJWolEh6QwOACa1UgEAgEAqVKs39EFpWU2/wDOGdFHMkzY/Kmm9U3zAQCAVIBAKlXC/pImb3bUEO1aIpV/lTztaKae0ST55BAIBUmhAIBV9VpY9rbP7yVGQfxKmf6Te047jfMBAJqpBqA+r00W92Go4lJjbam1DpBR5BAIBAIBDA+qaCTQUUQjbWbVLUybvx5hBNTQgPqGP2m1JpdzfUi7GAgLWn0+zs+cDMuo2t2DzwpUqxSATQgEFX09L+P1f9PJ+XgrV6COvUYEP42GZ/4Gv9KT+Pbpm7m8XvDBaJs2UEcAINXpr00I01iDcD6cZ0WtliYKUkrd++Ppf1Bcwschwnl3u4Bq2poQC2raqyEPpwoIPU7Pji3Gpk2NrAQQQCAQHMIfTBqi0v7egONILU9yFUqQQQQ52rVoH6NoLugo9I7+5MibH45hF+3tTyB77GaQTUPaH0DY3u8BN0bz56TNHGPPaaA3ocKVcSL6wEEFSaU08qwMD50URkNBRQNj8cdq2qs0qzSlidG6iggmnACbxpVwHzYozIaCYwMFDO3F8aUUrIzUnhanWxRvqMWjqYnC7UUgkvb+sSxCdlftVRo4AQCpDF+wPmMaXGgoYhGKxWL4EV5RLWi7Tte2ugn6iR/kqycBQSmJ+4I04bgmmlrIb/5AgE1DN5HEfMAtaeD0x/vgeEuqYwf5T9XI798KVYC0k1fgVKCOx5UMweFLF6bqQCHAfR6WGvyPEoJzwAn6p540qVKkAgoJN4o+VKwxutq/9WIIYpUhgcLQPy9LBvNnwq4lwCM7g40UST2eIQzSDVtTbabCNSNUTzE5TMo7ghwrA4hBD5EMRkKaABQ4yTNj8qSQvNn2qTRgBUmHaVIyxuCjdY2leOFKsDgAq+OExheaCYwMFDjPN6YTnuebPCuYQQGaTHbU9ldhOF94CrgMUgFXwb5tF9BQxemOBeB0VqZ+6aiS42UAqzSrgFSamhAZAVJppUq5AKlXytLBtG48HaloBTnF3lUqzWQFsXpotQC2oNQGKzSpVypAfL0sO47iimyBxoKXUbemqXUl/XIYOGoYIQag1AKlWQhwrgPlxx7zSfIB+A8KScu6b4Qc4CgqVKlXAK8tCGKVKlSriOJ+WMBR/iOltW1Bi2Itr2QE3AwM17RVKvkjDUzAQwQqwcHg1BDgAq9yvg//xAAsEQABBAEDBAICAgEFAAAAAAABAAIDERAEEiATITFQMEAiQTJhIxQVM0JR/9oACAECAQE/Afmr1h9q6RrPKdq/00JrJH/yKa0NFDiVeDwv4q9G/UMYn6qR3hdytLp3A7ieRKOS5Xi1fq5NSxvhSTverxCRY7WeRKJV4tHjfEZH3z2Umqa3wpJ3yec2omdR21RxNjHbiSiVeCVav1cuoaxSTOf5V8GMc801QacR9/3yKPrpJms8qTUOfxtNaXGgtNp+l+R88iUTgq/hHotRPt/EInjaazd4C00Do7JR5HJRzav00r9jC5WiawMWmRuf4WnhMY78bVolFytErcrVq1avNeiK1Ulu2/8AmHiwhmKB0nhQQiIVxOLVolWiVav4qVfelk6bd2CqQN40+nc424dkAB45FFEq04olWr9Vq5N7qH6yE8V+QUTOqaCY3aK5FFEpy3IuRPq9TL02/wB4Kbf7xC0SOpRQNjNjkUSiUSiUfkHoHODRZU0vUdeAqxpo9o3IHkUU5Eon46+5akZvb2UWrp3Tl7HJdS1M/U7Dxxi0+5284BVq1avBKJTiiUT6i1rtJ12WPIUGrk/gSv8AcJYmfl3TNc7UdjxYwyGggK7YCtWi5b11EZEXon1NZ1WnYZCms/Ha/uhEA4EJ2AqUMWxvAuVpxVrcr4H1BU8/T8eUTwKC08e43koolEon1xKm1f6Yib4DOmoMV5KKPCsUqVIhH6dfQc4N8qTWNH8VJM5/lXzDd3ZQsLGUVWSnchwKPoHSsb5KdrWDwn6158IuLvPxAoDBRQKciOVq8n70szYhZUuofJxtXmlavIKhlbK2wjgjFoo+mlkEbbKkkMhs5vFcbUkTpB+HlaXSyyMuTsv9PI00pWdKt37xDIdLLf8A1KsEWMOKJ+M/dc4NFlTSmR14vkDY7IbnnaGlN0Dv2UzTMZ4C2qlS1MDZmFpTCR+LvITm7gtDMW/4nIpyOaxXoiaWon6h/rgAqzFpXv8A6TNJG39IDhaONZp7/wAjfIUTgVNCWd1DN1GIlHgVfotZPf4DiMNYXJmkYONq1atEolTRdN1jwo3CRu0r/hfg4CtHnX2gtVqNg2jzya0lDTtLRaDQOwzfA4tbluTqcKKFxuUrBKxQusbSj6WaURNRcXGzxiidL4UcYY2hzvJKcVatWnjcFG7aaKe2nbgvPC/QPeGCypJDI6zx08XUd3TWBgocL5lEonNp4tMffYpprt8Fq1f0aVc3Gu5U8vUPANJFhaaDtbk1oaKCvF4tblfAopyvNq0RatWrzatEq/sjGr1G47RwZpX2E1oaKCtE4tWrwSt6EiDkXLci5OObVq1avA4X9zVT7BtHnDoy0WVDpy/u5Q6YR9z3Ob4jDkcAouRcrV/CD9+SQMbaZETbz5UUAb3d3KLWk2VuW5WrxfAYccWrW5WrV/EPulSfke63rei9b0Hc6wSjg5tX8YVq/tuT8FHDSgcDAyUUUckq8j7f/8QANxAAAQMBBQYEAwcFAQAAAAAAAQACAxEQEiExUQQTIjJBUCAjUmFxgaEwM0JikcHRBRRAYOFy/9oACAEBAAY/Av8Ab6zSNZ8Vc2SF0rtSr207RuG+iPNBoJNNTXvNHPvO9LVSOkDfqqm9I7Ulb2QNjachdxPeaV3j9Gq7euM0asli5MZGH7RL6rtGt7xRrt6/Rqu1uM0bZgsUQ0igzJVyMfE692LG+bJoMgvMfw+kZIuPguxtJVBi88x7rxuq/wBAzRAO7Z6W2YW4BXGNLj7Ihxq52Y07qdn2V3F+J6JJqbKnAKjRZkrsd4nQIia7U9Kd1ow0fJgLKMxOiN/CnS3NUiaXfBXH3b1endnXTwM4W2NkcMETbWMcIzJQiDr3dnUPG/BtlTkLcRgVvNoj8rQ9VdY0NGg7uSORuDVRUbYYZOU5exW4HKMSfZU7vum/eSfQWXim3MqY2M3gq0NvJ7468Xd3SyHhanSu62AIJt4G6TRCVxq+Rv6DuZ3brruhojBKN3M3NuvwtL5DdaOqutwiGQsrpbG+cNMRN673UzjB8Yr8kDxPLciM/wDqEZY/eIUfWMdLAFQWCMYDq5NY3JooO60OSk3D+AONEJIQY304qap7ZiX3lhlZihQVOSunmdi7ux2eE1lOZ9Pgu9eixWozRnrwRnD37qXvcGtHUoxbJgPWqnw32mlV+ZqiAFCRePc70j2tHuUWwN3h16KsrzTTp4/ZMiOF40qmRuIJaKdw8yVjfiV5YdIf0C8u7GPbNVke5x9zbgsrKWkE5j9FE8dHdvvyHHo3Vc11vpCxNuS6LFypZQ5K+OVUVFUYJklA6hyTZG5Htpkk+Q1Rlk+Q0swVTgsqqlLKqqp1V0ggoncl8XVB7b8cujslcMVPforoG8bdvVFjb3wcqjLtZkeaNCLzyjlFlcgsvn4ANVdkBb8QmhkjHh2gKBkc271DaqscQHgoOcYtRNKFVxwOaEROB5f47UXE0AV1hpE3L3sqVSytnWhR3g3TNXDFNoy84dXfYGdo/wDf8p2ybR93Nh8D0KDXGrDyuCvfjGDu0/2kRwHOf2sGGPgocNE3ynmvUBAhhcR6j9neZyHlP7Iwz4vbg7+VupuXI+7dVUZdn3bD5rvosVgKKtt9kbnNrSoChZtELS5jQgxoo0ZD7R0UgwP0V4jLP8wTZYqF1KsP7J2yP5o+WunZrxxeeUIySGpPhdQ3WjqUImZD6/b3cpBylHYNoq1pOFfwlM/qMHq4wmysPC4VHZDLIcB9UZH/ACGngwQMjDuhmrkbQ1un+DvI8J25fmT9g2webSmPX/qm/p0lSG8Ubuxl7jRozKwwjHKPBI9jcGDFGaVvG7IHorrGho0H+GzaGvMUrfxAKtMexnZ4j5beY6myiutFSozI+7XnGio0U6943EX3r/oFuSDeGaEsho954WdaaoTbU3h6N1V8cT9T07y6Z3T6p+3TU378Yw7ot7J5sxxLig9zAXNy73GZMY2Y3dT/ALh//8QAKhABAAICAQMCBgIDAQAAAAAAAQARECExQVFhIHEwQFCBkbGh8MHR4fH/2gAIAQEAAT8hhBgwyGCcYxl/LkIes9JlIkPQFrBxgwQxGLl4PywlSoQhCVhyPoUqnlt+0v1GjQfjlle9ehX5dIJpdTp+7hlQemI1GKhAQgQl4vIX8oQxUrJlzcuW1H8jLNvB3+cLdDmLsspP5nYYmQzVTli0emiCKwxYvliEPSYvCy4YnzLj3Zci14vyzd2PLHizFp5391bggZM2QZMEIZBFYWOH0vx6lQMkMVlZdCug5Yg/iR+Zd7bxfmdyOtVv23L+b92CH7ekPacvTz85HF8HBWIgipywqVGLFjFl/JmD1glRxxxep+RjO06NYmhA4mrRGK7XLzzq9D3ilv7Ug9AMOMIYCVK9BcUWLF+XIZqVCDh545f5dps1+pz7vWKtwkWgCbX3lzrCBlXpFociHEEkVWAhxkOAYBKgyWKLH5kYMMVhUuahoOng/wBxKycq8xblDb305gmhLtavywUCbl3GJvbsAs93rhWSBiGoZwggSsDLwLF+cIMGER7quOh1f73jKNIHkbYPUnuBQBQaAn2nSG+zLDLw1CW5s048X1yqBfw+vKmBci/QBhRLP+4zrHvVuzxEhg28957Iu+bIuCJ2ZCRKK3VZHUMCWyj1DKRWbjh+eJcIsFX/AGmMoHlCfhigapLHvHEdXqF1gLNN4XIeAojlwhDDNU5eggegJX0WwN/f/Mr+FzoN5i0NQ/b2vrK6B1dx4SqFlorcckUMGoYfQUGLwel+OfJEy6a/YzrJXS0R1arR2ZfbApLjOicfublHf0O2KlSvWoUwQl5IZJcX58lCAL9/ETXlo7HaDggkcnMVeype8hTNUSdPNWRUMGmLm+aECBKlQgPQfOVAg03UH3IFnSs15RzAYI0Nqm07fe8su7snLsKSaFXFSEKduqIaayC+LCYGiZgIECVK+gk2jPXsh3EDxj2Svnp+3mcaZ1KP4mySeLxZ/wCxIbjVtXHSXfLLVvEurDdGgg8UT2CcIZZKZdg+EXGRBiQPoxcRAAopGGmpi7KuEvrwnwja4FK9bgXcmyaiS8vVAJazQ6wj2dK48fbBSr9ABqUlIQQ+lU7YKP8ArcuXi9LHo7jg2uEnA9APiE7Ude7n+IOQzRlx6CEUUH6HUCcuIEoJWv8AA9b7doqIq4YNMo91A5OXUp0Sv8kEoH5VyGkW5xgghGLF9ITh9AvCTuHVL0u/1FqLoOh9pd4Emq1BHCoF7L7Mu5YfvTd2AOJeHCaMeRixwuEH0Jfid2whPBoWIPuv5Med4LpbLvmWWoMW+odaaeJWERumKnfRHXRLmFLhi3iYLJTFTmMfSA9avB8vtcXFyo3t9PSR60fvG2NaJl9/aM6ofaeYd5fR/wCwLDtwr2dF1C6a+GXF0i+wIGqIvf4l4dN08nhwWILwGo9RcVKwCGQ+Meo+AuXjqLtEo/QO0Xe5VtRx49nmDqs6qS7SR50QcbdOScPz1lBVVoo5Y4G++o5dpq8L48w6rWdZf5luthrrUXzFztAXT2igO5N6LQB3Dr7n6hIIKLE6zfFolYjgMH0GQ9R8qAstqy/A1dsjuDbaNMf700o3EUzls9sjcrV13drzHdAB0/d0QCeHuH5iRGlXy/zChRqXiRr0Nq9+z4eIu7Zfceo+YNNCD9cZvX/I+8ME4xIS4ODhgIEEPTXoD0nxTBCtXpGLOF/ZluI/AhCbbq9R93R1KAHMp8pd6cLRe5UHDf6Ihibra9+3ESLjmVFHqDpr+H96f+QQa3XqfB+vuxau/pf+JDSThTv39n0FzCCECEIYPgEXLyYPh2rsy6sJup3BnMOY2A5TYl1y3MVeJ8nZNiFLs/jiLeSHopolURBHSMO2cna/4/XtNW+8ngxKDTacdp7c/mEEFFidc0iYjlcGDFCHxCHpPSRnFwarp7yjAX1mogDsRDC9QT1NAXApUa0j9oUIlB0zUqEMSWTXh7UQeq6JOjBanC9T+6Yo4fLjyveK7T3zx+0WCJKhCXgyXx1ZIZYQ4jirQ77/AKjqX2rOcdk8S91KJOlNX2hv9x7u8rDCBDCesQFwq2f8b4mu0H8b7MA/R9x/pl0oUCEqEV6QggQfFMRkxccKBnEd3aKfz7A7QKpB0nPfBAqFXxFTNna+IDCuBAjKjAQwIQgyQSsKxhNuzsx0wG+Kf9JRFvQ0nb+b/MCDBWTgYpFfGJeRDDgRZbTpN6K6/wA8Nbh3hvQtdE5LA058HmKLU0Lg95UwehRgIYIMLXF4DE3BAgZKskHqq4uAVVilrEySGEQfIj0DLlxxzaur+1Y93RKJCdoDnk6o6feU7hbeV5Y4uj0Mlk3wKehCiCBCBCDEkYYrAPkzJgxUvPp3UnQTa9bmld1fuLt0iqBzXT7+xEhPS/ShhDpA3kDXojqJqWeoMBAggZqCMPkgyekgSp0veju6Ep0ieAfRYoWx5DxAlIjTi+YPEghNTlAY4JWFYDKuE0wmBUrIYqVBkRRfKHohqC4Xc0/7/t/mACqhiOkolSokqMXcJLYjgcECEBKwQh6RKgSsD5AyYMV9BBDKhQbiTjCKpeBDrEYGIJWHB6ySpUCV8b//2gAMAwEAAgADAAAAEH2HUWVRt01vusrnCqQdyy4N9XeYWWL2cdbhqRx0hGkn/wAs0nkte+AQgaKPE2wWfkGt2j1Y/JJpId4PnLAe3/kikDJPKyX9pQNglIi9KcD3LyLIV2KB7QVOhQZHc7sQaly8r7/4D4Qydu2J49xjIXy8xb5zVpyBHOglgjzzstSQq/p8m8/zqMBYezDcRwhuKVZtACMCW0WTFLAy1sZGYTVrfsdgKP3Q3F7rKImyM8xCB83o55LZ6wGYu5RdeI7Lp6AMoRWg4CLzuePJ7M55rLG3M4oebZO68kG2S/DT0p3Th/cUmwbUm7g/skONjaEm2qCyavWvb6KYFW2AmKms78tEtYtZbdAacIzaL9b6iRIf5emPy+0ABiRvgoxTAR8dgDbD5plFyEogUtcBEv8Am8krr0HX0PRe1t89izE+0Gjz8jUaolnmsk5yyiks1bZKkkNqS2w52KAqkjWVytEkmiuysoYxLaGX0Y/4aHqrhKS5MZ6YkkkmhsqzkkkQOp9gfQRBkAFYPmxJR4kkkkkb4Epj1ujAAUPLDQOrC6wQNRtM+AkkkkQzNwgHiYE28zo6YUo8csVUJJ3iREkkkCxdyIQYPqE2UUYrF8dAbxwpfhiBMkkk3+ww3QnxeW+y7PLTznY8DudN8XMMgHkrSWzu++IgiYVZqRZkUV/WYn7Xgnkk6khawJJQuMXP3iflDG6A+EBhYBPQQMn6A26DRwYBa/r+b/imdAcuoISNcLhqkgMkLg10wsUTJlq2+UaWXKVLueOM9rmmkkkncCt+MbCVspCfTY5xK9Il1hvLkmskmkHxIQqM7/EQmpcQNRUuLuw2WZXkoEm00oQG6Df4BzRLB39WcnufoYWtzmwfMmm2AKgGyksQOV3Rqr9fM2DZszWWBkgkkkkXW3qeeGsg2eGFYhkGJlRzvk65Ekkkkky+Ti1yD25a5AtyDMXfugXkmYkkkkkkkcL9pZf+MoG7i7OqkFJtorQTzkkkkkkkmCfngR+ZIUUu06s8RU1hhMJikkkkkkktGftSppknhiZ/VhReALFkhOoQkkkkkkInvAZg3jSpMLQ+AHeigckkv8Mmkkkkk//EACkRAAMAAgIBAwQBBQEAAAAAAAABERAhIDFBMFFhgaGx0XFAkeHw8cH/2gAIAQMBAT8QzRCdQmJkEkQsUuLxmLCjE5lBeiWKL0UTEwjQsExOi6GUXXF0XgPKxvitnR2LYmdjYniwTJiZIaEuE4I160SVh/H7NRZ+7H0ZQkJa4KGsEtEEFmjGxsvClKUTwhiJBZWh0QnlEEsJiylw2Mi+Tc7v/fBHEiAKv8ft8UhBCQlw6BojCQWIQbKP0IQgtkOxcJwQhEFhdCQuO+0fP6OiV+7E4hdiO6EX3/6TigooFQsZLCDRCEy+SylntYpRP0Esp4lEsLC24j2I+/8AY6tv3feE/Yttll2Nb09hMeFgWJUTJSIIXBvDLg2UfJCOspHWEXKEI7wkISFlZWkJNf2aLiUXtE1YaBrBD6wlj0ExLBBLCFijeG9FxOE4pZuKMWi0vG4Qg2EbxNe5tJX7sh2GNCd+BFGIkL0vPkhDoSEqJYEhBBBCEELDZRso+FFzomJEEPQxEEoXFELMCR8L/Ikkdis0uhLinsEKC8fIw0LQ0I8WEiFggihJmlGylLi5XGlEd8FjvhcIQtCYhEl+u3/H+X9qQb1E98kPpiGyF1rJ9xhDYhGNfEK3AmFkuDZdYReK4dYSFiUhcI6LwTwsLDae/wAPH7+olBtzJtNDYnv9g7SmEJCELDDEs1QXCsnil9FsuEMTEUhBaLcrZBawnjwRvDz/AB/nr6iC9mLYugo+A4ANa2UI7EKGjhCgo4JEy8P04QSIPsRJwb4rEZsTw3z34eBI0tLBT4/Hwyg9h7G7ZRYQhI0DBBGWCcEuLw2T0FyeE8JCWUjo7E0XFx2fS2//ABEp22Ik9D6Hle/Aj+D7kIQRBeBchYhZUQuNG/QWJvmsIuhDwsdkGsdiYldjFBfr8sSJMFsm+hzT0hqMgkQhMGEuSSEhYgkJcExvC9KE49Y6WFopKJQhDdlV5XwN7F8eUN4OZJKtil8j7EZ2LhbvIO9saJw0EHMcsSCCRCei+Gxems74rCwkpK5Jr2ur+xZlWn2ot/v8lYz+C/2d19RIRbpt9/7rwQREkJUug13YyRYJUiUGLHiFgWsEhejcLM9FcfOUxDwh6YwnUSjvappVPaHoLfa8X4+DvRev74oZdHR9LoT2JkpI2wVIIFAvWF6lwli4uVrPkQ1mxv8Aq+P4939P4SSKWD2MO00ntlpWKGjIrXBYYb0pl8exC5z0khjcP0n7/QhaRDY0JoVbQlZaD8CgQ0HrOovDobomUIr1BeKzRCxSiKJ4oncvDSFY1t4vv+jru/fyQQmIaF2N4IHHQ3rif6KI6GrHO/B9D1hCVFgvQby+D40sxOMxZ2drv6Hiv3fj9nlf+vgTRi+BvCFQ2EniC0hCNhuPIuhyyD5DwSEEsF1xvrJCR3yQkeHnlibSv3ZTR2JUTQQ0FoXyXL4ErcI04zsfhRjXg0wJXCkF1mDwpTCwXFcHyWeuKz1l4v4oIJJESCeLRKjZONFeJN4b+4p6jzap+z7KvP8Ab9D1P+HhlPb70/8AwbORtC40JzBNcFobEdBdZeEuEF6DFyRRA7GQL6kNxKD2yknoa80HZ10vktdv8iiPaH2HhmKH1PleRluhl4ifq84J4bMokIJcZwhMUvFcZwY0XYir7CEhPwNBMpdbIpbf75La0XwbPBMEEsL/AAvr4f8AkWPoDMn9UXU68YlINzKCQsJCWE56NGy5hMpTKFwR+Ji6Eh0SwhLYzNtaL6Ti+C0kEIQWBYqQdc0+6/wdBkzWrtCeMIMMaF4KLIXoLhOEwkQgsJEPZt9xItIYmM6O9Y/tTbHr7HiEEhBBCjFWBFkNDRTf+plS/qK8CzqUWSGKUTyYb0kpwj4IRMJYm/C7EpGkJ3FGyT7xjKEwiCQlhLJSyG2E4m6NoxbFhNwIJCwIJeiniiEIayhlySQUSQkIbRsU9lj1iWJrBLCKJiYtFwJJCSwfo+inxkKUSEokXBCCwUJ6SxM0QohcHv5BMfL7xTwPV2MrV1+R8ZWNEIJCvGCwlFgpghD3MYWntCQkSgkTCQwRSL1ITC5LNEe4f4I28NJC4W39mMq1GEEosoUsOhhiLiwpCEEkhIWU1BieIIQ9ZMvBbysJEIe3K/JCUWxl2zyK8x/gRwohIhEJbySEzQmi5DBEQQSgkIJwYagmL+gMWijwniYQkQetRmup3PwIuoObtMrBChoSNjCSD2JYkEqIyIIpEJMghZQg0JhMTE/6ClxRFwgtISsZt835xXDckQaPI+sJluNIJCaOsIJCEwlhLhBMEEhevcIRBZQp2G0XBSCmNUxo0FvCiEdMUEhbEpgSEg1hIXKDQgkJT1v/xAApEQEBAQACAgECBQUBAQAAAAABABEQISAxQTBRQGGhsdFxgZHB8OHx/9oACAECAQE/EA2zjLJJvXJEEEQ4PwJL5LznPx4MMMM8PBLOpj1y8M8ZZBBBHr8Gy2274NtsPkl7jkC9qG3I+xwgI42Uzp4L3Dbw2WZsssggiH198H1P0Q8es3X8rrOp/wB8yNq22gfv/B47wK23OJm8CbbbwPARHO/SbPDYbZeV43l4756Xs/8AfN7Fw+xYtfiOQ/2Pz+fXGx4gxZq52HhvIQ4OByeO22cPhvO28ZzvKWSBq3T9n9LoF19iLD5g/EmJz5/tZj2+88HGUspteBjNmbctjuIIizgYbedjgeM5PBs43y22DjpDtke09s5XLNG3Yu18/wAS+X2nqWWW22Z4DYIIIPE8S2J8N465ySeV5TgXt3dDuFswZFiwTrKlexn5W287ySymLPK8ZBCCPELJjrgPLOAs5ecsnjbbbt+39rR142D7y5AlebNsn38fbgPA2yzl2ertKWWeTLIIIPE8sstvjk52zjPFsmbOPfo/q/wfrl2g9p9dQi19pnDs/Hu/pJPqSXPMasa1rwBZwCzwzgILNg5Hfr5w+Dqnr93z/H9pbSD3euWMEnnQ+8pDu8MzCWczwnitbq+GQWcByZwcZZ4B4FsH00sstH5fH9f/AD3LL7XpENl+0AgNwZZwzw5eIBrrw3neCI8Mg43keFtjnbfpZZZD8N+75lg33CZf5fzJz6IAHxHLMpXRKfAB9Asg+k8D4t8cbb5By3pfbo/mW7GE0MIj8fmffL+kW22yy8SNSzwE+WQ8ngs4XLbPPOM4PANjrhmCdEiv18S8Cb7D3Fs9vANtttvEXTmFl5HJfFgQcnG8nVtt7jqY65HfMt4Mgsfhv8knw8bkQVepV8D9Zs2DL1MHoy9ch4yjwBFzGy+bbweWeSTzl1weAcsxA3c7h/1MRJnrt/4lzJ+bc/yRvpfeHr/v62zBzgEg9T7lOJuEUMHGrLs/S7+mtscZxmwSTHl8WTE7hyL8+fZ7mfgPT+X53R3kMZhw937ZJLc8CLtW7Xh/CngbL1wO85ZHAWckvAhOf+H5v+v+1F14L2Qul+QyyeC4MbWXgjhJJPwG2+BYyWZHBDxlnIxbbYmtjv8Ak/iRKvfgupugsFPmaskeuKl4IgcjxB+APBmWcZZBZ9DIbVkJnZvd+vtw9+A5Hd/dI4+pEbbuQmfcQRwyTJfwhn1vSherrF50nte287ls8k46fF0dz1wXfANLKYjg4Me5fJln0dtt4PpbfMX4JDtw+1t8cbY4HcmzMevm6Gx2cYWh/wD7weLcmvYdwXqG222WZ8D6nxznJ5rqc+G7bVhx6ZetsJpaQqPk/acN2+Mx9+/6XqP8WDTP9vtxlnt7/J/7+P6BXoZ65DdmyySyGGXkvgcbzvmcHPUPk6bolS9fHDi9wcfM6dwbdpk9haT0/wBO5rT2AdBZkX9pt+z8P9raLOhP9n5PsjUfUjp/R/7/AL/MpShk4JwSTjbSWfo7bHlkE8lngAV9T5np6/m22S04ZZKa9LuezAQcbw7TMg/uH3P5PZ/iZB9M0D2emHb5PfII7g5Fm2ec+jkHhsc7zkdcbbx+6f4ngMJ5OADZamv5wYQcLMYc7oY2l7H6P/v73zlLH8lns3ko4MmSySyfFtsfQe48Nth5WV9yX6Tq6wQRBKdEcHsicOoh4bbbwZzMYEeiGO6xP8iQjgt6tmyySySSfEbfobwS8jDPGo+X0TD2MxZHVqfbBvCZZeCy8gx4Ryl4Lj02zjeGwc9Syy+GWWfQZh8CIJZbaTmfcXTDr5ig4Sw2xF4eWfMLbGITvzYPntCpZZYYhl4Nbv0Ms8s5Ak5JgL6Jen0euPd84ToOizZ+/j8rDOEzYm8hu0smXFTNtmF2ae+d5EeQ38Klk8H1dh9H6w2R9pTLh+pZ5wjgL3w6xwwjHBrwPA0ltmMeDUMuFtn8GPFbeNvvq/Sx9sA6dhPQXZELaxN6mbZQ9cFFnyDWLLLLyXrgHZNmfw28NssqfxB9t+h/eX2/Yi5dljg8Q8NJkfALdJup4mbLPkT4SSz62eBznDwsLo/A+Pzu/ILvbbDwOwTMzgcyt4YzeXzURm2/WPotl6Q7jguEJYeDGCzwSl5FW8Lhnz22H6//xAAnEAEAAgICAgICAwADAQAAAAABABEhMRBBUWFxgSCRMKGxwdHw4f/aAAgBAQABPxC2JlBL4sxx8ApgIMpux1ERdxmuAzCVKmp1OuAlSoSqhCEqBBDmGJAxCahgl3waqdzqYlPqCRLJbKpvKuETFhQNuIYSptCFloXiMHAh4uMuLh56hycHAQiSvwIOBwWu5rBcBUqoMMtl4nsixcTCMaMsP0gy/RLS4pVHqh/wQHKKHM8Ob+ywZuV84lFY9w3eIZcOGUwsxLrFZTOOLcfmlU0xPCWR95iZYtRgeKgQhwEDkgQ7lQJUeWriBcIFAqGo4OJcRH5g3GkOsNMxsd3hdH236l5cx3z/AB9VGgo2kq/+9yhHi0mSiye1QlwFQY4q2ZYz1x6yzCXqUaRswFamJCvHRChEjruPURjweJWIk7hKlcdQODg5CVK3ByBKxKzOptBxGLnghtAknigi/QfVsY1dvbHjY/5GcQ5cMoh6802EsaKwCbA7a8p8Fy1gk1FmTHS6nqlRqXdT0ygg1BcsI4VN9So4LUKOPBlQh74BKzKgSoFcEJiHAQJpPhwkuKLFSoQFEvHElWCtGgJXuMW4vvX9XGgYqWQ/LbFJcld7hkA8soL2LxuINdBbc9bP/rqANGp5/b48EMKrgFy5mCNQRwSs7YMqhNYpUyhlqUOYeJuhDElQhMSuCVwQIHcz+HhB6ivECEYjDcylkKRYmYskuDnn+no+6mUB5H6V5+W2D22AO4YP2RC8/Us6/IhMqTrHyuiAnqtNDWh6P7/yg4dSs8ARJeMmGGYYYwPuPMRUEjG3ncOIqw5CE+uO+DXBDcPyJcWYoa4OB8V2blW1dkK8ej2/QxNHGFFP2f49RFZb9wqcEyGvcpTDpe0bXeGIMs81GGBqX9+Ja9BF1GvbnLMVyiFkqyMvDVmGiWvJimYoDxKMzAi1Em3PCrjqVUKj8zuEIy/xNfgsuHBOocHljIUwtDaXzKExlzbv2+f08xU8rYKe2LsrALILP6DzPlaYy/cQqfFSf7MoEE2McB+i0folIE6k83WX0wrVY3KrmUqETuDPEiyqM2CmCYuFa1LzBB1K02zbw2Tc6gwYzqH4Gp98kJ3+XXNwvzGyrcKptF6LKU9d9UQpVV7h9AgKlni4Qg0CGbOmDI8MA9RQbUwPZO2BgZuaRKfLoPmWQ1OYhqlS6UtvmjERUWZcVBWJpwRZV1LViKxPEc6jPUp3MMp4j+ZhHGo9suXcGXu51Dg4OCViGeA4PcxO/wAji4blIT5x+544Aaaf7H+qlh53L36hOvI99kuRUo/tFYmFuyUAkOBodTf648QGs6wLasDox/vG8sh1FcN9SpCi7qCmoB1PXBhnUpKJRCUstluLl2S4TPFwccnITrgPxXhhOp3Bjgw4AESubJZ/Qf2kYZsu4j829vRKlEG1IxCCADQ8j4iP3IH+kU5OwfRixrvxiawfkH0RWcbRQLZhl7TKo8RFOpeanrgkKr8AENcP4HAcXwQgSpUCVx55J3LnXJ+AwbllWoAWr1HrlUdAc/Zz8VAYQK18HcwrezzFqAUq/MtmE+C9npqk+PEbWLYrQgvkt6mHAMKtaKzwrHBzOipe8JRjpTLuoR1CIASw4DBArgQKlYmNwUiwlcHHmEN8HO0eTmuOo8GYstnrgmQPTTTp+zR9+ItxONeoGVYz2wKkm3OVuvSV/cxC9jGVJNmkgfsEtkOCValaY9/0RyR4FXqBtlzNfED1Kpj1KJiY/AeoMco7lAl0XghC4EODUCEMXL/O8Q5udQhEjB4AMuXldD2sarSF2OsegiV5K1U0Hlq9xeXo3AdgAnxYPkGKiIQaWtPstv1KVi+ouoi3XAEMEh1CRi1xUHFg4WiSj8FFZb+BAhDk1x1Dg4qp5/JlLLBBgWrBd4TZ/fhGOCax9kdiZg9I6XhaLQf/AH1Gi7Mb/wC3+fuFnsdsvfQvzL6L8ZnmcxEC/AWtYeG731ACAAKAMEvtqbS1LBqIbIt6iRTBVhmHMqJXxYJSU/IZ1yQhCEN8EITz+JyS4pxcUrgwUxKMV0d5iX5Nn/2EVBtV3yIsOsmHpLgK2JE85Y+iJwKjgsEaA9LbemtRC8Sh/BUuvcastj1K3Oi8dRwbK5RCl/OvuUFAHgKP8huKtE8SGskAajYcR1xAnUM2f1CMEI4GyUfwjDjEqUwhCVCHPTBK4vgjOp1xqXczBplDAgw9QGEdjFnKSNB0njRkmzq6q5umh3Lo7DKAtt+rmNKdvqW5sMy4sI+kjtFgrbYKimYaNFIV/d/cWZilzKM1MtRRpjtJj1AOoB1BRHmbR/xEMwhOuCEITrj75oPwvi/wYyrYDE6juwu2Bwg/+nzFdNr3K3OzgRJTY+Tr7gmWfdHZCr2ljflBPIqbtEF9ZDEVl1hvcCAxcSl1KSARCopUUWYfmD5ln8NQ5OA4Ic4qD+Oody8QZcshEmXCe/rKB8stY8tFfF6e3PxEqBartiK1EhbIeqLmGDZRjV9t/r9xWaGg1XklIMxbp3b9UfUqc6hB1FF8Uw4LIKiqYJXDgW9xZbFZ/CQg8EOCMvg3zcZfFwZcWDDtBuFXXUD8XuHhEotN+Nv9SuNNq+iMfcUnbLRzL2Yq4BRbdwMlkXpf80fqJp3FYCoa73Mt1xWgtBYOCj6iWO5bTg3VBMCKiZIuNhjWd0NcV/BmEPXA9cGp1Djrj44HHFy5cvMGXCGKtWhb63BSMxT+xz/U8Q3pg/8AGqj1G2sf9ytgIJWoa1awdKboah5ZkXmNhtq6gqFMBkJmAEpTbIX1fjplxA90Jkyez2J5EsiiL0xLviGmWLI4CwUmRcGIODhmTwUQQQcrUYtmnBxc7lwzCVidcY4Nfwo6DRn/AMx5YH2jMoPfa+2KlfawyqVnSxm0eAgoJsunKXwukLXH6A/vYLF701oRzHqvT5I+fS2YLWr+5nIZfBdYjcUVVJHbqRwyUiJnrMMtqmQ3t8+SUAD0afaHScKmYpRtgjZG5I3NYycEdQcXw6iy4Zg1DUNfgQ4V+OUYfhcJoX4b6Y/76jyctBo6B4lnivYQw5eiWxu1Zb6hQLFXWfhgdyyGiaq5NSptTPzEgl/0MS17TYo6muWAbHpGANMCADTfCL0eYudFQshFJkCVnq9MFoU2FyUDgUMDWaMSgnmVN6TLYtIXs8ywVEx6nUvTuhVe6M43YwgwealrA6R8RRq4BSaSmFoBAYhAhDBBU7w1GVKgQYzAxuBidSuCEJWJX4E6nmLF4ueJ+5j/AJfUfiys4/73axqy7hlWNC7RyV+4IKtslu6s/uXVGTIxu3Tuo1Ors7IHaFUUBfWXBDRmiEj0q0+CJhi1gWqFgPNw3n3SfFqyZAVG6vFpamiQaAoIeRlzcVKd0WCPqLXzfUBd3BKCoDwRH96RhpkMDAmd+e4egRX1nfhc/QzRwUbh4DqY98dqixY4wckeoHRCVKhFEo4wSo1FhMIQZ5mIQ7hNcMeGhIeoBtY/CU031/1HR9xbTMqcu7NsJpFZeGCSjc5auIwY/pjPXyHuIhvSmceEZwpGjfFg/vEKCpS/mNH0RRV4iLuC3ARLEQeNk4AoGxg/SqOqaYWVQI0s3OkV8Kks88zanD7VNX9oyx5TUYWH0ZPs6lEFES5hFZmy0lE1rgMrzX8HRERi4QTuaRYQhi5eIvFRICtEOwWzcdFvB37x1Ea5tFEGl5SXb8Re6vEOlM7nV1UVijkWr9RJHgUxNKNVjOYuLgPsnaK/pEytgwgvXJNjUMtRNCJblQWI7EggZ/hTK3z0vcKQhne/c8+XyN4c6dHBstgd/wDRh+1IWB0j4gxKxLJtmDMXAaJXhpgsVk0/gGXiHHtMItwnXAxAxGOoMNkIDURAa9mU7e/H78ShO1pS1VyxAlFBUFAf8TMPiHaBAlrwRH0rTotY7yfuKaaooDJdLzv3bKgehoHqJEg258YczXgRIU0aQPETAnY6O10j/wCphElp4z36H+inUaJ/HxPgGiOk9MvnWnBXq99vHwniBUsqoBIE2xCxwXmW3HuCxvA/4SEGDBgmUnHtw+omL4hmEMcCpfsfT/5LulM7i2OpS1LepeQZgT4I8FJblW0rurfr3K1R6aU2vbARwRZhthQ3qHjHlHBT1MHAwYBqs0u/Y78YZbKUdva/s1dJtjjQAWBWFa6bH3nbL7mruk0+zT7iuGFp6JUJqK5UBiLylH8BUOLhxp3AckSBBGOEVsAsrFHZnoHtjpcq+oiGQMsUKZXcJewgwdeHAv2xEprNlOrna1rNRrw4NHy+X3MdwQSRN1KYcwFRZqU6mbiXsxcBkBWo2NR34wwDXu8P040YVwFGV38nnF7GB+vSxNLbWQU6YeI8DSMTPCRd1PXBIAP4RhDWZ3CfOYQuVF3FiKdRS8xmU2KAbY0UMjs8/bDFquOsrjIooA7jfHPFauqgzs/AwpRt07VHtMV4vzCbIsGH0RdxQqZJ6ZcaiqsIi1ESCJdjXxrSk4V4G3UPndE3VoYtK3eoVDIHJC6L8Fv7ZXxAGBUQrXCqz1z1wCAH8h4hCHBYLBmCEaRy8zvwyMB17D+36jdWP8J6TLjoABaszbLUdZB5Wb8e4scGky608qxHqUOSF04F4gNSp1ANVEPBGSwjNJLiUxL1KXBaTZjhu4KkGoOAXC/CZ1/MMHi4TSEqCAyxG44Q21oLdMX8uiEGcKIGaTySpP57oF+AMK3nqYALQfoM/wBjG7ZxjD0NPvfxCdwXMHKpRGsNwyBUrPEoC2JZupX1L+pT1OqohOiYuM6lYjuNphgqKoiVhr+YZSDGKDCViE3lpBrUISz264D5YKF1GYNausUdEv6MPYNtQ9325+Jc5wNXCnzCbJpqOMQJbpL2gCAOYzaVYXXjoISNwkPFAOoPiV9QMPCCaTSdSkpMEOXh5iBX84MGDdwfMIOY5cILlEDQy4hKCxcD6C6O30zTlAPEC8EHxAdIl2ph1CRqUtIQGVYRzFyxLiVkFsKsyg43zPMcR3ACHMMOPwSypjY5szwoQZmn8twgwXDc7/AwiVE0iM3ZCvUGrgIjCQcCMwUyVjhqKWDLmFBhVBUF1AZQgSBiDHBghr8QSJgCBUAfzf/Z";let U=class extends l{constructor(){super(...arguments),this._refImage=I(),this._boundVisibilityHandler=this._visibilityHandler.bind(this),this._mediaLoadedInfo=null}async play(){this._cachedValueController?.startTimer()}async pause(){this._cachedValueController?.stopTimer()}async mute(){}async unmute(){}isMuted(){return!0}async seek(A){}async setControls(A){}isPaused(){return!this._cachedValueController?.hasTimer()}async getScreenshotURL(){return this._cachedValueController?.value??null}_getCameraEntity(){return(this.cameraConfig?.camera_entity||this.cameraConfig?.webrtc_card?.entity)??null}shouldUpdate(A){if(!this.hass||"visible"!==document.visibilityState)return!1;const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));return!A.has("hass")||1!=A.size||!e||(n(this.hass,A.get("hass"),[e])?(this._cachedValueController?.clearValue(),!0):!this.hasUpdated)}willUpdate(A){A.has("imageConfig")&&(this._cachedValueController&&this._cachedValueController.removeController(),this.imageConfig&&(this._cachedValueController=new p(this,this.imageConfig.refresh_seconds,this._getImageSource.bind(this),(()=>E(this)),(()=>u(this)))));const e=this._getRelevantEntityForMode(this._resolveMode(this.imageConfig?.mode));(A.has("cameraConfig")||A.has("view")||e&&!this._getAcceptableState(e))&&this._cachedValueController?.clearValue(),this._cachedValueController?.value||this._cachedValueController?.updateValue()}_getAcceptableState(A){const e=(A?this.hass?.states[A]:null)??null;return this.hass&&this.hass.connected&&e&&Date.now()-Date.parse(e.last_updated)<3e5?e:null}connectedCallback(){super.connectedCallback(),document.addEventListener("visibilitychange",this._boundVisibilityHandler),this._cachedValueController?.startTimer()}disconnectedCallback(){this._cachedValueController?.stopTimer(),document.removeEventListener("visibilitychange",this._boundVisibilityHandler),super.disconnectedCallback()}_visibilityHandler(){this._refImage.value&&("hidden"===document.visibilityState?(this._cachedValueController?.stopTimer(),this._cachedValueController?.clearValue(),this._forceSafeImage()):(this._cachedValueController?.startTimer(),this.requestUpdate()))}_buildImageURL(A){return A.searchParams.append("_t",String(Date.now())),A.toString()}_addQueryParametersToURL(A,e){if(e){const t=new URLSearchParams(e);for(const[e,i]of t.entries())A.searchParams.append(e,i)}return A}_getRelevantEntityForMode(A){return"camera"===A?this._getCameraEntity():"entity"===A?this.imageConfig?.entity??null:null}_resolveMode(A){if(!A)return"screensaver";if("auto"!==A)return A;const e=this._getCameraEntity();return this.imageConfig?.entity?"entity":this.imageConfig?.url?"url":e?"camera":"screensaver"}_getImageSource(){const A=this._resolveMode(this.imageConfig?.mode);if(this.hass&&"camera"===A){const A=this._getAcceptableState(this._getCameraEntity());if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}if(this.hass&&"entity"===A&&this.imageConfig?.entity){const A=this._getAcceptableState(this.imageConfig?.entity);if(A?.attributes.entity_picture){const e=new URL(A.attributes.entity_picture,document.baseURI);return this._addQueryParametersToURL(e,this.imageConfig?.entity_parameters),this._buildImageURL(e)}}return"url"===A&&this.imageConfig?.url?this._buildImageURL(new URL(this.imageConfig.url,document.baseURI)):k}_forceSafeImage(A){this._refImage.value&&(this._refImage.value.src=!A&&this.imageConfig?.url?this.imageConfig.url:k)}render(){const A=this._cachedValueController?.value;return A?m` + {const e=Q(A,{player:this,capabilities:{supportsPause:!!this.imageConfig?.refresh_seconds}});e&&!M(this._mediaLoadedInfo,e)&&(this._mediaLoadedInfo=e,B(this,e))}} + @error=${()=>{const A=this._resolveMode(this.imageConfig?.mode);"camera"===A||"entity"===A?this._forceSafeImage(!0):"url"===A&&d(this,b("error.image_load_error"),{context:this.imageConfig})}} + /> + `:m``}static get styles(){return L(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\nimg {\n width: 100%;\n height: 100%;\n display: block;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}')}};c([s({attribute:!1})],U.prototype,"hass",void 0),c([s({attribute:!1})],U.prototype,"view",void 0),c([s({attribute:!1})],U.prototype,"cameraConfig",void 0),c([s({attribute:!1})],U.prototype,"cameraManager",void 0),c([s({attribute:!1,hasChanged:h})],U.prototype,"imageConfig",void 0),U=c([C("frigate-card-image")],U);export{U as FrigateCardImage}; diff --git a/www/community/frigate-hass-card/image-cbfd7ccb.js.gz b/www/community/frigate-hass-card/image-cbfd7ccb.js.gz new file mode 100644 index 00000000..99938452 Binary files /dev/null and b/www/community/frigate-hass-card/image-cbfd7ccb.js.gz differ diff --git a/www/community/frigate-hass-card/image-cdeb2c7e.js b/www/community/frigate-hass-card/image-cdeb2c7e.js new file mode 100644 index 00000000..4e4b6599 --- /dev/null +++ b/www/community/frigate-hass-card/image-cdeb2c7e.js @@ -0,0 +1,9 @@ +import{a,cR as e,x as s,cV as t,r as i,d2 as r,_ as m,n as g,t as n}from"./card-09c4bade.js";import{g as u}from"./index-e610f971.js";import"./image-1c1ebdfa.js";import"./media-aef44451.js";let o=class extends a{constructor(){super(...arguments),this._refImage=e()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(a){await(this._refImage.value?.seek(a))}async setControls(a){await(this._refImage.value?.setControls(a))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return u(this,this.hass,this.cameraConfig),s` + + + `}static get styles(){return i(r)}};m([g({attribute:!1})],o.prototype,"hass",void 0),m([g({attribute:!1})],o.prototype,"cameraConfig",void 0),o=m([n("frigate-card-live-image")],o);export{o as FrigateCardLiveImage}; diff --git a/www/community/frigate-hass-card/image-cdeb2c7e.js.gz b/www/community/frigate-hass-card/image-cdeb2c7e.js.gz new file mode 100644 index 00000000..4a0e1c2f Binary files /dev/null and b/www/community/frigate-hass-card/image-cdeb2c7e.js.gz differ diff --git a/www/community/frigate-hass-card/index-0197eb89.js b/www/community/frigate-hass-card/index-0197eb89.js new file mode 100644 index 00000000..f867e25d --- /dev/null +++ b/www/community/frigate-hass-card/index-0197eb89.js @@ -0,0 +1,131 @@ +import{_ as e,n as i,b as t,t as a,a as r,cR as s,dm as o,dn as n,da as d,dp as l,dq as g,dr as h,ds as c,dt as u,du as m,dv as v,db as p,cT as C,x as w,c_ as f,dl as I,cV as M,dw as y,dx as _,dy as b,dz as A,r as D,cW as x,cI as k,dA as j,s as $,dB as T,l as z,c$ as N,d1 as L,d2 as E,cU as P}from"./card-c642ee74.js";import"./ha-hls-player-abb86874.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./media-6eadcd60.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let q=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-725f087c.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-3082f0ad.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-0197eb89.js.gz b/www/community/frigate-hass-card/index-0197eb89.js.gz new file mode 100644 index 00000000..63e3dacc Binary files /dev/null and b/www/community/frigate-hass-card/index-0197eb89.js.gz differ diff --git a/www/community/frigate-hass-card/index-0a012f43.js b/www/community/frigate-hass-card/index-0a012f43.js new file mode 100644 index 00000000..fc574140 --- /dev/null +++ b/www/community/frigate-hass-card/index-0a012f43.js @@ -0,0 +1,162 @@ +import{cL as e,cM as i,cN as t,cO as a,cP as r,cQ as o,l as s,_ as n,n as d,b as g,t as c,a as h,cR as l,cI as m,cS as v,cT as p,x as u,cU as C,cV as f,e as I,r as M,cW as _,cX as w,cY as b,cZ as y,c_ as L,c$ as A,d0 as D,d1 as $,d2 as j}from"./card-c642ee74.js";import{p as z,u as k,i as S,M as E,A as N,a as x,b as T}from"./media-6eadcd60.js"; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Z=e(class extends i{constructor(){super(...arguments),this.key=t}render(e,i){return this.key=e,i}update(e,[i,t]){return i!==this.key&&(a(e),this.key=i),t}});class O{constructor(e){this._inBackground=!1,this._messageReceived=!1,this._lastMediaLoadedInfo=null,this._renderEpoch=0,this._handleMessage=e=>{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-c6a10ba0.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-725f087c.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-66c8006d.js")):"ha"===e?this._importPromises.push(import("./ha-31684cf1.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-74652e9d.js")):"image"===e?this._importPromises.push(import("./image-c6a10ba0.js")):"go2rtc"===e&&this._importPromises.push(import("./index-17f8eed5.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-3082f0ad.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/www/community/frigate-hass-card/index-0a012f43.js.gz b/www/community/frigate-hass-card/index-0a012f43.js.gz new file mode 100644 index 00000000..769d84c3 Binary files /dev/null and b/www/community/frigate-hass-card/index-0a012f43.js.gz differ diff --git a/www/community/frigate-hass-card/index-0b99d370.js b/www/community/frigate-hass-card/index-0b99d370.js new file mode 100644 index 00000000..bfeeec4b --- /dev/null +++ b/www/community/frigate-hass-card/index-0b99d370.js @@ -0,0 +1,122 @@ +import{_ as e,n as i,b as t,t as a,a as r,cR as s,dn as o,dp as n,db as d,dq as l,dr as g,ds as h,dt as c,du as u,dv as m,dw as v,dc as C,cT as p,x as w,c_ as f,dm as I,cV as M,dx as y,dy as _,dz as b,dA as A,r as D,cW as x,cI as j,dB as k,s as T,c$ as N,d0 as z,dC as $,l as L,d2 as P,d3 as E,cU as Z}from"./card-4e88bdfb.js";import"./ha-hls-player-7f5d4dfb.js";import{p as V,h as G,s as S,u as W,i as F,c as O,M as R,A as U,a as Y,b as B}from"./media-2a3bfaef.js";import{m as Q}from"./audio-cf3a75aa.js";import{V as q}from"./media-c9012082.js";let H=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await V(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(G(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&S(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){C(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-56de395a.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;W(this,i?.dimensions?.layout),this.style.aspectRatio=p({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"media",void 0),e([i({attribute:!1})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"load",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([t()],H.prototype,"_url",void 0),H=e([a("frigate-card-viewer-provider")],H);let X=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new R,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??j.media_viewer.transition_effect}_getPlugins(){return[U({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),Y(),B()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!i||!this._media)return;const t=("previous"===e?i.previous?.index:i.next?.index)??null;null!==t&&this._setViewSelectedIndex(t)},a=N(this),r="ltr"===a&&"left"===e||"rtl"===a&&"right"===e?"previous":"next";return w` {t(r),z(e)}} + >`}render(){const e=this._media?.length??0;if(!this._media||!e)return $(this,L("common.no_media"),"info",{icon:"mdi:multimedia"});const i=this._media[this._selected]??this._media[e-1];if(!this.hass||!this.cameraManager||!i)return;const t=this._getMediaNeighbors(),a=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?this._renderNextPrevious("left",t):""} + ${F([this._media,a],(()=>this._getSlides()))} + ${this.showControls?this._renderNextPrevious("right",t):""} + + ${a?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);T(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),e([i({attribute:!1})],X.prototype,"showControls",void 0),e([t()],X.prototype,"_selected",void 0),X=e([a("frigate-card-viewer-carousel")],X);let J=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-a4c182ec.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),J=e([a("frigate-card-viewer-grid")],J);let K=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return Z({type:"info",message:L(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],K.prototype,"hass",void 0),e([i({attribute:!1})],K.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],K.prototype,"viewerConfig",void 0),e([i({attribute:!1})],K.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],K.prototype,"cameraManager",void 0),e([i({attribute:!1})],K.prototype,"cardWideConfig",void 0),K=e([a("frigate-card-viewer")],K);export{K as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-0b99d370.js.gz b/www/community/frigate-hass-card/index-0b99d370.js.gz new file mode 100644 index 00000000..64e2cdcd Binary files /dev/null and b/www/community/frigate-hass-card/index-0b99d370.js.gz differ diff --git a/www/community/frigate-hass-card/index-17f8eed5.js b/www/community/frigate-hass-card/index-17f8eed5.js new file mode 100644 index 00000000..2e71cf49 --- /dev/null +++ b/www/community/frigate-hass-card/index-17f8eed5.js @@ -0,0 +1 @@ +import{dw as e,dx as t,dy as i,dz as s,a as n,dm as o,cQ as a,l as c,x as r,r as d,_ as h,n as l,t as p}from"./card-c642ee74.js";import{g as u}from"./endpoint-cc3caf82.js";import{s as m,h as v,c as y}from"./media-6eadcd60.js";import"./image-cbfd7ccb.js";import{m as g}from"./audio-cf3a75aa.js";import{g as f}from"./get-technology-for-video-rtc-778a0c05.js";class b extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;ethis.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-28db7d93.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-0f7352bc.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-25c40d01.js.gz b/www/community/frigate-hass-card/index-25c40d01.js.gz new file mode 100644 index 00000000..f9d289d8 Binary files /dev/null and b/www/community/frigate-hass-card/index-25c40d01.js.gz differ diff --git a/www/community/frigate-hass-card/index-33db4eee.js b/www/community/frigate-hass-card/index-33db4eee.js new file mode 100644 index 00000000..bb79fff7 --- /dev/null +++ b/www/community/frigate-hass-card/index-33db4eee.js @@ -0,0 +1,154 @@ +import{cL as e,_ as i,n as a,b as t,t as r,a as o,cM as s,cI as n,cN as d,cO as g,x as c,cP as h,l,cQ as m,e as v,r as p,cR as u,cS as C,cT as f,cU as I,cV as M,cW as _,cX as w,cY as b,cZ as y,c_ as L}from"./card-320adb66.js";import{p as A,u as D,i as $,d as j,M as z,A as E,a as S,b as N}from"./dispatch-live-error-c649b480.js";class k{constructor(e){this._inBackground=!1,this._lastMediaLoadedInfo=null,this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}isInBackground(){return this._inBackground}_intersectionHandler(i){const a=this._inBackground;this._inBackground=!i.some((e=>e.isIntersecting)),!this._inBackground&&this._lastMediaLoadedInfo&&e(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),a!==this._inBackground&&this._host.requestUpdate()}}let x=class extends o{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._hasProviderError=!1,this._refProvider=s(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await A(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":n.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!(!this.cameraConfig?.camera_entity||!this.hass||!this.liveConfig?.show_image_during_load||this._hasProviderError)}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}_providerErrorHandler(){this._hasProviderError=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,d(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-678a8283.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-85596cd4.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-50dde246.js")):"ha"===e?this._importPromises.push(import("./ha-4f7cd760.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-a69dcd1f.js")):"image"===e?this._importPromises.push(import("./image-678a8283.js")):"go2rtc"===e&&this._importPromises.push(import("./index-a3bb8676.js")),D(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=g({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?c` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),a={hidden:i};if("ha"===e||"image"===e||this.cameraConfig?.camera_entity&&this.cameraConfig.always_error_if_entity_unavailable){if(!this.cameraConfig?.camera_entity)return j(this),h({message:l("error.no_live_camera"),type:"error",icon:"mdi:camera",context:this.cameraConfig});const e=this.hass.states[this.cameraConfig.camera_entity];if(!e)return j(this),h({message:l("error.live_camera_not_found"),type:"error",icon:"mdi:camera",context:this.cameraConfig});if("unavailable"===e.state)return j(this),d(this),h({message:`${l("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return c`${this._useZoomIfRequired(c` + ${i||"image"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${i=>{"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:c``} + ${"ha"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"go2rtc"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"webrtc-card"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"jsmpeg"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:c``} + `)} + ${i&&!this._isVideoMediaLoaded?c``:""} `}static get styles(){return p(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};i([a({attribute:!1})],x.prototype,"hass",void 0),i([a({attribute:!1})],x.prototype,"cameraConfig",void 0),i([a({attribute:!1})],x.prototype,"cameraEndpoints",void 0),i([a({attribute:!1})],x.prototype,"liveConfig",void 0),i([a({attribute:!0,type:Boolean})],x.prototype,"load",void 0),i([a({attribute:!1})],x.prototype,"label",void 0),i([a({attribute:!1})],x.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],x.prototype,"microphoneStream",void 0),i([a({attribute:!1})],x.prototype,"zoomSettings",void 0),i([t()],x.prototype,"_isVideoMediaLoaded",void 0),i([t()],x.prototype,"_hasProviderError",void 0),x=i([r("frigate-card-live-provider")],x);const P="frigate-card-live-provider";let T=class extends o{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=s(),this._refCarousel=s(),this._mediaActionsController=new z,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??n.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:P,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[E({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),S(),N()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),a=[],t={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(t[r]=a.length,a.push(n))}return[a,t]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,a){a instanceof HTMLSlotElement&&(a=a.assignedElements({flatten:!0})[0]);const t=a?.querySelector(P);t&&(t.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let a=null;try{a=C(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:f}).live}catch(e){return I(this,e)}const t=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return c` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${t?.title??""} + .liveConfig=${a} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>M(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getSubstreamCameraID(e,i){return i?.context?.live?.overrides?.get(e)??e}_getCameraNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return{};const a=this.viewFilterCameraID??i.camera,t=e.indexOf(a);if(t<0)return{};const r=e[t>0?t-1:e.length-1],o=e[t+1{this._setViewCameraID(t?.id),w(e)}} + > + `}render(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.overriddenLiveConfig&&this.hass&&e&&this.cameraManager))return;const[i,a]=this._getSlides();if(this._cameraToSlide=a,!i.length)return;const t=i.length>1,r=this._getCameraNeighbors(),o=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return c` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + ${this._renderNextPrevious("left",r)} + + ${i} + + ${this._renderNextPrevious("right",r)} + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return p(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};i([a({attribute:!1})],T.prototype,"hass",void 0),i([a({attribute:!1})],T.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],T.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],T.prototype,"overrides",void 0),i([a({attribute:!1})],T.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],T.prototype,"cameraManager",void 0),i([a({attribute:!1})],T.prototype,"microphoneManager",void 0),i([a({attribute:!1})],T.prototype,"viewFilterCameraID",void 0),i([t()],T.prototype,"_mediaHasLoaded",void 0),T=i([r("frigate-card-live-carousel")],T);let Z=class extends o{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),a=e??i?.camera;return c` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-adc03f7c.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?c` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return p(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};i([a({attribute:!1})],Z.prototype,"hass",void 0),i([a({attribute:!1})],Z.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],Z.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],Z.prototype,"overrides",void 0),i([a({attribute:!1})],Z.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],Z.prototype,"cameraManager",void 0),i([a({attribute:!1})],Z.prototype,"microphoneManager",void 0),i([a({attribute:!1})],Z.prototype,"triggeredCameraIDs",void 0),Z=i([r("frigate-card-live-grid")],Z);let G=class extends o{constructor(){super(...arguments),this._controller=new k(this)}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return c` + + + `}static get styles(){return p(L)}};i([a({attribute:!1})],G.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"hass",void 0),i([a({attribute:!1})],G.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],G.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],G.prototype,"overrides",void 0),i([a({attribute:!1})],G.prototype,"cameraManager",void 0),i([a({attribute:!1})],G.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],G.prototype,"microphoneManager",void 0),i([a({attribute:!1})],G.prototype,"triggeredCameraIDs",void 0),G=i([r("frigate-card-live")],G);export{G as FrigateCardLive}; diff --git a/www/community/frigate-hass-card/index-33db4eee.js.gz b/www/community/frigate-hass-card/index-33db4eee.js.gz new file mode 100644 index 00000000..2e77413b Binary files /dev/null and b/www/community/frigate-hass-card/index-33db4eee.js.gz differ diff --git a/www/community/frigate-hass-card/index-33ed76c0.js b/www/community/frigate-hass-card/index-33ed76c0.js new file mode 100644 index 00000000..86217596 --- /dev/null +++ b/www/community/frigate-hass-card/index-33ed76c0.js @@ -0,0 +1 @@ +import{dr as e,ds as t,dt as i,du as s,a as n,dh as o,l as a,cO as c,x as r,r as h,_ as d,n as l,b as p,t as m}from"./card-e5d55e5b.js";import{s as u,h as v,c as y,d as g}from"./media-921a03ae.js";import{c as f}from"./endpoint-c9cec68c.js";import"./image-04d4df35.js";import{m as b}from"./audio-cf3a75aa.js";import{g as w}from"./get-technology-for-video-rtc-778a0c05.js";class S extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),u(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:b(this.video)},technology:w(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{u(this.video,!1),this.video.poster="data:image/jpeg;base64,"+S.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),u(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+S.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-b5d57727.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-672d26af.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-45778f1d.js")):"ha"===e?this._importPromises.push(import("./ha-9af0bc47.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-b8854548.js")):"image"===e?this._importPromises.push(import("./image-b5d57727.js")):"go2rtc"===e&&this._importPromises.push(import("./index-78f3984a.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-cff66b0b.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/www/community/frigate-hass-card/index-3c9b9749.js.gz b/www/community/frigate-hass-card/index-3c9b9749.js.gz new file mode 100644 index 00000000..2d83ab75 Binary files /dev/null and b/www/community/frigate-hass-card/index-3c9b9749.js.gz differ diff --git a/www/community/frigate-hass-card/index-5de5f421.js b/www/community/frigate-hass-card/index-5de5f421.js new file mode 100644 index 00000000..be2da7a6 --- /dev/null +++ b/www/community/frigate-hass-card/index-5de5f421.js @@ -0,0 +1,122 @@ +import{_ as e,n as i,b as t,t as a,a as r,cM as s,di as o,dj as n,d6 as d,dk as l,dl as g,dm as h,dn as c,dp as u,dq as m,dr as v,d7 as C,cO as p,x as w,cV as I,dh as f,cQ as M,ds as y,dt as _,du as b,dv as A,r as D,cR as j,cI as k,dw as x,s as T,cW as N,cX as z,cP as $,l as L,cZ as P,c_ as E}from"./card-320adb66.js";import"./ha-hls-player-b195eaa1.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./dispatch-live-error-c649b480.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let q=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){C(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-85596cd4.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=p({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>I(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):f({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!i||!this._media)return;const t=("previous"===e?i.previous?.index:i.next?.index)??null;null!==t&&this._setViewSelectedIndex(t)},a=N(this),r="ltr"===a&&"left"===e||"rtl"===a&&"right"===e?"previous":"next";return w` {t(r),z(e)}} + >`}render(){const e=this._media?.length??0;if(!this._media||!e)return $({message:L("common.no_media"),type:"info",icon:"mdi:multimedia",...this.viewFilterCameraID&&{context:{camera_id:this.viewFilterCameraID}}});const i=this._media[this._selected]??this._media[e-1];if(!this.hass||!this.cameraManager||!i)return;const t=this._getMediaNeighbors(),a=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?this._renderNextPrevious("left",t):""} + ${W([this._media,a],(()=>this._getSlides()))} + ${this.showControls?this._renderNextPrevious("right",t):""} + + ${a?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);T(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:j})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-adc03f7c.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return $({type:"info",message:L(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-5de5f421.js.gz b/www/community/frigate-hass-card/index-5de5f421.js.gz new file mode 100644 index 00000000..fbe026ec Binary files /dev/null and b/www/community/frigate-hass-card/index-5de5f421.js.gz differ diff --git a/www/community/frigate-hass-card/index-7484e0d9.js b/www/community/frigate-hass-card/index-7484e0d9.js new file mode 100644 index 00000000..91ae248f --- /dev/null +++ b/www/community/frigate-hass-card/index-7484e0d9.js @@ -0,0 +1,122 @@ +import{_ as e,n as i,b as t,t as a,a as r,cM as s,di as o,dj as n,d6 as d,dk as l,dl as g,dm as h,dn as c,dp as u,dq as m,dr as v,d7 as C,cO as p,x as w,cV as I,dh as f,cQ as M,ds as y,dt as _,du as b,dv as A,r as D,cR as j,cI as k,dw as x,s as T,cW as N,cX as z,cP as $,l as L,cZ as P,c_ as E}from"./card-19444f74.js";import"./ha-hls-player-19f4a97a.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./dispatch-live-error-65d9f8de.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let q=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){C(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-29d78c71.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=p({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>I(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):f({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!i||!this._media)return;const t=("previous"===e?i.previous?.index:i.next?.index)??null;null!==t&&this._setViewSelectedIndex(t)},a=N(this),r="ltr"===a&&"left"===e||"rtl"===a&&"right"===e?"previous":"next";return w` {t(r),z(e)}} + >`}render(){const e=this._media?.length??0;if(!this._media||!e)return $({message:L("common.no_media"),type:"info",icon:"mdi:multimedia",...this.viewFilterCameraID&&{context:{camera_id:this.viewFilterCameraID}}});const i=this._media[this._selected]??this._media[e-1];if(!this.hass||!this.cameraManager||!i)return;const t=this._getMediaNeighbors(),a=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?this._renderNextPrevious("left",t):""} + ${W([this._media,a],(()=>this._getSlides()))} + ${this.showControls?this._renderNextPrevious("right",t):""} + + ${a?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);T(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:j})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-7b38fd80.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return $({type:"info",message:L(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-7484e0d9.js.gz b/www/community/frigate-hass-card/index-7484e0d9.js.gz new file mode 100644 index 00000000..3679b5ab Binary files /dev/null and b/www/community/frigate-hass-card/index-7484e0d9.js.gz differ diff --git a/www/community/frigate-hass-card/index-76cab2a3.js b/www/community/frigate-hass-card/index-76cab2a3.js new file mode 100644 index 00000000..3b9fe425 --- /dev/null +++ b/www/community/frigate-hass-card/index-76cab2a3.js @@ -0,0 +1,131 @@ +import{_ as e,n as i,b as t,t as a,a as r,cR as s,dm as o,dn as n,da as d,dp as l,dq as g,dr as h,ds as c,dt as u,du as m,dv as v,db as p,cT as C,x as w,c_ as f,dl as I,cV as M,dw as y,dx as _,dy as b,dz as A,r as D,cW as x,cI as k,dA as j,s as $,dB as T,l as z,c$ as N,d1 as L,d2 as E,cU as P}from"./card-09c4bade.js";import"./ha-hls-player-ba5834a9.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./media-aef44451.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let q=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-37e20bdd.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-ef47501a.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-76cab2a3.js.gz b/www/community/frigate-hass-card/index-76cab2a3.js.gz new file mode 100644 index 00000000..44a1ba7d Binary files /dev/null and b/www/community/frigate-hass-card/index-76cab2a3.js.gz differ diff --git a/www/community/frigate-hass-card/index-78f3984a.js b/www/community/frigate-hass-card/index-78f3984a.js new file mode 100644 index 00000000..f10f6e67 --- /dev/null +++ b/www/community/frigate-hass-card/index-78f3984a.js @@ -0,0 +1 @@ +import{dw as e,dx as t,dy as i,dz as s,a as n,dm as o,cQ as a,l as c,x as r,r as d,_ as h,n as l,t as p}from"./card-7cd05290.js";import{g as u}from"./endpoint-760ea36f.js";import{s as m,h as v,c as y}from"./media-67c578aa.js";import"./image-5371a090.js";import{m as g}from"./audio-cf3a75aa.js";import{g as f}from"./get-technology-for-video-rtc-778a0c05.js";class b extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){p(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-672d26af.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=C({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!t||!this._media)return;const i=("previous"===e?t.previous?.index:t.next?.index)??null;null!==i&&this._setViewSelectedIndex(i)},r=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?w` {a("previous"),N(e)}} + >`:""} + ${W([this._media,r],(()=>this._getSlides()))} + ${this.showControls?w` {a("next"),N(e)}} + >`:""} + + ${r?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);$(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:x})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-cff66b0b.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return P({type:"info",message:z(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-961f10b9.js.gz b/www/community/frigate-hass-card/index-961f10b9.js.gz new file mode 100644 index 00000000..81f83ed6 Binary files /dev/null and b/www/community/frigate-hass-card/index-961f10b9.js.gz differ diff --git a/www/community/frigate-hass-card/index-9bf80040.js b/www/community/frigate-hass-card/index-9bf80040.js new file mode 100644 index 00000000..cb15a605 --- /dev/null +++ b/www/community/frigate-hass-card/index-9bf80040.js @@ -0,0 +1,162 @@ +import{cL as e,cM as i,cN as t,cO as a,cP as r,cQ as o,l as s,_ as n,n as d,b as g,t as c,a as h,cR as l,cI as m,cS as v,cT as p,x as u,cU as C,cV as f,e as I,r as M,cW as _,cX as w,cY as b,cZ as y,c_ as L,c$ as A,d0 as D,d1 as $,d2 as j}from"./card-45855f1f.js";import{p as z,u as k,i as S,M as E,A as N,a as x,b as T}from"./media-1a34ac2c.js"; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Z=e(class extends i{constructor(){super(...arguments),this.key=t}render(e,i){return this.key=e,i}update(e,[i,t]){return i!==this.key&&(a(e),this.key=i),t}});class O{constructor(e){this._inBackground=!1,this._messageReceived=!1,this._lastMediaLoadedInfo=null,this._renderEpoch=0,this._handleMessage=e=>{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-c0a8dc12.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-28db7d93.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-05cdf58e.js")):"ha"===e?this._importPromises.push(import("./ha-1d1cb9a1.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-171319e4.js")):"image"===e?this._importPromises.push(import("./image-c0a8dc12.js")):"go2rtc"===e&&this._importPromises.push(import("./index-d3be62c7.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-0f7352bc.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/www/community/frigate-hass-card/index-9bf80040.js.gz b/www/community/frigate-hass-card/index-9bf80040.js.gz new file mode 100644 index 00000000..96cb34e4 Binary files /dev/null and b/www/community/frigate-hass-card/index-9bf80040.js.gz differ diff --git a/www/community/frigate-hass-card/index-a3bb8676.js b/www/community/frigate-hass-card/index-a3bb8676.js new file mode 100644 index 00000000..4f95ecba --- /dev/null +++ b/www/community/frigate-hass-card/index-a3bb8676.js @@ -0,0 +1 @@ +import{ds as e,dt as t,du as i,dv as s,a as n,di as o,l as a,cP as c,x as r,r as h,_ as d,n as l,b as p,t as m}from"./card-320adb66.js";import{s as u,h as v,c as y,d as g}from"./dispatch-live-error-c649b480.js";import{c as f}from"./endpoint-a6d38c7a.js";import"./image-88fcb8ac.js";import{m as b}from"./audio-cf3a75aa.js";import{g as w}from"./get-technology-for-video-rtc-778a0c05.js";class S extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),u(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:b(this.video)},technology:w(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{u(this.video,!1),this.video.poster="data:image/jpeg;base64,"+S.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),u(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+S.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const G=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let W=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await k(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-4bbb911f.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-56de395a.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-d03277e7.js")):"ha"===e?this._importPromises.push(import("./ha-bcde5927.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-5b90708c.js")):"image"===e?this._importPromises.push(import("./image-4bbb911f.js")):"go2rtc"===e&&this._importPromises.push(import("./index-19e17297.js")),S(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=G(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],W.prototype,"hass",void 0),n([d({attribute:!1})],W.prototype,"cameraConfig",void 0),n([d({attribute:!1})],W.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],W.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],W.prototype,"load",void 0),n([d({attribute:!1})],W.prototype,"label",void 0),n([d({attribute:!1})],W.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],W.prototype,"microphoneStream",void 0),n([d({attribute:!1})],W.prototype,"zoomSettings",void 0),n([g()],W.prototype,"_isVideoMediaLoaded",void 0),W=n([c("frigate-card-live-provider")],W);const U="frigate-card-live-provider";let B=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new N,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:U,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[x({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),T(),P()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(U);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getSubstreamCameraID(e,i){return i?.context?.live?.overrides?.get(e)??e}_getCameraNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return{};const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);if(a<0)return{};const r=e[a>0?a-1:e.length-1],o=e[a+1{this._setViewCameraID(a?.id),D(e)}} + > + `}render(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.overriddenLiveConfig&&this.hass&&e&&this.cameraManager))return;const[i,t]=this._getSlides();if(this._cameraToSlide=t,!i.length)return;const a=i.length>1,r=this._getCameraNeighbors(),o=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + ${this._renderNextPrevious("left",r)} + + ${i} + + ${this._renderNextPrevious("right",r)} + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"viewFilterCameraID",void 0),n([g()],B.prototype,"_mediaHasLoaded",void 0),B=n([c("frigate-card-live-carousel")],B);let V=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-a4c182ec.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live-grid")],V);let Y=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(z)}};n([d({attribute:!1})],Y.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],Y.prototype,"hass",void 0),n([d({attribute:!1})],Y.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],Y.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],Y.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],Y.prototype,"overrides",void 0),n([d({attribute:!1})],Y.prototype,"cameraManager",void 0),n([d({attribute:!1})],Y.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],Y.prototype,"microphoneManager",void 0),n([d({attribute:!1})],Y.prototype,"triggeredCameraIDs",void 0),Y=n([c("frigate-card-live")],Y);var R=Object.freeze({__proto__:null,get FrigateCardLive(){return Y}});export{G as g,R as i}; diff --git a/www/community/frigate-hass-card/index-add135a5.js.gz b/www/community/frigate-hass-card/index-add135a5.js.gz new file mode 100644 index 00000000..75a6ae0e Binary files /dev/null and b/www/community/frigate-hass-card/index-add135a5.js.gz differ diff --git a/www/community/frigate-hass-card/index-b82fe5da.js b/www/community/frigate-hass-card/index-b82fe5da.js new file mode 100644 index 00000000..d8426aa6 --- /dev/null +++ b/www/community/frigate-hass-card/index-b82fe5da.js @@ -0,0 +1,154 @@ +import{cL as e,_ as i,n as a,b as t,t as r,a as o,cM as s,cI as n,cN as d,cO as g,x as c,cP as h,l,cQ as m,e as v,r as p,cR as u,cS as C,cT as f,cU as I,cV as M,cW as _,cX as w,cY as b,cZ as y,c_ as L}from"./card-0be2c6a9.js";import{p as A,u as D,i as $,d as j,M as z,A as E,a as S,b as N}from"./dispatch-live-error-bba465cd.js";class k{constructor(e){this._inBackground=!1,this._lastMediaLoadedInfo=null,this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}isInBackground(){return this._inBackground}_intersectionHandler(i){const a=this._inBackground;this._inBackground=!i.some((e=>e.isIntersecting)),!this._inBackground&&this._lastMediaLoadedInfo&&e(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),a!==this._inBackground&&this._host.requestUpdate()}}let x=class extends o{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._hasProviderError=!1,this._refProvider=s(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await A(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":n.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!(!this.cameraConfig?.camera_entity||!this.hass||!this.liveConfig?.show_image_during_load||this._hasProviderError)}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}_providerErrorHandler(){this._hasProviderError=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,d(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-26186c3a.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-d7eed149.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-cc57bc74.js")):"ha"===e?this._importPromises.push(import("./ha-f54d281b.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-169f46d7.js")):"image"===e?this._importPromises.push(import("./image-26186c3a.js")):"go2rtc"===e&&this._importPromises.push(import("./index-c1383f43.js")),D(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=g({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?c` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),a={hidden:i};if("ha"===e||"image"===e){if(!this.cameraConfig?.camera_entity)return j(this),h({message:l("error.no_live_camera"),type:"error",icon:"mdi:camera",context:this.cameraConfig});const e=this.hass.states[this.cameraConfig.camera_entity];if(!e)return j(this),h({message:l("error.live_camera_not_found"),type:"error",icon:"mdi:camera",context:this.cameraConfig});if("unavailable"===e.state)return j(this),d(this),h({message:`${l("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return c`${this._useZoomIfRequired(c` + ${i||"image"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${i=>{"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:c``} + ${"ha"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"go2rtc"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"webrtc-card"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"jsmpeg"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:c``} + `)} + ${i&&!this._isVideoMediaLoaded?c``:""} `}static get styles(){return p(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};i([a({attribute:!1})],x.prototype,"hass",void 0),i([a({attribute:!1})],x.prototype,"cameraConfig",void 0),i([a({attribute:!1})],x.prototype,"cameraEndpoints",void 0),i([a({attribute:!1})],x.prototype,"liveConfig",void 0),i([a({attribute:!0,type:Boolean})],x.prototype,"load",void 0),i([a({attribute:!1})],x.prototype,"label",void 0),i([a({attribute:!1})],x.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],x.prototype,"microphoneStream",void 0),i([a({attribute:!1})],x.prototype,"zoomSettings",void 0),i([t()],x.prototype,"_isVideoMediaLoaded",void 0),i([t()],x.prototype,"_hasProviderError",void 0),x=i([r("frigate-card-live-provider")],x);const P="frigate-card-live-provider";let T=class extends o{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=s(),this._refCarousel=s(),this._mediaActionsController=new z,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??n.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:P,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[E({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),S(),N()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),a=[],t={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(t[r]=a.length,a.push(n))}return[a,t]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,a){a instanceof HTMLSlotElement&&(a=a.assignedElements({flatten:!0})[0]);const t=a?.querySelector(P);t&&(t.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let a=null;try{a=C(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:f}).live}catch(e){return I(this,e)}const t=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return c` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${t?.title??""} + .liveConfig=${a} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>M(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getSubstreamCameraID(e,i){return i?.context?.live?.overrides?.get(e)??e}_getCameraNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return{};const a=this.viewFilterCameraID??i.camera,t=e.indexOf(a);if(t<0)return{};const r=e[t>0?t-1:e.length-1],o=e[t+1{this._setViewCameraID(t?.id),w(e)}} + > + `}render(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.overriddenLiveConfig&&this.hass&&e&&this.cameraManager))return;const[i,a]=this._getSlides();if(this._cameraToSlide=a,!i.length)return;const t=i.length>1,r=this._getCameraNeighbors(),o=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return c` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + ${this._renderNextPrevious("left",r)} + + ${i} + + ${this._renderNextPrevious("right",r)} + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return p(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};i([a({attribute:!1})],T.prototype,"hass",void 0),i([a({attribute:!1})],T.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],T.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],T.prototype,"overrides",void 0),i([a({attribute:!1})],T.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],T.prototype,"cameraManager",void 0),i([a({attribute:!1})],T.prototype,"microphoneManager",void 0),i([a({attribute:!1})],T.prototype,"viewFilterCameraID",void 0),i([t()],T.prototype,"_mediaHasLoaded",void 0),T=i([r("frigate-card-live-carousel")],T);let Z=class extends o{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),a=e??i?.camera;return c` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-5cef81cf.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?c` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return p(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};i([a({attribute:!1})],Z.prototype,"hass",void 0),i([a({attribute:!1})],Z.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],Z.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],Z.prototype,"overrides",void 0),i([a({attribute:!1})],Z.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],Z.prototype,"cameraManager",void 0),i([a({attribute:!1})],Z.prototype,"microphoneManager",void 0),i([a({attribute:!1})],Z.prototype,"triggeredCameraIDs",void 0),Z=i([r("frigate-card-live-grid")],Z);let G=class extends o{constructor(){super(...arguments),this._controller=new k(this)}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return c` + + + `}static get styles(){return p(L)}};i([a({attribute:!1})],G.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"hass",void 0),i([a({attribute:!1})],G.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],G.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],G.prototype,"overrides",void 0),i([a({attribute:!1})],G.prototype,"cameraManager",void 0),i([a({attribute:!1})],G.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],G.prototype,"microphoneManager",void 0),i([a({attribute:!1})],G.prototype,"triggeredCameraIDs",void 0),G=i([r("frigate-card-live")],G);export{G as FrigateCardLive}; diff --git a/www/community/frigate-hass-card/index-b82fe5da.js.gz b/www/community/frigate-hass-card/index-b82fe5da.js.gz new file mode 100644 index 00000000..082b0a20 Binary files /dev/null and b/www/community/frigate-hass-card/index-b82fe5da.js.gz differ diff --git a/www/community/frigate-hass-card/index-befc50c0.js b/www/community/frigate-hass-card/index-befc50c0.js new file mode 100644 index 00000000..0085f319 --- /dev/null +++ b/www/community/frigate-hass-card/index-befc50c0.js @@ -0,0 +1,125 @@ +import{_ as e,n as i,b as t,t as a,a as r,cL as s,dh as o,di as n,d5 as d,dj as l,dk as g,dl as h,dm as c,dn as u,dp as m,dq as v,d6 as C,cN as p,x as w,cU as f,dg as I,cP as M,dr as y,ds as _,dt as b,du as A,r as D,cQ as j,cH as k,dv as x,s as N,cV as T,cW as $,cO as z,l as L,cY as P,cZ as E}from"./card-e5d55e5b.js";import"./ha-hls-player-1787796f.js";import{p as Z,h as V,s as G,u as S,i as W,c as F,M as O,A as R,a as U,b as Y}from"./media-921a03ae.js";import{m as B}from"./audio-cf3a75aa.js";import{V as Q}from"./media-c9012082.js";let H=class extends r{constructor(){super(...arguments),this.load=!1,this._refFrigateCardMediaPlayer=s(),this._refVideoProvider=s(),this._refImageProvider=s(),this._url=null}async play(){await Z(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(V(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&G(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?o(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _switchToRelatedClipView(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.hass&&e&&this.cameraManager&&this.media&&n.isEvent(this.media)&&d.areEventQueries(e.query)))return;const i=e.query.clone();i.convertToClipsQueries();i.getQueries()&&await(this.viewManagerEpoch?.manager.setViewByParametersWithExistingQuery({params:{view:"media",query:i},queryExecutorOptions:{selectResult:{id:this.media.getID()??void 0},rejectResults:e=>!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){C(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-2b03f2ed.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=p({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>f(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):I({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"media",void 0),e([i({attribute:!1})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"load",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([t()],H.prototype,"_url",void 0),H=e([a("frigate-card-viewer-provider")],H);let q=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!i||!this._media)return;const t=("previous"===e?i.previous?.index:i.next?.index)??null;null!==t&&this._setViewSelectedIndex(t)},a=T(this),r="ltr"===a&&"left"===e||"rtl"===a&&"right"===e?"previous":"next";return w` {t(r),$(e)}} + >`}render(){const e=this._media?.length??0;if(!this._media||!e)return z({message:L("common.no_media"),type:"info",icon:"mdi:multimedia",...this.viewFilterCameraID&&{context:{camera_id:this.viewFilterCameraID}}});const i=this._media[this._selected]??this._media[e-1];if(!this.hass||!this.cameraManager||!i)return;const t=this._getMediaNeighbors(),a=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?this._renderNextPrevious("left",t):""} + ${W([this._media,a],(()=>this._getSlides()))} + ${this.showControls?this._renderNextPrevious("right",t):""} + + ${a?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);N(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:j})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"showControls",void 0),e([t()],q.prototype,"_selected",void 0),q=e([a("frigate-card-viewer-carousel")],q);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-82029e37.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return z({type:"info",message:L(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-befc50c0.js.gz b/www/community/frigate-hass-card/index-befc50c0.js.gz new file mode 100644 index 00000000..94655b73 Binary files /dev/null and b/www/community/frigate-hass-card/index-befc50c0.js.gz differ diff --git a/www/community/frigate-hass-card/index-c1383f43.js b/www/community/frigate-hass-card/index-c1383f43.js new file mode 100644 index 00000000..67da0671 --- /dev/null +++ b/www/community/frigate-hass-card/index-c1383f43.js @@ -0,0 +1 @@ +import{ds as e,dt as t,du as i,dv as s,a as n,di as o,l as a,cP as c,x as r,r as h,_ as d,n as l,b as p,t as m}from"./card-0be2c6a9.js";import{s as u,h as v,c as y,d as g}from"./dispatch-live-error-bba465cd.js";import{c as f}from"./endpoint-30ea0cd0.js";import"./image-8d44d210.js";import{m as b}from"./audio-cf3a75aa.js";import{g as w}from"./get-technology-for-video-rtc-778a0c05.js";class S extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),u(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:b(this.video)},technology:w(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{u(this.video,!1),this.video.poster="data:image/jpeg;base64,"+S.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),u(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+S.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;ethis.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),u(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:b(this.video)},technology:w(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{u(this.video,!1),this.video.poster="data:image/jpeg;base64,"+S.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),u(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+S.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;ethis.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}isInBackground(){return this._inBackground}_intersectionHandler(i){const a=this._inBackground;this._inBackground=!i.some((e=>e.isIntersecting)),!this._inBackground&&this._lastMediaLoadedInfo&&e(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),a!==this._inBackground&&this._host.requestUpdate()}}let x=class extends o{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._hasProviderError=!1,this._refProvider=s(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await A(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":n.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!(!this.cameraConfig?.camera_entity||!this.hass||!this.liveConfig?.show_image_during_load||this._hasProviderError)}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}_providerErrorHandler(){this._hasProviderError=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,d(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-c4c28ccb.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-2b03f2ed.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-1cb0aa9d.js")):"ha"===e?this._importPromises.push(import("./ha-45d9145a.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-bb4c56e2.js")):"image"===e?this._importPromises.push(import("./image-c4c28ccb.js")):"go2rtc"===e&&this._importPromises.push(import("./index-33ed76c0.js")),D(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=g({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?c` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),a={hidden:i};if("ha"===e||"image"===e||this.cameraConfig?.camera_entity&&this.cameraConfig.always_error_if_entity_unavailable){if(!this.cameraConfig?.camera_entity)return j(this),h({message:l("error.no_live_camera"),type:"error",icon:"mdi:camera",context:this.cameraConfig});const e=this.hass.states[this.cameraConfig.camera_entity];if(!e)return j(this),h({message:l("error.live_camera_not_found"),type:"error",icon:"mdi:camera",context:this.cameraConfig});if("unavailable"===e.state)return j(this),d(this),h({message:`${l("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return c`${this._useZoomIfRequired(c` + ${i||"image"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${i=>{"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:c``} + ${"ha"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"go2rtc"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"webrtc-card"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"jsmpeg"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:c``} + `)} + ${i&&!this._isVideoMediaLoaded?c``:""} `}static get styles(){return p(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nfrigate-card-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};i([a({attribute:!1})],x.prototype,"hass",void 0),i([a({attribute:!1})],x.prototype,"cameraConfig",void 0),i([a({attribute:!1})],x.prototype,"cameraEndpoints",void 0),i([a({attribute:!1})],x.prototype,"liveConfig",void 0),i([a({attribute:!0,type:Boolean})],x.prototype,"load",void 0),i([a({attribute:!1})],x.prototype,"label",void 0),i([a({attribute:!1})],x.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],x.prototype,"microphoneStream",void 0),i([a({attribute:!1})],x.prototype,"zoomSettings",void 0),i([t()],x.prototype,"_isVideoMediaLoaded",void 0),i([t()],x.prototype,"_hasProviderError",void 0),x=i([r("frigate-card-live-provider")],x);const P="frigate-card-live-provider";let T=class extends o{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=s(),this._refCarousel=s(),this._mediaActionsController=new z,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??n.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:P,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[E({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),S(),N()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),a=[],t={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(t[r]=a.length,a.push(n))}return[a,t]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,a){a instanceof HTMLSlotElement&&(a=a.assignedElements({flatten:!0})[0]);const t=a?.querySelector(P);t&&(t.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let a=null;try{a=C(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:f}).live}catch(e){return I(this,e)}const t=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return c` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${t?.title??""} + .liveConfig=${a} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>M(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getSubstreamCameraID(e,i){return i?.context?.live?.overrides?.get(e)??e}_getCameraNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return{};const a=this.viewFilterCameraID??i.camera,t=e.indexOf(a);if(t<0)return{};const r=e[t>0?t-1:e.length-1],o=e[t+1{this._setViewCameraID(t?.id),w(e)}} + > + `}render(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.overriddenLiveConfig&&this.hass&&e&&this.cameraManager))return;const[i,a]=this._getSlides();if(this._cameraToSlide=a,!i.length)return;const t=i.length>1,r=this._getCameraNeighbors(),o=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return c` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + ${this._renderNextPrevious("left",r)} + + ${i} + + ${this._renderNextPrevious("right",r)} + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return p(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};i([a({attribute:!1})],T.prototype,"hass",void 0),i([a({attribute:!1})],T.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],T.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],T.prototype,"overrides",void 0),i([a({attribute:!1})],T.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],T.prototype,"cameraManager",void 0),i([a({attribute:!1})],T.prototype,"microphoneManager",void 0),i([a({attribute:!1})],T.prototype,"viewFilterCameraID",void 0),i([t()],T.prototype,"_mediaHasLoaded",void 0),T=i([r("frigate-card-live-carousel")],T);let Z=class extends o{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),a=e??i?.camera;return c` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-82029e37.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?c` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return p(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};i([a({attribute:!1})],Z.prototype,"hass",void 0),i([a({attribute:!1})],Z.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],Z.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],Z.prototype,"overrides",void 0),i([a({attribute:!1})],Z.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],Z.prototype,"cameraManager",void 0),i([a({attribute:!1})],Z.prototype,"microphoneManager",void 0),i([a({attribute:!1})],Z.prototype,"triggeredCameraIDs",void 0),Z=i([r("frigate-card-live-grid")],Z);let G=class extends o{constructor(){super(...arguments),this._controller=new k(this)}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return c` + + + `}static get styles(){return p(L)}};i([a({attribute:!1})],G.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"hass",void 0),i([a({attribute:!1})],G.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],G.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],G.prototype,"overrides",void 0),i([a({attribute:!1})],G.prototype,"cameraManager",void 0),i([a({attribute:!1})],G.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],G.prototype,"microphoneManager",void 0),i([a({attribute:!1})],G.prototype,"triggeredCameraIDs",void 0),G=i([r("frigate-card-live")],G);export{G as FrigateCardLive}; diff --git a/www/community/frigate-hass-card/index-dd357256.js.gz b/www/community/frigate-hass-card/index-dd357256.js.gz new file mode 100644 index 00000000..ab0a7ba4 Binary files /dev/null and b/www/community/frigate-hass-card/index-dd357256.js.gz differ diff --git a/www/community/frigate-hass-card/index-e0b66e9f.js b/www/community/frigate-hass-card/index-e0b66e9f.js new file mode 100644 index 00000000..95bd8f9b --- /dev/null +++ b/www/community/frigate-hass-card/index-e0b66e9f.js @@ -0,0 +1 @@ +import{dw as e,dx as t,dy as i,dz as s,a as n,dm as o,cQ as a,l as c,x as r,r as d,_ as h,n as l,t as p}from"./card-09c4bade.js";import{g as u}from"./endpoint-e9cb8034.js";import{s as m,h as v,c as y}from"./media-aef44451.js";import"./image-1c1ebdfa.js";import{m as g}from"./audio-cf3a75aa.js";import{g as f}from"./get-technology-for-video-rtc-778a0c05.js";class b extends HTMLElement{constructor(){super(),this.DISCONNECT_TIMEOUT=5e3,this.RECONNECT_TIMEOUT=15e3,this.CODECS=["avc1.640029","avc1.64002A","avc1.640033","hvc1.1.6.L153.B0","mp4a.40.2","mp4a.40.5","flac","opus"],this.mode="webrtc,mse,hls,mjpeg",this.media="video,audio",this.background=!1,this.visibilityThreshold=0,this.visibilityCheck=!0,this.pcConfig={bundlePolicy:"max-bundle",iceServers:[{urls:"stun:stun.l.google.com:19302"}],sdpSemantics:"unified-plan"},this.wsState=WebSocket.CLOSED,this.pcState=WebSocket.CLOSED,this.video=null,this.ws=null,this.wsURL="",this.pc=null,this.connectTS=0,this.mseCodecs="",this.disconnectTID=0,this.reconnectTID=0,this.ondata=null,this.onmessage=null,this.microphoneStream=null,this.containingPlayer=null,this.controls=!0}reconnect(){this.wsState!==WebSocket.CLOSED?(this.ws?.addEventListener("close",(()=>this.onconnect())),this.ondisconnect()):(this.ondisconnect(),this.onconnect())}set src(e){"string"!=typeof e&&(e=e.toString()),e.startsWith("http")?e="ws"+e.substring(4):e.startsWith("/")&&(e="ws"+location.origin.substring(4)+e),this.wsURL=e,this.onconnect()}play(){}send(e){this.ws&&this.ws.send(JSON.stringify(e))}codecs(e){return this.CODECS.filter((e=>this.media.indexOf(e.indexOf("vc1")>0?"video":"audio")>=0)).filter((t=>e(`video/mp4; codecs="${t}"`))).join()}connectedCallback(){if(this.disconnectTID&&(clearTimeout(this.disconnectTID),this.disconnectTID=0),this.video){const e=this.video.seekable;e.length>0&&(this.video.currentTime=e.end(e.length-1)),this.play()}else this.oninit();this.onconnect()}disconnectedCallback(){this.background||this.disconnectTID||this.wsState===WebSocket.CLOSED&&this.pcState===WebSocket.CLOSED||(this.disconnectTID=setTimeout((()=>{this.reconnectTID&&(clearTimeout(this.reconnectTID),this.reconnectTID=0),this.disconnectTID=0,this.ondisconnect()}),this.DISCONNECT_TIMEOUT))}oninit(){this.video=document.createElement("video"),m(this.video,this.controls),this.video.playsInline=!0,this.video.preload="auto",this.video.style.display="block",this.video.style.width="100%",this.video.style.height="100%",this.appendChild(this.video),this.video.addEventListener("error",(e=>{this.ws&&this.wsState===WebSocket.OPEN&&this.ws.close()}));const n=window.navigator.userAgent.match(/Version\/(\d+).+Safari/);if(n){const e=n[1]<"13"?"mp4a.40.2":n[1]<"14"?"flac":"opus";this.CODECS.splice(this.CODECS.indexOf(e))}if(!this.background){if("hidden"in document&&this.visibilityCheck&&document.addEventListener("visibilitychange",(()=>{document.hidden?this.disconnectedCallback():this.isConnected&&this.connectedCallback()})),"IntersectionObserver"in window&&this.visibilityThreshold){new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?this.isConnected&&this.connectedCallback():this.disconnectedCallback()}))}),{threshold:this.visibilityThreshold}).observe(this)}this.video.onloadeddata=()=>{this.controls&&v(this.video,y),e(this,this.video,{player:this.containingPlayer,capabilities:{supports2WayAudio:!!this.pc,supportsPause:!0,hasAudio:g(this.video)},technology:f(this)})},this.video.onvolumechange=()=>t(this),this.video.onplay=()=>i(this),this.video.onpause=()=>s(this),this.video.muted=!0}}onconnect(){return!(!this.isConnected||!this.wsURL||this.ws||this.pc)&&(this.wsState=WebSocket.CONNECTING,this.connectTS=Date.now(),this.ws=new WebSocket(this.wsURL),this.ws.binaryType="arraybuffer",this.ws.addEventListener("open",(e=>this.onopen(e))),this.ws.addEventListener("close",(e=>this.onclose(e))),!0)}ondisconnect(){this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null),this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.getSenders().forEach((e=>{e.track&&e.track.stop()})),this.pc.close(),this.pc=null),this.video.src="",this.video.srcObject=null}onopen(){this.wsState=WebSocket.OPEN,this.ws.addEventListener("message",(e=>{if("string"==typeof e.data){const t=JSON.parse(e.data);for(const e in this.onmessage)this.onmessage[e](t)}else this.ondata(e.data)})),this.ondata=null,this.onmessage={};const e=[];return this.mode.indexOf("mse")>=0&&("MediaSource"in window||"ManagedMediaSource"in window)?(e.push("mse"),this.onmse()):this.mode.indexOf("hls")>=0&&this.video.canPlayType("application/vnd.apple.mpegurl")?(e.push("hls"),this.onhls()):this.mode.indexOf("mp4")>=0&&(e.push("mp4"),this.onmp4()),this.mode.indexOf("webrtc")>=0&&"RTCPeerConnection"in window&&(e.push("webrtc"),this.onwebrtc()),this.mode.indexOf("mjpeg")>=0&&(e.length?this.onmessage.mjpeg=t=>{"error"===t.type&&0===t.value.indexOf(e[0])&&this.onmjpeg()}:(e.push("mjpeg"),this.onmjpeg())),e}onclose(){if(this.wsState===WebSocket.CLOSED)return!1;this.wsState=WebSocket.CONNECTING,this.ws=null;const e=Math.max(this.RECONNECT_TIMEOUT-(Date.now()-this.connectTS),0);return this.reconnectTID=setTimeout((()=>{this.reconnectTID=0,this.onconnect()}),e),!0}onmse(){let e;if("ManagedMediaSource"in window){const t=window.ManagedMediaSource;e=new t,e.addEventListener("sourceopen",(()=>{this.send({type:"mse",value:this.codecs(t.isTypeSupported)})}),{once:!0}),this.video.disableRemotePlayback=!0,this.video.srcObject=e}else e=new MediaSource,e.addEventListener("sourceopen",(()=>{URL.revokeObjectURL(this.video.src),this.send({type:"mse",value:this.codecs(MediaSource.isTypeSupported)})}),{once:!0}),this.video.src=URL.createObjectURL(e),this.video.srcObject=null;this.play(),this.mseCodecs="",this.onmessage.mse=t=>{if("mse"!==t.type)return;this.mseCodecs=t.value;const i=e.addSourceBuffer(t.value);i.mode="segments",i.addEventListener("updateend",(()=>{if(!i.updating)try{if(n>0){const e=s.slice(0,n);n=0,i.appendBuffer(e)}else if(i.buffered&&i.buffered.length){const t=i.buffered.end(i.buffered.length-1)-15,s=i.buffered.start(0);t>s&&(i.remove(s,t),e.setLiveSeekableRange(t,t+15))}}catch(e){}}));const s=new Uint8Array(2097152);let n=0;this.ondata=e=>{if(i.updating||n>0){const t=new Uint8Array(e);s.set(t,n),n+=t.byteLength}else try{i.appendBuffer(e)}catch(e){}}}}onwebrtc(){const e=new RTCPeerConnection(this.pcConfig);e.addEventListener("icecandidate",(e=>{if(e.candidate&&this.mode.indexOf("webrtc/tcp")>=0&&"udp"===e.candidate.protocol)return;const t=e.candidate?e.candidate.toJSON().candidate:"";this.send({type:"webrtc/candidate",value:t})})),e.addEventListener("connectionstatechange",(()=>{if("connected"===e.connectionState){const t=e.getTransceivers().filter((e=>"recvonly"===e.currentDirection)).map((e=>e.receiver.track)),i=document.createElement("video");i.addEventListener("loadeddata",(()=>this.onpcvideo(i)),{once:!0}),i.srcObject=new MediaStream(t)}else"failed"!==e.connectionState&&"disconnected"!==e.connectionState||(e.close(),this.pcState=WebSocket.CLOSED,this.pc=null,this.onconnect())})),this.onmessage.webrtc=t=>{switch(t.type){case"webrtc/candidate":if(this.mode.indexOf("webrtc/tcp")>=0&&t.value.indexOf(" udp ")>0)return;e.addIceCandidate({candidate:t.value,sdpMid:"0"}).catch((e=>{console.warn(e)}));break;case"webrtc/answer":e.setRemoteDescription({type:"answer",sdp:t.value}).catch((e=>{console.warn(e)}));break;case"error":if(t.value.indexOf("webrtc/offer")<0)return;e.close()}},this.createOffer(e).then((e=>{this.send({type:"webrtc/offer",value:e.sdp})})),this.pcState=WebSocket.CONNECTING,this.pc=e}async createOffer(e){this.microphoneStream?.getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}));try{if(this.media.indexOf("microphone")>=0){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>{e.addTransceiver(t,{direction:"sendonly"})}))}}catch(e){console.warn(e)}for(const t of["video","audio"])this.media.indexOf(t)>=0&&e.addTransceiver(t,{direction:"recvonly"});const t=await e.createOffer();return await e.setLocalDescription(t),t}onpcvideo(e){if(this.pc){let t=0,i=0;const s=e.srcObject;s.getVideoTracks().length>0&&(t+=544),s.getAudioTracks().length>0&&(t+=258),this.mseCodecs.indexOf("hvc1.")>=0&&(i+=560),this.mseCodecs.indexOf("avc1.")>=0&&(i+=528),this.mseCodecs.indexOf("mp4a.")>=0&&(i+=257),t>=i?(this.video.srcObject=s,this.play(),this.pcState=WebSocket.OPEN,this.wsState=WebSocket.CLOSED,this.ws&&(this.ws.close(),this.ws=null)):(this.pcState=WebSocket.CLOSED,this.pc&&(this.pc.close(),this.pc=null))}e.srcObject=null}onmjpeg(){let t=!1;this.ondata=i=>{m(this.video,!1),this.video.poster="data:image/jpeg;base64,"+b.btoa(i),t||(t=!0,e(this,this.video,{player:this.containingPlayer,technology:["mjpeg"]}))},this.send({type:"mjpeg"})}onhls(){this.onmessage.hls=e=>{if("hls"!==e.type)return;const t="http"+this.wsURL.substring(2,this.wsURL.indexOf("/ws"))+"/hls/",i=e.value.replace("hls/",t);this.video.src="data:application/vnd.apple.mpegurl;base64,"+btoa(i),this.play()},this.send({type:"hls",value:this.codecs((e=>this.video.canPlayType(e)))})}onmp4(){const t=document.createElement("canvas");let i;const s=document.createElement("video");s.autoplay=!0,s.playsInline=!0,s.muted=!0,s.addEventListener("loadeddata",(n=>{i||(t.width=s.videoWidth,t.height=s.videoHeight,i=t.getContext("2d"),e(this,s,{player:this.containingPlayer,technology:["mp4"]})),i.drawImage(s,0,0,t.width,t.height),m(this.video,!1),this.video.poster=t.toDataURL("image/jpeg")})),this.ondata=e=>{s.src="data:video/mp4;base64,"+b.btoa(e)},this.send({type:"mp4",value:this.codecs(this.video.canPlayType)})}static btoa(e){const t=new Uint8Array(e),i=t.byteLength;let s="";for(let e=0;e!e.hasSelectedResult()}}))}async _setURL(){const e=this.media?.getContentID();if(!this.media||!e||!this.hass||this.viewerConfig?.lazy_load&&!this.load)return;let i=this.resolvedMediaCache?.get(e)??null;if(i||(i=await l(this.hass,e,this.resolvedMediaCache)),!i)return;const t=i.url;if(g(t))return void(this._url=h(this.hass,t));const a=this.cameraManager?.getStore().getCamera(this.media.getCameraID()),r=a?.getProxyConfig();if(r&&c(this.hass,r,"media")){if(r.dynamic){const e=t.split(/#/)[0];await u(this.hass,e,{sslVerification:r.ssl_verification,sslCiphers:r.ssl_ciphers,openLimit:0})}try{this._url=await m(this.hass,v(t))}catch(e){C(e)}}else this._url=t}willUpdate(e){if((e.has("load")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this._setURL().then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-d7eed149.js"),e.has("media")||e.has("cameraManager")){const e=this.media?.getCameraID(),i=e?this.cameraManager?.getStore().getCameraConfig(e):null;S(this,i?.dimensions?.layout),this.style.aspectRatio=p({ratio:i?.dimensions?.aspect_ratio})}}_useZoomIfRequired(e){if(!this.media)return e;const i=this.media.getCameraID(),t=this.media.getID()??void 0,a=this.cameraManager?.getStore().getCameraConfig(i),r=this.viewManagerEpoch?.manager.getView();return this.viewerConfig?.zoomable?w` a?.dimensions?.layout?{pan:a.dimensions.layout.pan,zoom:a.dimensions.layout.zoom}:void 0))} + .settings=${t?r?.context?.zoom?.[t]?.requested:void 0} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + @frigate-card:zoom:change=${e=>I(e,this.viewManagerEpoch?.manager,t)} + > + ${e} + `:e}render(){if(this.load&&this.media&&this.hass&&this.viewerConfig)return this._url?this._useZoomIfRequired(w` + ${n.isVideo(this.media)?this.media.getVideoContentType()===Q.HLS?w` + `:w` + + `:w`{this.viewerConfig?.snapshot_click_plays_clip&&this._switchToRelatedClipView()}} + @load=${e=>{y(this,e,{player:this,technology:["jpg"]})}} + />`} + `):f({cardWideConfig:this.cardWideConfig})}static get styles(){return D(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}')}};e([i({attribute:!1})],q.prototype,"hass",void 0),e([i({attribute:!1})],q.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],q.prototype,"media",void 0),e([i({attribute:!1})],q.prototype,"viewerConfig",void 0),e([i({attribute:!1})],q.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],q.prototype,"load",void 0),e([i({attribute:!1})],q.prototype,"cameraManager",void 0),e([i({attribute:!1})],q.prototype,"cardWideConfig",void 0),e([t()],q.prototype,"_url",void 0),q=e([a("frigate-card-viewer-provider")],q);let H=class extends r{constructor(){super(...arguments),this.showControls=!0,this._selected=0,this._media=null,this._mediaActionsController=new O,this._player=null,this._refCarousel=s()}updated(e){super.updated(e),e.has("viewManagerEpoch")&&this.viewManagerEpoch?.manager.getView()?.context?.mediaViewer!==this.viewManagerEpoch?.oldView?.context?.mediaViewer&&this._seekHandler(),!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&this._mediaActionsController.initialize(this._refCarousel.value)}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.viewerConfig?.transition_effect??k.media_viewer.transition_effect}_getPlugins(){return[R({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),U(),Y()]}_getMediaNeighbors(){const e=this._media?.length??0;if(!this._media)return null;const i=this._selected>0?this._selected-1:null,t=this._selected+1{if(!i||!this._media)return;const t=("previous"===e?i.previous?.index:i.next?.index)??null;null!==t&&this._setViewSelectedIndex(t)},a=N(this),r="ltr"===a&&"left"===e||"rtl"===a&&"right"===e?"previous":"next";return w` {t(r),z(e)}} + >`}render(){const e=this._media?.length??0;if(!this._media||!e)return $({message:L("common.no_media"),type:"info",icon:"mdi:multimedia",...this.viewFilterCameraID&&{context:{camera_id:this.viewFilterCameraID}}});const i=this._media[this._selected]??this._media[e-1];if(!this.hass||!this.cameraManager||!i)return;const t=this._getMediaNeighbors(),a=this.viewManagerEpoch?.manager.getView();return w` + {this._setViewSelectedIndex(e.detail.index)}} + @frigate-card:media:loaded=${e=>{this._player=e.detail.player??null,this._seekHandler()}} + @frigate-card:media:unloaded=${()=>{this._player=null}} + > + ${this.showControls?this._renderNextPrevious("left",t):""} + ${W([this._media,a],(()=>this._getSlides()))} + ${this.showControls?this._renderNextPrevious("right",t):""} + + ${a?w` + `:""} +
+ + +
+ `}async _seekHandler(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.context?.mediaViewer?.seek;if(!(this.hass&&i&&this._media&&this._player))return;const t=this._media[this._selected];if(!t)return;const a=t.includesTime(i);T(this,!a,"unseekable"),a||this._player.isPaused()?a&&this._player.isPaused()&&this._player.play():this._player.pause();const r=await(this.cameraManager?.getMediaSeekTime(t,i))??null;null!==r&&this._player.seek(r)}_renderMediaItem(e){const i=this.viewManagerEpoch?.manager.getView();return this.hass&&i&&this.viewerConfig?w`
+ +
`:null}static get styles(){return D(":host {\n position: relative;\n --video-max-height: none;\n}\n\n:host([unselected]) frigate-card-carousel,\n:host([unselected]) .seek-warning {\n pointer-events: none;\n}\n\n:host([unseekable]) frigate-card-carousel {\n filter: brightness(50%);\n}\n\n:host([unseekable]) .seek-warning {\n display: block;\n}\n\n.seek-warning {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n color: white;\n}\n\n.embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};e([i({attribute:!1})],H.prototype,"hass",void 0),e([i({attribute:!1})],H.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],H.prototype,"viewFilterCameraID",void 0),e([i({attribute:!1,hasChanged:j})],H.prototype,"viewerConfig",void 0),e([i({attribute:!1})],H.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],H.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],H.prototype,"cameraManager",void 0),e([i({attribute:!1})],H.prototype,"showControls",void 0),e([t()],H.prototype,"_selected",void 0),H=e([a("frigate-card-viewer-carousel")],H);let X=class extends r{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView()?.camera;return w` + + + `}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-5cef81cf.js")}_needsGrid(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return!!e?.isGrid()&&!!e?.supportsMultipleDisplayModes()&&(i?.size??0)>1}_gridSelectCamera(e){const i=this.viewManagerEpoch?.manager.getView();this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e,queryResults:i?.queryResults?.clone().promoteCameraSelectionToMainSelection(e)}})}render(){const e=this.viewManagerEpoch?.manager.getView(),i=e?.queryResults?.getCameraIDs();return i&&this._needsGrid()?w` + this._gridSelectCamera(e.detail.selected)} + > + ${[...i].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return D(E)}};e([i({attribute:!1})],X.prototype,"hass",void 0),e([i({attribute:!1})],X.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],X.prototype,"viewerConfig",void 0),e([i({attribute:!1})],X.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],X.prototype,"cardWideConfig",void 0),e([i({attribute:!1})],X.prototype,"cameraManager",void 0),X=e([a("frigate-card-viewer-grid")],X);let J=class extends r{render(){if(this.hass&&this.viewManagerEpoch&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.viewManagerEpoch.manager.getView()?.queryResults?.hasResults()){const e=!!this.viewManagerEpoch.manager.getView()?.context?.loading?.query;return $({type:"info",message:L(e?"error.awaiting_media":"common.no_media"),icon:"mdi:multimedia",dotdotdot:e})}return w` + `}}static get styles(){return D(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};e([i({attribute:!1})],J.prototype,"hass",void 0),e([i({attribute:!1})],J.prototype,"viewManagerEpoch",void 0),e([i({attribute:!1})],J.prototype,"viewerConfig",void 0),e([i({attribute:!1})],J.prototype,"resolvedMediaCache",void 0),e([i({attribute:!1})],J.prototype,"cameraManager",void 0),e([i({attribute:!1})],J.prototype,"cardWideConfig",void 0),J=e([a("frigate-card-viewer")],J);export{J as FrigateCardViewer}; diff --git a/www/community/frigate-hass-card/index-e376cdd8.js.gz b/www/community/frigate-hass-card/index-e376cdd8.js.gz new file mode 100644 index 00000000..4bfea450 Binary files /dev/null and b/www/community/frigate-hass-card/index-e376cdd8.js.gz differ diff --git a/www/community/frigate-hass-card/index-e610f971.js b/www/community/frigate-hass-card/index-e610f971.js new file mode 100644 index 00000000..37e75546 --- /dev/null +++ b/www/community/frigate-hass-card/index-e610f971.js @@ -0,0 +1,162 @@ +import{cL as e,cM as i,cN as t,cO as a,cP as r,cQ as o,l as s,_ as n,n as d,b as g,t as c,a as h,cR as l,cI as m,cS as v,cT as p,x as u,cU as C,cV as f,e as I,r as M,cW as _,cX as w,cY as b,cZ as y,c_ as L,c$ as A,d0 as D,d1 as $,d2 as j}from"./card-09c4bade.js";import{p as z,u as k,i as S,M as E,A as N,a as x,b as T}from"./media-aef44451.js"; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Z=e(class extends i{constructor(){super(...arguments),this.key=t}render(e,i){return this.key=e,i}update(e,[i,t]){return i!==this.key&&(a(e),this.key=i),t}});class O{constructor(e){this._inBackground=!1,this._messageReceived=!1,this._lastMediaLoadedInfo=null,this._renderEpoch=0,this._handleMessage=e=>{this._messageReceived=!0,this._inBackground&&(e.stopPropagation(),this._renderEpoch++)},this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}shouldUpdate(){return!(this._inBackground&&this._messageReceived)}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.addEventListener("frigate-card:message",this._handleMessage)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded),this._host.removeEventListener("frigate-card:message",this._handleMessage)}clearMessageReceived(){this._messageReceived=!1}isInBackground(){return this._inBackground}getRenderEpoch(){return this._renderEpoch}_intersectionHandler(e){const i=this._inBackground;this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceived||!this._lastMediaLoadedInfo||r(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),i!==this._inBackground&&this._host.requestUpdate()}}const P=(e,i,t)=>{if(!t?.camera_entity)return o(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a||(o(e,s("error.live_camera_not_found"),{context:t}),null)};let G=class extends h{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=l(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await z(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":m.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,v(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-cdeb2c7e.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-37e20bdd.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-fd152ef0.js")):"ha"===e?this._importPromises.push(import("./ha-a4f2c69e.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-a9018c5e.js")):"image"===e?this._importPromises.push(import("./image-cdeb2c7e.js")):"go2rtc"===e&&this._importPromises.push(import("./index-e0b66e9f.js")),k(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=p({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?u` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};if("ha"===e||"image"===e){const e=P(this,this.hass,this.cameraConfig);if(!e)return;if("unavailable"===e.state)return v(this),C({message:`${s("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return u`${this._useZoomIfRequired(u` + ${i||"image"===e?u` {"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:u``} + ${"ha"===e?u` + `:"go2rtc"===e?u` + `:"webrtc-card"===e?u` + `:"jsmpeg"===e?u` + `:u``} + `)} + ${i&&!this._isVideoMediaLoaded?u``:""} `}static get styles(){return M(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};n([d({attribute:!1})],G.prototype,"hass",void 0),n([d({attribute:!1})],G.prototype,"cameraConfig",void 0),n([d({attribute:!1})],G.prototype,"cameraEndpoints",void 0),n([d({attribute:!1})],G.prototype,"liveConfig",void 0),n([d({attribute:!0,type:Boolean})],G.prototype,"load",void 0),n([d({attribute:!1})],G.prototype,"label",void 0),n([d({attribute:!1})],G.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],G.prototype,"microphoneStream",void 0),n([d({attribute:!1})],G.prototype,"zoomSettings",void 0),n([g()],G.prototype,"_isVideoMediaLoaded",void 0),G=n([c("frigate-card-live-provider")],G);const W="frigate-card-live-provider";let U=class extends h{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=l(),this._refCarousel=l(),this._mediaActionsController=new E,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??m.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:W,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[N({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),x(),T()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),t=[],a={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(a[r]=t.length,t.push(n))}return[t,a]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(W);a&&(a.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let t=null;try{t=w(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:b}).live}catch(e){return y(this,e)}const a=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return u` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${a?.title??""} + .liveConfig=${t} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>L(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getCameraIDsOfNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return[null,null];const t=this.viewFilterCameraID??i.camera,a=e.indexOf(t);return a<0?[null,null]:[e[a>0?a-1:e.length-1],e[a+11,[r,o]=this._getCameraIDsOfNeighbors(),s=r?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(r,e)):null,n=o?this.cameraManager.getCameraMetadata(this._getSubstreamCameraID(o,e)):null,d=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return u` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + {this._setViewCameraID(r),A(e)}} + > + + ${i} + {this._setViewCameraID(o),A(e)}} + > + + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return M(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};n([d({attribute:!1})],U.prototype,"hass",void 0),n([d({attribute:!1})],U.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],U.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],U.prototype,"overrides",void 0),n([d({attribute:!1})],U.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],U.prototype,"cameraManager",void 0),n([d({attribute:!1})],U.prototype,"microphoneManager",void 0),n([d({attribute:!1})],U.prototype,"viewFilterCameraID",void 0),n([g()],U.prototype,"_mediaHasLoaded",void 0),U=n([c("frigate-card-live-carousel")],U);let B=class extends h{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),t=e??i?.camera;return u` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-ef47501a.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?u` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return M(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};n([d({attribute:!1})],B.prototype,"hass",void 0),n([d({attribute:!1})],B.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],B.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],B.prototype,"overrides",void 0),n([d({attribute:!1})],B.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],B.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],B.prototype,"cameraManager",void 0),n([d({attribute:!1})],B.prototype,"microphoneManager",void 0),n([d({attribute:!1})],B.prototype,"triggeredCameraIDs",void 0),B=n([c("frigate-card-live-grid")],B);let V=class extends h{constructor(){super(...arguments),this._controller=new O(this)}shouldUpdate(e){return this._controller.shouldUpdate()}willUpdate(){this._controller.clearMessageReceived()}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return u`${Z(this._controller.getRenderEpoch(),u` + + + `)}`}static get styles(){return M(j)}};n([d({attribute:!1})],V.prototype,"conditionsManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"hass",void 0),n([d({attribute:!1})],V.prototype,"viewManagerEpoch",void 0),n([d({attribute:!1})],V.prototype,"nonOverriddenLiveConfig",void 0),n([d({attribute:!1})],V.prototype,"overriddenLiveConfig",void 0),n([d({attribute:!1,hasChanged:_})],V.prototype,"overrides",void 0),n([d({attribute:!1})],V.prototype,"cameraManager",void 0),n([d({attribute:!1})],V.prototype,"cardWideConfig",void 0),n([d({attribute:!1})],V.prototype,"microphoneManager",void 0),n([d({attribute:!1})],V.prototype,"triggeredCameraIDs",void 0),V=n([c("frigate-card-live")],V);var Y=Object.freeze({__proto__:null,get FrigateCardLive(){return V}});export{P as g,Y as i}; diff --git a/www/community/frigate-hass-card/index-e610f971.js.gz b/www/community/frigate-hass-card/index-e610f971.js.gz new file mode 100644 index 00000000..287feb56 Binary files /dev/null and b/www/community/frigate-hass-card/index-e610f971.js.gz differ diff --git a/www/community/frigate-hass-card/index-ffb1be06.js b/www/community/frigate-hass-card/index-ffb1be06.js new file mode 100644 index 00000000..5d37d2b1 --- /dev/null +++ b/www/community/frigate-hass-card/index-ffb1be06.js @@ -0,0 +1,154 @@ +import{cL as e,_ as i,n as a,b as t,t as r,a as o,cM as s,cI as n,cN as d,cO as g,x as c,cP as h,l,cQ as m,e as v,r as p,cR as u,cS as C,cT as f,cU as I,cV as M,cW as _,cX as w,cY as b,cZ as y,c_ as L}from"./card-19444f74.js";import{p as A,u as D,i as $,d as j,M as z,A as E,a as S,b as N}from"./dispatch-live-error-65d9f8de.js";class k{constructor(e){this._inBackground=!1,this._lastMediaLoadedInfo=null,this._handleMediaLoaded=e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()},this._host=e,e.addController(this),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}hostConnected(){this._intersectionObserver.observe(this._host),this._host.addEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}hostDisconnected(){this._intersectionObserver.disconnect(),this._host.removeEventListener("frigate-card:media:loaded",this._handleMediaLoaded)}isInBackground(){return this._inBackground}_intersectionHandler(i){const a=this._inBackground;this._inBackground=!i.some((e=>e.isIntersecting)),!this._inBackground&&this._lastMediaLoadedInfo&&e(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),a!==this._inBackground&&this._host.requestUpdate()}}let x=class extends o{constructor(){super(...arguments),this.load=!1,this.label="",this._isVideoMediaLoaded=!1,this._hasProviderError=!1,this._refProvider=s(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await A(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":n.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!(!this.cameraConfig?.camera_entity||!this.hass||!this.liveConfig?.show_image_during_load||this._hasProviderError)}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}_providerErrorHandler(){this._hasProviderError=!0}willUpdate(e){if(e.has("load")&&(this.load||(this._isVideoMediaLoaded=!1,d(this))),e.has("liveConfig")&&(this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./image-5c577dc4.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-29d78c71.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./jsmpeg-11aa4937.js")):"ha"===e?this._importPromises.push(import("./ha-a94f6b28.js")):"webrtc-card"===e?this._importPromises.push(import("./webrtc-card-15844fc3.js")):"image"===e?this._importPromises.push(import("./image-5c577dc4.js")):"go2rtc"===e&&this._importPromises.push(import("./index-cdbe3e5e.js")),D(this,this.cameraConfig?.dimensions?.layout),this.style.aspectRatio=g({ratio:this.cameraConfig?.dimensions?.aspect_ratio})}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?c` this.cameraConfig?.dimensions?.layout?{pan:this.cameraConfig.dimensions.layout.pan,zoom:this.cameraConfig.dimensions.layout.zoom}:void 0))} + .settings=${this.zoomSettings} + @frigate-card:zoom:zoomed=${()=>this.setControls(!1)} + @frigate-card:zoom:unzoomed=${()=>this.setControls()} + > + ${e} + `:e}render(){if(!(this.load&&this.hass&&this.liveConfig&&this.cameraConfig))return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),a={hidden:i};if("ha"===e||"image"===e){if(!this.cameraConfig?.camera_entity)return j(this),h({message:l("error.no_live_camera"),type:"error",icon:"mdi:camera",context:this.cameraConfig});const e=this.hass.states[this.cameraConfig.camera_entity];if(!e)return j(this),h({message:l("error.live_camera_not_found"),type:"error",icon:"mdi:camera",context:this.cameraConfig});if("unavailable"===e.state)return j(this),d(this),h({message:`${l("error.live_camera_unavailable")}${this.label?`: ${this.label}`:""}`,type:"info",icon:"mdi:cctv-off",dotdotdot:!0})}return c`${this._useZoomIfRequired(c` + ${i||"image"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${i=>{"image"===e?this._videoMediaShowHandler():i.stopPropagation()}} + > + `:c``} + ${"ha"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"go2rtc"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"webrtc-card"===e?c`this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:"jsmpeg"===e?c` this._providerErrorHandler()} + @frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)} + > + `:c``} + `)} + ${i&&!this._isVideoMediaLoaded?c``:""} `}static get styles(){return p(':host {\n background-color: var(--primary-background-color);\n background-position: center;\n background-repeat: no-repeat;\n background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgaW5rc2NhcGU6dmVyc2lvbj0iMS4yLjIgKGIwYTg0ODY1NDEsIDIwMjItMTItMDEpIgogICBzb2RpcG9kaTpkb2NuYW1lPSJjYW1lcmEtaXJpcy5zdmciCiAgIGlkPSJzdmc0IgogICB2ZXJzaW9uPSIxLjEiCiAgIHZpZXdCb3g9IjAgMCAyNCAyNCIKICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiCiAgIHhtbG5zOnNvZGlwb2RpPSJodHRwOi8vc29kaXBvZGkuc291cmNlZm9yZ2UubmV0L0RURC9zb2RpcG9kaS0wLmR0ZCIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzOCIgLz4KICA8c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgaWQ9Im5hbWVkdmlldzYiCiAgICAgcGFnZWNvbG9yPSIjYjkzZTNlIgogICAgIGJvcmRlcmNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcm9wYWNpdHk9IjAuMjUiCiAgICAgaW5rc2NhcGU6c2hvd3BhZ2VzaGFkb3c9IjIiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuNjA3ODQzMTQiCiAgICAgaW5rc2NhcGU6cGFnZWNoZWNrZXJib2FyZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6ZGVza2NvbG9yPSIjZDFkMWQxIgogICAgIHNob3dncmlkPSJmYWxzZSIKICAgICBpbmtzY2FwZTp6b29tPSIyNi42MjUwNiIKICAgICBpbmtzY2FwZTpjeD0iLTEuOTM0MjY4IgogICAgIGlua3NjYXBlOmN5PSIxNS42ODA3MTYiCiAgICAgaW5rc2NhcGU6d2luZG93LXdpZHRoPSIzODQwIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjE1MjciCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjEwODAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjIyNyIKICAgICBpbmtzY2FwZTp3aW5kb3ctbWF4aW1pemVkPSIxIgogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9InN2ZzQiIC8+CiAgPGcKICAgICBpZD0iZzExMTkiCiAgICAgc3R5bGU9ImZpbGwtb3BhY2l0eTowLjA1O2ZpbGw6I2ZmZmZmZiI+CiAgICA8Y2lyY2xlCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eTowLjA1O3N0cm9rZS13aWR0aDoxLjM5NzI5IgogICAgICAgaWQ9InBhdGgxNzAiCiAgICAgICBjeD0iMTIiCiAgICAgICBjeT0iMTIiCiAgICAgICBpbmtzY2FwZTpsYWJlbD0iV2hpdGUgQmFja2dyb3VuZCIKICAgICAgIHI9IjExLjI1IiAvPgogICAgPHBhdGgKICAgICAgIGQ9Ik0gMTMuNzMwMDAxLDE1IDkuODMwMDAwMywyMS43NiBDIDEwLjUzLDIxLjkxIDExLjI1LDIyIDEyLDIyIGMgMi40MDAwMDEsMCA0LjYsLTAuODUgNi4zMiwtMi4yNSBMIDE0LjY2MDAwMSwxMy40IE0gMi40NjAwMDAzLDE1IGMgMC45MiwyLjkyIDMuMTUsNS4yNiA1Ljk5LDYuMzQgTCAxMi4xMiwxNSBtIC0zLjU3OTk5OTcsLTMgLTMuOSwtNi43NDk5OTk2IGMgLTEuNjQsMS43NDk5OTkgLTIuNjQsNC4xMzk5OTkzIC0yLjY0LDYuNzQ5OTk5NiAwLDAuNjggMC4wNywxLjM1IDAuMiwyIGggNy40OSBNIDIxLjgsOS45OTk5OTk3IEggMTQuMzEwMDAxIEwgMTQuNjAwMDAxLDEwLjUgMTkuMzYsMTguNzUgQyAyMSwxNi45NyAyMiwxNC42IDIyLDEyIDIyLDExLjMxIDIxLjkzLDEwLjY0IDIxLjgsOS45OTk5OTk3IG0gLTAuMjYsLTEgQyAyMC42Miw2LjA3MDAwMDUgMTguMzksMy43NDAwMDAyIDE1LjU1MDAwMSwyLjY2MDAwMDIgTCAxMS44OCw4Ljk5OTk5OTcgTSA5LjQwMDAwMDMsMTAuNSAxNC4xNzAwMDEsMi4yNDAwMDAyIGMgLTAuNywtMC4xNSAtMS40MjAwMDEsLTAuMjQgLTIuMTcwMDAxLC0wLjI0IC0yLjM5OTk5OTcsMCAtNC41OTk5OTk3LDAuODQgLTYuMzE5OTk5NywyLjI1MDAwMDMgbCAzLjY2LDYuMzQ5OTk5NSB6IgogICAgICAgaWQ9InBhdGgyIgogICAgICAgaW5rc2NhcGU6bGFiZWw9IklyaXMiCiAgICAgICBzdHlsZT0iZmlsbC1vcGFjaXR5OjAuMDU7ZmlsbDojZmZmZmZmIiAvPgogIDwvZz4KPC9zdmc+Cg==");\n background-size: 10%;\n background-position: center;\n}\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n position: relative;\n}\n\n.hidden {\n display: none;\n}\n\nha-icon {\n position: absolute;\n top: 10px;\n right: 10px;\n color: var(--primary-color);\n}')}};i([a({attribute:!1})],x.prototype,"hass",void 0),i([a({attribute:!1})],x.prototype,"cameraConfig",void 0),i([a({attribute:!1})],x.prototype,"cameraEndpoints",void 0),i([a({attribute:!1})],x.prototype,"liveConfig",void 0),i([a({attribute:!0,type:Boolean})],x.prototype,"load",void 0),i([a({attribute:!1})],x.prototype,"label",void 0),i([a({attribute:!1})],x.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],x.prototype,"microphoneStream",void 0),i([a({attribute:!1})],x.prototype,"zoomSettings",void 0),i([t()],x.prototype,"_isVideoMediaLoaded",void 0),i([t()],x.prototype,"_hasProviderError",void 0),x=i([r("frigate-card-live-provider")],x);const P="frigate-card-live-provider";let T=class extends o{constructor(){super(...arguments),this._cameraToSlide={},this._refPTZControl=s(),this._refCarousel=s(),this._mediaActionsController=new z,this._mediaHasLoaded=!1}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){this._mediaActionsController.destroy(),super.disconnectedCallback()}_getTransitionEffect(){return this.overriddenLiveConfig?.transition_effect??n.live.transition_effect}_getSelectedCameraIndex(){if(this.viewFilterCameraID)return 0;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return e?.size&&i?Math.max(0,Array.from(e).indexOf(i.camera)):0}willUpdate(e){(e.has("microphoneManager")||e.has("overriddenLiveConfig"))&&this._mediaActionsController.setOptions({playerSelector:P,...this.overriddenLiveConfig?.auto_play&&{autoPlayConditions:this.overriddenLiveConfig.auto_play},...this.overriddenLiveConfig?.auto_pause&&{autoPauseConditions:this.overriddenLiveConfig.auto_pause},...this.overriddenLiveConfig?.auto_mute&&{autoMuteConditions:this.overriddenLiveConfig.auto_mute},...this.overriddenLiveConfig?.auto_unmute&&{autoUnmuteConditions:this.overriddenLiveConfig.auto_unmute},...(this.overriddenLiveConfig?.auto_unmute||this.overriddenLiveConfig?.auto_mute)&&{microphoneManager:this.microphoneManager,microphoneMuteSeconds:this.overriddenLiveConfig.microphone.mute_after_microphone_mute_seconds}})}_getPlugins(){return[E({...this.overriddenLiveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadConditions:this.overriddenLiveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),S(),N()]}_getLazyLoadCount(){return!1===this.overriddenLiveConfig?.lazy_load?null:0}_getSlides(){if(!this.cameraManager)return[[],{}];const e=this.viewManagerEpoch?.manager.getView(),i=this.viewFilterCameraID?new Set([this.viewFilterCameraID]):this.cameraManager?.getStore().getCameraIDsWithCapability("live"),a=[],t={};for(const[r,o]of this.cameraManager.getStore().getCameraConfigEntries(i)){const i=this._getSubstreamCameraID(r,e),s=r===i?o:this.cameraManager?.getStore().getCameraConfig(i),n=s?this._renderLive(i,s):null;n&&(t[r]=a.length,a.push(n))}return[a,t]}_setViewHandler(e){const i=this.cameraManager?.getStore().getCameraIDsWithCapability("live");i?.size&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID([...i][e.detail.index])}_setViewCameraID(e){e&&this.viewManagerEpoch?.manager.setViewByParametersWithNewQuery({params:{camera:e}})}_lazyloadOrUnloadSlide(e,i,a){a instanceof HTMLSlotElement&&(a=a.assignedElements({flatten:!0})[0]);const t=a?.querySelector(P);t&&(t.load="load"===e)}_renderLive(e,i){if(!(this.overriddenLiveConfig&&this.nonOverriddenLiveConfig&&this.hass&&this.cameraManager&&this.conditionsManagerEpoch))return;let a=null;try{a=C(this.conditionsManagerEpoch.manager,{live:this.nonOverriddenLiveConfig},{configOverrides:this.overrides,stateOverrides:{camera:e},schema:f}).live}catch(e){return I(this,e)}const t=this.cameraManager.getCameraMetadata(e),r=this.viewManagerEpoch?.manager.getView();return c` +
+ this.cameraManager?.getCameraEndpoints(e)??void 0))} + .label=${t?.title??""} + .liveConfig=${a} + .hass=${this.hass} + .cardWideConfig=${this.cardWideConfig} + .zoomSettings=${r?.context?.zoom?.[e]?.requested} + @frigate-card:zoom:change=${i=>M(i,this.viewManagerEpoch?.manager,e)} + > + +
+ `}_getSubstreamCameraID(e,i){return i?.context?.live?.overrides?.get(e)??e}_getCameraNeighbors(){const e=this.cameraManager?[...this.cameraManager?.getStore().getCameraIDsWithCapability("live")]:[],i=this.viewManagerEpoch?.manager.getView();if(this.viewFilterCameraID||e.length<=1||!i||!this.hass)return{};const a=this.viewFilterCameraID??i.camera,t=e.indexOf(a);if(t<0)return{};const r=e[t>0?t-1:e.length-1],o=e[t+1{this._setViewCameraID(t?.id),w(e)}} + > + `}render(){const e=this.viewManagerEpoch?.manager.getView();if(!(this.overriddenLiveConfig&&this.hass&&e&&this.cameraManager))return;const[i,a]=this._getSlides();if(this._cameraToSlide=a,!i.length)return;const t=i.length>1,r=this._getCameraNeighbors(),o=!(!this._mediaHasLoaded||this.viewFilterCameraID&&this.viewFilterCameraID!==e.camera||!1===e.context?.ptzControls?.enabled)&&e.context?.ptzControls?.enabled;return c` + {this._mediaHasLoaded=!0}} + @frigate-card:media:unloaded=${()=>{this._mediaHasLoaded=!1}} + > + ${this._renderNextPrevious("left",r)} + + ${i} + + ${this._renderNextPrevious("right",r)} + + + + `}_setMediaTarget(){const e=this.viewManagerEpoch?.manager.getView(),i=this._getSelectedCameraIndex();this.viewFilterCameraID?this._mediaActionsController.setTarget(i,e?.camera===this.viewFilterCameraID):this._mediaActionsController.setTarget(i,!0)}updated(e){super.updated(e);let i=!1;!this._mediaActionsController.hasRoot()&&this._refCarousel.value&&(this._mediaActionsController.initialize(this._refCarousel.value),i=!0),(i||e.has("viewManagerEpoch"))&&this._setMediaTarget()}static get styles(){return p(":host {\n display: block;\n --video-max-height: none;\n}\n\n:host(:not([grid-id])) {\n height: 100%;\n}\n\n:host([unselected]) frigate-card-carousel {\n pointer-events: none;\n}\n\n.embla__slide {\n display: flex;\n justify-content: center;\n height: 100%;\n flex: 0 0 100%;\n}")}};i([a({attribute:!1})],T.prototype,"hass",void 0),i([a({attribute:!1})],T.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],T.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],T.prototype,"overrides",void 0),i([a({attribute:!1})],T.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],T.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],T.prototype,"cameraManager",void 0),i([a({attribute:!1})],T.prototype,"microphoneManager",void 0),i([a({attribute:!1})],T.prototype,"viewFilterCameraID",void 0),i([t()],T.prototype,"_mediaHasLoaded",void 0),T=i([r("frigate-card-live-carousel")],T);let Z=class extends o{_renderCarousel(e){const i=this.viewManagerEpoch?.manager.getView(),a=e??i?.camera;return c` + + + `}_gridSelectCamera(e){this.viewManagerEpoch?.manager.setViewByParameters({params:{camera:e}})}_needsGrid(){const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live"),i=this.viewManagerEpoch?.manager.getView();return!!i?.isGrid()&&!!i?.supportsMultipleDisplayModes()&&!!e&&e.size>1}willUpdate(e){e.has("viewManagerEpoch")&&this._needsGrid()&&import("./media-grid-7b38fd80.js")}render(){if(!this.conditionsManagerEpoch||!this.nonOverriddenLiveConfig)return;const e=this.cameraManager?.getStore().getCameraIDsWithCapability("live");return e?.size&&this._needsGrid()?c` + this._gridSelectCamera(e.detail.selected)} + > + ${[...e].map((e=>this._renderCarousel(e)))} + + `:this._renderCarousel()}static get styles(){return p(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n@keyframes warning-pulse {\n 0% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n 50% {\n border: solid 2px var(--frigate-card-triggered-color-2, var(--warning-color));\n }\n 100% {\n border: solid 2px var(--frigate-card-triggered-color-1, rgba(0, 0, 0, 0));\n }\n}\nfrigate-card-live-carousel[triggered] {\n animation: warning-pulse 5s infinite;\n}\n\nfrigate-card-live-carousel[selected] {\n --frigate-card-triggered-color-1: var(--primary-color);\n}")}};i([a({attribute:!1})],Z.prototype,"hass",void 0),i([a({attribute:!1})],Z.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],Z.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],Z.prototype,"overrides",void 0),i([a({attribute:!1})],Z.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],Z.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],Z.prototype,"cameraManager",void 0),i([a({attribute:!1})],Z.prototype,"microphoneManager",void 0),i([a({attribute:!1})],Z.prototype,"triggeredCameraIDs",void 0),Z=i([r("frigate-card-live-grid")],Z);let G=class extends o{constructor(){super(...arguments),this._controller=new k(this)}render(){if(this.hass&&this.nonOverriddenLiveConfig&&this.cameraManager)return c` + + + `}static get styles(){return p(L)}};i([a({attribute:!1})],G.prototype,"conditionsManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"hass",void 0),i([a({attribute:!1})],G.prototype,"viewManagerEpoch",void 0),i([a({attribute:!1})],G.prototype,"nonOverriddenLiveConfig",void 0),i([a({attribute:!1})],G.prototype,"overriddenLiveConfig",void 0),i([a({attribute:!1,hasChanged:u})],G.prototype,"overrides",void 0),i([a({attribute:!1})],G.prototype,"cameraManager",void 0),i([a({attribute:!1})],G.prototype,"cardWideConfig",void 0),i([a({attribute:!1})],G.prototype,"microphoneManager",void 0),i([a({attribute:!1})],G.prototype,"triggeredCameraIDs",void 0),G=i([r("frigate-card-live")],G);export{G as FrigateCardLive}; diff --git a/www/community/frigate-hass-card/index-ffb1be06.js.gz b/www/community/frigate-hass-card/index-ffb1be06.js.gz new file mode 100644 index 00000000..b19144e6 Binary files /dev/null and b/www/community/frigate-hass-card/index-ffb1be06.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-05cdf58e.js b/www/community/frigate-hass-card/jsmpeg-05cdf58e.js new file mode 100644 index 00000000..ae20ce44 --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-05cdf58e.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-45855f1f.js";import{g as c}from"./endpoint-f74ef6db.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-05cdf58e.js.gz b/www/community/frigate-hass-card/jsmpeg-05cdf58e.js.gz new file mode 100644 index 00000000..9fae1f12 Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-05cdf58e.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-11aa4937.js b/www/community/frigate-hass-card/jsmpeg-11aa4937.js new file mode 100644 index 00000000..8727b53c --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-11aa4937.js @@ -0,0 +1,12 @@ +import{dx as A,eK as t,dz as i,eL as e,a as s,dA as o,du as g,dv as I,ds as a,l as B,cP as r,x as C,dh as n,r as E,_ as Q,n as h,b as d,t as c}from"./card-19444f74.js";import{d as l}from"./dispatch-live-error-65d9f8de.js";import{c as u}from"./endpoint-cd945bd3.js";function w(){return w=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,f=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var y="WJ3NAvwFY9",R="tR2-0dd-e1",k="ZgIIHVSSYI",b="kAA8SjbHe2",S="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var G=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,l=void 0===c||c,u=s.picMode,p=void 0!==u&&u,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=w({videoUrl:t,canvas:g,poster:a,picMode:p,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:l,progressive:f,chunkSize:R,hooks:w({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:D(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=D(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(y),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=w(this.options,{canvas:this.els.canvas});var t=w({},this.options,{autoplay:!1});if(this.player=new Z(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(S),A.els.poster&&A.els.poster.classList.add(S),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(S),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(S),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(R),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(S),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(b),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(k),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return f((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(S),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),F=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},M=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=F(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=F()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),U=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),J=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();J.MODE={EVICT:1,EXPAND:2};var T=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new J(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new J(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();T.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var v=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),x=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?J.MODE.EVICT:J.MODE.EXPAND;return i.bits=new J(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}p(t,A);var i=t.prototype;return i.write=function(A,i){if(v.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=F();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,D=p+(m=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,D|=(p=s[C]+s[C+o])+m+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,D|=p+(m=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,D|=p+m+2<<22&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else for(;n>1&255,D=p+(m=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,D|=(p=s[C++])+m+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,D|=p+(m=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,D|=(p=s[C++])+m+1<<23&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,D=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,D|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,D|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,D|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(v);x.prototype.frameRate=30,x.prototype.currentY=null,x.prototype.currentCr=null,x.prototype.currentCb=null,x.prototype.pictureType=0,x.prototype.forwardY=null,x.prototype.forwardCr=null,x.prototype.forwardCb=null,x.prototype.fullPelForward=!1,x.prototype.forwardFCode=0,x.prototype.forwardRSize=0,x.prototype.forwardF=0,x.prototype.quantizerScale=0,x.prototype.sliceBegin=!1,x.prototype.macroblockAddress=0,x.prototype.mbRow=0,x.prototype.mbCol=0,x.prototype.macroblockType=0,x.prototype.macroblockIntra=!1,x.prototype.macroblockMotFw=!1,x.prototype.motionFwH=0,x.prototype.motionFwV=0,x.prototype.motionFwHPrev=0,x.prototype.motionFwVPrev=0,x.prototype.dcPredictorY=0,x.prototype.dcPredictorCr=0,x.prototype.dcPredictorCb=0,x.prototype.blockData=null,x.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],x.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),x.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),x.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),x.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),x.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),x.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),x.MACROBLOCK_TYPE=[null,x.MACROBLOCK_TYPE_INTRA,x.MACROBLOCK_TYPE_PREDICTIVE,x.MACROBLOCK_TYPE_B],x.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),x.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),x.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),x.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),x.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),x.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},x.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(v),H=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?J.MODE.EVICT:J.MODE.EXPAND;e.bits=new J(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}p(t,A);var i=t.prototype;return i.decode=function(){var A=F(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),m=A[9][t]+A[22][t],D=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+m,m=1.72244709824*(d-m),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+m,M=.601344886935*(M-m),m=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+m,m=1.30656296488*(w-m),w=b+G,G=.707106781187*(b-G),b=n+m,m=.707106781187*(n-m),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=m,b+=n+=R,n+=G,G+=R+=N,R+=m,m+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+D,D=1.72244709824*(c-D),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+D,I=.601344886935*(I-D),D=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+D,D=1.30656296488*(u-D),u=C+F,F=.707106781187*(C-F),C=c+D,D=.707106781187*(c-D),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=D,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=D,E+=h,h+=D+=o,D+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-m,i[e+10]=m,i[e+21]=-D,i[e+11]=D,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(v);H.FRAME_SYNC=2047,H.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},H.LAYER={III:1,II:2,I:3},H.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},H.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),H.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),H.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),H.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),H.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],H.QUANT_TAB={A:91,B:94,C:8,D:12},H.QUANT_LUT_STEP_2=[[H.QUANT_TAB.C,H.QUANT_TAB.C,H.QUANT_TAB.D],[H.QUANT_TAB.A,H.QUANT_TAB.A,H.QUANT_TAB.A],[H.QUANT_TAB.B,H.QUANT_TAB.A,H.QUANT_TAB.B]],H.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],H.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],H.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var P=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.sampleRate=0,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();_.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var O=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),M(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var D=A[C++],f=A[C++];e[d]=D+g,e[d+1]=D-I,e[d+2]=D+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),K=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=F();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),j={Player:Z,VideoElement:G,BitBuffer:J,Source:{Ajax:N,AjaxProgressive:L,WebSocket:U,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:T},Decoder:{Base:v,MPEG1Video:x,MPEG1VideoWASM:Y,MP2Audio:H,MP2AudioWASM:P},Renderer:{WebGL:_,Canvas2D:O},AudioOutput:{WebAudio:K},WASMModule:X,Now:F,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const $=A=>!e(A)&&"function"==typeof A.then,AA=1073741823;const tA=A(class extends t{constructor(){super(...arguments),this._$Cwt=AA,this._$Cbt=[],this._$CK=new V(this),this._$CX=new z}render(...A){return A.find((A=>!$(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!$(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&eA.has(t)))&&(this._message=null)}async _createJSMPEGPlayer(A){this._jsmpegVideoPlayer=await new Promise((t=>{let i=!1;const e=new j.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._message=null,this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return this._message={message:B("error.live_camera_no_endpoint"),type:"error",context:this.cameraConfig},void l(this);const t=await u(this.hass,A,86400);if(!t)return this._message={type:"error",message:B("error.failed_sign"),context:this.cameraConfig},void l(this);await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate()))}render(){if(this._message)return r(this._message);return C`${tA((async()=>{if(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement)return C`${this._jsmpegCanvasElement}`;this._message||(this._message={message:B("error.jsmpeg_no_player"),type:"error",context:this.cameraConfig},l(this))})(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],iA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],iA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],iA.prototype,"cardWideConfig",void 0),Q([d()],iA.prototype,"_message",void 0),iA=Q([c("frigate-card-live-jsmpeg")],iA);export{iA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-11aa4937.js.gz b/www/community/frigate-hass-card/jsmpeg-11aa4937.js.gz new file mode 100644 index 00000000..fff7e7ae Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-11aa4937.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-1cb0aa9d.js b/www/community/frigate-hass-card/jsmpeg-1cb0aa9d.js new file mode 100644 index 00000000..47a35a5f --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-1cb0aa9d.js @@ -0,0 +1,12 @@ +import{dw as A,eF as t,dy as i,eG as e,a as s,dz as o,dt as g,du as I,dr as a,l as B,cO as r,x as C,dg as n,r as E,_ as Q,n as h,b as d,t as c}from"./card-e5d55e5b.js";import{d as l}from"./media-921a03ae.js";import{c as u}from"./endpoint-c9cec68c.js";function w(){return w=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,f=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var y="WJ3NAvwFY9",R="tR2-0dd-e1",k="ZgIIHVSSYI",b="kAA8SjbHe2",G="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var S=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,l=void 0===c||c,u=s.picMode,p=void 0!==u&&u,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=w({videoUrl:t,canvas:g,poster:a,picMode:p,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:l,progressive:f,chunkSize:R,hooks:w({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:D(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=D(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(y),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=w(this.options,{canvas:this.els.canvas});var t=w({},this.options,{autoplay:!1});if(this.player=new Z(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(G),A.els.poster&&A.els.poster.classList.add(G),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(G),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(G),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(R),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(G),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(b),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(k),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return f((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(G),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),F=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},M=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=F(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=F()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),U=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),J=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();J.MODE={EVICT:1,EXPAND:2};var T=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new J(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new J(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();T.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var v=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),x=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?J.MODE.EVICT:J.MODE.EXPAND;return i.bits=new J(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}p(t,A);var i=t.prototype;return i.write=function(A,i){if(v.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=F();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,D=p+(m=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,D|=(p=s[C]+s[C+o])+m+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,D|=p+(m=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,D|=p+m+2<<22&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else for(;n>1&255,D=p+(m=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,D|=(p=s[C++])+m+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,D|=p+(m=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,D|=(p=s[C++])+m+1<<23&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,D=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,D|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,D|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,D|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(v);x.prototype.frameRate=30,x.prototype.currentY=null,x.prototype.currentCr=null,x.prototype.currentCb=null,x.prototype.pictureType=0,x.prototype.forwardY=null,x.prototype.forwardCr=null,x.prototype.forwardCb=null,x.prototype.fullPelForward=!1,x.prototype.forwardFCode=0,x.prototype.forwardRSize=0,x.prototype.forwardF=0,x.prototype.quantizerScale=0,x.prototype.sliceBegin=!1,x.prototype.macroblockAddress=0,x.prototype.mbRow=0,x.prototype.mbCol=0,x.prototype.macroblockType=0,x.prototype.macroblockIntra=!1,x.prototype.macroblockMotFw=!1,x.prototype.motionFwH=0,x.prototype.motionFwV=0,x.prototype.motionFwHPrev=0,x.prototype.motionFwVPrev=0,x.prototype.dcPredictorY=0,x.prototype.dcPredictorCr=0,x.prototype.dcPredictorCb=0,x.prototype.blockData=null,x.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],x.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),x.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),x.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),x.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),x.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),x.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),x.MACROBLOCK_TYPE=[null,x.MACROBLOCK_TYPE_INTRA,x.MACROBLOCK_TYPE_PREDICTIVE,x.MACROBLOCK_TYPE_B],x.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),x.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),x.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),x.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),x.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),x.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},x.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(v),H=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?J.MODE.EVICT:J.MODE.EXPAND;e.bits=new J(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}p(t,A);var i=t.prototype;return i.decode=function(){var A=F(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f,y,R,k,b,G,S,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),m=A[9][t]+A[22][t],D=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],G=1.48416461631*(A[12][t]-A[19][t]),S=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+S,S=.566944034816*(a-S),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+m,m=1.72244709824*(d-m),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+m,M=.601344886935*(M-m),m=S+f,f=.899976223136*(S-f),S=b+R,R=2.56291544774*(b-R),b=n+S,n=.541196100146*(n-S),S=w+m,m=1.30656296488*(w-m),w=b+S,S=.707106781187*(b-S),b=n+m,m=.707106781187*(n-m),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=m,b+=n+=R,n+=S,S+=R+=N,R+=m,m+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+G,C=.64682178336*(C-G),G=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+D,D=1.72244709824*(c-D),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+G,G=2.56291544774*(B-G),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+G,G=.541196100146*(c-G),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=G+k,L+=p+=k=.707106781187*(G-k),p+=c,G=c+k,c=o+u,o=.509795579104*(o-u),u=I+D,I=.601344886935*(I-D),D=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+D,D=1.30656296488*(u-D),u=C+F,F=.707106781187*(C-F),C=c+D,D=.707106781187*(c-D),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=D,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=G,G+=E+=D,E+=h,h+=D+=o,D+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-S,i[e+2]=S,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-G,i[e+5]=G,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-m,i[e+10]=m,i[e+21]=-D,i[e+11]=D,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(v);H.FRAME_SYNC=2047,H.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},H.LAYER={III:1,II:2,I:3},H.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},H.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),H.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),H.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),H.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),H.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],H.QUANT_TAB={A:91,B:94,C:8,D:12},H.QUANT_LUT_STEP_2=[[H.QUANT_TAB.C,H.QUANT_TAB.C,H.QUANT_TAB.D],[H.QUANT_TAB.A,H.QUANT_TAB.A,H.QUANT_TAB.A],[H.QUANT_TAB.B,H.QUANT_TAB.A,H.QUANT_TAB.B]],H.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],H.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],H.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var P=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.sampleRate=0,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();_.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var O=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),M(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var D=A[C++],f=A[C++];e[d]=D+g,e[d+1]=D-I,e[d+2]=D+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),K=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=F();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),j={Player:Z,VideoElement:S,BitBuffer:J,Source:{Ajax:N,AjaxProgressive:L,WebSocket:U,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:T},Decoder:{Base:v,MPEG1Video:x,MPEG1VideoWASM:Y,MP2Audio:H,MP2AudioWASM:P},Renderer:{WebGL:_,Canvas2D:O},AudioOutput:{WebAudio:K},WASMModule:X,Now:F,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const $=A=>!e(A)&&"function"==typeof A.then,AA=1073741823;const tA=A(class extends t{constructor(){super(...arguments),this._$Cwt=AA,this._$Cbt=[],this._$CK=new V(this),this._$CX=new z}render(...A){return A.find((A=>!$(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!$(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&eA.has(t)))&&(this._message=null)}async _createJSMPEGPlayer(A){this._jsmpegVideoPlayer=await new Promise((t=>{let i=!1;const e=new j.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._message=null,this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return this._message={message:B("error.live_camera_no_endpoint"),type:"error",context:this.cameraConfig},void l(this);const t=await u(this.hass,A,86400);if(!t)return this._message={type:"error",message:B("error.failed_sign"),context:this.cameraConfig},void l(this);await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate()))}render(){if(this._message)return r(this._message);return C`${tA((async()=>{if(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement)return C`${this._jsmpegCanvasElement}`;this._message||(this._message={message:B("error.jsmpeg_no_player"),type:"error",context:this.cameraConfig},l(this))})(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],iA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],iA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],iA.prototype,"cardWideConfig",void 0),Q([d()],iA.prototype,"_message",void 0),iA=Q([c("frigate-card-live-jsmpeg")],iA);export{iA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-1cb0aa9d.js.gz b/www/community/frigate-hass-card/jsmpeg-1cb0aa9d.js.gz new file mode 100644 index 00000000..b94a517f Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-1cb0aa9d.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-45778f1d.js b/www/community/frigate-hass-card/jsmpeg-45778f1d.js new file mode 100644 index 00000000..fa1a1a43 --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-45778f1d.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-7cd05290.js";import{g as c}from"./endpoint-760ea36f.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-45778f1d.js.gz b/www/community/frigate-hass-card/jsmpeg-45778f1d.js.gz new file mode 100644 index 00000000..7b712358 Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-45778f1d.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-50dde246.js b/www/community/frigate-hass-card/jsmpeg-50dde246.js new file mode 100644 index 00000000..4e26ebf4 --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-50dde246.js @@ -0,0 +1,12 @@ +import{dx as A,eK as t,dz as i,eL as e,a as s,dA as o,du as g,dv as I,ds as a,l as B,cP as r,x as C,dh as n,r as E,_ as Q,n as h,b as d,t as c}from"./card-320adb66.js";import{d as l}from"./dispatch-live-error-c649b480.js";import{c as u}from"./endpoint-a6d38c7a.js";function w(){return w=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,f=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var y="WJ3NAvwFY9",R="tR2-0dd-e1",k="ZgIIHVSSYI",b="kAA8SjbHe2",S="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var G=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,l=void 0===c||c,u=s.picMode,p=void 0!==u&&u,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=w({videoUrl:t,canvas:g,poster:a,picMode:p,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:l,progressive:f,chunkSize:R,hooks:w({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:D(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=D(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(y),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=w(this.options,{canvas:this.els.canvas});var t=w({},this.options,{autoplay:!1});if(this.player=new Z(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(S),A.els.poster&&A.els.poster.classList.add(S),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(S),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(S),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(R),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(S),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(b),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(k),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return f((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(S),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),F=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},M=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=F(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=F()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),U=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),J=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();J.MODE={EVICT:1,EXPAND:2};var T=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new J(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new J(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();T.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var v=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),x=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?J.MODE.EVICT:J.MODE.EXPAND;return i.bits=new J(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}p(t,A);var i=t.prototype;return i.write=function(A,i){if(v.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=F();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,D=p+(m=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,D|=(p=s[C]+s[C+o])+m+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,D|=p+(m=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,D|=p+m+2<<22&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else for(;n>1&255,D=p+(m=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,D|=(p=s[C++])+m+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,D|=p+(m=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,D|=(p=s[C++])+m+1<<23&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,D=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,D|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,D|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,D|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(v);x.prototype.frameRate=30,x.prototype.currentY=null,x.prototype.currentCr=null,x.prototype.currentCb=null,x.prototype.pictureType=0,x.prototype.forwardY=null,x.prototype.forwardCr=null,x.prototype.forwardCb=null,x.prototype.fullPelForward=!1,x.prototype.forwardFCode=0,x.prototype.forwardRSize=0,x.prototype.forwardF=0,x.prototype.quantizerScale=0,x.prototype.sliceBegin=!1,x.prototype.macroblockAddress=0,x.prototype.mbRow=0,x.prototype.mbCol=0,x.prototype.macroblockType=0,x.prototype.macroblockIntra=!1,x.prototype.macroblockMotFw=!1,x.prototype.motionFwH=0,x.prototype.motionFwV=0,x.prototype.motionFwHPrev=0,x.prototype.motionFwVPrev=0,x.prototype.dcPredictorY=0,x.prototype.dcPredictorCr=0,x.prototype.dcPredictorCb=0,x.prototype.blockData=null,x.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],x.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),x.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),x.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),x.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),x.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),x.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),x.MACROBLOCK_TYPE=[null,x.MACROBLOCK_TYPE_INTRA,x.MACROBLOCK_TYPE_PREDICTIVE,x.MACROBLOCK_TYPE_B],x.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),x.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),x.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),x.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),x.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),x.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},x.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(v),H=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?J.MODE.EVICT:J.MODE.EXPAND;e.bits=new J(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}p(t,A);var i=t.prototype;return i.decode=function(){var A=F(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),m=A[9][t]+A[22][t],D=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+m,m=1.72244709824*(d-m),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+m,M=.601344886935*(M-m),m=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+m,m=1.30656296488*(w-m),w=b+G,G=.707106781187*(b-G),b=n+m,m=.707106781187*(n-m),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=m,b+=n+=R,n+=G,G+=R+=N,R+=m,m+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+D,D=1.72244709824*(c-D),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+D,I=.601344886935*(I-D),D=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+D,D=1.30656296488*(u-D),u=C+F,F=.707106781187*(C-F),C=c+D,D=.707106781187*(c-D),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=D,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=D,E+=h,h+=D+=o,D+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-m,i[e+10]=m,i[e+21]=-D,i[e+11]=D,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(v);H.FRAME_SYNC=2047,H.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},H.LAYER={III:1,II:2,I:3},H.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},H.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),H.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),H.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),H.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),H.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],H.QUANT_TAB={A:91,B:94,C:8,D:12},H.QUANT_LUT_STEP_2=[[H.QUANT_TAB.C,H.QUANT_TAB.C,H.QUANT_TAB.D],[H.QUANT_TAB.A,H.QUANT_TAB.A,H.QUANT_TAB.A],[H.QUANT_TAB.B,H.QUANT_TAB.A,H.QUANT_TAB.B]],H.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],H.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],H.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var P=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.sampleRate=0,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();_.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var O=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),M(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var D=A[C++],f=A[C++];e[d]=D+g,e[d+1]=D-I,e[d+2]=D+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),K=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=F();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),j={Player:Z,VideoElement:G,BitBuffer:J,Source:{Ajax:N,AjaxProgressive:L,WebSocket:U,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:T},Decoder:{Base:v,MPEG1Video:x,MPEG1VideoWASM:Y,MP2Audio:H,MP2AudioWASM:P},Renderer:{WebGL:_,Canvas2D:O},AudioOutput:{WebAudio:K},WASMModule:X,Now:F,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const $=A=>!e(A)&&"function"==typeof A.then,AA=1073741823;const tA=A(class extends t{constructor(){super(...arguments),this._$Cwt=AA,this._$Cbt=[],this._$CK=new V(this),this._$CX=new z}render(...A){return A.find((A=>!$(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!$(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&eA.has(t)))&&(this._message=null)}async _createJSMPEGPlayer(A){this._jsmpegVideoPlayer=await new Promise((t=>{let i=!1;const e=new j.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._message=null,this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return this._message={message:B("error.live_camera_no_endpoint"),type:"error",context:this.cameraConfig},void l(this);const t=await u(this.hass,A,86400);if(!t)return this._message={type:"error",message:B("error.failed_sign"),context:this.cameraConfig},void l(this);await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate()))}render(){if(this._message)return r(this._message);return C`${tA((async()=>{if(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement)return C`${this._jsmpegCanvasElement}`;this._message||(this._message={message:B("error.jsmpeg_no_player"),type:"error",context:this.cameraConfig},l(this))})(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],iA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],iA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],iA.prototype,"cardWideConfig",void 0),Q([d()],iA.prototype,"_message",void 0),iA=Q([c("frigate-card-live-jsmpeg")],iA);export{iA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-50dde246.js.gz b/www/community/frigate-hass-card/jsmpeg-50dde246.js.gz new file mode 100644 index 00000000..ea779cd4 Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-50dde246.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-66c8006d.js b/www/community/frigate-hass-card/jsmpeg-66c8006d.js new file mode 100644 index 00000000..b076d34f --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-66c8006d.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-c642ee74.js";import{g as c}from"./endpoint-cc3caf82.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-66c8006d.js.gz b/www/community/frigate-hass-card/jsmpeg-66c8006d.js.gz new file mode 100644 index 00000000..48afac14 Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-66c8006d.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-cc57bc74.js b/www/community/frigate-hass-card/jsmpeg-cc57bc74.js new file mode 100644 index 00000000..6305d645 --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-cc57bc74.js @@ -0,0 +1,12 @@ +import{dx as A,eK as t,dz as i,eL as e,a as s,dA as o,du as g,dv as I,ds as a,l as B,cP as r,x as C,dh as n,r as E,_ as Q,n as h,b as d,t as c}from"./card-0be2c6a9.js";import{d as l}from"./dispatch-live-error-bba465cd.js";import{c as u}from"./endpoint-30ea0cd0.js";function w(){return w=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,f=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var y="WJ3NAvwFY9",R="tR2-0dd-e1",k="ZgIIHVSSYI",b="kAA8SjbHe2",S="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var G=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,l=void 0===c||c,u=s.picMode,p=void 0!==u&&u,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=w({videoUrl:t,canvas:g,poster:a,picMode:p,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:l,progressive:f,chunkSize:R,hooks:w({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:D(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=D(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(y),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=w(this.options,{canvas:this.els.canvas});var t=w({},this.options,{autoplay:!1});if(this.player=new Z(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(S),A.els.poster&&A.els.poster.classList.add(S),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(S),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(S),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(R),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(S),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(b),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(k),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return f((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(S),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),F=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},M=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=F(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=F()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),U=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),J=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();J.MODE={EVICT:1,EXPAND:2};var T=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new J(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new J(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();T.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var v=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),x=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?J.MODE.EVICT:J.MODE.EXPAND;return i.bits=new J(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}p(t,A);var i=t.prototype;return i.write=function(A,i){if(v.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=F();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,D=p+(m=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,D|=(p=s[C]+s[C+o])+m+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,D|=p+(m=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,D|=p+m+2<<22&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else for(;n>1&255,D=p+(m=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,D|=(p=s[C++])+m+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,D|=p+(m=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,D|=(p=s[C++])+m+1<<23&4278190080,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,D=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,D|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,D|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,D|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=D,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),M(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(v);x.prototype.frameRate=30,x.prototype.currentY=null,x.prototype.currentCr=null,x.prototype.currentCb=null,x.prototype.pictureType=0,x.prototype.forwardY=null,x.prototype.forwardCr=null,x.prototype.forwardCb=null,x.prototype.fullPelForward=!1,x.prototype.forwardFCode=0,x.prototype.forwardRSize=0,x.prototype.forwardF=0,x.prototype.quantizerScale=0,x.prototype.sliceBegin=!1,x.prototype.macroblockAddress=0,x.prototype.mbRow=0,x.prototype.mbCol=0,x.prototype.macroblockType=0,x.prototype.macroblockIntra=!1,x.prototype.macroblockMotFw=!1,x.prototype.motionFwH=0,x.prototype.motionFwV=0,x.prototype.motionFwHPrev=0,x.prototype.motionFwVPrev=0,x.prototype.dcPredictorY=0,x.prototype.dcPredictorCr=0,x.prototype.dcPredictorCb=0,x.prototype.blockData=null,x.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],x.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),x.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),x.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),x.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),x.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),x.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),x.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),x.MACROBLOCK_TYPE=[null,x.MACROBLOCK_TYPE_INTRA,x.MACROBLOCK_TYPE_PREDICTIVE,x.MACROBLOCK_TYPE_B],x.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),x.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),x.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),x.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),x.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),x.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},x.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(v),H=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?J.MODE.EVICT:J.MODE.EXPAND;e.bits=new J(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}p(t,A);var i=t.prototype;return i.decode=function(){var A=F(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=F()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,m,D,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),m=A[9][t]+A[22][t],D=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+m,m=1.72244709824*(d-m),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+m,M=.601344886935*(M-m),m=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+m,m=1.30656296488*(w-m),w=b+G,G=.707106781187*(b-G),b=n+m,m=.707106781187*(n-m),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=m,b+=n+=R,n+=G,G+=R+=N,R+=m,m+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+D,D=1.72244709824*(c-D),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+D,I=.601344886935*(I-D),D=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+D,D=1.30656296488*(u-D),u=C+F,F=.707106781187*(C-F),C=c+D,D=.707106781187*(c-D),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=D,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=D,E+=h,h+=D+=o,D+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-m,i[e+10]=m,i[e+21]=-D,i[e+11]=D,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(v);H.FRAME_SYNC=2047,H.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},H.LAYER={III:1,II:2,I:3},H.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},H.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),H.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),H.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),H.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),H.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],H.QUANT_TAB={A:91,B:94,C:8,D:12},H.QUANT_LUT_STEP_2=[[H.QUANT_TAB.C,H.QUANT_TAB.C,H.QUANT_TAB.D],[H.QUANT_TAB.A,H.QUANT_TAB.A,H.QUANT_TAB.A],[H.QUANT_TAB.B,H.QUANT_TAB.A,H.QUANT_TAB.B]],H.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],H.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],H.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var P=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?J.MODE.EVICT:J.MODE.EXPAND,i.sampleRate=0,i}p(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();_.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var O=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),M(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var D=A[C++],f=A[C++];e[d]=D+g,e[d+1]=D-I,e[d+2]=D+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),K=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=F();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),j={Player:Z,VideoElement:G,BitBuffer:J,Source:{Ajax:N,AjaxProgressive:L,WebSocket:U,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:T},Decoder:{Base:v,MPEG1Video:x,MPEG1VideoWASM:Y,MP2Audio:H,MP2AudioWASM:P},Renderer:{WebGL:_,Canvas2D:O},AudioOutput:{WebAudio:K},WASMModule:X,Now:F,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const $=A=>!e(A)&&"function"==typeof A.then,AA=1073741823;const tA=A(class extends t{constructor(){super(...arguments),this._$Cwt=AA,this._$Cbt=[],this._$CK=new V(this),this._$CX=new z}render(...A){return A.find((A=>!$(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!$(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&eA.has(t)))&&(this._message=null)}async _createJSMPEGPlayer(A){this._jsmpegVideoPlayer=await new Promise((t=>{let i=!1;const e=new j.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._message=null,this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return this._message={message:B("error.live_camera_no_endpoint"),type:"error",context:this.cameraConfig},void l(this);const t=await u(this.hass,A,86400);if(!t)return this._message={type:"error",message:B("error.failed_sign"),context:this.cameraConfig},void l(this);await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate()))}render(){if(this._message)return r(this._message);return C`${tA((async()=>{if(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement)return C`${this._jsmpegCanvasElement}`;this._message||(this._message={message:B("error.jsmpeg_no_player"),type:"error",context:this.cameraConfig},l(this))})(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],iA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],iA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],iA.prototype,"cardWideConfig",void 0),Q([d()],iA.prototype,"_message",void 0),iA=Q([c("frigate-card-live-jsmpeg")],iA);export{iA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-cc57bc74.js.gz b/www/community/frigate-hass-card/jsmpeg-cc57bc74.js.gz new file mode 100644 index 00000000..6490cf1a Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-cc57bc74.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-d03277e7.js b/www/community/frigate-hass-card/jsmpeg-d03277e7.js new file mode 100644 index 00000000..4dc91fbc --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-d03277e7.js @@ -0,0 +1,12 @@ +import{cL as A,eO as t,dD as i,eP as e,a as s,dE as o,dz as g,dA as I,dx as a,cQ as B,l as r,x as C,dm as n,r as E,_ as Q,n as h,t as d}from"./card-4e88bdfb.js";import{g as c}from"./endpoint-e6c464c5.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-d03277e7.js.gz b/www/community/frigate-hass-card/jsmpeg-d03277e7.js.gz new file mode 100644 index 00000000..9f746248 Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-d03277e7.js.gz differ diff --git a/www/community/frigate-hass-card/jsmpeg-fd152ef0.js b/www/community/frigate-hass-card/jsmpeg-fd152ef0.js new file mode 100644 index 00000000..1e8683cc --- /dev/null +++ b/www/community/frigate-hass-card/jsmpeg-fd152ef0.js @@ -0,0 +1,12 @@ +import{cL as A,eN as t,dC as i,eO as e,a as s,dD as o,dy as g,dz as I,dw as a,cQ as B,l as r,x as C,dl as n,r as E,_ as Q,n as h,t as d}from"./card-09c4bade.js";import{g as c}from"./endpoint-e9cb8034.js";function l(){return l=Object.assign?Object.assign.bind():function(A){for(var t=1;t"string"==typeof A&&A.constructor===String,D=function(A){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=A,"Promise"===Object.prototype.toString.call(t).slice(8,-1)?A:new Promise((t=>{A(),setTimeout(t,i)}))};var m="WJ3NAvwFY9",f="tR2-0dd-e1",y="ZgIIHVSSYI",R="kAA8SjbHe2",k="OueN4AU4CJ";!function(A,t){void 0===t&&(t={});var i=t.insertAt;if(A&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s),s.styleSheet?s.styleSheet.cssText=A:s.appendChild(document.createTextNode(A))}}(".WJ3NAvwFY9,.ZgIIHVSSYI,.kAA8SjbHe2,.tR2-0dd-e1{height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.ZgIIHVSSYI{-ms-flex-pack:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;justify-content:center}.WJ3NAvwFY9,.tR2-0dd-e1{display:block}.tR2-0dd-e1.OueN4AU4CJ{display:none}.ZgIIHVSSYI,.kAA8SjbHe2{-webkit-tap-highlight-color:rgba(255,0,0,0);cursor:pointer;opacity:.7}.OueN4AU4CJ.ZgIIHVSSYI,.OueN4AU4CJ.kAA8SjbHe2{display:none}.ZgIIHVSSYI{z-index:10}.ZgIIHVSSYI>svg{fill:#fff;height:12vw;max-height:60px;max-width:60px;width:12vw}.kAA8SjbHe2{-ms-flex-pack:end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;z-index:10}.kAA8SjbHe2>svg{fill:#fff;height:9vw;margin:0 15px 15px 0;max-height:40px;max-width:40px;width:9vw}");var b=function(){function A(A,t,i,e){var s=void 0===i?{}:i,o=s.canvas,g=void 0===o?"":o,I=s.poster,a=void 0===I?"":I,B=s.autoplay,r=void 0!==B&&B,C=s.autoSetWrapperSize,n=void 0!==C&&C,E=s.loop,Q=void 0!==E&&E,h=s.control,d=void 0===h||h,c=s.decodeFirstFrame,u=void 0===c||c,w=s.picMode,D=void 0!==w&&w,m=s.progressive,f=void 0===m||m,y=s.chunkSize,R=void 0===y?1048576:y,k=s.hooks,b=void 0===k?{}:k;void 0===e&&(e={}),this.options=l({videoUrl:t,canvas:g,poster:a,picMode:D,autoplay:r,autoSetWrapperSize:n,loop:Q,control:d,decodeFirstFrame:u,progressive:f,chunkSize:R,hooks:l({play:function(){},pause:function(){},stop:function(){},load:function(){}},b)},e),this.options.needPlayButton=this.options.control&&!this.options.picMode,this.player=null,this.els={wrapper:p(A)?document.querySelector(A):A,canvas:null,playButton:document.createElement("div"),unmuteButton:null,poster:null},"static"===window.getComputedStyle(this.els.wrapper).getPropertyValue("position")&&(this.els.wrapper.style.position="relative"),this.els.wrapper.clientRect=this.els.wrapper.getBoundingClientRect(),this.initCanvas(),this.initPlayButton(),this.initPlayer()}var t=A.prototype;return t.initCanvas=function(){this.options.canvas?this.els.canvas=p(this.options.canvas)?document.querySelector(this.options.canvas):this.options.canvas:(this.els.canvas=document.createElement("canvas"),this.els.canvas.classList.add(m),this.els.wrapper.appendChild(this.els.canvas))},t.initPlayer=function(){var A=this;this.options=l(this.options,{canvas:this.els.canvas});var t=l({},this.options,{autoplay:!1});if(this.player=new X(this.options.videoUrl,t,{play:function(){A.options.needPlayButton&&A.els.playButton.classList.add(k),A.els.poster&&A.els.poster.classList.add(k),A.options.hooks.play()},pause:function(){A.options.needPlayButton&&A.els.playButton.classList.remove(k),A.options.hooks.pause()},stop:function(){A.els.poster&&A.els.poster.classList.remove(k),A.options.hooks.stop()},load:function(){A.options.autoplay&&A.play(),A._autoSetWrapperSize(),A.options.hooks.load()}}),this._copyPlayerFuncs(),this.els.wrapper.playerInstance=this.player,!this.options.poster||this.options.autoplay||this.player.options.streaming||(this.options.decodeFirstFrame=!1,this.els.poster=new Image,this.els.poster.src=this.options.poster,this.els.poster.classList.add(f),this.els.wrapper.appendChild(this.els.poster)),this.player.options.streaming||this.els.wrapper.addEventListener("click",this.onClick.bind(this)),(this.options.autoplay||this.player.options.streaming)&&this.els.playButton.classList.add(k),this.player.audioOut&&!this.player.audioOut.unlocked){var i=this.els.wrapper;(this.options.autoplay||this.player.options.streaming)&&(this.els.unmuteButton=document.createElement("div"),this.els.unmuteButton.innerHTML='\n\n \n\n',this.els.unmuteButton.classList.add(R),this.els.wrapper.appendChild(this.els.unmuteButton),i=this.els.unmuteButton),this.unlockAudioBound=this.onUnlockAudio.bind(this,i),i.addEventListener("touchstart",this.unlockAudioBound,!1),i.addEventListener("click",this.unlockAudioBound,!0)}},t.initPlayButton=function(){this.options.needPlayButton&&(this.els.playButton.classList.add(y),this.els.playButton.innerHTML='\n\n \n\n',this.els.wrapper.appendChild(this.els.playButton))},t._autoSetWrapperSize=function(){var A=this;if(!this.options.autoSetWrapperSize)return Promise.resolve();var t=this.player.video.destination;return t?Promise.resolve().then((function(){return D((function(){A.els.wrapper.style.width=t.width+"px",A.els.wrapper.style.height=t.height+"px"}))})):Promise.resolve()},t.onUnlockAudio=function(A,t){var i=this;this.els.unmuteButton&&(t.preventDefault(),t.stopPropagation()),this.player.audioOut.unlock((function(){i.els.unmuteButton&&i.els.unmuteButton.classList.add(k),A.removeEventListener("touchstart",i.unlockAudioBound),A.removeEventListener("click",i.unlockAudioBound)}))},t.onClick=function(){this.options.control&&(this.player.isPlaying?this.pause():this.play())},t._copyPlayerFuncs=function(){var A=this;this.play=function(){return A.player.play()},this.pause=function(){return A.player.pause()},this.stop=function(){return A.player.stop()},this.destroy=function(){A.player.destroy(),A.els.wrapper.innerHTML="",A.els.wrapper.playerInstance=null}},A}(),S=function(){return window.performance?window.performance.now()/1e3:Date.now()/1e3},G=function(A,t){if(A.fill)A.fill(t);else for(var i=0;iA&&this.loadNextChunk())},t.destroy=function(){this.request.abort(),this.aborted=!0},t.loadNextChunk=function(){var A=this,t=this.loadedSize,i=Math.min(this.loadedSize+this.chunkSize-1,this.fileSize-1);if(t>=this.fileSize||this.aborted)return this.completed=!0,void(this.onCompletedCallback&&this.onCompletedCallback(this));this.isLoading=!0,this.loadStartTime=S(),this.request=new XMLHttpRequest,this.request.onreadystatechange=function(){A.request.readyState===A.request.DONE&&A.request.status>=200&&A.request.status<300?A.onChunkLoad(A.request.response):A.request.readyState===A.request.DONE&&A.loadFails++<3&&A.loadNextChunk()},0===t&&(this.request.onprogress=this.onProgress.bind(this)),this.request.open("GET",this.url+"?"+t+"-"+i),this.request.setRequestHeader("Range","bytes="+t+"-"+i),this.request.responseType="arraybuffer",this.request.send()},t.onProgress=function(A){this.progress=A.loaded/A.total},t.onChunkLoad=function(A){var t=!this.established;this.established=!0,this.progress=1,this.loadedSize+=A.byteLength,this.loadFails=0,this.isLoading=!1,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A),this.loadTime=S()-this.loadStartTime,this.throttled||this.loadNextChunk()},A}(),N=function(){function A(A,t){this.url=A,this.options=t,this.socket=null,this.streaming=!0,this.callbacks={connect:[],data:[]},this.destination=null,this.reconnectInterval=void 0!==t.reconnectInterval?t.reconnectInterval:5,this.shouldAttemptReconnect=!!this.reconnectInterval,this.completed=!1,this.established=!1,this.progress=0,this.reconnectTimeoutId=0,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.destroy=function(){clearTimeout(this.reconnectTimeoutId),this.shouldAttemptReconnect=!1,this.socket.close()},t.start=function(){this.shouldAttemptReconnect=!!this.reconnectInterval,this.progress=0,this.established=!1,this.options.protocols?this.socket=new WebSocket(this.url,this.options.protocols):this.socket=new WebSocket(this.url),this.socket.binaryType="arraybuffer",this.socket.onmessage=this.onMessage.bind(this),this.socket.onopen=this.onOpen.bind(this),this.socket.onerror=this.onClose.bind(this),this.socket.onclose=this.onClose.bind(this)},t.resume=function(){},t.onOpen=function(){this.progress=1},t.onClose=function(){var A=this;this.shouldAttemptReconnect&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=setTimeout((function(){A.start()}),1e3*this.reconnectInterval))},t.onMessage=function(A){var t=!this.established;this.established=!0,t&&this.hookOnEstablished&&this.hookOnEstablished(),t&&this.onEstablishedCallback&&this.onEstablishedCallback(this),this.destination&&this.destination.write(A.data)},A}(),L=function(){function A(t,i){"object"==typeof t?(this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.byteLength=this.bytes.length):(this.bytes=new Uint8Array(t||1048576),this.byteLength=0),this.mode=i||A.MODE.EXPAND,this.index=0}var t=A.prototype;return t.resize=function(A){var t=new Uint8Array(A);0!==this.byteLength&&(this.byteLength=Math.min(this.byteLength,A),t.set(this.bytes,0,this.byteLength)),this.bytes=t,this.index=Math.min(this.index,this.byteLength<<3)},t.evict=function(A){var t=this.index>>3,i=this.bytes.length-this.byteLength;if(this.index===this.byteLength<<3||A>i+t)return this.byteLength=0,void(this.index=0);0!==t&&(this.bytes.copyWithin?this.bytes.copyWithin(0,t,this.byteLength):this.bytes.set(this.bytes.subarray(t,this.byteLength)),this.byteLength-=t,this.index-=t<<3)},t.write=function(t){var i="object"==typeof t[0],e=0,s=this.bytes.length-this.byteLength;if(i){e=0;for(var o=0;os)if(this.mode===A.MODE.EXPAND){var g=Math.max(2*this.bytes.length,e-s);this.resize(g)}else this.evict(e);if(i)for(var I=0;I>3;A>3;return A>=this.byteLength||0===this.bytes[A]&&0===this.bytes[A+1]&&1===this.bytes[A+2]},t.peek=function(A){for(var t=this.index,i=0;A;){var e=8-(7&t),s=e>3]&255>>8-s<>o,t+=s,A-=s}return i},t.read=function(A){var t=this.peek(A);return this.index+=A,t},t.skip=function(A){return this.index+=A},t.rewind=function(A){this.index=Math.max(this.index-A,0)},t.has=function(A){return(this.byteLength<<3)-this.index>=A},A}();L.MODE={EVICT:1,EXPAND:2};var U=function(){function A(){this.bits=null,this.leftoverBytes=null,this.guessVideoFrameEnd=!0,this.pidsToStreamIds={},this.pesPacketInfo={},this.startTime=0,this.currentTime=0}var t=A.prototype;return t.connect=function(A,t){this.pesPacketInfo[A]={destination:t,currentLength:0,totalLength:0,pts:0,buffers:[]}},t.write=function(A){if(this.leftoverBytes){var t=A.byteLength+this.leftoverBytes.byteLength;this.bits=new L(t),this.bits.write([this.leftoverBytes,A])}else this.bits=new L(A);for(;this.bits.has(1504)&&this.parsePacket(););var i=this.bits.byteLength-(this.bits.index>>3);this.leftoverBytes=i>0?this.bits.bytes.subarray(this.bits.index>>3):null},t.parsePacket=function(){if(71!==this.bits.read(8)&&!this.resync())return!1;var A=187+(this.bits.index>>3);this.bits.read(1);var t=this.bits.read(1);this.bits.read(1);var i=this.bits.read(13);this.bits.read(2);var e=this.bits.read(2);this.bits.read(4);var s=this.pidsToStreamIds[i];if(t&&s){var o=this.pesPacketInfo[s];o&&o.currentLength&&this.packetComplete(o)}if(1&e){if(2&e){var g=this.bits.read(8);this.bits.skip(g<<3)}if(t&&this.bits.nextBytesAreStartCode()){this.bits.skip(24),s=this.bits.read(8),this.pidsToStreamIds[i]=s;var I=this.bits.read(16);this.bits.skip(8);var a=this.bits.read(2);this.bits.skip(6);var B=this.bits.read(8),r=this.bits.index+(B<<3),C=this.pesPacketInfo[s];if(C){var n=0;if(2&a){this.bits.skip(4);var E=this.bits.read(3);this.bits.skip(1);var Q=this.bits.read(15);this.bits.skip(1);var h=this.bits.read(15);this.bits.skip(1),n=(1073741824*E+32768*Q+h)/9e4,this.currentTime=n,-1===this.startTime&&(this.startTime=n)}var d=I?I-B-3:0;this.packetStart(C,n,d)}this.bits.index=r}if(s){var c=this.pesPacketInfo[s];if(c){var l=this.bits.index>>3,u=!t&&2&e;(this.packetAddData(c,l,A)||this.guessVideoFrameEnd&&u)&&this.packetComplete(c)}}}return this.bits.index=A<<3,!0},t.resync=function(){if(!this.bits.has(9024))return!1;for(var A=this.bits.index>>3,t=0;t<187;t++)if(71===this.bits.bytes[A+t]){for(var i=!0,e=1;e<5;e++)if(71!==this.bits.bytes[A+t+188*e]){i=!1;break}if(i)return this.bits.index=A+t+1<<3,!0}return console.warn("JSMpeg: Possible garbage data. Skipping."),this.bits.skip(1496),!1},t.packetStart=function(A,t,i){A.totalLength=i,A.currentLength=0,A.pts=t},t.packetAddData=function(A,t,i){return A.buffers.push(this.bits.bytes.subarray(t,i)),A.currentLength+=i-t,0!==A.totalLength&&A.currentLength>=A.totalLength},t.packetComplete=function(A){A.destination.write(A.pts,A.buffers),A.totalLength=0,A.currentLength=0,A.buffers=[]},A}();U.STREAM={PACK_HEADER:186,SYSTEM_HEADER:187,PROGRAM_MAP:188,PRIVATE_1:189,PADDING:190,PRIVATE_2:191,AUDIO_1:192,VIDEO_1:224,DIRECTORY:255};var J=function(){function A(A){this.destination=null,this.canPlay=!1,this.collectTimestamps=!A.streaming,this.bytesWritten=0,this.timestamps=[],this.timestampIndex=0,this.startTime=0,this.decodedTime=0,Object.defineProperty(this,"currentTime",{get:this.getCurrentTime})}var t=A.prototype;return t.destroy=function(){},t.connect=function(A){this.destination=A},t.bufferGetIndex=function(){return this.bits.index},t.bufferSetIndex=function(A){this.bits.index=A},t.bufferWrite=function(A){return this.bits.write(A)},t.write=function(A,t){this.collectTimestamps&&(0===this.timestamps.length&&(this.startTime=A,this.decodedTime=A),this.timestamps.push({index:this.bytesWritten<<3,time:A})),this.bytesWritten+=this.bufferWrite(t),this.canPlay=!0},t.seek=function(A){if(this.collectTimestamps){this.timestampIndex=0;for(var t=0;tA);t++)this.timestampIndex=t;var i=this.timestamps[this.timestampIndex];i?(this.bufferSetIndex(i.index),this.decodedTime=i.time):(this.bits.index=0,this.decodedTime=this.startTime)}},t.decode=function(){this.advanceDecodedTime(0)},t.advanceDecodedTime=function(A){if(this.collectTimestamps){for(var t=-1,i=this.bufferGetIndex(),e=this.timestampIndex;ei);e++)t=e;if(-1!==t&&t!==this.timestampIndex)return this.timestampIndex=t,void(this.decodedTime=this.timestamps[this.timestampIndex].time)}this.decodedTime+=A},t.getCurrentTime=function(){return this.decodedTime},A}(),T=function(A){function t(t){var i;(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode;var e=t.videoBufferSize||524288,s=t.streaming?L.MODE.EVICT:L.MODE.EXPAND;return i.bits=new L(e,s),i.customIntraQuantMatrix=new Uint8Array(64),i.customNonIntraQuantMatrix=new Uint8Array(64),i.blockData=new Int32Array(64),i.currentFrame=0,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i}u(t,A);var i=t.prototype;return i.write=function(A,i){if(J.prototype.write.call(this,A,i),!this.hasSequenceHeader){if(-1===this.bits.findStartCode(t.START.SEQUENCE))return!1;this.decodeSequenceHeader(),this.decodeFirstFrame&&this.decode()}},i.decode=function(){var A=S();if(!this.hasSequenceHeader)return!1;if(-1===this.bits.findStartCode(t.START.PICTURE))return!1;this.decodePicture(),this.advanceDecodedTime(1/this.frameRate);var i=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,i),!0},i.readHuffman=function(A){var t=0;do{t=A[t+this.bits.read(1)]}while(t>=0&&0!==A[t]);return A[t+2]},i.decodeSequenceHeader=function(){var A=this.bits.read(12),i=this.bits.read(12);if(this.bits.skip(4),this.frameRate=t.PICTURE_RATE[this.bits.read(4)],this.bits.skip(30),A===this.width&&i===this.height||(this.width=A,this.height=i,this.initBuffers(),this.destination&&this.destination.resize(A,i)),this.bits.read(1)){for(var e=0;e<64;e++)this.customIntraQuantMatrix[t.ZIG_ZAG[e]]=this.bits.read(8);this.intraQuantMatrix=this.customIntraQuantMatrix}if(this.bits.read(1)){for(var s=0;s<64;s++){var o=t.ZIG_ZAG[s];this.customNonIntraQuantMatrix[o]=this.bits.read(8)}this.nonIntraQuantMatrix=this.customNonIntraQuantMatrix}this.hasSequenceHeader=!0},i.initBuffers=function(){this.intraQuantMatrix=t.DEFAULT_INTRA_QUANT_MATRIX,this.nonIntraQuantMatrix=t.DEFAULT_NON_INTRA_QUANT_MATRIX,this.mbWidth=this.width+15>>4,this.mbHeight=this.height+15>>4,this.mbSize=this.mbWidth*this.mbHeight,this.codedWidth=this.mbWidth<<4,this.codedHeight=this.mbHeight<<4,this.codedSize=this.codedWidth*this.codedHeight,this.halfWidth=this.mbWidth<<3,this.halfHeight=this.mbHeight<<3,this.currentY=new Uint8ClampedArray(this.codedSize),this.currentY32=new Uint32Array(this.currentY.buffer),this.currentCr=new Uint8ClampedArray(this.codedSize>>2),this.currentCr32=new Uint32Array(this.currentCr.buffer),this.currentCb=new Uint8ClampedArray(this.codedSize>>2),this.currentCb32=new Uint32Array(this.currentCb.buffer),this.forwardY=new Uint8ClampedArray(this.codedSize),this.forwardY32=new Uint32Array(this.forwardY.buffer),this.forwardCr=new Uint8ClampedArray(this.codedSize>>2),this.forwardCr32=new Uint32Array(this.forwardCr.buffer),this.forwardCb=new Uint8ClampedArray(this.codedSize>>2),this.forwardCb32=new Uint32Array(this.forwardCb.buffer)},i.decodePicture=function(){if(this.currentFrame++,this.bits.skip(10),this.pictureType=this.bits.read(3),this.bits.skip(16),!(this.pictureType<=0||this.pictureType>=t.PICTURE_TYPE.B)){if(this.pictureType===t.PICTURE_TYPE.PREDICTIVE){if(this.fullPelForward=this.bits.read(1),this.forwardFCode=this.bits.read(3),0===this.forwardFCode)return;this.forwardRSize=this.forwardFCode-1,this.forwardF=1<=t.START.SLICE_FIRST&&A<=t.START.SLICE_LAST;)this.decodeSlice(255&A),A=this.bits.findNextStartCode();if(-1!==A&&this.bits.rewind(32),this.destination&&this.destination.render(this.currentY,this.currentCr,this.currentCb,!0),this.pictureType===t.PICTURE_TYPE.INTRA||this.pictureType===t.PICTURE_TYPE.PREDICTIVE){var i=this.forwardY,e=this.forwardY32,s=this.forwardCr,o=this.forwardCr32,g=this.forwardCb,I=this.forwardCb32;this.forwardY=this.currentY,this.forwardY32=this.currentY32,this.forwardCr=this.currentCr,this.forwardCr32=this.currentCr32,this.forwardCb=this.currentCb,this.forwardCb32=this.currentCb32,this.currentY=i,this.currentY32=e,this.currentCr=s,this.currentCr32=o,this.currentCb=g,this.currentCb32=I}}},i.decodeSlice=function(A){for(this.sliceBegin=!0,this.macroblockAddress=(A-1)*this.mbWidth-1,this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0,this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.quantizerScale=this.bits.read(5);this.bits.read(1);)this.bits.skip(8);do{this.decodeMacroblock()}while(!this.bits.nextBytesAreStartCode())},i.decodeMacroblock=function(){for(var A=0,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);34===i;)i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);for(;35===i;)A+=33,i=this.readHuffman(t.MACROBLOCK_ADDRESS_INCREMENT);if(A+=i,this.sliceBegin)this.sliceBegin=!1,this.macroblockAddress+=A;else{if(this.macroblockAddress+A>=this.mbSize)return;for(A>1&&(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0));A>1;)this.macroblockAddress++,this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth,this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb),A--;this.macroblockAddress++}this.mbRow=this.macroblockAddress/this.mbWidth|0,this.mbCol=this.macroblockAddress%this.mbWidth;var e=t.MACROBLOCK_TYPE[this.pictureType];this.macroblockType=this.readHuffman(e),this.macroblockIntra=1&this.macroblockType,this.macroblockMotFw=8&this.macroblockType,16&this.macroblockType&&(this.quantizerScale=this.bits.read(5)),this.macroblockIntra?(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0):(this.dcPredictorY=128,this.dcPredictorCr=128,this.dcPredictorCb=128,this.decodeMotionVectors(),this.copyMacroblock(this.motionFwH,this.motionFwV,this.forwardY,this.forwardCr,this.forwardCb));for(var s=2&this.macroblockType?this.readHuffman(t.CODE_BLOCK_PATTERN):this.macroblockIntra?63:0,o=0,g=32;o<6;o++)s&g&&this.decodeBlock(o),g>>=1},i.decodeMotionVectors=function(){var A,i,e=0;this.macroblockMotFw?(0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwHPrev-=this.forwardF<<5:this.motionFwHPrev<-this.forwardF<<4&&(this.motionFwHPrev+=this.forwardF<<5),this.motionFwH=this.motionFwHPrev,this.fullPelForward&&(this.motionFwH<<=1),0!==(A=this.readHuffman(t.MOTION))&&1!==this.forwardF?(e=this.bits.read(this.forwardRSize),i=(Math.abs(A)-1<(this.forwardF<<4)-1?this.motionFwVPrev-=this.forwardF<<5:this.motionFwVPrev<-this.forwardF<<4&&(this.motionFwVPrev+=this.forwardF<<5),this.motionFwV=this.motionFwVPrev,this.fullPelForward&&(this.motionFwV<<=1)):this.pictureType===t.PICTURE_TYPE.PREDICTIVE&&(this.motionFwH=this.motionFwHPrev=0,this.motionFwV=this.motionFwVPrev=0)},i.copyMacroblock=function(A,t,i,e,s){var o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f=this.currentY32,y=this.currentCb32,R=this.currentCr32;if(g=(o=this.codedWidth)-16,I=A>>1,a=t>>1,B=!(1&~A),r=!(1&~t),C=((this.mbRow<<4)+a)*o+(this.mbCol<<4)+I,E=(n=this.mbRow*o+this.mbCol<<2)+(o<<2),B)if(r)for(;n>2&255,c|=(h=i[++C]+i[C+o])+d+2<<6&65280,c|=h+(d=i[++C]+i[C+o])+2<<14&16711680,h=i[++C]+i[C+o],C++,c|=h+d+2<<22&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else for(;n>1&255,c|=(h=i[C++])+d+1<<7&65280,c|=h+(d=i[C++])+1<<15&16711680,c|=(h=i[C++])+d+1<<23&4278190080,f[n++]=c;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,c|=i[++C]+i[C+o]+1<<7&65280,c|=i[++C]+i[C+o]+1<<15&16711680,c|=i[++C]+i[C+o]+1<<23&4278190080,C++,f[n++]=c;n+=g>>2,C+=g}else for(;n>2,C+=g}if(g=(o=this.halfWidth)-8,I=A/2>>1,a=t/2>>1,B=1==(A/2&1),r=1==(t/2&1),C=((this.mbRow<<3)+a)*o+(this.mbCol<<3)+I,E=(n=this.mbRow*o+this.mbCol<<1)+(o<<1),B)if(r)for(;n>2&255,m=p+(D=s[C]+s[C+o])+2>>2&255,w|=(l=e[++C]+e[C+o])+u+2<<6&65280,m|=(p=s[C]+s[C+o])+D+2<<6&65280,w|=l+(u=e[++C]+e[C+o])+2<<14&16711680,m|=p+(D=s[C]+s[C+o])+2<<14&16711680,l=e[++C]+e[C+o],p=s[C]+s[C+o],C++,w|=l+u+2<<22&4278190080,m|=p+D+2<<22&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else for(;n>1&255,m=p+(D=s[C++])+1>>1&255,w|=(l=e[C])+u+1<<7&65280,m|=(p=s[C++])+D+1<<7&65280,w|=l+(u=e[C])+1<<15&16711680,m|=p+(D=s[C++])+1<<15&16711680,w|=(l=e[C])+u+1<<23&4278190080,m|=(p=s[C++])+D+1<<23&4278190080,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g-1}else if(r)for(;n>1&255,m=s[C]+s[C+o]+1>>1&255,w|=e[++C]+e[C+o]+1<<7&65280,m|=s[C]+s[C+o]+1<<7&65280,w|=e[++C]+e[C+o]+1<<15&16711680,m|=s[C]+s[C+o]+1<<15&16711680,w|=e[++C]+e[C+o]+1<<23&4278190080,m|=s[C]+s[C+o]+1<<23&4278190080,C++,R[n]=w,y[n]=m,n++;n+=g>>2,C+=g}else for(;n>2,C+=g}},i.decodeBlock=function(A){var i,e=0;if(this.macroblockIntra){var s,o;if(A<4?(s=this.dcPredictorY,o=this.readHuffman(t.DCT_DC_SIZE_LUMINANCE)):(s=4===A?this.dcPredictorCr:this.dcPredictorCb,o=this.readHuffman(t.DCT_DC_SIZE_CHROMINANCE)),o>0){var g=this.bits.read(o);this.blockData[0]=g&1<0&&0===this.bits.read(1))break;65535===n?(C=this.bits.read(6),0===(r=this.bits.read(8))?r=this.bits.read(8):128===r?r=this.bits.read(8)-256:r>128&&(r-=256)):(C=n>>8,r=255&n,this.bits.read(1)&&(r=-r)),e+=C;var E=t.ZIG_ZAG[e];e++,r<<=1,this.macroblockIntra||(r+=r<0?-1:1),1&(r=r*this.quantizerScale*i[E]>>4)||(r-=r>0?1:-1),r>2047?r=2047:r<-2048&&(r=-2048),this.blockData[E]=r*t.PREMULTIPLIER_MATRIX[E]}A<4?(I=this.currentY,B=this.codedWidth-8,a=this.mbRow*this.codedWidth+this.mbCol<<4,1&A&&(a+=8),2&A&&(a+=this.codedWidth<<3)):(I=4===A?this.currentCb:this.currentCr,B=(this.codedWidth>>1)-8,a=(this.mbRow*this.codedWidth<<2)+(this.mbCol<<3)),this.macroblockIntra?1===e?(t.CopyValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.CopyBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)):1===e?(t.AddValueToDestination(this.blockData[0]+128>>8,I,a,B),this.blockData[0]=0):(t.IDCT(this.blockData),t.AddBlockToDestination(this.blockData,I,a,B),G(this.blockData,0)),e=0},t.CopyBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A[s+0],t[i+1]=A[s+1],t[i+2]=A[s+2],t[i+3]=A[s+3],t[i+4]=A[s+4],t[i+5]=A[s+5],t[i+6]=A[s+6],t[i+7]=A[s+7]},t.AddBlockToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A[s+0],t[i+1]+=A[s+1],t[i+2]+=A[s+2],t[i+3]+=A[s+3],t[i+4]+=A[s+4],t[i+5]+=A[s+5],t[i+6]+=A[s+6],t[i+7]+=A[s+7]},t.CopyValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]=A,t[i+1]=A,t[i+2]=A,t[i+3]=A,t[i+4]=A,t[i+5]=A,t[i+6]=A,t[i+7]=A},t.AddValueToDestination=function(A,t,i,e){for(var s=0;s<64;s+=8,i+=e+8)t[i+0]+=A,t[i+1]+=A,t[i+2]+=A,t[i+3]+=A,t[i+4]+=A,t[i+5]+=A,t[i+6]+=A,t[i+7]+=A},t.IDCT=function(A){for(var t,i,e,s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u=0;u<8;++u)t=A[32+u],i=A[16+u]+A[48+u],e=A[40+u]-A[24+u],g=A[8+u]+A[56+u],I=A[24+u]+A[40+u],B=(E=(473*(s=A[8+u]-A[56+u])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+u])-t)+(C=(362*(A[16+u]-A[48+u])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+u]=o+h,A[8+u]=E+Q,A[16+u]=d-B,A[24+u]=c-l,A[32+u]=c+l,A[40+u]=B+d,A[48+u]=Q-E,A[56+u]=h-o;for(var w=0;w<64;w+=8)t=A[4+w],i=A[2+w]+A[6+w],e=A[5+w]-A[3+w],g=A[1+w]+A[7+w],I=A[3+w]+A[5+w],B=(E=(473*(s=A[1+w]-A[7+w])-196*e+128>>8)-(o=g+I))-(362*(g-I)+128>>8),Q=(r=(a=A[0+w])-t)+(C=(362*(A[2+w]-A[6+w])+128>>8)-i),h=(n=a+t)+i,d=r-C,c=n-i,l=-B-(473*e+196*s+128>>8),A[0+w]=o+h+128>>8,A[1+w]=E+Q+128>>8,A[2+w]=d-B+128>>8,A[3+w]=c-l+128>>8,A[4+w]=c+l+128>>8,A[5+w]=B+d+128>>8,A[6+w]=Q-E+128>>8,A[7+w]=h-o+128>>8},t}(J);T.prototype.frameRate=30,T.prototype.currentY=null,T.prototype.currentCr=null,T.prototype.currentCb=null,T.prototype.pictureType=0,T.prototype.forwardY=null,T.prototype.forwardCr=null,T.prototype.forwardCb=null,T.prototype.fullPelForward=!1,T.prototype.forwardFCode=0,T.prototype.forwardRSize=0,T.prototype.forwardF=0,T.prototype.quantizerScale=0,T.prototype.sliceBegin=!1,T.prototype.macroblockAddress=0,T.prototype.mbRow=0,T.prototype.mbCol=0,T.prototype.macroblockType=0,T.prototype.macroblockIntra=!1,T.prototype.macroblockMotFw=!1,T.prototype.motionFwH=0,T.prototype.motionFwV=0,T.prototype.motionFwHPrev=0,T.prototype.motionFwVPrev=0,T.prototype.dcPredictorY=0,T.prototype.dcPredictorCr=0,T.prototype.dcPredictorCb=0,T.prototype.blockData=null,T.PICTURE_RATE=[0,23.976,24,25,29.97,30,50,59.94,60,0,0,0,0,0,0,0],T.ZIG_ZAG=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),T.DEFAULT_INTRA_QUANT_MATRIX=new Uint8Array([8,16,19,22,26,27,29,34,16,16,22,24,27,29,34,37,19,22,26,27,29,34,34,38,22,22,26,27,29,34,37,40,22,26,27,29,32,35,40,48,26,27,29,32,35,40,48,58,26,27,29,34,38,46,56,69,27,29,35,38,46,56,69,83]),T.DEFAULT_NON_INTRA_QUANT_MATRIX=new Uint8Array([16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]),T.PREMULTIPLIER_MATRIX=new Uint8Array([32,44,42,38,32,25,17,9,44,62,58,52,44,35,24,12,42,58,55,49,42,33,23,12,38,52,49,44,38,30,20,10,32,44,42,38,32,25,17,9,25,35,33,30,25,20,14,7,17,24,23,20,17,14,9,5,9,12,12,10,9,7,5,2]),T.MACROBLOCK_ADDRESS_INCREMENT=new Int16Array([3,6,0,9,12,0,0,0,1,15,18,0,21,24,0,27,30,0,33,36,0,0,0,3,0,0,2,39,42,0,45,48,0,0,0,5,0,0,4,51,54,0,57,60,0,0,0,7,0,0,6,63,66,0,69,72,0,75,78,0,81,84,0,-1,87,0,-1,90,0,93,96,0,99,102,0,105,108,0,111,114,0,0,0,9,0,0,8,117,120,0,123,126,0,129,132,0,135,138,0,0,0,15,0,0,14,0,0,13,0,0,12,0,0,11,0,0,10,141,-1,0,-1,144,0,147,150,0,153,156,0,159,162,0,165,168,0,171,174,0,177,180,0,183,-1,0,-1,186,0,189,192,0,195,198,0,201,204,0,207,210,0,213,216,0,219,222,0,0,0,21,0,0,20,0,0,19,0,0,18,0,0,17,0,0,16,0,0,35,0,0,34,0,0,33,0,0,32,0,0,31,0,0,30,0,0,29,0,0,28,0,0,27,0,0,26,0,0,25,0,0,24,0,0,23,0,0,22]),T.MACROBLOCK_TYPE_INTRA=new Int8Array([3,6,0,-1,9,0,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_PREDICTIVE=new Int8Array([3,6,0,9,12,0,0,0,10,15,18,0,0,0,2,21,24,0,0,0,8,27,30,0,33,36,0,-1,39,0,0,0,18,0,0,26,0,0,1,0,0,17]),T.MACROBLOCK_TYPE_B=new Int8Array([3,6,0,9,15,0,12,18,0,24,21,0,0,0,12,27,30,0,0,0,14,39,42,0,36,33,0,0,0,4,0,0,6,54,48,0,45,51,0,0,0,8,0,0,10,-1,57,0,0,0,1,60,63,0,0,0,30,0,0,17,0,0,22,0,0,26]),T.MACROBLOCK_TYPE=[null,T.MACROBLOCK_TYPE_INTRA,T.MACROBLOCK_TYPE_PREDICTIVE,T.MACROBLOCK_TYPE_B],T.CODE_BLOCK_PATTERN=new Int16Array([6,3,0,9,18,0,12,15,0,24,33,0,36,39,0,27,21,0,30,42,0,60,57,0,54,48,0,69,51,0,81,75,0,63,84,0,45,66,0,72,78,0,0,0,60,105,120,0,132,144,0,114,108,0,126,141,0,87,93,0,117,96,0,0,0,32,135,138,0,99,123,0,129,102,0,0,0,4,90,111,0,0,0,8,0,0,16,0,0,44,150,168,0,0,0,28,0,0,52,0,0,62,183,177,0,156,180,0,0,0,1,165,162,0,0,0,61,0,0,56,171,174,0,0,0,2,0,0,40,153,186,0,0,0,48,192,189,0,147,159,0,0,0,20,0,0,12,240,249,0,0,0,63,231,225,0,195,219,0,252,198,0,0,0,24,0,0,36,0,0,3,207,261,0,243,237,0,204,213,0,210,234,0,201,228,0,216,222,0,258,255,0,264,246,0,-1,282,0,285,291,0,0,0,33,0,0,9,318,330,0,306,348,0,0,0,5,0,0,10,279,267,0,0,0,6,0,0,18,0,0,17,0,0,34,339,357,0,309,312,0,270,276,0,327,321,0,351,354,0,303,297,0,294,288,0,300,273,0,342,345,0,315,324,0,336,333,0,363,375,0,0,0,41,0,0,14,0,0,21,372,366,0,360,369,0,0,0,11,0,0,19,0,0,7,0,0,35,0,0,13,0,0,50,0,0,49,0,0,58,0,0,37,0,0,25,0,0,45,0,0,57,0,0,26,0,0,29,0,0,38,0,0,53,0,0,23,0,0,43,0,0,46,0,0,42,0,0,22,0,0,54,0,0,51,0,0,15,0,0,30,0,0,39,0,0,47,0,0,55,0,0,27,0,0,59,0,0,31]),T.MOTION=new Int16Array([3,6,0,12,9,0,0,0,0,18,15,0,24,21,0,0,0,-1,0,0,1,27,30,0,36,33,0,0,0,2,0,0,-2,42,45,0,48,39,0,60,54,0,0,0,3,0,0,-3,51,57,0,-1,69,0,81,75,0,78,63,0,72,66,0,96,84,0,87,93,0,-1,99,0,108,105,0,0,0,-4,90,102,0,0,0,4,0,0,-7,0,0,5,111,123,0,0,0,-5,0,0,7,114,120,0,126,117,0,0,0,-6,0,0,6,153,162,0,150,147,0,135,138,0,156,141,0,129,159,0,132,144,0,0,0,10,0,0,9,0,0,8,0,0,-8,171,198,0,0,0,-9,180,192,0,168,183,0,165,186,0,174,189,0,0,0,-10,177,195,0,0,0,12,0,0,16,0,0,13,0,0,14,0,0,11,0,0,15,0,0,-16,0,0,-12,0,0,-14,0,0,-15,0,0,-11,0,0,-13]),T.DCT_DC_SIZE_LUMINANCE=new Int8Array([6,3,0,18,15,0,9,12,0,0,0,1,0,0,2,27,24,0,21,30,0,0,0,0,36,33,0,0,0,4,0,0,3,39,42,0,0,0,5,0,0,6,48,45,0,51,-1,0,0,0,7,0,0,8]),T.DCT_DC_SIZE_CHROMINANCE=new Int8Array([6,3,0,12,9,0,18,15,0,24,21,0,0,0,2,0,0,1,0,0,0,30,27,0,0,0,3,36,33,0,0,0,4,42,39,0,0,0,5,48,45,0,0,0,6,51,-1,0,0,0,7,0,0,8]),T.DCT_COEFF=new Int32Array([3,6,0,12,9,0,0,0,1,21,24,0,18,15,0,39,27,0,33,30,0,42,36,0,0,0,257,60,66,0,54,63,0,48,57,0,0,0,513,51,45,0,0,0,2,0,0,3,81,75,0,87,93,0,72,78,0,96,90,0,0,0,1025,69,84,0,0,0,769,0,0,258,0,0,1793,0,0,65535,0,0,1537,111,108,0,0,0,1281,105,102,0,117,114,0,99,126,0,120,123,0,156,150,0,162,159,0,144,147,0,129,135,0,138,132,0,0,0,2049,0,0,4,0,0,514,0,0,2305,153,141,0,165,171,0,180,168,0,177,174,0,183,186,0,0,0,2561,0,0,3329,0,0,6,0,0,259,0,0,5,0,0,770,0,0,2817,0,0,3073,228,225,0,201,210,0,219,213,0,234,222,0,216,231,0,207,192,0,204,189,0,198,195,0,243,261,0,273,240,0,246,237,0,249,258,0,279,276,0,252,255,0,270,282,0,264,267,0,0,0,515,0,0,260,0,0,7,0,0,1026,0,0,1282,0,0,4097,0,0,3841,0,0,3585,315,321,0,333,342,0,312,291,0,375,357,0,288,294,0,-1,369,0,285,303,0,318,363,0,297,306,0,339,309,0,336,348,0,330,300,0,372,345,0,351,366,0,327,354,0,360,324,0,381,408,0,417,420,0,390,378,0,435,438,0,384,387,0,0,0,2050,396,402,0,465,462,0,0,0,8,411,399,0,429,432,0,453,414,0,426,423,0,0,0,10,0,0,9,0,0,11,0,0,5377,0,0,1538,0,0,771,0,0,5121,0,0,1794,0,0,4353,0,0,4609,0,0,4865,444,456,0,0,0,1027,459,450,0,0,0,261,393,405,0,0,0,516,447,441,0,516,519,0,486,474,0,510,483,0,504,498,0,471,537,0,507,501,0,522,513,0,534,531,0,468,477,0,492,495,0,549,546,0,525,528,0,0,0,263,0,0,2562,0,0,2306,0,0,5633,0,0,5889,0,0,6401,0,0,6145,0,0,1283,0,0,772,0,0,13,0,0,12,0,0,14,0,0,15,0,0,517,0,0,6657,0,0,262,540,543,0,480,489,0,588,597,0,0,0,27,609,555,0,606,603,0,0,0,19,0,0,22,591,621,0,0,0,18,573,576,0,564,570,0,0,0,20,552,582,0,0,0,21,558,579,0,0,0,23,612,594,0,0,0,25,0,0,24,600,615,0,0,0,31,0,0,30,0,0,28,0,0,29,0,0,26,0,0,17,0,0,16,567,618,0,561,585,0,654,633,0,0,0,37,645,648,0,0,0,36,630,636,0,0,0,34,639,627,0,663,666,0,657,624,0,651,642,0,669,660,0,0,0,35,0,0,267,0,0,40,0,0,268,0,0,266,0,0,32,0,0,264,0,0,265,0,0,38,0,0,269,0,0,270,0,0,33,0,0,39,0,0,7937,0,0,6913,0,0,7681,0,0,4098,0,0,7425,0,0,7169,0,0,271,0,0,274,0,0,273,0,0,272,0,0,1539,0,0,2818,0,0,3586,0,0,3330,0,0,3074,0,0,3842]),T.PICTURE_TYPE={INTRA:1,PREDICTIVE:2,B:3},T.START={SEQUENCE:179,SLICE_FIRST:1,SLICE_LAST:175,PICTURE:0,EXTENSION:181,USER_DATA:178};var v=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onVideoDecode,i.module=t.wasmModule,i.bufferSize=t.videoBufferSize||524288,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.decodeFirstFrame=!1!==t.decodeFirstFrame,i.hasSequenceHeader=!1,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mpeg1_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mpeg1_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mpeg1_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mpeg1_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>2)),g=this.instance.heapU8.subarray(e,e+(this.codedSize>>2));this.destination.render(s,o,g,!1)}this.advanceDecodedTime(1/this.frameRate);var I=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,I),!0},t}(J),x=function(A){function t(i){var e;(e=A.call(this,i)||this).onDecodeCallback=i.onAudioDecode;var s=i.audioBufferSize||131072,o=i.streaming?L.MODE.EVICT:L.MODE.EXPAND;e.bits=new L(s,o),e.left=new Float32Array(1152),e.right=new Float32Array(1152),e.sampleRate=44100,e.D=new Float32Array(1024),e.D.set(t.SYNTHESIS_WINDOW,0),e.D.set(t.SYNTHESIS_WINDOW,512),e.V=[new Float32Array(1024),new Float32Array(1024)],e.U=new Int32Array(32),e.VPos=0,e.allocation=[new Array(32),new Array(32)],e.scaleFactorInfo=[new Uint8Array(32),new Uint8Array(32)],e.scaleFactor=[new Array(32),new Array(32)],e.sample=[new Array(32),new Array(32)];for(var g=0;g<2;g++)for(var I=0;I<32;I++)e.scaleFactor[g][I]=[0,0,0],e.sample[g][I]=[0,0,0];return e}u(t,A);var i=t.prototype;return i.decode=function(){var A=S(),t=this.bits.index>>3;if(t>=this.bits.byteLength)return!1;var i=this.decodeFrame(this.left,this.right);if(this.bits.index=t+i<<3,!i)return!1;this.destination&&this.destination.play(this.sampleRate,this.left,this.right),this.advanceDecodedTime(this.left.length/this.sampleRate);var e=S()-A;return this.onDecodeCallback&&this.onDecodeCallback(this,e),!0},i.getCurrentTime=function(){var A=this.destination?this.destination.enqueuedTime:0;return this.decodedTime-A},i.decodeFrame=function(A,i){var e=this.bits.read(11),s=this.bits.read(2),o=this.bits.read(2),g=!this.bits.read(1);if(e!==t.FRAME_SYNC||s!==t.VERSION.MPEG_1||o!==t.LAYER.II)return 0;var I=this.bits.read(4)-1;if(I>13)return 0;var a=this.bits.read(2),B=t.SAMPLE_RATE[a];if(3===a)return 0;s===t.VERSION.MPEG_2&&(a+=4,I+=14);var r=this.bits.read(1);this.bits.read(1);var C=this.bits.read(2),n=0;C===t.MODE.JOINT_STEREO?n=this.bits.read(2)+1<<2:(this.bits.skip(2),n=C===t.MODE.MONO?0:32),this.bits.skip(4),g&&this.bits.skip(16);var E=144e3*t.BIT_RATE[I]/(B=t.SAMPLE_RATE[a])+r|0,Q=0,h=0;if(s===t.VERSION.MPEG_2)Q=2,h=30;else{var d=C===t.MODE.MONO?0:1,c=t.QUANT_LUT_STEP_1[d][I];h=63&(Q=t.QUANT_LUT_STEP_2[c][a]),Q>>=6}n>h&&(n=h);for(var l=0;l>1),U=this.VPos%128>>1;U<1024;){for(var J=0;J<32;++J)this.U[J]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(U=1120-U,L-=480;U<1024;){for(var T=0;T<32;++T)this.U[T]+=this.D[L++]*this.V[N][U++];U+=96,L+=32}for(var v=0===N?A:i,x=0;x<32;x++)v[R+x]=this.U[x]/2147418112}R+=32}}return this.sampleRate=B,E},i.readAllocation=function(A,i){var e=t.QUANT_LUT_STEP_3[i][A],s=t.QUANT_LUT_STEP4[15&e][this.bits.read(e>>4)];return s?t.QUANT_TAB[s-1]:0},i.readSamples=function(A,i,e){var s=this.allocation[A][i],o=this.scaleFactor[A][i][e],g=this.sample[A][i],I=0;if(s){if(63===o)o=0;else{var a=o/3|0;o=t.SCALEFACTOR_BASE[o%3]+(1<>1)>>a}var B=s.levels;s.group?(I=this.bits.read(s.bits),g[0]=I%B,I=I/B|0,g[1]=I%B,g[2]=I/B|0):(g[0]=this.bits.read(s.bits),g[1]=this.bits.read(s.bits),g[2]=this.bits.read(s.bits));var r=65536/(B+1)|0;I=((B=(B+1>>1)-1)-g[0])*r,g[0]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[1])*r,g[1]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12,I=(B-g[2])*r,g[2]=I*(o>>12)+(I*(4095&o)+2048>>12)>>12}else g[0]=g[1]=g[2]=0},t.MatrixTransform=function(A,t,i,e){var s,o,g,I,a,B,r,C,n,E,Q,h,d,c,l,u,w,p,D,m,f,y,R,k,b,S,G,F,M,q,N,L,U;s=A[0][t]+A[31][t],o=.500602998235*(A[0][t]-A[31][t]),g=A[1][t]+A[30][t],I=.505470959898*(A[1][t]-A[30][t]),a=A[2][t]+A[29][t],B=.515447309923*(A[2][t]-A[29][t]),r=A[3][t]+A[28][t],C=.53104259109*(A[3][t]-A[28][t]),n=A[4][t]+A[27][t],E=.553103896034*(A[4][t]-A[27][t]),Q=A[5][t]+A[26][t],h=.582934968206*(A[5][t]-A[26][t]),d=A[6][t]+A[25][t],c=.622504123036*(A[6][t]-A[25][t]),l=A[7][t]+A[24][t],u=.674808341455*(A[7][t]-A[24][t]),w=A[8][t]+A[23][t],p=.744536271002*(A[8][t]-A[23][t]),D=A[9][t]+A[22][t],m=.839349645416*(A[9][t]-A[22][t]),f=A[10][t]+A[21][t],y=.972568237862*(A[10][t]-A[21][t]),R=A[11][t]+A[20][t],k=1.16943993343*(A[11][t]-A[20][t]),b=A[12][t]+A[19][t],S=1.48416461631*(A[12][t]-A[19][t]),G=A[13][t]+A[18][t],F=2.05778100995*(A[13][t]-A[18][t]),M=A[14][t]+A[17][t],q=3.40760841847*(A[14][t]-A[17][t]),U=s+(N=A[15][t]+A[16][t]),N=.502419286188*(s-N),s=g+M,M=.52249861494*(g-M),g=a+G,G=.566944034816*(a-G),a=r+b,b=.64682178336*(r-b),r=n+R,R=.788154623451*(n-R),n=Q+f,f=1.06067768599*(Q-f),Q=d+D,D=1.72244709824*(d-D),d=l+w,w=5.10114861869*(l-w),l=U+d,d=.509795579104*(U-d),U=s+Q,s=.601344886935*(s-Q),Q=g+n,n=.899976223136*(g-n),g=a+r,r=2.56291544774*(a-r),a=l+g,l=.541196100146*(l-g),g=U+Q,Q=1.30656296488*(U-Q),U=a+g,a=.707106781187*(a-g),g=l+Q,g+=l=.707106781187*(l-Q),Q=d+r,d=.541196100146*(d-r),r=s+n,n=1.30656296488*(s-n),s=Q+r,r=.707106781187*(Q-r),Q=d+n,s+=Q+=d=.707106781187*(d-n),Q+=r,r+=d,n=N+w,N=.509795579104*(N-w),w=M+D,M=.601344886935*(M-D),D=G+f,f=.899976223136*(G-f),G=b+R,R=2.56291544774*(b-R),b=n+G,n=.541196100146*(n-G),G=w+D,D=1.30656296488*(w-D),w=b+G,G=.707106781187*(b-G),b=n+D,D=.707106781187*(n-D),n=N+R,N=.541196100146*(N-R),R=M+f,f=1.30656296488*(M-f),M=n+R,R=.707106781187*(n-R),n=N+f,w+=M+=n+=N=.707106781187*(N-f),M+=b+=D,b+=n+=R,n+=G,G+=R+=N,R+=D,D+=N,f=o+(L=10.1900081235*(A[15][t]-A[16][t])),o=.502419286188*(o-L),L=I+q,I=.52249861494*(I-q),q=B+F,F=.566944034816*(B-F),B=C+S,C=.64682178336*(C-S),S=E+k,E=.788154623451*(E-k),k=h+y,y=1.06067768599*(h-y),h=c+m,m=1.72244709824*(c-m),c=u+p,u=5.10114861869*(u-p),p=f+c,c=.509795579104*(f-c),f=L+h,L=.601344886935*(L-h),h=q+k,k=.899976223136*(q-k),q=B+S,S=2.56291544774*(B-S),B=p+q,p=.541196100146*(p-q),q=f+h,h=1.30656296488*(f-h),f=B+q,q=.707106781187*(B-q),B=p+h,h=.707106781187*(p-h),p=c+S,S=.541196100146*(c-S),c=L+k,k=1.30656296488*(L-k),L=p+c,c=.707106781187*(p-c),p=S+k,L+=p+=k=.707106781187*(S-k),p+=c,S=c+k,c=o+u,o=.509795579104*(o-u),u=I+m,I=.601344886935*(I-m),m=F+y,y=.899976223136*(F-y),F=C+E,E=2.56291544774*(C-E),C=c+F,c=.541196100146*(c-F),F=u+m,m=1.30656296488*(u-m),u=C+F,F=.707106781187*(C-F),C=c+m,m=.707106781187*(c-m),c=o+E,o=.541196100146*(o-E),E=I+y,y=1.30656296488*(I-y),I=c+E,E=.707106781187*(c-E),c=o+y,f+=u+=I+=c+=o=.707106781187*(o-y),u+=L,L+=I+=C+=m,I+=B+=h,B+=C+=c+=E,C+=p,p+=c+=F,c+=q,q+=F+=E+=o,F+=S,S+=E+=m,E+=h,h+=m+=o,m+=k,k+=o,i[e+48]=-U,i[e+49]=i[e+47]=-f,i[e+50]=i[e+46]=-w,i[e+51]=i[e+45]=-u,i[e+52]=i[e+44]=-s,i[e+53]=i[e+43]=-L,i[e+54]=i[e+42]=-M,i[e+55]=i[e+41]=-I,i[e+56]=i[e+40]=-g,i[e+57]=i[e+39]=-B,i[e+58]=i[e+38]=-b,i[e+59]=i[e+37]=-C,i[e+60]=i[e+36]=-Q,i[e+61]=i[e+35]=-p,i[e+62]=i[e+34]=-n,i[e+63]=i[e+33]=-c,i[e+32]=-a,i[e+0]=a,i[e+31]=-q,i[e+1]=q,i[e+30]=-G,i[e+2]=G,i[e+29]=-F,i[e+3]=F,i[e+28]=-r,i[e+4]=r,i[e+27]=-S,i[e+5]=S,i[e+26]=-R,i[e+6]=R,i[e+25]=-E,i[e+7]=E,i[e+24]=-l,i[e+8]=l,i[e+23]=-h,i[e+9]=h,i[e+22]=-D,i[e+10]=D,i[e+21]=-m,i[e+11]=m,i[e+20]=-d,i[e+12]=d,i[e+19]=-k,i[e+13]=k,i[e+18]=-N,i[e+14]=N,i[e+17]=-o,i[e+15]=o,i[e+16]=0},t}(J);x.FRAME_SYNC=2047,x.VERSION={MPEG_2_5:0,MPEG_2:2,MPEG_1:3},x.LAYER={III:1,II:2,I:3},x.MODE={STEREO:0,JOINT_STEREO:1,DUAL_CHANNEL:2,MONO:3},x.SAMPLE_RATE=new Uint16Array([44100,48e3,32e3,0,22050,24e3,16e3,0]),x.BIT_RATE=new Uint16Array([32,48,56,64,80,96,112,128,160,192,224,256,320,384,8,16,24,32,40,48,56,64,80,96,112,128,144,160]),x.SCALEFACTOR_BASE=new Uint32Array([33554432,26632170,21137968]),x.SYNTHESIS_WINDOW=new Float32Array([0,-.5,-.5,-.5,-.5,-.5,-.5,-1,-1,-1,-1,-1.5,-1.5,-2,-2,-2.5,-2.5,-3,-3.5,-3.5,-4,-4.5,-5,-5.5,-6.5,-7,-8,-8.5,-9.5,-10.5,-12,-13,-14.5,-15.5,-17.5,-19,-20.5,-22.5,-24.5,-26.5,-29,-31.5,-34,-36.5,-39.5,-42.5,-45.5,-48.5,-52,-55.5,-58.5,-62.5,-66,-69.5,-73.5,-77,-80.5,-84.5,-88,-91.5,-95,-98,-101,-104,106.5,109,111,112.5,113.5,114,114,113.5,112,110.5,107.5,104,100,94.5,88.5,81.5,73,63.5,53,41.5,28.5,14.5,-1,-18,-36,-55.5,-76.5,-98.5,-122,-147,-173.5,-200.5,-229.5,-259.5,-290.5,-322.5,-355.5,-389.5,-424,-459.5,-495.5,-532,-568.5,-605,-641.5,-678,-714,-749,-783.5,-817,-849,-879.5,-908.5,-935,-959.5,-981,-1000.5,-1016,-1028.5,-1037.5,-1042.5,-1043.5,-1040,-1031.5,1018.5,1e3,976,946.5,911,869.5,822,767.5,707,640,565.5,485,397,302.5,201,92.5,-22.5,-144,-272.5,-407,-547.5,-694,-846,-1003,-1165,-1331.5,-1502,-1675.5,-1852.5,-2031.5,-2212.5,-2394,-2576.5,-2758.5,-2939.5,-3118.5,-3294.5,-3467.5,-3635.5,-3798.5,-3955,-4104.5,-4245.5,-4377.5,-4499,-4609.5,-4708,-4792.5,-4863.5,-4919,-4958,-4979.5,-4983,-4967.5,-4931.5,-4875,-4796,-4694.5,-4569.5,-4420,-4246,-4046,-3820,-3567,3287,2979.5,2644,2280.5,1888,1467.5,1018.5,541,35,-499,-1061,-1650,-2266.5,-2909,-3577,-4270,-4987.5,-5727.5,-6490,-7274,-8077.5,-8899.5,-9739,-10594.5,-11464.5,-12347,-13241,-14144.5,-15056,-15973.5,-16895.5,-17820,-18744.5,-19668,-20588,-21503,-22410.5,-23308.5,-24195,-25068.5,-25926.5,-26767,-27589,-28389,-29166.5,-29919,-30644.5,-31342,-32009.5,-32645,-33247,-33814.5,-34346,-34839.5,-35295,-35710,-36084.5,-36417.5,-36707.5,-36954,-37156.5,-37315,-37428,-37496,37519,37496,37428,37315,37156.5,36954,36707.5,36417.5,36084.5,35710,35295,34839.5,34346,33814.5,33247,32645,32009.5,31342,30644.5,29919,29166.5,28389,27589,26767,25926.5,25068.5,24195,23308.5,22410.5,21503,20588,19668,18744.5,17820,16895.5,15973.5,15056,14144.5,13241,12347,11464.5,10594.5,9739,8899.5,8077.5,7274,6490,5727.5,4987.5,4270,3577,2909,2266.5,1650,1061,499,-35,-541,-1018.5,-1467.5,-1888,-2280.5,-2644,-2979.5,3287,3567,3820,4046,4246,4420,4569.5,4694.5,4796,4875,4931.5,4967.5,4983,4979.5,4958,4919,4863.5,4792.5,4708,4609.5,4499,4377.5,4245.5,4104.5,3955,3798.5,3635.5,3467.5,3294.5,3118.5,2939.5,2758.5,2576.5,2394,2212.5,2031.5,1852.5,1675.5,1502,1331.5,1165,1003,846,694,547.5,407,272.5,144,22.5,-92.5,-201,-302.5,-397,-485,-565.5,-640,-707,-767.5,-822,-869.5,-911,-946.5,-976,-1e3,1018.5,1031.5,1040,1043.5,1042.5,1037.5,1028.5,1016,1000.5,981,959.5,935,908.5,879.5,849,817,783.5,749,714,678,641.5,605,568.5,532,495.5,459.5,424,389.5,355.5,322.5,290.5,259.5,229.5,200.5,173.5,147,122,98.5,76.5,55.5,36,18,1,-14.5,-28.5,-41.5,-53,-63.5,-73,-81.5,-88.5,-94.5,-100,-104,-107.5,-110.5,-112,-113.5,-114,-114,-113.5,-112.5,-111,-109,106.5,104,101,98,95,91.5,88,84.5,80.5,77,73.5,69.5,66,62.5,58.5,55.5,52,48.5,45.5,42.5,39.5,36.5,34,31.5,29,26.5,24.5,22.5,20.5,19,17.5,15.5,14.5,13,12,10.5,9.5,8.5,8,7,6.5,5.5,5,4.5,4,3.5,3.5,3,2.5,2.5,2,2,1.5,1.5,1,1,1,1,.5,.5,.5,.5,.5,.5]),x.QUANT_LUT_STEP_1=[[0,0,1,1,1,2,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,1,1,1,2,2,2,2,2]],x.QUANT_TAB={A:91,B:94,C:8,D:12},x.QUANT_LUT_STEP_2=[[x.QUANT_TAB.C,x.QUANT_TAB.C,x.QUANT_TAB.D],[x.QUANT_TAB.A,x.QUANT_TAB.A,x.QUANT_TAB.A],[x.QUANT_TAB.B,x.QUANT_TAB.A,x.QUANT_TAB.B]],x.QUANT_LUT_STEP_3=[[68,68,52,52,52,52,52,52,52,52,52,52],[67,67,67,66,66,66,66,66,66,66,66,49,49,49,49,49,49,49,49,49,49,49,49,32,32,32,32,32,32,32],[69,69,69,69,52,52,52,52,52,52,52,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]],x.QUANT_LUT_STEP4=[[0,1,2,17],[0,1,2,3,4,5,6,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17],[0,1,3,5,6,7,8,9,10,11,12,13,14,15,16,17],[0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,17],[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]],x.QUANT_TAB=[{levels:3,group:1,bits:5},{levels:5,group:1,bits:7},{levels:7,group:0,bits:3},{levels:9,group:1,bits:10},{levels:15,group:0,bits:4},{levels:31,group:0,bits:5},{levels:63,group:0,bits:6},{levels:127,group:0,bits:7},{levels:255,group:0,bits:8},{levels:511,group:0,bits:9},{levels:1023,group:0,bits:10},{levels:2047,group:0,bits:11},{levels:4095,group:0,bits:12},{levels:8191,group:0,bits:13},{levels:16383,group:0,bits:14},{levels:32767,group:0,bits:15},{levels:65535,group:0,bits:16}];var Y=function(A){function t(t){var i;return(i=A.call(this,t)||this).onDecodeCallback=t.onAudioDecode,i.module=t.wasmModule,i.bufferSize=t.audioBufferSize||131072,i.bufferMode=t.streaming?L.MODE.EVICT:L.MODE.EXPAND,i.sampleRate=0,i}u(t,A);var i=t.prototype;return i.initializeWasmDecoder=function(){this.module.instance?(this.instance=this.module.instance,this.functions=this.module.instance.exports,this.decoder=this.functions._mp2_decoder_create(this.bufferSize,this.bufferMode)):console.warn("JSMpeg: WASM module not compiled yet")},i.destroy=function(){this.decoder&&this.functions._mp2_decoder_destroy(this.decoder)},i.bufferGetIndex=function(){if(this.decoder)return this.functions._mp2_decoder_get_index(this.decoder)},i.bufferSetIndex=function(A){this.decoder&&this.functions._mp2_decoder_set_index(this.decoder,A)},i.bufferWrite=function(A){this.decoder||this.initializeWasmDecoder();for(var t=0,i=0;i>4<<4;this.gl.viewport(0,0,i,this.height)},t.createTexture=function(A,t){var i=this.gl,e=i.createTexture();return i.bindTexture(i.TEXTURE_2D,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.uniform1i(i.getUniformLocation(this.program,t),A),e},t.createProgram=function(A,t){var i=this.gl,e=i.createProgram();return i.attachShader(e,this.compileShader(i.VERTEX_SHADER,A)),i.attachShader(e,this.compileShader(i.FRAGMENT_SHADER,t)),i.linkProgram(e),i.useProgram(e),e},t.compileShader=function(A,t){var i=this.gl,e=i.createShader(A);if(i.shaderSource(e,t),i.compileShader(e),!i.getShaderParameter(e,i.COMPILE_STATUS))throw new Error(i.getShaderInfoLog(e));return e},t.allowsClampedTextureData=function(){var A=this.gl,t=A.createTexture();return A.bindTexture(A.TEXTURE_2D,t),A.texImage2D(A.TEXTURE_2D,0,A.LUMINANCE,1,1,0,A.LUMINANCE,A.UNSIGNED_BYTE,new Uint8ClampedArray([0])),0===A.getError()},t.renderProgress=function(A){var t=this.gl;t.useProgram(this.loadingProgram);var i=t.getUniformLocation(this.loadingProgram,"progress");t.uniform1f(i,A),t.drawArrays(t.TRIANGLE_STRIP,0,4)},t.render=function(A,t,i,e){if(this.enabled){var s=this.gl,o=this.width+15>>4<<4,g=this.height,I=o>>1,a=g>>1;e&&this.shouldCreateUnclampedViews&&(A=new Uint8Array(A.buffer),t=new Uint8Array(t.buffer),i=new Uint8Array(i.buffer)),s.useProgram(this.program),this.updateTexture(s.TEXTURE0,this.textureY,o,g,A),this.updateTexture(s.TEXTURE1,this.textureCb,I,a,t),this.updateTexture(s.TEXTURE2,this.textureCr,I,a,i),s.drawArrays(s.TRIANGLE_STRIP,0,4)}},t.updateTexture=function(A,t,i,e,s){var o=this.gl;o.activeTexture(A),o.bindTexture(o.TEXTURE_2D,t),this.hasTextureData[A]?o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,e,o.LUMINANCE,o.UNSIGNED_BYTE,s):(this.hasTextureData[A]=!0,o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,i,e,0,o.LUMINANCE,o.UNSIGNED_BYTE,s))},t.deleteTexture=function(A,t){var i=this.gl;i.activeTexture(A),i.bindTexture(i.TEXTURE_2D,null),i.deleteTexture(t)},A.IsSupported=function(){try{if(!window.WebGLRenderingContext)return!1;var A=document.createElement("canvas");return!(!A.getContext("webgl")&&!A.getContext("experimental-webgl"))}catch(A){return!1}},A}();H.SHADER={FRAGMENT_YCRCB_TO_RGBA:["precision mediump float;","uniform sampler2D textureY;","uniform sampler2D textureCb;","uniform sampler2D textureCr;","varying vec2 texCoord;","mat4 rec601 = mat4(","1.16438, 0.00000, 1.59603, -0.87079,","1.16438, -0.39176, -0.81297, 0.52959,","1.16438, 2.01723, 0.00000, -1.08139,","0, 0, 0, 1",");","void main() {","float y = texture2D(textureY, texCoord).r;","float cb = texture2D(textureCb, texCoord).r;","float cr = texture2D(textureCr, texCoord).r;","gl_FragColor = vec4(y, cr, cb, 1.0) * rec601;","}"].join("\n"),FRAGMENT_LOADING:["precision mediump float;","uniform float progress;","varying vec2 texCoord;","void main() {","float c = ceil(progress-(1.0-texCoord.y));","gl_FragColor = vec4(c,c,c,1);","}"].join("\n"),VERTEX_IDENTITY:["attribute vec2 vertex;","varying vec2 texCoord;","void main() {","texCoord = vertex;","gl_Position = vec4((vertex * 2.0 - 1.0) * vec2(1, -1), 0.0, 1.0);","}"].join("\n")};var P=function(){function A(A){A.canvas?(this.canvas=A.canvas,this.ownsCanvasElement=!1):(this.canvas=document.createElement("canvas"),this.ownsCanvasElement=!0),this.width=this.canvas.width,this.height=this.canvas.height,this.enabled=!0,this.context=this.canvas.getContext("2d")}var t=A.prototype;return t.destroy=function(){this.ownsCanvasElement&&this.canvas.remove()},t.resize=function(A,t){this.width=0|A,this.height=0|t,this.canvas.width=this.width,this.canvas.height=this.height,this.imageData=this.context.getImageData(0,0,this.width,this.height),G(this.imageData.data,255)},t.renderProgress=function(A){var t=this.canvas.width,i=this.canvas.height,e=this.context;e.fillStyle="#222",e.fillRect(0,0,t,i),e.fillStyle="#fff",e.fillRect(0,i-i*A,t,i*A)},t.render=function(A,t,i){this.YCbCrToRGBA(A,t,i,this.imageData.data),this.context.putImageData(this.imageData,0,0)},t.YCbCrToRGBA=function(A,t,i,e){if(this.enabled)for(var s,o,g,I,a,B=this.width+15>>4<<4,r=B>>1,C=0,n=B,E=B+(B-this.width),Q=0,h=r-(this.width>>1),d=0,c=4*this.width,l=4*this.width,u=this.width>>1,w=this.height>>1,p=0;p>8)-179,I=(88*o>>8)-44+(183*s>>8)-91,a=o+(198*o>>8)-227;var m=A[C++],f=A[C++];e[d]=m+g,e[d+1]=m-I,e[d+2]=m+a,e[d+4]=f+g,e[d+5]=f-I,e[d+6]=f+a,d+=8;var y=A[n++],R=A[n++];e[c]=y+g,e[c+1]=y-I,e[c+2]=y+a,e[c+4]=R+g,e[c+5]=R-I,e[c+6]=R+a,c+=8}C+=E,n+=E,d+=l,c+=l,Q+=h}},A}(),O=function(){function A(){this.context=A.CachedContext=A.CachedContext||new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.destination=this.gain,this.gain.connect(this.context.destination),this.context._connections=(this.context._connections||0)+1,this.startTime=0,this.buffer=null,this.wallclockStartTime=0,this.volume=1,this.enabled=!0,this.unlocked=!A.NeedsUnlocking(),Object.defineProperty(this,"enqueuedTime",{get:this.getEnqueuedTime})}var t=A.prototype;return t.destroy=function(){this.gain.disconnect(),this.context._connections--,0===this.context._connections&&(this.context.close(),A.CachedContext=null)},t.play=function(A,t,i){if(this.enabled){if(!this.unlocked){var e=S();return this.wallclockStartTimethis.memory.buffer.byteLength){var i=this.brk-this.memory.buffer.byteLength,e=Math.ceil(i/this.pageSize);this.memory.grow(e),this.createHeapViews()}return t},t.c_abort=function(A){console.warn("JSMPeg: WASM abort",arguments)},t.c_assertFail=function(A){console.warn("JSMPeg: WASM ___assert_fail",arguments)},t.readDylinkSection=function(A){var t=new Uint8Array(A),i=0,e=function(){for(var A=0,e=1;;){var s=t[i++];if(A+=(127&s)*e,e*=128,!(128&s))return A}},s=function(A){for(var e=0;ethis.maxAudioLag&&(this.audioOut.resetEnqueuedTime(),this.audioOut.enabled=!1),A=this.audio.decode()}while(A);this.audioOut.enabled=!0}},t.updateForStaticFile=function(){var A=!1,t=0;if(this.audio&&this.audio.canPlay){for(;!A&&this.audio.decodedTime-this.audio.currentTime<.25;)A=!this.audio.decode();this.video&&this.video.currentTime0&&(e>2*s&&(this.startTime+=e),A=!this.video.decode()),t=this.demuxer.currentTime-i}this.source.resume(t),A&&this.source.completed?this.loop?this.seek(0):(this.stop(),this.options.onEnded&&this.options.onEnded(this)):A&&this.options.onStalled&&this.options.onStalled(this)},A}(),W={Player:X,VideoElement:b,BitBuffer:L,Source:{Ajax:M,AjaxProgressive:q,WebSocket:N,Fetch:function(){function A(A,t){this.url=A,this.destination=null,this.request=null,this.streaming=!0,this.completed=!1,this.established=!1,this.progress=0,this.aborted=!1,this.onEstablishedCallback=t.onSourceEstablished,this.onCompletedCallback=t.onSourceCompleted,t.hookOnEstablished&&(this.hookOnEstablished=t.hookOnEstablished)}var t=A.prototype;return t.connect=function(A){this.destination=A},t.start=function(){var A=this,t={method:"GET",headers:new Headers,cache:"default"};self.fetch(this.url,t).then((function(t){if(t.ok&&t.status>=200&&t.status<=299)return A.progress=1,A.established=!0,A.pump(t.body.getReader())})).catch((function(A){throw A}))},t.pump=function(A){var t=this;return A.read().then((function(i){if(!i.done)return t.aborted?A.cancel():(t.destination&&t.destination.write(i.value.buffer),t.pump(A));t.completed=!0})).catch((function(A){throw A}))},t.resume=function(){},t.abort=function(){this.aborted=!0},A}()},Demuxer:{TS:U},Decoder:{Base:J,MPEG1Video:T,MPEG1VideoWASM:v,MP2Audio:x,MP2AudioWASM:Y},Renderer:{WebGL:H,Canvas2D:P},AudioOutput:{WebAudio:O},WASMModule:K,Now:S,CreateVideoElements:function(){for(var A=document.querySelectorAll(".jsmpeg"),t=0;tthis.q=A))}resume(){this.q?.(),this.Z=this.q=void 0}} +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const V=A=>!e(A)&&"function"==typeof A.then,z=1073741823;const $=A(class extends t{constructor(){super(...arguments),this._$Cwt=z,this._$Cbt=[],this._$CK=new Z(this),this._$CX=new j}render(...A){return A.find((A=>!V(A)))??i}update(A,t){const e=this._$Cbt;let s=e.length;this._$Cbt=t;const o=this._$CK,g=this._$CX;this.isConnected||this.disconnected();for(let A=0;Athis._$Cwt);A++){const i=t[A];if(!V(i))return this._$Cwt=A,i;A{for(;g.get();)await g.get();const t=o.deref();if(void 0!==t){const e=t._$Cbt.indexOf(i);e>-1&&e{let i=!1;const e=new W.VideoElement(this,A,{canvas:this._jsmpegCanvasElement},{pauseWhenHidden:!1,autoplay:!1,protocols:[],audio:!1,videoBufferSize:4194304,preserveDrawingBuffer:!0,...this.cameraConfig?.jsmpeg?.options,reconnectInterval:0,onVideoDecode:()=>{!i&&this._jsmpegCanvasElement&&(i=!0,t(e))},onPlay:()=>g(this),onPause:()=>I(this)})})),this._jsmpegCanvasElement&&a(this,this._jsmpegCanvasElement,{player:this,capabilities:{supportsPause:!0},technology:["jsmpeg"]})}_resetPlayer(){if(this._refreshPlayerTimer.stop(),this._jsmpegVideoPlayer){try{this._jsmpegVideoPlayer.destroy()}catch(A){}this._jsmpegVideoPlayer=void 0}this._jsmpegCanvasElement&&(this._jsmpegCanvasElement.remove(),this._jsmpegCanvasElement=void 0)}connectedCallback(){super.connectedCallback(),this.isConnected&&this.requestUpdate()}disconnectedCallback(){this.isConnected||this._resetPlayer(),super.disconnectedCallback()}async _refreshPlayer(){if(!this.hass)return;this._resetPlayer(),this._jsmpegCanvasElement=document.createElement("canvas"),this._jsmpegCanvasElement.className="media";const A=this.cameraEndpoints?.jsmpeg;if(!A)return B(this,r("error.live_camera_no_endpoint"),{context:this.cameraConfig});const t=await c(this,this.hass,A,86400);t&&(await this._createJSMPEGPlayer(t),this._refreshPlayerTimer.start(82800,(()=>this.requestUpdate())))}render(){return C`${$((async()=>(await this._refreshPlayer(),this._jsmpegVideoPlayer&&this._jsmpegCanvasElement?C`${this._jsmpegCanvasElement}`:B(this,r("error.jsmpeg_no_player"))))(),n({cardWideConfig:this.cardWideConfig}))}`}static get styles(){return E(":host {\n width: 100%;\n height: 100%;\n display: flex;\n}\n\ncanvas {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n object-view-box: inset(var(--frigate-card-media-layout-view-box-top, 0%) var(--frigate-card-media-layout-view-box-right, 0%) var(--frigate-card-media-layout-view-box-bottom, 0%) var(--frigate-card-media-layout-view-box-left, 0%));\n}")}};Q([h({attribute:!1})],AA.prototype,"cameraConfig",void 0),Q([h({attribute:!1})],AA.prototype,"cameraEndpoints",void 0),Q([h({attribute:!1})],AA.prototype,"cardWideConfig",void 0),AA=Q([d("frigate-card-live-jsmpeg")],AA);export{AA as FrigateCardLiveJSMPEG}; diff --git a/www/community/frigate-hass-card/jsmpeg-fd152ef0.js.gz b/www/community/frigate-hass-card/jsmpeg-fd152ef0.js.gz new file mode 100644 index 00000000..44153de5 Binary files /dev/null and b/www/community/frigate-hass-card/jsmpeg-fd152ef0.js.gz differ diff --git a/www/community/frigate-hass-card/lang-ca-449daa4a.js b/www/community/frigate-hass-card/lang-ca-449daa4a.js new file mode 100644 index 00000000..f31ba121 --- /dev/null +++ b/www/community/frigate-hass-card/lang-ca-449daa4a.js @@ -0,0 +1 @@ +var e={frigate_card:"Tarjeta Frigate",frigate_card_description:"Una targeta Lovelace per a utilitzar amb Frigate",live:"En directe",no_media:"No hi ha suport per mostrar",recordings:"Enregistraments",version:"Versió"},a={cameras:{camera_entity:"Entitat de càmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"Ruta del tauler de control",view_path:"Ruta de la visualització"},editor_label:"Opcions d'emissió",method:"Mètode d'emissió",methods:{dashboard:"Tauler de control",standard:"Estàndard"}},dependencies:{all_cameras:"Mostra els esdeveniments de totes les càmeres amb aquesta càmera",cameras:"Mostra esdeveniments per a càmeres específiques amb aquesta càmera",editor_label:"Opcions de dependències"},dimensions:{aspect_ratio:"Relació d'aspecte estàtica",editor_label:"Dimensions de la càmera",layout:{editor_label:"Maquetació de la càmera",fit:"Ajust de la maquetació",fits:{contain:"Els mitjans multimèdia estan continguts/en bústia",cover:"El suport s'expandeix proporcionalment per cobrir la targeta",fill:"El suport s'estira per omplir la targeta"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentatge d'emplaçament horitzontal",y:"Percentatge d'emplaçament vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opcions del motor de càmera"},frigate:{camera_name:"Nom de la càmera de Frigate (detecció automàtica de l'entitat)",client_id:"Identificador de client de Frigate (per a > 1 servidor de Frigate)",editor_label:"Opcions de Frigate",labels:"Etiquetes de Frigate/filtres d'objectes",url:"URL del servidor de Frigate",zones:"Zones de Frigate"},go2rtc:{editor_label:"Opcions de go2rtc",modes:{editor_label:"Modes de go2rtc",mjpeg:"",mp4:"",mse:"",webrtc:""},stream:"nom del flux de go2rtc"},icon:"Icona d'aquesta càmera (detecció automàtica des de l'entitat)",id:"Identificador únic per a aquesta càmera en aquesta targeta",image:{editor_label:"Opcions d'imatge",refresh_seconds:"Nombre de segons després dels quals actualitzar la imatge en directe (0=mai)",url:"URL de la imatge que cal utilitzar en lloc de la instantània de l'entitat de la càmera"},live_provider:"Proveïdor de visualització en directe per a aquesta càmera",live_provider_options:{editor_label:"Opcions de proveïdor en directe"},live_providers:{auto:"Automàtic",go2rtc:"",ha:"Transmissió de vídeo de Home Assistant (és a dir, HLS, LL-HLS, WebRTC mitjançant HA)",image:"Imatges de Home Assistant",jsmpeg:"","webrtc-card":"Targeta WebRTC (és a dir, la targeta WebRTC d'AlexxIT)"},motioneye:{editor_label:"Opcions de MotionEye",images:{directory_pattern:"Patró del directori d'imatges",file_pattern:"Patró de fitxer d'imatges"},movies:{directory_pattern:"Patró del directori de pel·lícules",file_pattern:"Patró de fitxer de pel·lícules"},url:"URL de la interfície d'usuari de MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Títol d'aquesta càmera (detecció automàtica de l'entitat)",triggers:{editor_label:"Opcions d'activació",entities:"Activador d'altres entitats",events:{clips:"Esdeveniments amb nous clips",editor_label:"Activar esdeveniments",events:"Tots els esdeveniments",snapshots:"Esdeveniments amb noves instantànies"},motion:"Activa la detecció automàtica del sensor de moviment",occupancy:"Activa la detecció automàtica del sensor d'ocupació"},webrtc_card:{editor_label:"Opcions de la targeta WebRTC",entity:"Entitat de càmera de targeta WebRTC (no una càmera de Frigate)",url:"URL de la càmera de la targeta WebRTC"}},common:{controls:{builtin:"Controls de vídeo integrats",filter:{editor_label:"Filtre multimèdia",mode:"Mode de filtre",modes:{left:"Filtre multimèdia en un calaix a l'esquerra",none:"Sense filtre multimèdia",right:"Filtre multimèdia en un calaix a la dreta"}},next_previous:{editor_label:"Següent i anterior",size:"Mida del control següent i anterior en píxels",style:"Estil de control següent i anterior",styles:{chevrons:"Xebrons",icons:"Icones",none:"Cap",thumbnails:"Miniatures"}},thumbnails:{editor_label:"Miniatures",events_media_type:"Si voleu mostrar miniatures d'esdeveniments de clips o instantànies",events_media_types:{clips:"Miniatures de clips",snapshots:"Miniatures d'instantànies"},media_type:"Si voleu mostrar miniatures d'esdeveniments o enregistraments",media_types:{events:"Esdeveniments",recordings:"Enregistraments"},mode:"Mode de miniatures",modes:{above:"Miniatures a dalt",below:"Miniatures a baix",left:"Miniatures en un calaix a l'esquerra",none:"Sense miniatures",right:"Miniatures en un calaix a la dreta"},show_details:"Mostra els detalls amb miniatures",show_download_control:"Mostra el control de descàrrega a les miniatures",show_favorite_control:"Mostra el control preferit a les miniatures",show_timeline_control:"Mostra el control de la línia de temps a les miniatures",size:"Mida de les miniatures en píxels"},timeline:{editor_label:"Mini cronologia",mode:"Mode",modes:{above:"A dalt",below:"Baix",none:"Cap"},pan_mode:"Mode d'escombratge predeterminat",pan_modes:{pan:"Escombratge",seek:"Cerca d'escombratge en tots els mitjans","seek-in-camera":"Cerca d'escombratge només a la càmera seleccionada","seek-in-media":"Cerca d'escombratge només dins de l'element multimèdia seleccionat"}}},display:{editor_label:"Visualització",grid_columns:"Nombre exacte de columnes de la graella",grid_max_columns:"Nombre màxim de columnes de la graella",grid_selected_width_factor:"Augmenta l'amplada del suport multimèdia seleccionat en aquest factor",mode:"Mode"},image:{entity:"",entity_parameters:"",mode:"Mode de visualització d'imatges",modes:{camera:"Instantània de l'entitat de la càmera de Home Assistant",entity:"",screensaver:"Logotip de Frigate incrustat",url:"Imatge arbitrària especificada per URL"},refresh_seconds:"Nombre de segons després dels quals cal actualitzar (0=mai)",url:"URL d'imatge estàtica per a la visualització d'imatges"},media_action_conditions:{all:"Totes les oportunitats",hidden:"A l'amagat del navegador/pestanya",microphone_mute:"Si el micròfon està en silenci",microphone_unmute:"Si el micròfon no està en silenci",never:"Mai",selected:"A la selecció",unselected:"En desselecció",visible:"En la visualització del navegador/pestanya"},timeline:{clustering_threshold:"El recompte d'esdeveniments en què s'agrupen (0=sense agrupació)",events_media_type:"Els esdeveniments multimèdia que mostra la línia de temps",events_media_types:{all:"Tots els tipus de mitjans",clips:"Clips",snapshots:"Imatges instantànies"},show_recordings:"Mostra les gravacions",style:"Estil de cronologia",styles:{ribbon:"Esdeveniments en una sola cinta",stack:"Esdeveniments apilats i agrupats"},window_seconds:"La durada predeterminada de la visualització de la línia de temps en segons"}},dimensions:{aspect_ratio:"Relació d'aspecte predeterminada (p. ex., '16:9')",aspect_ratio_mode:"Mode de relació d'aspecte",aspect_ratio_modes:{dynamic:"La relació d'aspecte s'ajusta al suport multimèdia",static:"Relació d'aspecte estàtica",unconstrained:"Relació d'aspecte sense restriccions"},height:""},live:{auto_mute:"Silencia automàticament les càmeres en directe",auto_pause:"Posa en pausa automàticament les càmeres en directe",auto_play:"Reprodueix automàticament les càmeres en directe",auto_unmute:"Activa automàticament el so de les càmeres en directe",controls:{editor_label:"Controls del directe",ptz:{editor_label:"PTZ",hide_home:"Amaga el control de casa",hide_pan_tilt:"Amaga el control d'escombratge i inclinació",hide_zoom:"Amaga el control de zoom",mode:"Mode",modes:{off:"Desactivat",on:"Activat"},orientation:"Orientació",orientations:{horizontal:"Horitzontal",vertical:"Vertical"},position:"Posició",positions:{"bottom-left":"Inferior esquerra","bottom-right":"Inferior dreta","top-left":"Superior left","top-right":"Superior dreta"}}},draggable:"La vista de càmeres en directe es pot arrossegar/lliscar",lazy_load:"Les càmeres en directe es carreguen amb mandra",lazy_unload:"Les càmeres en directe es descarreguen amb mandra",microphone:{always_connected:"Mantingueu sempre el micròfon connectat",disconnect_seconds:"Segons després dels quals desconnectar el micròfon (0=mai)",editor_label:"Micròfon",enabled:"El micròfon està activat",mute_after_microphone_mute_seconds:"Segons després de silenciar el micròfon per silenciar l'àudio entrant"},preload:"Carregueu prèviament la visualització en directe en segon pla",show_image_during_load:"Mostra la imatge fixa mentre es carrega la reproducció en directe",transition_effect:"Efecte de transició de càmera en directe",zoomable:"Les càmeres en directe es poden ampliar/escombrar"},media_viewer:{auto_mute:"Silencia automàticament els continguts multimèdia",auto_pause:"Atura automàticament el contingut multimèdia",auto_play:"Reprodueix automàticament els continguts multimèdia",auto_unmute:"Activa automàticament el so del contingut multimèdia",controls:{editor_label:"Controls del visualitzador de contingut multimèdia"},draggable:"El visualitzador de mitjans es pot arrossegar/lliscar",lazy_load:"El contingut multimèdia del visualitzador multimèdia es carreguen amb mandra al carrusel",snapshot_click_plays_clip:"Si feu clic a una instantània, es reprodueix un clip relacionat",transition_effect:"Efecte de transició del visualitzador multimèdia",transition_effects:{none:"Sense transició",slide:"Transició de diapositives"},zoomable:"El visualitzador de mitjans es pot ampliar/escombrar"},menu:{alignment:"Alineació del menú",alignments:{bottom:"Alineat a la part inferior",left:"Alineat a l'esquerra",right:"Alineat a la dreta",top:"Alineat a la part superior"},button_size:"Mida del botó del menú en píxels",buttons:{alignment:"Alineació de botons",alignments:{matching:"Coincideix amb l'alineació del menú",opposing:"Oposat a l'alineació del menú"},camera_ui:"Interfície d'usuari de la càmera",cameras:"Càmeres",clips:"Clips",display_mode:"Mode de visualització",download:"Descarregar",enabled:"Botó habilitat",expand:"Expandir",frigate:"Menú de Frigate / Vista per defecte",fullscreen:"Pantalla completa",icon:"Icona",image:"Imatge",live:"En directe",media_player:"Envia al reproductor multimèdia",microphone:"Micròfon",mute:"Silenciar / Activar el so",permanent:"",play:"Reproduir / Pausa",priority:"Prioritat",ptz_controls:"",ptz_home:"",recordings:"Enregistraments",screenshot:"Captura de pantalla",snapshots:"Imatges instantànies",substreams:"Subfluxos",timeline:"Cronologia",type:"Tipus de botó",types:{momentary:"Momentani",toggle:"Commuta"}},position:"Posició del menú",positions:{bottom:"Situat a la part inferior",left:"Situat a l'esquerra",right:"Situat a la dreta",top:"Situat a la part superior"},style:"Estil de menú",styles:{hidden:"Menú ocult",hover:"Menú passant el cursor","hover-card":"Menú passant el cursor (a tota la targeta)",none:"Sense menú",outside:"Menú exterior",overlay:"Menú superposat"}},overrides:{info:"Aquesta configuració de targeta ha especificat manualment substitucions configurades que poden anul·lar els valors que es mostren a l'editor visual; consulteu l'editor de codi per veure/modificar aquestes substitucions."},performance:{features:{animated_progress_indicator:"Indicador animat del progrés",editor_label:"Opcions de característiques",max_simultaneous_engine_requests:"",media_chunk_size:"Mida del fragment multimèdia"},style:{border_radius:"Corbes",box_shadow:"Ombres",editor_label:"Opcions d'estil"},warning:"Aquesta targeta està en mode de perfil baix, de manera que els valors predeterminats han canviat per optimitzar el rendiment"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualitza les càmeres seleccionades recentment",dark_mode:"Mode fosc",dark_modes:{auto:"Automàtic",off:"Desactivat",on:"Activat"},default:"Vista per defecte",default_cycle_camera:"Passeu per les càmeres quan s'actualitzi la vista predeterminada",default_reset:{after_interaction:"Restableix la vista predeterminada després de la interacció de l'usuari",editor_label:"",entities:"",every_seconds:"Actualitza la vista predeterminada cada X segons (0=mai)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"Segons després de l'acció de l'usuari per continuar interactuant (0=mai)",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"Activar accions",interaction_mode:"Com gestionar les accions quan la targeta té interacció humana",interaction_modes:{active:"Activa només accions quan la targeta té interacció humana",all:"Activa accions independentment de la interacció humana",inactive:"Només activa accions quan la targeta no té interacció humana"},trigger:"Activar l'acció",triggers:{default:"Canvia o actualitza la vista predeterminada",live:"Canvia o actualitza la visualització en directe",media:"Canvieu a la visualització de mitjans rellevants per als nous mitjans",none:"Sense acció"},untrigger:"Desactiva l'acció",untriggers:{default:"Canvia a la vista/càmera predeterminada",none:"Sense acció"}},editor_label:"Comportament quan s'activa una càmera",filter_selected_camera:"Activa només a la càmera seleccionada",show_trigger_status:"Mostra la vora intermitent quan s'activa",untrigger_seconds:"Segons després del canvi d'estat inactiu a desactivat"},views:{clip:"Clip més recent",clips:"Galeria de clips",current:"Vista actual",image:"Imatge estàtica",live:"Visualització en directe",recording:"Enregistrament més recent",recordings:"Galeria d'enregistraments",snapshot:"Instantània més recent",snapshots:"Galeria d'instantànies",timeline:"Vista cronològica"}}},i={grid:"Mostra el visualitzador multimèdia per a cada càmera d'una quadrícula",single:"Mostra un visualitzador multimèdia únic"},t={add_new_camera:"Afegeix una càmera nova",button:"Botó",camera:"Càmera",cameras:"Càmeres",cameras_secondary:"Quines càmeres renderitzar en aquesta targeta",delete:"Suprimeix",dimensions:"Dimensions",dimensions_secondary:"Opcions de dimensions i forma",image:"Imatge",image_secondary:"Opcions de visualització d'imatges estàtiques",live:"En directe",live_secondary:"Opcions de visualització de la càmera en directe",media_gallery:"Galeria multimèdia",media_gallery_secondary:"Opcions de la galeria multimèdia",media_viewer:"Visor multimèdia",media_viewer_secondary:"Visor de suports estàtics (clips, instantànies o enregistraments)",menu:"Menú",menu_secondary:"Opcions d'aspecte del menú",move_down:"Moure cap avall",move_up:"Moure cap amunt",overrides:"Les substitucions estan actives",overrides_secondary:"S'han detectat substitucions de configuració dinàmica",performance:"Rendiment",performance_secondary:"Opcions de rendiment de la targeta",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Cronologia",timeline_secondary:"Opcions de la cronologia d'esdeveniments",upgrade:"Upgrade",upgrade_available:"Hi ha disponible una actualització automàtica de la configuració de la targeta",view:"Vista",view_secondary:"Què ha de mostrar la targeta i com mostrar-la"},r={ptz:{down:"Avall",home:"Casa",left:"Esquerra",right:"Dreta",up:"Amunt",zoom_in:"Ampliar",zoom_out:"Reduir"}},s={awaiting_live:"S'està esperant que es carregui la transmissió en directe ...",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"No s'han pogut representar els elements de la imatge",could_not_resolve:"No s'ha pogut resoldre l'URL multimèdia",diagnostics:"Diagnòstic de targetes. Reviseu la informació confidencial abans de compartir-la",download_no_media:"No hi ha contingut multimèdia per descarregar",download_sign_failed:"No s'ha pogut signar l'URL multimèdia per baixar-la",duplicate_camera_id:"Duplica l'identificador de la càmera Frigate per a la següent càmera, utilitza el paràmetre 'id' per identificar les càmeres de manera única",empty_response:"S'ha rebut una resposta buida de Home Assistant per a la sol·licitud",failed_response:"No s'ha pogut rebre la resposta de Home Assistant per a la sol·licitud",failed_retain:"No s'ha pogut retenir l'esdeveniment",failed_sign:"No s'ha pogut signar l'URL de Home Assistant",image_load_error:"No s'ha pogut carregar la imatge",invalid_configuration:"Configuració no vàlida",invalid_configuration_no_hint:"No hi ha cap indicació d'ubicació disponible (tipus dolent o faltant?)",invalid_configuration_override:"",invalid_elements_config:"La configuració dels elements de la imatge no és vàlida",invalid_response:"S'ha rebut una resposta no vàlida de Home Assistant per a la sol·licitud",jsmpeg_no_player:"No s'ha pogut iniciar el reproductor JSMPEG",live_camera_no_endpoint:"No s'ha pogut obtenir el punt final de la càmera per a aquest proveïdor en directe (configuració incompleta?)",live_camera_not_found:"No s'ha trobat la 'camera_entity' (entitat de la càmera) configurada",live_camera_unavailable:"Càmera no disponible",no_camera_engine:"No s'ha pogut determinar el motor adequat per a la càmera",no_camera_entity:"No s'ha pogut trobar l'entitat de la càmera",no_camera_entity_for_triggers:"Es requereix una entitat de càmera per detectar automàticament els activadors",no_camera_id:"No s'ha pogut determinar l'identificador de la càmera per a la següent càmera, és possible que hagis d'establir el paràmetre 'id' manualment",no_camera_name:"No s'ha pogut determinar el nom de la càmera Frigate per a la càmera (o una de les seves dependències), especifiqueu 'camera_entity' o 'camera_name'",no_dashboard_or_view:"Tant els paràmetres 'dashboard_path' com 'view_path' són necessaris per al mètode d'emissió 'dashboard'",no_live_camera:"El paràmetre 'camera_entity' s'ha de configurar i validar per a aquest proveïdor en directe",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Reconnectant",too_many_automations:"Hi ha massa trucades d'automatització imbricades, comproveu la vostra configuració per veure si hi ha bucles",troubleshooting:"Comproveu la resolució de problemes",unknown:"Error desconegut",upgrade_available:"Hi ha disponible una actualització automàtica de la configuració de la targeta; visiteu l'editor de targetes visuals",webrtc_card_reported_error:"La targeta WebRTC ha informat d'un error",webrtc_card_waiting:"S'està esperant que es carregui la targeta WebRTC ..."},n={camera:"Càmera",duration:"Durada",in_progress:"En procés",score:"Puntuació",seek:"Buscar",start:"Començar",tag:"Etiqueta",what:"Què",where:"On"},o={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},l={all:"Tots",camera:"Càmera",favorite:"Preferit",media_type:"Tipus de suport multimèdia",media_types:{clips:"Clips",recordings:"Enregistraments",snapshots:"Imatges instantànies"},not_favorite:"No preferit",select_camera:"Selecciona la càmera...",select_favorite:"Selecciona el preferit...",select_media_type:"Selecciona el tipus de suport multimèdia...",select_tag:"Selecciona l'etiqueta...",select_what:"Selecciona el què...",select_when:"Selecciona quan...",select_where:"Selecciona on...",tag:"Etiqueta",what:"Què",when:"Quan",whens:{custom:"Personalitzat",past_month:"El mes passat",past_week:"La setmana passada",today:"Avui",yesterday:"Ahir"},where:"On"},d={unseekable:"Busqueu temps no trobat als mitjans multimèdia"},c={camera:"Càmera",duration:"Durada",events:"Esdeveniments",in_progress:"En procés",seek:"Buscar",start:"Començar"},m={download:"Descarregar mitjans multimèdia",no_thumbnail:"No hi ha cap miniatura disponible",retain_indefinitely:"Els mitjans multimèdia es conservaran indefinidament",timeline:"Veure els mitjans multimèdia a la línia de temps"},u={select_date:"Escolliu la data"},p={common:e,config:a,display_modes:i,editor:t,elements:r,error:s,event:n,key_assigner:o,media_filter:l,media_viewer:d,recording:c,thumbnail:m,timeline:u};export{e as common,a as config,p as default,i as display_modes,t as editor,r as elements,s as error,n as event,o as key_assigner,l as media_filter,d as media_viewer,c as recording,m as thumbnail,u as timeline}; diff --git a/www/community/frigate-hass-card/lang-ca-449daa4a.js.gz b/www/community/frigate-hass-card/lang-ca-449daa4a.js.gz new file mode 100644 index 00000000..e153951c Binary files /dev/null and b/www/community/frigate-hass-card/lang-ca-449daa4a.js.gz differ diff --git a/www/community/frigate-hass-card/lang-ca-99b9960f.js b/www/community/frigate-hass-card/lang-ca-99b9960f.js new file mode 100644 index 00000000..b6b710be --- /dev/null +++ b/www/community/frigate-hass-card/lang-ca-99b9960f.js @@ -0,0 +1 @@ +var e={frigate_card:"Tarjeta Frigate",frigate_card_description:"Una targeta Lovelace per a utilitzar amb Frigate",live:"En directe",no_media:"No hi ha suport per mostrar",recordings:"Enregistraments",version:"Versió"},a={cameras:{camera_entity:"Entitat de càmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"Ruta del tauler de control",view_path:"Ruta de la visualització"},editor_label:"Opcions d'emissió",method:"Mètode d'emissió",methods:{dashboard:"Tauler de control",standard:"Estàndard"}},dependencies:{all_cameras:"Mostra els esdeveniments de totes les càmeres amb aquesta càmera",cameras:"Mostra esdeveniments per a càmeres específiques amb aquesta càmera",editor_label:"Opcions de dependències"},dimensions:{aspect_ratio:"Relació d'aspecte estàtica",editor_label:"Dimensions de la càmera",layout:{editor_label:"Maquetació de la càmera",fit:"Ajust de la maquetació",fits:{contain:"Els mitjans multimèdia estan continguts/en bústia",cover:"El suport s'expandeix proporcionalment per cobrir la targeta",fill:"El suport s'estira per omplir la targeta"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentatge d'emplaçament horitzontal",y:"Percentatge d'emplaçament vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opcions del motor de càmera"},frigate:{camera_name:"Nom de la càmera de Frigate (detecció automàtica de l'entitat)",client_id:"Identificador de client de Frigate (per a > 1 servidor de Frigate)",editor_label:"Opcions de Frigate",labels:"Etiquetes de Frigate/filtres d'objectes",url:"URL del servidor de Frigate",zones:"Zones de Frigate"},go2rtc:{editor_label:"Opcions de go2rtc",modes:{editor_label:"Modes de go2rtc",mjpeg:"",mp4:"",mse:"",webrtc:""},stream:"nom del flux de go2rtc"},icon:"Icona d'aquesta càmera (detecció automàtica des de l'entitat)",id:"Identificador únic per a aquesta càmera en aquesta targeta",image:{editor_label:"Opcions d'imatge",refresh_seconds:"Nombre de segons després dels quals actualitzar la imatge en directe (0=mai)",url:"URL de la imatge que cal utilitzar en lloc de la instantània de l'entitat de la càmera"},live_provider:"Proveïdor de visualització en directe per a aquesta càmera",live_provider_options:{editor_label:"Opcions de proveïdor en directe"},live_providers:{auto:"Automàtic",go2rtc:"",ha:"Transmissió de vídeo de Home Assistant (és a dir, HLS, LL-HLS, WebRTC mitjançant HA)",image:"Imatges de Home Assistant",jsmpeg:"","webrtc-card":"Targeta WebRTC (és a dir, la targeta WebRTC d'AlexxIT)"},motioneye:{editor_label:"Opcions de MotionEye",images:{directory_pattern:"Patró del directori d'imatges",file_pattern:"Patró de fitxer d'imatges"},movies:{directory_pattern:"Patró del directori de pel·lícules",file_pattern:"Patró de fitxer de pel·lícules"},url:"URL de la interfície d'usuari de MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Títol d'aquesta càmera (detecció automàtica de l'entitat)",triggers:{editor_label:"Opcions d'activació",entities:"Activador d'altres entitats",events:{clips:"Esdeveniments amb nous clips",editor_label:"Activar esdeveniments",events:"Tots els esdeveniments",snapshots:"Esdeveniments amb noves instantànies"},motion:"Activa la detecció automàtica del sensor de moviment",occupancy:"Activa la detecció automàtica del sensor d'ocupació"},webrtc_card:{editor_label:"Opcions de la targeta WebRTC",entity:"Entitat de càmera de targeta WebRTC (no una càmera de Frigate)",url:"URL de la càmera de la targeta WebRTC"}},common:{controls:{builtin:"Controls de vídeo integrats",filter:{editor_label:"Filtre multimèdia",mode:"Mode de filtre",modes:{left:"Filtre multimèdia en un calaix a l'esquerra",none:"Sense filtre multimèdia",right:"Filtre multimèdia en un calaix a la dreta"}},next_previous:{editor_label:"Següent i anterior",size:"Mida del control següent i anterior en píxels",style:"Estil de control següent i anterior",styles:{chevrons:"Xebrons",icons:"Icones",none:"Cap",thumbnails:"Miniatures"}},thumbnails:{editor_label:"Miniatures",events_media_type:"Si voleu mostrar miniatures d'esdeveniments de clips o instantànies",events_media_types:{clips:"Miniatures de clips",snapshots:"Miniatures d'instantànies"},media_type:"Si voleu mostrar miniatures d'esdeveniments o enregistraments",media_types:{events:"Esdeveniments",recordings:"Enregistraments"},mode:"Mode de miniatures",modes:{above:"Miniatures a dalt",below:"Miniatures a baix",left:"Miniatures en un calaix a l'esquerra",none:"Sense miniatures",right:"Miniatures en un calaix a la dreta"},show_details:"Mostra els detalls amb miniatures",show_download_control:"Mostra el control de descàrrega a les miniatures",show_favorite_control:"Mostra el control preferit a les miniatures",show_timeline_control:"Mostra el control de la línia de temps a les miniatures",size:"Mida de les miniatures en píxels"},timeline:{editor_label:"Mini cronologia",mode:"Mode",modes:{above:"A dalt",below:"Baix",none:"Cap"},pan_mode:"Mode d'escombratge predeterminat",pan_modes:{pan:"Escombratge",seek:"Cerca d'escombratge en tots els mitjans","seek-in-camera":"Cerca d'escombratge només a la càmera seleccionada","seek-in-media":"Cerca d'escombratge només dins de l'element multimèdia seleccionat"}}},display:{editor_label:"Visualització",grid_columns:"Nombre exacte de columnes de la graella",grid_max_columns:"Nombre màxim de columnes de la graella",grid_selected_width_factor:"Augmenta l'amplada del suport multimèdia seleccionat en aquest factor",mode:"Mode"},image:{entity:"",entity_parameters:"",mode:"Mode de visualització d'imatges",modes:{camera:"Instantània de l'entitat de la càmera de Home Assistant",entity:"",screensaver:"Logotip de Frigate incrustat",url:"Imatge arbitrària especificada per URL"},refresh_seconds:"Nombre de segons després dels quals cal actualitzar (0=mai)",url:"URL d'imatge estàtica per a la visualització d'imatges"},media_action_conditions:{all:"Totes les oportunitats",hidden:"A l'amagat del navegador/pestanya",microphone_mute:"Si el micròfon està en silenci",microphone_unmute:"Si el micròfon no està en silenci",never:"Mai",selected:"A la selecció",unselected:"En desselecció",visible:"En la visualització del navegador/pestanya"},timeline:{clustering_threshold:"El recompte d'esdeveniments en què s'agrupen (0=sense agrupació)",events_media_type:"Els esdeveniments multimèdia que mostra la línia de temps",events_media_types:{all:"Tots els tipus de mitjans",clips:"Clips",snapshots:"Imatges instantànies"},show_recordings:"Mostra les gravacions",style:"Estil de cronologia",styles:{ribbon:"Esdeveniments en una sola cinta",stack:"Esdeveniments apilats i agrupats"},window_seconds:"La durada predeterminada de la visualització de la línia de temps en segons"}},dimensions:{aspect_ratio:"Relació d'aspecte predeterminada (p. ex., '16:9')",aspect_ratio_mode:"Mode de relació d'aspecte",aspect_ratio_modes:{dynamic:"La relació d'aspecte s'ajusta al suport multimèdia",static:"Relació d'aspecte estàtica",unconstrained:"Relació d'aspecte sense restriccions"},height:""},live:{auto_mute:"Silencia automàticament les càmeres en directe",auto_pause:"Posa en pausa automàticament les càmeres en directe",auto_play:"Reprodueix automàticament les càmeres en directe",auto_unmute:"Activa automàticament el so de les càmeres en directe",controls:{editor_label:"Controls del directe",ptz:{editor_label:"PTZ",hide_home:"Amaga el control de casa",hide_pan_tilt:"Amaga el control d'escombratge i inclinació",hide_zoom:"Amaga el control de zoom",mode:"Mode",modes:{off:"Desactivat",on:"Activat"},orientation:"Orientació",orientations:{horizontal:"Horitzontal",vertical:"Vertical"},position:"Posició",positions:{"bottom-left":"Inferior esquerra","bottom-right":"Inferior dreta","top-left":"Superior left","top-right":"Superior dreta"}}},draggable:"La vista de càmeres en directe es pot arrossegar/lliscar",lazy_load:"Les càmeres en directe es carreguen amb mandra",lazy_unload:"Les càmeres en directe es descarreguen amb mandra",microphone:{always_connected:"Mantingueu sempre el micròfon connectat",disconnect_seconds:"Segons després dels quals desconnectar el micròfon (0=mai)",editor_label:"Micròfon",enabled:"El micròfon està activat",mute_after_microphone_mute_seconds:"Segons després de silenciar el micròfon per silenciar l'àudio entrant"},preload:"Carregueu prèviament la visualització en directe en segon pla",show_image_during_load:"Mostra la imatge fixa mentre es carrega la reproducció en directe",transition_effect:"Efecte de transició de càmera en directe",zoomable:"Les càmeres en directe es poden ampliar/escombrar"},media_viewer:{auto_mute:"Silencia automàticament els continguts multimèdia",auto_pause:"Atura automàticament el contingut multimèdia",auto_play:"Reprodueix automàticament els continguts multimèdia",auto_unmute:"Activa automàticament el so del contingut multimèdia",controls:{editor_label:"Controls del visualitzador de contingut multimèdia"},draggable:"El visualitzador de mitjans es pot arrossegar/lliscar",lazy_load:"El contingut multimèdia del visualitzador multimèdia es carreguen amb mandra al carrusel",snapshot_click_plays_clip:"Si feu clic a una instantània, es reprodueix un clip relacionat",transition_effect:"Efecte de transició del visualitzador multimèdia",transition_effects:{none:"Sense transició",slide:"Transició de diapositives"},zoomable:"El visualitzador de mitjans es pot ampliar/escombrar"},menu:{alignment:"Alineació del menú",alignments:{bottom:"Alineat a la part inferior",left:"Alineat a l'esquerra",right:"Alineat a la dreta",top:"Alineat a la part superior"},button_size:"Mida del botó del menú en píxels",buttons:{alignment:"Alineació de botons",alignments:{matching:"Coincideix amb l'alineació del menú",opposing:"Oposat a l'alineació del menú"},camera_ui:"Interfície d'usuari de la càmera",cameras:"Càmeres",clips:"Clips",display_mode:"Mode de visualització",download:"Descarregar",enabled:"Botó habilitat",expand:"Expandir",frigate:"Menú de Frigate / Vista per defecte",fullscreen:"Pantalla completa",icon:"Icona",image:"Imatge",live:"En directe",media_player:"Envia al reproductor multimèdia",microphone:"Micròfon",mute:"Silenciar / Activar el so",permanent:"",play:"Reproduir / Pausa",priority:"Prioritat",ptz_controls:"",ptz_home:"",recordings:"Enregistraments",screenshot:"Captura de pantalla",snapshots:"Imatges instantànies",substreams:"Subfluxos",timeline:"Cronologia",type:"Tipus de botó",types:{momentary:"Momentani",toggle:"Commuta"}},position:"Posició del menú",positions:{bottom:"Situat a la part inferior",left:"Situat a l'esquerra",right:"Situat a la dreta",top:"Situat a la part superior"},style:"Estil de menú",styles:{hidden:"Menú ocult",hover:"Menú passant el cursor","hover-card":"Menú passant el cursor (a tota la targeta)",none:"Sense menú",outside:"Menú exterior",overlay:"Menú superposat"}},overrides:{info:"Aquesta configuració de targeta ha especificat manualment substitucions configurades que poden anul·lar els valors que es mostren a l'editor visual; consulteu l'editor de codi per veure/modificar aquestes substitucions."},performance:{features:{animated_progress_indicator:"Indicador animat del progrés",editor_label:"Opcions de característiques",max_simultaneous_engine_requests:"",media_chunk_size:"Mida del fragment multimèdia"},style:{border_radius:"Corbes",box_shadow:"Ombres",editor_label:"Opcions d'estil"},warning:"Aquesta targeta està en mode de perfil baix, de manera que els valors predeterminats han canviat per optimitzar el rendiment"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualitza les càmeres seleccionades recentment",dark_mode:"Mode fosc",dark_modes:{auto:"Automàtic",off:"Desactivat",on:"Activat"},default:"Vista per defecte",default_cycle_camera:"Passeu per les càmeres quan s'actualitzi la vista predeterminada",default_reset:{after_interaction:"Restableix la vista predeterminada després de la interacció de l'usuari",editor_label:"",entities:"",every_seconds:"Actualitza la vista predeterminada cada X segons (0=mai)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"Segons després de l'acció de l'usuari per continuar interactuant (0=mai)",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"Activar accions",interaction_mode:"Com gestionar les accions quan la targeta té interacció humana",interaction_modes:{active:"Activa només accions quan la targeta té interacció humana",all:"Activa accions independentment de la interacció humana",inactive:"Només activa accions quan la targeta no té interacció humana"},trigger:"Activar l'acció",triggers:{default:"Canvia o actualitza la vista predeterminada",live:"Canvia o actualitza la visualització en directe",media:"Canvieu a la visualització de mitjans rellevants per als nous mitjans",none:"Sense acció"},untrigger:"Desactiva l'acció",untriggers:{default:"Canvia a la vista/càmera predeterminada",none:"Sense acció"}},editor_label:"Comportament quan s'activa una càmera",filter_selected_camera:"Activa només a la càmera seleccionada",show_trigger_status:"Mostra la vora intermitent quan s'activa",untrigger_seconds:"Segons després del canvi d'estat inactiu a desactivat"},views:{clip:"Clip més recent",clips:"Galeria de clips",current:"Vista actual",image:"Imatge estàtica",live:"Visualització en directe",recording:"Enregistrament més recent",recordings:"Galeria d'enregistraments",snapshot:"Instantània més recent",snapshots:"Galeria d'instantànies",timeline:"Vista cronològica"}}},i={grid:"Mostra el visualitzador multimèdia per a cada càmera d'una quadrícula",single:"Mostra un visualitzador multimèdia únic"},t={add_new_camera:"Afegeix una càmera nova",button:"Botó",camera:"Càmera",cameras:"Càmeres",cameras_secondary:"Quines càmeres renderitzar en aquesta targeta",delete:"Suprimeix",dimensions:"Dimensions",dimensions_secondary:"Opcions de dimensions i forma",image:"Imatge",image_secondary:"Opcions de visualització d'imatges estàtiques",live:"En directe",live_secondary:"Opcions de visualització de la càmera en directe",media_gallery:"Galeria multimèdia",media_gallery_secondary:"Opcions de la galeria multimèdia",media_viewer:"Visor multimèdia",media_viewer_secondary:"Visor de suports estàtics (clips, instantànies o enregistraments)",menu:"Menú",menu_secondary:"Opcions d'aspecte del menú",move_down:"Moure cap avall",move_up:"Moure cap amunt",overrides:"Les substitucions estan actives",overrides_secondary:"S'han detectat substitucions de configuració dinàmica",performance:"Rendiment",performance_secondary:"Opcions de rendiment de la targeta",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Cronologia",timeline_secondary:"Opcions de la cronologia d'esdeveniments",upgrade:"Upgrade",upgrade_available:"Hi ha disponible una actualització automàtica de la configuració de la targeta",view:"Vista",view_secondary:"Què ha de mostrar la targeta i com mostrar-la"},r={ptz:{down:"Avall",home:"Casa",left:"Esquerra",right:"Dreta",up:"Amunt",zoom_in:"Ampliar",zoom_out:"Reduir"}},s={awaiting_live:"S'està esperant que es carregui la transmissió en directe ...",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"No s'han pogut representar els elements de la imatge",could_not_resolve:"No s'ha pogut resoldre l'URL multimèdia",diagnostics:"Diagnòstic de targetes. Reviseu la informació confidencial abans de compartir-la",download_no_media:"No hi ha contingut multimèdia per descarregar",download_sign_failed:"No s'ha pogut signar l'URL multimèdia per baixar-la",duplicate_camera_id:"Duplica l'identificador de la càmera Frigate per a la següent càmera, utilitza el paràmetre 'id' per identificar les càmeres de manera única",empty_response:"S'ha rebut una resposta buida de Home Assistant per a la sol·licitud",failed_response:"No s'ha pogut rebre la resposta de Home Assistant per a la sol·licitud",failed_retain:"No s'ha pogut retenir l'esdeveniment",failed_sign:"No s'ha pogut signar l'URL de Home Assistant",image_load_error:"No s'ha pogut carregar la imatge",invalid_configuration:"Configuració no vàlida",invalid_configuration_no_hint:"No hi ha cap indicació d'ubicació disponible (tipus dolent o faltant?)",invalid_configuration_override:"",invalid_elements_config:"La configuració dels elements de la imatge no és vàlida",invalid_response:"S'ha rebut una resposta no vàlida de Home Assistant per a la sol·licitud",jsmpeg_no_player:"No s'ha pogut iniciar el reproductor JSMPEG",live_camera_no_endpoint:"No s'ha pogut obtenir el punt final de la càmera per a aquest proveïdor en directe (configuració incompleta?)",live_camera_not_found:"No s'ha trobat la 'camera_entity' (entitat de la càmera) configurada",live_camera_unavailable:"Càmera no disponible",no_camera_engine:"No s'ha pogut determinar el motor adequat per a la càmera",no_camera_entity:"No s'ha pogut trobar l'entitat de la càmera",no_camera_entity_for_triggers:"Es requereix una entitat de càmera per detectar automàticament els activadors",no_camera_id:"No s'ha pogut determinar l'identificador de la càmera per a la següent càmera, és possible que hagis d'establir el paràmetre 'id' manualment",no_camera_name:"No s'ha pogut determinar el nom de la càmera Frigate per a la càmera (o una de les seves dependències), especifiqueu 'camera_entity' o 'camera_name'",no_dashboard_or_view:"Tant els paràmetres 'dashboard_path' com 'view_path' són necessaris per al mètode d'emissió 'dashboard'",no_live_camera:"El paràmetre 'camera_entity' s'ha de configurar i validar per a aquest proveïdor en directe",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Reconnectant",too_many_automations:"Hi ha massa trucades d'automatització imbricades, comproveu la vostra configuració per veure si hi ha bucles",troubleshooting:"Comproveu la resolució de problemes",unknown:"Error desconegut",upgrade_available:"Hi ha disponible una actualització automàtica de la configuració de la targeta; visiteu l'editor de targetes visuals",webrtc_card_reported_error:"La targeta WebRTC ha informat d'un error",webrtc_card_waiting:"S'està esperant que es carregui la targeta WebRTC ..."},n={camera:"Càmera",duration:"Durada",in_progress:"En procés",score:"Puntuació",seek:"Buscar",start:"Començar",tag:"Etiqueta",what:"Què",where:"On"},o={assign:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},l={all:"Tots",camera:"Càmera",favorite:"Preferit",media_type:"Tipus de suport multimèdia",media_types:{clips:"Clips",recordings:"Enregistraments",snapshots:"Imatges instantànies"},not_favorite:"No preferit",select_camera:"Selecciona la càmera...",select_favorite:"Selecciona el preferit...",select_media_type:"Selecciona el tipus de suport multimèdia...",select_tag:"Selecciona l'etiqueta...",select_what:"Selecciona el què...",select_when:"Selecciona quan...",select_where:"Selecciona on...",tag:"Etiqueta",what:"Què",when:"Quan",whens:{custom:"Personalitzat",past_month:"El mes passat",past_week:"La setmana passada",today:"Avui",yesterday:"Ahir"},where:"On"},d={unseekable:"Busqueu temps no trobat als mitjans multimèdia"},c={camera:"Càmera",duration:"Durada",events:"Esdeveniments",in_progress:"En procés",seek:"Buscar",start:"Començar"},m={download:"Descarregar mitjans multimèdia",no_thumbnail:"No hi ha cap miniatura disponible",retain_indefinitely:"Els mitjans multimèdia es conservaran indefinidament",timeline:"Veure els mitjans multimèdia a la línia de temps"},u={select_date:"Escolliu la data"},p={common:e,config:a,display_modes:i,editor:t,elements:r,error:s,event:n,key_assigner:o,media_filter:l,media_viewer:d,recording:c,thumbnail:m,timeline:u};export{e as common,a as config,p as default,i as display_modes,t as editor,r as elements,s as error,n as event,o as key_assigner,l as media_filter,d as media_viewer,c as recording,m as thumbnail,u as timeline}; diff --git a/www/community/frigate-hass-card/lang-ca-99b9960f.js.gz b/www/community/frigate-hass-card/lang-ca-99b9960f.js.gz new file mode 100644 index 00000000..e187e4b4 Binary files /dev/null and b/www/community/frigate-hass-card/lang-ca-99b9960f.js.gz differ diff --git a/www/community/frigate-hass-card/lang-fr-674e5de5.js b/www/community/frigate-hass-card/lang-fr-674e5de5.js new file mode 100644 index 00000000..b8f2fa9e --- /dev/null +++ b/www/community/frigate-hass-card/lang-fr-674e5de5.js @@ -0,0 +1 @@ +var e={frigate_card:"Carte Frigate",frigate_card_description:"Une carte Lovelace à utiliser avec Frigate",live:"En direct",no_media:"Aucun média à afficher",recordings:"Enregistrements",version:"Version"},a={cameras:{camera_entity:"Entité caméra",capabilities:{capabilities:{clips:"Clips","favorite-events":"Événements favoris","favorite-recordings":"Enregistrements favoris",live:"Vue en direct",menu:"Menu",ptz:"PTZ",recordings:"Enregistrements",seek:"Chercher",snapshots:"Snapshots",substream:"flux secondaire"},disable:"Désactiver",disable_except:"Désactive sauf",editor_label:"Capacités de la caméra"},cast:{dashboard:{dashboard_path:"Chemin du tableau de bord",view_path:"Voir le chemin"},editor_label:"Cast les options",method:"Cast les méthodes",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Afficher les événements pour toutes les caméras avec cette caméra",cameras:"Afficher les événements pour des caméras spécifiques avec cette caméra",editor_label:"Options de dépendance"},dimensions:{aspect_ratio:"ratio d'aspect",editor_label:"Dimensions de la caméra",layout:{editor_label:"Disposition de la caméra",fit:"Ajustement de la disposition",fits:{contain:"Le média est contenu",cover:"Le média s'étend proportionnellement pour couvrir la carte",fill:"Le média est étiré pour remplir la carte"},pan:{x:"",y:""},position:{editor_label:"",x:"Pourcentage de positionnement horizontal",y:"Pourcentage de positionnement vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Options du moteur de caméra"},frigate:{camera_name:"Nom de la caméra de la frégate (détecté automatiquement par l'entité)",client_id:"ID client Frigate (pour plus 1 d'un serveur Frigate)",editor_label:"Options de Frigate",labels:"Étiquettes de Frigate/filtres d'objets",url:"URL du serveur Frigate",zones:"Zones Frigate"},go2rtc:{editor_label:"Options go2rtc",modes:{editor_label:"Modes go2rtc",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Extensions de sources multimédias (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"nom du flux go2rtc"},icon:"Icône pour cette caméra (auto-détectée par l'entité)",id:"ID unique pour cette caméra dans cette carte",image:{editor_label:"Options d'images",refresh_seconds:"Nombre de secondes après lesquelles actualiser l'image en direct (0=jamais)",url:"URL de l'image à utiliser à la place de l'instantané de l'entité de la caméra"},live_provider:"Fournisseur de visualisation en direct pour cette caméra",live_provider_options:{editor_label:"Options du fournisseur en direct"},live_providers:{auto:"Automatique",go2rtc:"go2rtc",ha:"Flux vidéo Home Assistant (c'est-à-dire HLS, LL-HLS, WebRTC via HA)",image:"Images d'Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Carte WebRTC (c.-⁠à-⁠d. La cartte WebRTC d'AlexxIT)"},motioneye:{editor_label:"Options de MotionEye",images:{directory_pattern:"Modèle de répertoire d'images",file_pattern:"Modèle de fichier images"},movies:{directory_pattern:"Modèle de répertoire de films",file_pattern:"Modèle de fichier de films"},url:"URL de l’interface MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Titre de cette caméra (détection automatique à partir de l'entité)",triggers:{editor_label:"Modèle de répertoire des films",entities:"Déclencheur à partir d'autres entités",events:{clips:"Événements avec de nouveaux clips",editor_label:"Événements déclencheurs",events:"Tous les événements",snapshots:"Événements avec de nouveaux instantanés"},motion:"Déclenchement par détection automatique du capteur de mouvement",occupancy:"Déclenchement par détection automatique du capteur de présence"},webrtc_card:{editor_label:"Options de la carte WebRTC",entity:"Entité de caméra de carte WebRTC (pas une caméra de Frigate)",url:"URL de la caméra de la carte WebRTC"}},common:{controls:{builtin:"Commandes vidéo intégrées",filter:{editor_label:"Filtre multimédia",mode:"Mode de filtre",modes:{left:"Filtre média dans un menu à gauche",none:"Pas de filtre média",right:"Filtre média dans un menu à droite"}},next_previous:{editor_label:"Suivant et précédent",size:"Taille des contrôles suivant et précédent en pixels",style:"Style de contrôle suivant et précédent",styles:{chevrons:"Chevrons",icons:"Icônes",none:"Aucun",thumbnails:"Miniatures"}},thumbnails:{editor_label:"Miniatures",events_media_type:"S'il faut afficher des vignettes de clips ou des instantanés",events_media_types:{clips:"Miniatures de clips",snapshots:"Miniatures d'instantanés"},media_type:"Afficher ou non les vignettes des événements ou des enregistrements",media_types:{events:"Événements",recordings:"Enregistrements"},mode:"Mode vignettes",modes:{above:"Miniatures ci-dessus",below:"Miniatures ci-dessous",left:"Miniatures dans un menu à gauche",none:"Aucune vignette",right:"Miniatures dans un menu à droite"},show_details:"Afficher les détails avec des vignettes",show_download_control:"Afficher le contrôle de téléchargement sur les vignettes",show_favorite_control:"Afficher le contrôle favori sur les vignettes",show_timeline_control:"Afficher le contrôle de la chronologie sur les vignettes",size:"Taille des vignettes en pixels"},timeline:{editor_label:"Mini-chronologie",mode:"Mode",modes:{above:"Au-dessus",below:"En dessous",none:"Aucun"},pan_mode:"Mode panoramique par défaut",pan_modes:{pan:"Pan",seek:"Pan cherche parmi toutes les caméras","seek-in-camera":"Pan ne cherche que parmi la caméra sélectionnée","seek-in-media":"Pan ne cherche que parmi les médias sélectionnés"}}},display:{editor_label:"Affichage",grid_columns:"Nombre de colonnes de la grille",grid_max_columns:"Nombre maximum de colonnes de la grille",grid_selected_width_factor:"Augmenter la largeur du média sélectionnée par ce facteur",mode:"Mode"},image:{entity:"",entity_parameters:"",mode:"Mode d'affichage des images",modes:{camera:"Instantané de la caméra Home Assistant de l'entité caméra",entity:"",screensaver:"Logo Frigate intégré",url:"Image arbitraire spécifiée par URL"},refresh_seconds:"Nombre de secondes après lesquelles actualiser (0=jamais)",url:"URL d'image statique pour l'affichage de l'image"},media_action_conditions:{all:"Toutes les opportunités",hidden:"Sur le navigateur/onglet masqué",microphone_mute:"",microphone_unmute:"",never:"Jamais",selected:"Sur sélection",unselected:"Lors de la désélection",visible:"Sur la visibilité du navigateur/onglet"},timeline:{clustering_threshold:"Le nombre d'événements pour lesquels ils sont regroupés (0 = pas de clustering)",events_media_type:"Les médias affichés par la chronologie",events_media_types:{all:"Tous types de médias",clips:"Extraits",snapshots:"Instantanés"},show_recordings:"Afficher les enregistrements",style:"Style de chronologie",styles:{ribbon:"Événements sur un seul ruban",stack:"Événements empilés et groupés"},window_seconds:"La durée par défaut de la vue chronologique en secondes"}},dimensions:{aspect_ratio:"Format d'image par défaut (par exemple '16:9')",aspect_ratio_mode:"Mode rapport hauteur/largeur",aspect_ratio_modes:{dynamic:"Le rapport hauteur/largeur s'adapte au média",static:"Rapport hauteur/largeur statique",unconstrained:"Rapport hauteur/largeur sans contrainte"},height:""},live:{auto_mute:"Couper automatiquement le son des caméras en direct",auto_pause:"Mettre automatiquement en pause les caméras en direct",auto_play:"Lire automatiquement les caméras en direct",auto_unmute:"Activer automatiquement le son des caméras en direct",controls:{editor_label:"Contrôles en direct",ptz:{editor_label:"PTZ",hide_home:"Cacher le bouton d'origine",hide_pan_tilt:"Caher les boutons panoramiques/inclinaison",hide_zoom:"Cahger le bouton de zoom",mode:"Mode",modes:{off:"Eteint",on:"Allumé"},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"Bas à gauche","bottom-right":"Bas à droite","top-left":"Haut à gauche","top-right":"haut à droite"}}},draggable:"La vue des caméras en direct peut être glissée/glissée",lazy_load:"Les caméras en direct sont chargeés en différé",lazy_unload:"Les caméras en direct sont déchargés en différé",microphone:{always_connected:"Gardez toujours le microphone connecté",disconnect_seconds:"Secondes après quoi déconnecter le microphone (0=jamais)",editor_label:"Microphone",enabled:"Microphone activé",mute_after_microphone_mute_seconds:""},preload:"Précharger la vue en direct en arrière-plan",show_image_during_load:"Afficher une image fixe pendant le chargement du flux en direct",transition_effect:"Effet de transition de caméra en direct",zoomable:"Les caméras en direct peuvent être zoomées/panoramiques"},media_viewer:{auto_mute:"Couper automatiquement le son des médias",auto_pause:"Mettre automatiquement en pause les médias",auto_play:"Lire automatiquement les médias",auto_unmute:"Activer automatiquement le son des médias",controls:{editor_label:"Commandes de la visionneuse multimédia"},draggable:"La visionneuse multimédia peut être glissée/glissée",lazy_load:"Les médias Media Viewer sont chargés paresseusement dans le carrousel",snapshot_click_plays_clip:"Cliquer sur un instantané lit un clip associé",transition_effect:"Effet de transition de la visionneuse multimédia",transition_effects:{none:"Pas de transition",slide:"Transition de diapositive"},zoomable:"La visionneuse multimédia peut être zoomée/panoramique"},menu:{alignment:"Alignement des menus",alignments:{bottom:"Aligné vers le bas",left:"Aligné à gauche",right:"Aligné à droite",top:"Aligné vers le haut"},button_size:"Taille du bouton de menu en pixels",buttons:{alignment:"Alignement des boutons",alignments:{matching:"Faire correspondre l'alignement du menu",opposing:"S'opposer à l'alignement des menus"},camera_ui:"Interface utilisateur de la caméra",cameras:"Appareils photo",clips:"Extraits",display_mode:"",download:"Télécharger",enabled:"Bouton activé",expand:"Développer",frigate:"Menu Frégate / Vue par défaut",fullscreen:"Plein écran",icon:"Icône",image:"Image",live:"En direct",media_player:"Envoyer au lecteur multimédia",microphone:"Microphone",mute:"Désactiver/Réactiver le son",permanent:"",play:"Jouer / Pause",priority:"Priorité",ptz_controls:"",ptz_home:"",recordings:"Enregistrements",screenshot:"Capture d'écran",snapshots:"Instantanés",substreams:"Sous-flux",timeline:"Chronologie",type:"Type de bouton",types:{momentary:"Momentané",toggle:"Basculer"}},position:"Emplacement des menus",positions:{bottom:"Positionné en bas",left:"Positionné à gauche",right:"Positionné à droite",top:"Positionné en haut"},style:"Style de menu",styles:{hidden:"Menu caché",hover:"Menu survolé","hover-card":"Menu survolé (à l'échelle de la carte)",none:"Pas de menu",outside:"Menu extérieur",overlay:"Menu superposé"}},overrides:{info:"Cette configuration de carte comporte des remplacements spécifiés manuellement et configurés qui peuvent remplacer les valeurs affichées dans l'éditeur visuel. Veuillez consulter l'éditeur de code pour afficher/modifier ces remplacements."},performance:{features:{animated_progress_indicator:"Indicateur de progression animé",editor_label:"Options de fonctionnalités",max_simultaneous_engine_requests:"",media_chunk_size:"Taille du morceau de média"},style:{border_radius:"Courbes",box_shadow:"Ombres",editor_label:"Options de style"},warning:"Cette carte est en mode profil bas, les paramètres par défaut ont donc été modifiés pour optimiser les performances."},profiles:{casting:"",editor_label:"Configuration des profils","low-performance":"Basse performance",scrubbing:"Balayage vidéo"},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Afficher les caméras nouvellement sélectionnées",dark_mode:"Mode sombre",dark_modes:{auto:"Automatique",off:"Désactivé",on:"Activé"},default:"Vue par défaut",default_cycle_camera:"Parcourez les caméras lorsque la vue par défaut est mise à jour",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Actualiser la vue par défaut toutes les X secondes (0=jamais)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"Secondes après l'action de l'utilisateur pour maintenir l'interaction (0=jamais)",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"Actions de déclenchement",interaction_mode:"Comment gérer les actions lorsque la carte comporte une interaction humaine ?",interaction_modes:{active:"Ne déclencher des actions que lorsque la carte a une interaction humaine",all:"Déclencher des actions sans interaction humaine",inactive:"Ne déclencher des actions que lorsque la carte n'a pas d'interaction humaine"},trigger:"Actions de déclenchement",triggers:{default:"Changement ou mise à jour de la vue par défaut",live:"Change ou met a jour la vue en direct",media:"Changement d'affichage pour les nouveaux médias",none:"Pas d'acction"},untrigger:"Action de désactivation",untriggers:{default:"Passage à la vue/caméra par défaut",none:"Pas d'action"}},editor_label:"Comportement en cas de déclenchement d'une caméra",filter_selected_camera:"Déclenchement uniquement sur la caméra sélectionnée",show_trigger_status:"Afficher la bordure clignotante lors du déclenchement",untrigger_seconds:"Quelques secondes après le changement d'état inactif pour débloquer"},views:{clip:"Clip le plus récent",clips:"Galerie de clips",current:"Vue actuelle",image:"Image statique",live:"Vue en direct",recording:"Enregistrement le plus récent",recordings:"Galerie d'enregistrements",snapshot:"Instantané le plus récent",snapshots:"Galerie d'instantanés",timeline:"Vue chronologique"}}},t={grid:"Afficher la visionneuse de médias pour chaque caméra d'une grille",single:"Affi une seule visionneuse"},i={add_new_camera:"Ajouter une nouvelle caméra",button:"Bouton",camera:"Caméra",cameras:"Caméras",cameras_secondary:"Quelles caméras afficher sur cette carte",delete:"Supprimer",dimensions:"Dimensions",dimensions_secondary:"Options de dimensions et de forme",image:"Image",image_secondary:"Options d'affichage d'image statique",live:"En direct",live_secondary:"Options d'affichage de la caméra en direct",media_gallery:"Galerie des médias",media_gallery_secondary:"Options de la galerie multimédia",media_viewer:"Visionneuse de médias",media_viewer_secondary:"Visionneuse de médias statiques (clips, instantanés ou enregistrements)",menu:"Menu",menu_secondary:"Options d'apparence et de convivialité du menu",move_down:"Descendre",move_up:"Déplacer vers le haut",overrides:"Les remplacements sont actifs",overrides_secondary:"Remplacements de configuration dynamique détectés",performance:"Performance",performance_secondary:"Options de performances de la carte",profiles:"Profils de confi",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Chronologie",timeline_secondary:"Options de chronologie des événements",upgrade:"Mise à niveau",upgrade_available:"Une mise à niveau automatique de la configuration de la carte est disponible",view:"Voir",view_secondary:"Ce que la carte doit montrer et comment la montrer"},n={ptz:{down:"Bas",home:"Origine",left:"Gauche",right:"Droite",up:"Haut",zoom_in:"Zoomer",zoom_out:"Dézoomer"}},r={awaiting_live:"En attente du flux en direct...",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Impossible de restituer les éléments de l'image",could_not_resolve:"Impossible de résoudre l'URL du média",diagnostics:"Diagnostic de la carte. Veuillez enlever les informations confidentielles avant de les partager",download_no_media:"Aucun média à télécharger",download_sign_failed:"Impossible de signer l'URL du média à télécharger",duplicate_camera_id:"ID de caméra Frigate en double pour la caméra suivante, utilisez le paramètre « ID » pour identifier de manière unique les caméras",empty_response:"Réponse vide reçue de Home Assistant pour la demande",failed_response:"Échec de la réponse de Home Assistant à la demande",failed_retain:"Impossible de conserver l'événement",failed_sign:"Impossible de signer l'URL de Home Assistant",image_load_error:"L'image n'a pas pu être chargée",invalid_configuration:"Configuration invalide",invalid_configuration_no_hint:"Aucune indication de localisation disponible (type incorrect ou manquant ?)",invalid_configuration_override:"",invalid_elements_config:"Configuration des éléments d'image invalide",invalid_response:"Réponse non valide reçue de Home Assistant pour la demande",jsmpeg_no_player:"Impossible de démarrer le lecteur JSMPEG",live_camera_no_endpoint:"Impossible d'obtenir le point de terminaison de la caméra pour ce fournisseur en direct (configuration incomplète ?)",live_camera_not_found:"L'entité caméra configurée n'a pas été trouvée",live_camera_unavailable:"Caméra indisponible",no_camera_engine:"Impossible de déterminer le moteur approprié pour la caméra",no_camera_entity:"Impossible de trouver l'entité de caméra",no_camera_entity_for_triggers:"Une entité caméra est requise pour détecter automatiquement les déclencheurs",no_camera_id:"Impossible de déterminer l'identifiant de la caméra suivante. Il faudra peut-être définir le paramètre « ID » manuellement",no_camera_name:"Impossible de déterminer le nom de la caméra Frigate pour la caméra (ou l'une de ses dépendances). Veuillez spécifier soit « camera_entity » soit « camera_name ».",no_dashboard_or_view:"",no_live_camera:"Le paramètre camera_entity doit être défini et valide pour ce fournisseur en direct",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Reconnexion",too_many_automations:"Trop d'appels d'automatisation imbriqués, veuillez vérifier votre configuration pour les boucles",troubleshooting:"Vérifier le dépannage",unknown:"Erreur inconnue",upgrade_available:"Une mise à niveau automatisée de la configuration de la carte est disponible, veuillez visiter l'éditeur visuel de la carte",webrtc_card_reported_error:"La carte WebRTC a signalé une erreur",webrtc_card_waiting:"En attente du chargement de la carte WebRTC..."},s={camera:"Caméra",duration:"Durée",in_progress:"En cours",score:"Score",seek:"Chercher",start:"Commencer",tag:"Étiqueter",what:"Quoi",where:"Où"},o={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},l={all:"Tous",camera:"Caméra",favorite:"Préféré",media_type:"Type de support",media_types:{clips:"Extraits",recordings:"Enregistrements",snapshots:"Instantanés"},not_favorite:"Pas favori",select_camera:"Sélectionnez une caméra...",select_favorite:"Sélectionnez un favori...",select_media_type:"Sélectionnez le type de média...",select_tag:"Sélectionnez la balise...",select_what:"Sélectionnez quoi...",select_when:"Sélectionnez quand...",select_where:"Sélectionnez où...",tag:"Étiqueter",what:"Quoi",when:"Quand",whens:{custom:"",past_month:"Mois passé",past_week:"La semaine dernière",today:"Aujourd'hui",yesterday:"Hier"},where:"Où"},d={unseekable:"Temps non trouvé dans les médias"},c={camera:"Caméra",duration:"Durée",events:"Événements",in_progress:"En cours",seek:"Chercher",start:"Commencer"},u={download:"Télécharger des médias",no_thumbnail:"Aucune vignette disponible",retain_indefinitely:"Les médias seront conservés indéfiniment",timeline:"Voir les médias dans la chronologie"},m={select_date:"Choisir une date"},p={common:e,config:a,display_modes:t,editor:i,elements:n,error:r,event:s,key_assigner:o,media_filter:l,media_viewer:d,recording:c,thumbnail:u,timeline:m};export{e as common,a as config,p as default,t as display_modes,i as editor,n as elements,r as error,s as event,o as key_assigner,l as media_filter,d as media_viewer,c as recording,u as thumbnail,m as timeline}; diff --git a/www/community/frigate-hass-card/lang-fr-674e5de5.js.gz b/www/community/frigate-hass-card/lang-fr-674e5de5.js.gz new file mode 100644 index 00000000..17ff8fd3 Binary files /dev/null and b/www/community/frigate-hass-card/lang-fr-674e5de5.js.gz differ diff --git a/www/community/frigate-hass-card/lang-fr-e5e97bbf.js b/www/community/frigate-hass-card/lang-fr-e5e97bbf.js new file mode 100644 index 00000000..d4bfda6b --- /dev/null +++ b/www/community/frigate-hass-card/lang-fr-e5e97bbf.js @@ -0,0 +1 @@ +var e={frigate_card:"Carte Frigate",frigate_card_description:"Une carte Lovelace à utiliser avec Frigate",live:"En direct",no_media:"Aucun média à afficher",recordings:"Enregistrements",version:"Version"},a={cameras:{camera_entity:"Entité caméra",capabilities:{capabilities:{clips:"Clips","favorite-events":"Événements favoris","favorite-recordings":"Enregistrements favoris",live:"Vue en direct",menu:"Menu",ptz:"PTZ",recordings:"Enregistrements",seek:"Recherche",snapshots:"Snapshots",substream:"flux secondaire"},disable:"Désactiver",disable_except:"Désactive sauf",editor_label:"Capacités de la caméra"},cast:{dashboard:{dashboard_path:"Chemin du tableau de bord",view_path:"Voir le chemin"},editor_label:"Options de diffusion",method:"Méthodes de diffusion",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Afficher les événements pour toutes les caméras avec cette caméra",cameras:"Afficher les événements pour des caméras spécifiques avec cette caméra",editor_label:"Options de dépendance"},dimensions:{aspect_ratio:"Rapport d'aspect d'image",editor_label:"Dimensions de la caméra",layout:{editor_label:"Disposition de la caméra",fit:"Ajustement de la disposition",fits:{contain:"Le média est contenu",cover:"Le média s'étend proportionnellement pour couvrir la carte",fill:"Le média est étiré pour remplir la carte"},pan:{x:"Pourcentage de panoramique horizontal",y:"Pourcentage de panoramique vertical"},position:{editor_label:"Position de la couverture",x:"Pourcentage de positionnement horizontal",y:"Pourcentage de positionnement vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:"Facteur de zoom"}},engines:{editor_label:"Options du moteur de caméra"},frigate:{camera_name:"Nom de la caméra Frigate (détecté automatiquement par l'entité)",client_id:"ID client Frigate (Si plus d'un serveur Frigate)",editor_label:"Options de Frigate",labels:"Étiquettes de Frigate/filtres d'objets",url:"URL du serveur Frigate",zones:"Zones Frigate"},go2rtc:{editor_label:"Options go2rtc",modes:{editor_label:"Modes go2rtc",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Extensions de sources multimédias (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"nom du flux go2rtc"},icon:"Icône pour cette caméra (auto-détectée par l'entité)",id:"ID unique pour cette caméra dans cette carte",image:{editor_label:"Options d'images",refresh_seconds:"Nombre de secondes après lesquelles actualiser l'image en direct (0=jamais)",url:"URL de l'image à utiliser à la place de l'instantané de l'entité de la caméra"},live_provider:"Fournisseur de visualisation en direct pour cette caméra",live_provider_options:{editor_label:"Options du fournisseur en direct"},live_providers:{auto:"Automatique",go2rtc:"go2rtc",ha:"Flux vidéo Home Assistant (c'est-à-dire HLS, LL-HLS, WebRTC via HA)",image:"Images d'Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Carte WebRTC (c.-⁠à-⁠d. La carte WebRTC d'AlexxIT)"},motioneye:{editor_label:"Options de MotionEye",images:{directory_pattern:"Modèle de répertoire d'images",file_pattern:"Modèle de fichier images"},movies:{directory_pattern:"Modèle de répertoire de films",file_pattern:"Modèle de fichier de films"},url:"URL de l’interface MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"Option Reolink",media_resolution:{editor_label:"Désolution du média",high:"Haute résolution",low:"Basse résolution"},url:"URL de l'interface utilisateur Reolink"},title:"Titre de cette caméra (détection automatique à partir de l'entité)",triggers:{editor_label:"Modèle de répertoire des films",entities:"Déclencheur à partir d'autres entités",events:{clips:"Événements avec de nouveaux clips",editor_label:"Événements déclencheurs",events:"Tous les événements",snapshots:"Événements avec de nouveaux instantanés"},motion:"Déclenchement par détection automatique du capteur de mouvement",occupancy:"Déclenchement par détection automatique du capteur de présence"},webrtc_card:{editor_label:"Options de la carte WebRTC",entity:"Entité de caméra de carte WebRTC (pas une caméra de Frigate)",url:"URL de la caméra de la carte WebRTC"}},common:{controls:{builtin:"Commandes vidéo intégrées",filter:{editor_label:"Filtre multimédia",mode:"Mode de filtre",modes:{left:"Filtre média dans un menu à gauche",none:"Pas de filtre média",right:"Filtre média dans un menu à droite"}},next_previous:{editor_label:"Suivant et précédent",size:"Taille des contrôles suivant et précédent en pixels",style:"Style de contrôle suivant et précédent",styles:{chevrons:"Chevrons",icons:"Icônes",none:"Aucun",thumbnails:"Vignettes"}},thumbnails:{editor_label:"Vignettes",events_media_type:"S'il faut afficher des vignettes de clips ou des instantanés",events_media_types:{clips:"Vignettes de clips",snapshots:"Vignettes d'instantanés"},media_type:"Afficher ou non les vignettes des événements ou des enregistrements",media_types:{events:"Événements",recordings:"Enregistrements"},mode:"Mode vignettes",modes:{above:"Vignettes en haut",below:"Vignettes en bas",left:"Vignettes dans un menu à gauche",none:"Aucune vignette",right:"Vignettes dans un menu à droite"},show_details:"Afficher les détails avec des vignettes",show_download_control:"Afficher le contrôle de téléchargement sur les vignettes",show_favorite_control:"Afficher le contrôle favori sur les vignettes",show_timeline_control:"Afficher le contrôle de la chronologie sur les vignettes",size:"Taille des vignettes en pixels"},timeline:{editor_label:"Mini-chronologie",mode:"Mode",modes:{above:"Au-dessus",below:"En dessous",none:"Aucun"},pan_mode:"Mode panoramique par défaut",pan_modes:{pan:"Pan",seek:"Pan cherche parmi toutes les caméras","seek-in-camera":"Pan ne cherche que parmi la caméra sélectionnée","seek-in-media":"Pan ne cherche que parmi les médias sélectionnés"}}},display:{editor_label:"Affichage",grid_columns:"Nombre de colonnes de la grille",grid_max_columns:"Nombre maximum de colonnes de la grille",grid_selected_width_factor:"Augmenter la largeur du média sélectionnée par ce facteur",mode:"Mode"},image:{entity:"Entité à utiliser avec le mode entité",entity_parameters:"Paramètres de requête ajoutés aux URL des images basées sur l'entité (par exemple, width=1920&height=1080)",mode:"Mode d'affichage des images",modes:{camera:"Instantané de la caméra Home Assistant de l'entité caméra",entity:"Entité avec l'attribut entity_picture",screensaver:"Logo Frigate intégré",url:"Image arbitraire spécifiée par URL"},refresh_seconds:"Nombre de secondes après lesquelles actualiser (0=jamais)",url:"URL d'image statique pour l'affichage de l'image"},media_action_conditions:{all:"Toutes les opportunités",hidden:"Sur le navigateur/onglet masqué",microphone_mute:"Sourdine du microphone activée",microphone_unmute:"Sourdine du microphone désactivée",never:"Jamais",selected:"Sur sélection",unselected:"Lors de la désélection",visible:"Sur la visibilité du navigateur/onglet"},timeline:{clustering_threshold:"Le nombre d'événements pour lesquels ils sont regroupés (0 = pas de clustering)",events_media_type:"Les médias affichés par la chronologie",events_media_types:{all:"Tous types de médias",clips:"Extraits",snapshots:"Instantanés"},show_recordings:"Afficher les enregistrements",style:"Style de chronologie",styles:{ribbon:"Événements sur un seul ruban",stack:"Événements empilés et groupés"},window_seconds:"La durée par défaut de la vue chronologique en secondes"}},dimensions:{aspect_ratio:"Format d'image par défaut (par exemple '16:9')",aspect_ratio_mode:"Mode rapport hauteur/largeur",aspect_ratio_modes:{dynamic:"Le rapport hauteur/largeur s'adapte au média",static:"Rapport hauteur/largeur statique",unconstrained:"Rapport hauteur/largeur sans contrainte"},height:"Hauteur de la carte en unités CSS (par exemple, '500px')"},live:{auto_mute:"Couper automatiquement le son des caméras en direct",auto_pause:"Mettre automatiquement en pause les caméras en direct",auto_play:"Lire automatiquement les caméras en direct",auto_unmute:"Activer automatiquement le son des caméras en direct",controls:{editor_label:"Contrôles en direct",ptz:{editor_label:"PTZ",hide_home:"Cacher le bouton position d'origine",hide_pan_tilt:"Cacher les boutons panoramiques/inclinaison",hide_zoom:"Cacher le bouton de zoom",mode:"Mode",modes:{off:"Eteint",on:"Allumé"},orientation:"",orientations:{horizontal:"Horizontale",vertical:"Verticale"},position:"",positions:{"bottom-left":"En bas à gauche","bottom-right":"En bas à droite","top-left":"En haut à gauche","top-right":"En haut à droite"}}},draggable:"La vue des caméras en direct peut être déplacée/glissée",lazy_load:"Les caméras en direct sont chargeés en différé",lazy_unload:"Les caméras en direct sont déchargés en différé",microphone:{always_connected:"Toujours garder le microphone connecté",disconnect_seconds:"Secondes après quoi déconnecter le microphone (0=jamais)",editor_label:"Microphone",enabled:"Microphone activé",mute_after_microphone_mute_seconds:"Secondes après la mise en sourdine du microphone pour couper l'audio entrant"},preload:"Précharger la vue en direct en arrière-plan",show_image_during_load:"Afficher une image fixe pendant le chargement du flux en direct",transition_effect:"Effet de transition de caméra en direct",zoomable:"Les caméras en direct peuvent être zoomées/panoramiques"},media_viewer:{auto_mute:"Couper automatiquement le son des médias",auto_pause:"Mettre automatiquement en pause les médias",auto_play:"Lire automatiquement les médias",auto_unmute:"Activer automatiquement le son des médias",controls:{editor_label:"Commandes de la visionneuse multimédia"},draggable:"La visionneuse multimédia peut être déplacée/glissée",lazy_load:"Les médias Media Viewer sont chargés en différé dans le carrousel",snapshot_click_plays_clip:"Cliquer sur un instantané lit l'extrait associé",transition_effect:"Effet de transition de la visionneuse multimédia",transition_effects:{none:"Pas de transition",slide:"Transition de diapositive"},zoomable:"La visionneuse multimédia peut être zoomée/panoramique"},menu:{alignment:"Alignement des menus",alignments:{bottom:"Aligné vers le bas",left:"Aligné à gauche",right:"Aligné à droite",top:"Aligné vers le haut"},button_size:"Taille du bouton de menu en pixels",buttons:{alignment:"Alignement des boutons",alignments:{matching:"Faire correspondre l'alignement du menu",opposing:"S'opposer à l'alignement des menus"},camera_ui:"Interface utilisateur de la caméra",cameras:"Cameras",clips:"Extraits",display_mode:"Mode d'afficahge",download:"Télécharger",enabled:"Bouton activé",expand:"Développer",frigate:"Menu Frigate / Vue par défaut",fullscreen:"Plein écran",icon:"Icône",image:"Image",live:"En direct",media_player:"Envoyer au lecteur multimédia",microphone:"Microphone",mute:"Désactiver/Réactiver le son",permanent:"Afficher lorsque le menu est caché",play:"Jouer / Pause",priority:"Priorité",ptz_controls:"Afficher les controles PTZ",ptz_home:"Position d'origine PTZ",recordings:"Enregistrements",screenshot:"Capture d'écran",snapshots:"Instantanés",substreams:"flux secondaires",timeline:"Chronologie",type:"Type de bouton",types:{momentary:"Momentané",toggle:"Basculer"}},position:"Emplacement des menus",positions:{bottom:"Positionné en bas",left:"Positionné à gauche",right:"Positionné à droite",top:"Positionné en haut"},style:"Style de menu",styles:{hidden:"Menu caché",hover:"Menu survolé","hover-card":"Menu survolé (à l'échelle de la carte)",none:"Pas de menu",outside:"Menu extérieur",overlay:"Menu superposé"}},overrides:{info:"Cette configuration de carte comporte des remplacements spécifiés manuellement et configurés qui peuvent remplacer les valeurs affichées dans l'éditeur visuel. Veuillez consulter l'éditeur de code pour afficher/modifier ces remplacements."},performance:{features:{animated_progress_indicator:"Indicateur de progression animé",editor_label:"Options de fonctionnalités",max_simultaneous_engine_requests:"Nombre maximal de requêtes simultanées au moteur de caméra",media_chunk_size:"Taille du morceau de média"},style:{border_radius:"Courbes",box_shadow:"Ombres",editor_label:"Options de style"},warning:"Cette carte est en mode profil bas, les paramètres par défaut ont donc été modifiés pour optimiser les performances."},profiles:{casting:"Diffusion",editor_label:"Configuration des profils","low-performance":"Basse performance",scrubbing:"Balayage vidéo"},status_bar:{height:"Hauteur de la barre d'état en pixels",items:{enabled:"Item activé",engine:"Moteur de camera",live_provider:"fournisseur de flux en direc",priority:"Priorité de l'item",resolution:"Résolution",technology:"Technologie",title:"Titre"},popup_seconds:"Secondes de popup de la barre d'état",position:"Position de la barre d'état",positions:{bottom:"Postionné en bas",top:"Postionné en haut"},style:"Style de la barre d'état",styles:{hover:"Barre d'état au survol","hover-card":"Barre d'état au survol (sur toute la carte)",none:"Pas de barre d'état",outside:"Barre d'état extérieure",overlay:"Barre d'état superposée",popup:"Barre d'état contextuelle"}},view:{camera_select:"Afficher les caméras nouvellement sélectionnées",dark_mode:"Mode sombre",dark_modes:{auto:"Automatique",off:"Désactivé",on:"Activé"},default:"Vue par défaut",default_cycle_camera:"Parcourez les caméras lorsque la vue par défaut est mise à jour",default_reset:{after_interaction:"Réinitialiser à la vue par défaut après la fin de l'interaction de l'utilisateur",editor_label:"Comportement de réinitialisation de la vue par défaut",entities:"Réinitialiser à la vue par défaut lors du changement d'état de l'entité",every_seconds:"Actualiser la vue par défaut toutes les X secondes (0=jamais)",interaction_mode:"Comment la réinitialisation par défaut se comporte lorsque la carte a une interaction humaine",interaction_modes:{active:"Autoriser la réinitialisation uniquement lorsque la carte a une interaction humaine active",all:"Réinitialiser indépendamment de l'interaction humaine",inactive:"Réinitialiser uniquement lorsque la carte n'a pas d'interaction humaine"}},interaction_seconds:"Secondes après l'action de l'utilisateur pour maintenir l'interaction (0=jamais)",keyboard_shortcuts:{editor_label:"Raccourcis clavier",enabled:"Raccourcis clavier activés",ptz_down:"PTZ bas",ptz_home:"PTZ position d'origine",ptz_left:"PTZ gauche",ptz_right:"PTZ droite",ptz_up:"PTZ haut",ptz_zoom_in:"PTZ zoomer",ptz_zoom_out:"PTZ dézoomer"},triggers:{actions:{editor_label:"Actions de déclenchement",interaction_mode:"Comment gérer les actions lorsque la carte comporte une interaction humaine ?",interaction_modes:{active:"Ne déclencher des actions que lorsque la carte a une interaction humaine",all:"Déclencher des actions sans interaction humaine",inactive:"Ne déclencher des actions que lorsque la carte n'a pas d'interaction humaine"},trigger:"Actions de déclenchement",triggers:{default:"Changement ou mise à jour de la vue par défaut",live:"Change ou met a jour la vue en direct",media:"Changement d'affichage pour les nouveaux médias",none:"Pas d'acction"},untrigger:"Action de désactivation",untriggers:{default:"Passage à la vue/caméra par défaut",none:"Pas d'action"}},editor_label:"Comportement en cas de déclenchement d'une caméra",filter_selected_camera:"Déclenchement uniquement sur la caméra sélectionnée",show_trigger_status:"Afficher la bordure clignotante lors du déclenchement",untrigger_seconds:"Quelques secondes après le changement d'état inactif pour débloquer"},views:{clip:"Clip le plus récent",clips:"Galerie de clips",current:"Vue actuelle",image:"Image statique",live:"Vue en direct",recording:"Enregistrement le plus récent",recordings:"Galerie d'enregistrements",snapshot:"Instantané le plus récent",snapshots:"Galerie d'instantanés",timeline:"Vue chronologique"}}},t={grid:"Afficher la visionneuse de médias pour chaque caméra d'une grille",single:"Afficher une seule visionneuse"},i={add_new_camera:"Ajouter une nouvelle caméra",button:"Bouton",camera:"Caméra",cameras:"Caméras",cameras_secondary:"Quelles caméras afficher sur cette carte",delete:"Supprimer",dimensions:"Dimensions",dimensions_secondary:"Options de dimensions et de forme",image:"Image",image_secondary:"Options d'affichage d'image statique",live:"En direct",live_secondary:"Options d'affichage de la caméra en direct",media_gallery:"Galerie des médias",media_gallery_secondary:"Options de la galerie multimédia",media_viewer:"Visionneuse de médias",media_viewer_secondary:"Visionneuse de médias statiques (clips, instantanés ou enregistrements)",menu:"Menu",menu_secondary:"Options d'apparence et de convivialité du menu",move_down:"Descendre",move_up:"Déplacer vers le haut",overrides:"Les remplacements sont actifs",overrides_secondary:"Remplacements de configuration dynamique détectés",performance:"Performance",performance_secondary:"Options de performances de la carte",profiles:"Profils de confi",profiles_secondary:"Choisir des ensembles de paramètres par défaut pré-configurés",status_bar:"Barre d'état",status_bar_secondary:"Options d'apparence et de comportement de la barre d'état",timeline:"Chronologie",timeline_secondary:"Options de chronologie des événements",upgrade:"Mise à niveau",upgrade_available:"Une mise à niveau automatique de la configuration de la carte est disponible",view:"Voir",view_secondary:"Ce que la carte doit montrer et comment la montrer"},n={ptz:{down:"Bas",home:"Origine",left:"Gauche",right:"Droite",up:"Haut",zoom_in:"Zoomer",zoom_out:"Dézoomer"}},r={awaiting_live:"En attente du flux en direct...",awaiting_media:"En attente du chargement des médias",camera_initialization:"Échec de l'initialisation de la caméra",camera_initialization_reolink:"Impossible d'initialiser la caméra Reolink",could_not_render_elements:"Impossible de restituer les éléments de l'image",could_not_resolve:"Impossible de résoudre l'URL du média",diagnostics:"Diagnostic de la carte. Veuillez enlever les informations confidentielles avant de les partager",download_no_media:"Aucun média à télécharger",download_sign_failed:"Impossible de signer l'URL du média à télécharger",duplicate_camera_id:"ID de caméra Frigate en double pour la caméra suivante, utilisez le paramètre « ID » pour identifier de manière unique les caméras",empty_response:"Réponse vide reçue de Home Assistant pour la demande",failed_response:"Échec de la réponse de Home Assistant à la demande",failed_retain:"Impossible de conserver l'événement",failed_sign:"Impossible de signer l'URL de Home Assistant",image_load_error:"L'image n'a pas pu être chargée",invalid_configuration:"Configuration invalide",invalid_configuration_no_hint:"Aucune indication de localisation disponible (type incorrect ou manquant ?)",invalid_configuration_override:"Configuration de remplacement invalide",invalid_elements_config:"Configuration des éléments d'image invalide",invalid_response:"Réponse non valide reçue de Home Assistant pour la demande",jsmpeg_no_player:"Impossible de démarrer le lecteur JSMPEG",live_camera_no_endpoint:"Impossible d'obtenir le point de terminaison de la caméra pour ce fournisseur en direct (configuration incomplète ?)",live_camera_not_found:"L'entité caméra configurée n'a pas été trouvée",live_camera_unavailable:"Caméra indisponible",no_camera_engine:"Impossible de déterminer le moteur approprié pour la caméra",no_camera_entity:"Impossible de trouver l'entité de caméra",no_camera_entity_for_triggers:"Une entité caméra est requise pour détecter automatiquement les déclencheurs",no_camera_id:"Impossible de déterminer l'identifiant de la caméra suivante. Il faudra peut-être définir le paramètre « ID » manuellement",no_camera_name:"Impossible de déterminer le nom de la caméra Frigate pour la caméra (ou l'une de ses dépendances). Veuillez spécifier soit « camera_entity » soit « camera_name ».",no_dashboard_or_view:"Les paramètres 'dashboard_path' et 'view_path' sont requis pour la méthode de conversion 'dashboard'",no_live_camera:"Le paramètre camera_entity doit être défini et valide pour ce fournisseur en direct",no_supported_camera:"La caméra sélectionnée ne prend pas en charge cette vue",no_supported_cameras:"Aucune caméra ne prend en charge cette vue",reconnecting:"Reconnexion",too_many_automations:"Trop d'appels d'automatisation imbriqués, veuillez vérifier votre configuration pour les boucles",troubleshooting:"Vérifier le dépannage",unknown:"Erreur inconnue",upgrade_available:"Une mise à niveau automatisée de la configuration de la carte est disponible, veuillez visiter l'éditeur visuel de la carte",webrtc_card_reported_error:"La carte WebRTC a signalé une erreur",webrtc_card_waiting:"En attente du chargement de la carte WebRTC..."},o={camera:"Caméra",duration:"Durée",in_progress:"En cours",score:"Score",seek:"Chercher",start:"Commencer",tag:"Étiqueter",what:"Quoi",where:"Où"},s={assign:"Assigner",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:"Désassigner"},l={all:"Tous",camera:"Caméra",favorite:"Préféré",media_type:"Type de support",media_types:{clips:"Extraits",recordings:"Enregistrements",snapshots:"Instantanés"},not_favorite:"Pas favori",select_camera:"Sélectionnez une caméra...",select_favorite:"Sélectionnez un favori...",select_media_type:"Sélectionnez le type de média...",select_tag:"Sélectionnez la balise...",select_what:"Sélectionnez quoi...",select_when:"Sélectionnez quand...",select_where:"Sélectionnez où...",tag:"Étiqueter",what:"Quoi",when:"Quand",whens:{custom:"",past_month:"Mois passé",past_week:"La semaine dernière",today:"Aujourd'hui",yesterday:"Hier"},where:"Où"},d={unseekable:"Temps non trouvé dans les médias"},c={camera:"Caméra",duration:"Durée",events:"Événements",in_progress:"En cours",seek:"Chercher",start:"Commencer"},u={download:"Télécharger des médias",no_thumbnail:"Aucune vignette disponible",retain_indefinitely:"Les médias seront conservés indéfiniment",timeline:"Voir les médias dans la chronologie"},m={select_date:"Choisir une date"},p={common:e,config:a,display_modes:t,editor:i,elements:n,error:r,event:o,key_assigner:s,media_filter:l,media_viewer:d,recording:c,thumbnail:u,timeline:m};export{e as common,a as config,p as default,t as display_modes,i as editor,n as elements,r as error,o as event,s as key_assigner,l as media_filter,d as media_viewer,c as recording,u as thumbnail,m as timeline}; diff --git a/www/community/frigate-hass-card/lang-fr-e5e97bbf.js.gz b/www/community/frigate-hass-card/lang-fr-e5e97bbf.js.gz new file mode 100644 index 00000000..f8949183 Binary files /dev/null and b/www/community/frigate-hass-card/lang-fr-e5e97bbf.js.gz differ diff --git a/www/community/frigate-hass-card/lang-fr-ea16daba.js b/www/community/frigate-hass-card/lang-fr-ea16daba.js new file mode 100644 index 00000000..9fa4983c --- /dev/null +++ b/www/community/frigate-hass-card/lang-fr-ea16daba.js @@ -0,0 +1 @@ +var e={frigate_card:"Carte Frigate",frigate_card_description:"Une carte Lovelace à utiliser avec Frigate",live:"En direct",no_media:"Aucun média à afficher",recordings:"Enregistrements",version:"Version"},a={cameras:{camera_entity:"Entité caméra",capabilities:{capabilities:{clips:"Clips","favorite-events":"Événements favoris","favorite-recordings":"Enregistrements favoris",live:"Vue en direct",menu:"Menu",ptz:"PTZ",recordings:"Enregistrements",seek:"Recherche",snapshots:"Snapshots",substream:"flux secondaire"},disable:"Désactiver",disable_except:"Désactive sauf",editor_label:"Capacités de la caméra"},cast:{dashboard:{dashboard_path:"Chemin du tableau de bord",view_path:"Voir le chemin"},editor_label:"Options de diffusion",method:"Méthodes de diffusion",methods:{dashboard:"Dashboard",standard:"Standard"}},dependencies:{all_cameras:"Afficher les événements pour toutes les caméras avec cette caméra",cameras:"Afficher les événements pour des caméras spécifiques avec cette caméra",editor_label:"Options de dépendance"},dimensions:{aspect_ratio:"Rapport d'aspect d'image",editor_label:"Dimensions de la caméra",layout:{editor_label:"Disposition de la caméra",fit:"Ajustement de la disposition",fits:{contain:"Le média est contenu",cover:"Le média s'étend proportionnellement pour couvrir la carte",fill:"Le média est étiré pour remplir la carte"},pan:{x:"Pourcentage de panoramique horizontal",y:"Pourcentage de panoramique vertical"},position:{editor_label:"Position de la couverture",x:"Pourcentage de positionnement horizontal",y:"Pourcentage de positionnement vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:"Facteur de zoom"}},engines:{editor_label:"Options du moteur de caméra"},frigate:{camera_name:"Nom de la caméra Frigate (détecté automatiquement par l'entité)",client_id:"ID client Frigate (Si plus d'un serveur Frigate)",editor_label:"Options de Frigate",labels:"Étiquettes de Frigate/filtres d'objets",url:"URL du serveur Frigate",zones:"Zones Frigate"},go2rtc:{editor_label:"Options go2rtc",modes:{editor_label:"Modes go2rtc",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Extensions de sources multimédias (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"nom du flux go2rtc"},icon:"Icône pour cette caméra (auto-détectée par l'entité)",id:"ID unique pour cette caméra dans cette carte",image:{editor_label:"Options d'images",refresh_seconds:"Nombre de secondes après lesquelles actualiser l'image en direct (0=jamais)",url:"URL de l'image à utiliser à la place de l'instantané de l'entité de la caméra"},live_provider:"Fournisseur de visualisation en direct pour cette caméra",live_provider_options:{editor_label:"Options du fournisseur en direct"},live_providers:{auto:"Automatique",go2rtc:"go2rtc",ha:"Flux vidéo Home Assistant (c'est-à-dire HLS, LL-HLS, WebRTC via HA)",image:"Images d'Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Carte WebRTC (c.-⁠à-⁠d. La carte WebRTC d'AlexxIT)"},motioneye:{editor_label:"Options de MotionEye",images:{directory_pattern:"Modèle de répertoire d'images",file_pattern:"Modèle de fichier images"},movies:{directory_pattern:"Modèle de répertoire de films",file_pattern:"Modèle de fichier de films"},url:"URL de l’interface MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"Option Reolink",media_resolution:{editor_label:"Désolution du média",high:"Haute résolution",low:"Basse résolution"},url:"URL de l'interface utilisateur Reolink"},title:"Titre de cette caméra (détection automatique à partir de l'entité)",triggers:{editor_label:"Modèle de répertoire des films",entities:"Déclencheur à partir d'autres entités",events:{clips:"Événements avec de nouveaux clips",editor_label:"Événements déclencheurs",events:"Tous les événements",snapshots:"Événements avec de nouveaux instantanés"},motion:"Déclenchement par détection automatique du capteur de mouvement",occupancy:"Déclenchement par détection automatique du capteur de présence"},webrtc_card:{editor_label:"Options de la carte WebRTC",entity:"Entité de caméra de carte WebRTC (pas une caméra de Frigate)",url:"URL de la caméra de la carte WebRTC"}},common:{controls:{builtin:"Commandes vidéo intégrées",filter:{editor_label:"Filtre multimédia",mode:"Mode de filtre",modes:{left:"Filtre média dans un menu à gauche",none:"Pas de filtre média",right:"Filtre média dans un menu à droite"}},next_previous:{editor_label:"Suivant et précédent",size:"Taille des contrôles suivant et précédent en pixels",style:"Style de contrôle suivant et précédent",styles:{chevrons:"Chevrons",icons:"Icônes",none:"Aucun",thumbnails:"Vignettes"}},thumbnails:{editor_label:"Vignettes",events_media_type:"S'il faut afficher des vignettes de clips ou des instantanés",events_media_types:{clips:"Vignettes de clips",snapshots:"Vignettes d'instantanés"},media_type:"Afficher ou non les vignettes des événements ou des enregistrements",media_types:{events:"Événements",recordings:"Enregistrements"},mode:"Mode vignettes",modes:{above:"Vignettes en haut",below:"Vignettes en bas",left:"Vignettes dans un menu à gauche",none:"Aucune vignette",right:"Vignettes dans un menu à droite"},show_details:"Afficher les détails avec des vignettes",show_download_control:"Afficher le contrôle de téléchargement sur les vignettes",show_favorite_control:"Afficher le contrôle favori sur les vignettes",show_timeline_control:"Afficher le contrôle de la chronologie sur les vignettes",size:"Taille des vignettes en pixels"},timeline:{editor_label:"Mini-chronologie",mode:"Mode",modes:{above:"Au-dessus",below:"En dessous",none:"Aucun"},pan_mode:"Mode panoramique par défaut",pan_modes:{pan:"Pan",seek:"Pan cherche parmi toutes les caméras","seek-in-camera":"Pan ne cherche que parmi la caméra sélectionnée","seek-in-media":"Pan ne cherche que parmi les médias sélectionnés"}}},display:{editor_label:"Affichage",grid_columns:"Nombre de colonnes de la grille",grid_max_columns:"Nombre maximum de colonnes de la grille",grid_selected_width_factor:"Augmenter la largeur du média sélectionnée par ce facteur",mode:"Mode"},image:{entity:"Entité à utiliser avec le mode entité",entity_parameters:"Paramètres de requête ajoutés aux URL des images basées sur l'entité (par exemple, width=1920&height=1080)",mode:"Mode d'affichage des images",modes:{camera:"Instantané de la caméra Home Assistant de l'entité caméra",entity:"Entité avec l'attribut entity_picture",screensaver:"Logo Frigate intégré",url:"Image arbitraire spécifiée par URL"},refresh_seconds:"Nombre de secondes après lesquelles actualiser (0=jamais)",url:"URL d'image statique pour l'affichage de l'image"},media_action_conditions:{all:"Toutes les opportunités",hidden:"Sur le navigateur/onglet masqué",microphone_mute:"Sourdine du microphone activée",microphone_unmute:"Sourdine du microphone désactivée",never:"Jamais",selected:"Sur sélection",unselected:"Lors de la désélection",visible:"Sur la visibilité du navigateur/onglet"},timeline:{clustering_threshold:"Le nombre d'événements pour lesquels ils sont regroupés (0 = pas de clustering)",events_media_type:"Les médias affichés par la chronologie",events_media_types:{all:"Tous types de médias",clips:"Extraits",snapshots:"Instantanés"},show_recordings:"Afficher les enregistrements",style:"Style de chronologie",styles:{ribbon:"Événements sur un seul ruban",stack:"Événements empilés et groupés"},window_seconds:"La durée par défaut de la vue chronologique en secondes"}},dimensions:{aspect_ratio:"Format d'image par défaut (par exemple '16:9')",aspect_ratio_mode:"Mode rapport hauteur/largeur",aspect_ratio_modes:{dynamic:"Le rapport hauteur/largeur s'adapte au média",static:"Rapport hauteur/largeur statique",unconstrained:"Rapport hauteur/largeur sans contrainte"},height:"Hauteur de la carte en unités CSS (par exemple, '500px')"},live:{auto_mute:"Couper automatiquement le son des caméras en direct",auto_pause:"Mettre automatiquement en pause les caméras en direct",auto_play:"Lire automatiquement les caméras en direct",auto_unmute:"Activer automatiquement le son des caméras en direct",controls:{editor_label:"Contrôles en direct",ptz:{editor_label:"PTZ",hide_home:"Cacher le bouton position d'origine",hide_pan_tilt:"Cacher les boutons panoramiques/inclinaison",hide_zoom:"Cacher le bouton de zoom",mode:"Mode",modes:{off:"Eteint",on:"Allumé"},orientation:"",orientations:{horizontal:"Horizontale",vertical:"Verticale"},position:"",positions:{"bottom-left":"En bas à gauche","bottom-right":"En bas à droite","top-left":"En haut à gauche","top-right":"En haut à droite"}}},draggable:"La vue des caméras en direct peut être déplacée/glissée",lazy_load:"Les caméras en direct sont chargeés en différé",lazy_unload:"Les caméras en direct sont déchargés en différé",microphone:{always_connected:"Toujours garder le microphone connecté",disconnect_seconds:"Secondes après quoi déconnecter le microphone (0=jamais)",editor_label:"Microphone",enabled:"Microphone activé",mute_after_microphone_mute_seconds:"Secondes après la mise en sourdine du microphone pour couper l'audio entrant"},preload:"Précharger la vue en direct en arrière-plan",show_image_during_load:"Afficher une image fixe pendant le chargement du flux en direct",transition_effect:"Effet de transition de caméra en direct",zoomable:"Les caméras en direct peuvent être zoomées/panoramiques"},media_viewer:{auto_mute:"Couper automatiquement le son des médias",auto_pause:"Mettre automatiquement en pause les médias",auto_play:"Lire automatiquement les médias",auto_unmute:"Activer automatiquement le son des médias",controls:{editor_label:"Commandes de la visionneuse multimédia"},draggable:"La visionneuse multimédia peut être déplacée/glissée",lazy_load:"Les médias Media Viewer sont chargés en différé dans le carrousel",snapshot_click_plays_clip:"Cliquer sur un instantané lit l'extrait associé",transition_effect:"Effet de transition de la visionneuse multimédia",transition_effects:{none:"Pas de transition",slide:"Transition de diapositive"},zoomable:"La visionneuse multimédia peut être zoomée/panoramique"},menu:{alignment:"Alignement des menus",alignments:{bottom:"Aligné vers le bas",left:"Aligné à gauche",right:"Aligné à droite",top:"Aligné vers le haut"},button_size:"Taille du bouton de menu en pixels",buttons:{alignment:"Alignement des boutons",alignments:{matching:"Faire correspondre l'alignement du menu",opposing:"S'opposer à l'alignement des menus"},camera_ui:"Interface utilisateur de la caméra",cameras:"Cameras",clips:"Extraits",display_mode:"Mode d'afficahge",download:"Télécharger",enabled:"Bouton activé",expand:"Développer",frigate:"Menu Frigate / Vue par défaut",fullscreen:"Plein écran",icon:"Icône",image:"Image",live:"En direct",media_player:"Envoyer au lecteur multimédia",microphone:"Microphone",mute:"Désactiver/Réactiver le son",permanent:"Afficher lorsque le menu est caché",play:"Jouer / Pause",priority:"Priorité",ptz_controls:"Afficher les controles PTZ",ptz_home:"Position d'origine PTZ",recordings:"Enregistrements",screenshot:"Capture d'écran",snapshots:"Instantanés",substreams:"flux secondaires",timeline:"Chronologie",type:"Type de bouton",types:{momentary:"Momentané",toggle:"Basculer"}},position:"Emplacement des menus",positions:{bottom:"Positionné en bas",left:"Positionné à gauche",right:"Positionné à droite",top:"Positionné en haut"},style:"Style de menu",styles:{hidden:"Menu caché",hover:"Menu survolé","hover-card":"Menu survolé (à l'échelle de la carte)",none:"Pas de menu",outside:"Menu extérieur",overlay:"Menu superposé"}},overrides:{info:"Cette configuration de carte comporte des remplacements spécifiés manuellement et configurés qui peuvent remplacer les valeurs affichées dans l'éditeur visuel. Veuillez consulter l'éditeur de code pour afficher/modifier ces remplacements."},performance:{features:{animated_progress_indicator:"Indicateur de progression animé",editor_label:"Options de fonctionnalités",max_simultaneous_engine_requests:"Nombre maximal de requêtes simultanées au moteur de caméra",media_chunk_size:"Taille du morceau de média"},style:{border_radius:"Courbes",box_shadow:"Ombres",editor_label:"Options de style"},warning:"Cette carte est en mode profil bas, les paramètres par défaut ont donc été modifiés pour optimiser les performances."},profiles:{casting:"Diffusion",editor_label:"Configuration des profils","low-performance":"Basse performance",scrubbing:"Balayage vidéo"},status_bar:{height:"Hauteur de la barre d'état en pixels",items:{enabled:"Item activé",engine:"Moteur de camera",live_provider:"fournisseur de flux en direc",priority:"Priorité de l'item",resolution:"Résolution",technology:"Technologie",title:"Titre"},popup_seconds:"Secondes de popup de la barre d'état",position:"Position de la barre d'état",positions:{bottom:"Postionné en bas",top:"Postionné en haut"},style:"Style de la barre d'état",styles:{hover:"Barre d'état au survol","hover-card":"Barre d'état au survol (sur toute la carte)",none:"Pas de barre d'état",outside:"Barre d'état extérieure",overlay:"Barre d'état superposée",popup:"Barre d'état contextuelle"}},view:{camera_select:"Afficher les caméras nouvellement sélectionnées",dark_mode:"Mode sombre",dark_modes:{auto:"Automatique",off:"Désactivé",on:"Activé"},default:"Vue par défaut",default_cycle_camera:"Parcourez les caméras lorsque la vue par défaut est mise à jour",default_reset:{after_interaction:"Réinitialiser à la vue par défaut après la fin de l'interaction de l'utilisateur",editor_label:"Comportement de réinitialisation de la vue par défaut",entities:"Réinitialiser à la vue par défaut lors du changement d'état de l'entité",every_seconds:"Actualiser la vue par défaut toutes les X secondes (0=jamais)",interaction_mode:"Comment la réinitialisation par défaut se comporte lorsque la carte a une interaction humaine",interaction_modes:{active:"Autoriser la réinitialisation uniquement lorsque la carte a une interaction humaine active",all:"Réinitialiser indépendamment de l'interaction humaine",inactive:"Réinitialiser uniquement lorsque la carte n'a pas d'interaction humaine"}},interaction_seconds:"Secondes après l'action de l'utilisateur pour maintenir l'interaction (0=jamais)",keyboard_shortcuts:{editor_label:"Raccourcis clavier",enabled:"Raccourcis clavier activés",ptz_down:"PTZ bas",ptz_home:"PTZ position d'origine",ptz_left:"PTZ gauche",ptz_right:"PTZ droite",ptz_up:"PTZ haut",ptz_zoom_in:"PTZ zoomer",ptz_zoom_out:"PTZ dézoomer"},triggers:{actions:{editor_label:"Actions de déclenchement",interaction_mode:"Comment gérer les actions lorsque la carte comporte une interaction humaine ?",interaction_modes:{active:"Ne déclencher des actions que lorsque la carte a une interaction humaine",all:"Déclencher des actions sans interaction humaine",inactive:"Ne déclencher des actions que lorsque la carte n'a pas d'interaction humaine"},trigger:"Actions de déclenchement",triggers:{default:"Changement ou mise à jour de la vue par défaut",live:"Change ou met a jour la vue en direct",media:"Changement d'affichage pour les nouveaux médias",none:"Pas d'acction"},untrigger:"Action de désactivation",untriggers:{default:"Passage à la vue/caméra par défaut",none:"Pas d'action"}},editor_label:"Comportement en cas de déclenchement d'une caméra",filter_selected_camera:"Déclenchement uniquement sur la caméra sélectionnée",show_trigger_status:"Afficher la bordure clignotante lors du déclenchement",untrigger_seconds:"Quelques secondes après le changement d'état inactif pour débloquer"},views:{clip:"Clip le plus récent",clips:"Galerie de clips",current:"Vue actuelle",image:"Image statique",live:"Vue en direct",recording:"Enregistrement le plus récent",recordings:"Galerie d'enregistrements",snapshot:"Instantané le plus récent",snapshots:"Galerie d'instantanés",timeline:"Vue chronologique"}}},t={grid:"Afficher la visionneuse de médias pour chaque caméra d'une grille",single:"Afficher une seule visionneuse"},i={add_new_camera:"Ajouter une nouvelle caméra",button:"Bouton",camera:"Caméra",cameras:"Caméras",cameras_secondary:"Quelles caméras afficher sur cette carte",delete:"Supprimer",dimensions:"Dimensions",dimensions_secondary:"Options de dimensions et de forme",image:"Image",image_secondary:"Options d'affichage d'image statique",live:"En direct",live_secondary:"Options d'affichage de la caméra en direct",media_gallery:"Galerie des médias",media_gallery_secondary:"Options de la galerie multimédia",media_viewer:"Visionneuse de médias",media_viewer_secondary:"Visionneuse de médias statiques (clips, instantanés ou enregistrements)",menu:"Menu",menu_secondary:"Options d'apparence et de convivialité du menu",move_down:"Descendre",move_up:"Déplacer vers le haut",overrides:"Les remplacements sont actifs",overrides_secondary:"Remplacements de configuration dynamique détectés",performance:"Performance",performance_secondary:"Options de performances de la carte",profiles:"Profils de confi",profiles_secondary:"Choisir des ensembles de paramètres par défaut pré-configurés",status_bar:"Barre d'état",status_bar_secondary:"Options d'apparence et de comportement de la barre d'état",timeline:"Chronologie",timeline_secondary:"Options de chronologie des événements",upgrade:"Mise à niveau",upgrade_available:"Une mise à niveau automatique de la configuration de la carte est disponible",view:"Voir",view_secondary:"Ce que la carte doit montrer et comment la montrer"},n={ptz:{down:"Bas",home:"Origine",left:"Gauche",right:"Droite",up:"Haut",zoom_in:"Zoomer",zoom_out:"Dézoomer"}},r={awaiting_live:"En attente du flux en direct...",awaiting_media:"En attente du chargement des médias",camera_initialization:"Échec de l'initialisation de la caméra",camera_initialization_reolink:"Impossible d'initialiser la caméra Reolink",could_not_render_elements:"Impossible de restituer les éléments de l'image",could_not_resolve:"Impossible de résoudre l'URL du média",diagnostics:"Diagnostic de la carte. Veuillez enlever les informations confidentielles avant de les partager",download_no_media:"Aucun média à télécharger",download_sign_failed:"Impossible de signer l'URL du média à télécharger",duplicate_camera_id:"ID de caméra Frigate en double pour la caméra suivante, utilisez le paramètre « ID » pour identifier de manière unique les caméras",empty_response:"Réponse vide reçue de Home Assistant pour la demande",failed_response:"Échec de la réponse de Home Assistant à la demande",failed_retain:"Impossible de conserver l'événement",failed_sign:"Impossible de signer l'URL de Home Assistant",image_load_error:"L'image n'a pas pu être chargée",invalid_configuration:"Configuration invalide",invalid_configuration_no_hint:"Aucune indication de localisation disponible (type incorrect ou manquant ?)",invalid_configuration_override:"Configuration de remplacement invalide",invalid_elements_config:"Configuration des éléments d'image invalide",invalid_response:"Réponse non valide reçue de Home Assistant pour la demande",jsmpeg_no_player:"Impossible de démarrer le lecteur JSMPEG",live_camera_no_endpoint:"Impossible d'obtenir le point de terminaison de la caméra pour ce fournisseur en direct (configuration incomplète ?)",live_camera_not_found:"L'entité caméra configurée n'a pas été trouvée",live_camera_unavailable:"Caméra indisponible",no_camera_engine:"Impossible de déterminer le moteur approprié pour la caméra",no_camera_entity:"Impossible de trouver l'entité de caméra",no_camera_entity_for_triggers:"Une entité caméra est requise pour détecter automatiquement les déclencheurs",no_camera_id:"Impossible de déterminer l'identifiant de la caméra suivante. Il faudra peut-être définir le paramètre « ID » manuellement",no_camera_name:"Impossible de déterminer le nom de la caméra Frigate pour la caméra (ou l'une de ses dépendances). Veuillez spécifier soit « camera_entity » soit « camera_name ».",no_dashboard_or_view:"Les paramètres 'dashboard_path' et 'view_path' sont requis pour la méthode de conversion 'dashboard'",no_live_camera:"Le paramètre camera_entity doit être défini et valide pour ce fournisseur en direct",no_supported_camera:"La caméra sélectionnée ne prend pas en charge cette vue",no_supported_cameras:"Aucune caméra ne prend en charge cette vue",reconnecting:"Reconnexion",too_many_automations:"Trop d'appels d'automatisation imbriqués, veuillez vérifier votre configuration pour les boucles",troubleshooting:"Vérifier le dépannage",unknown:"Erreur inconnue",upgrade_available:"Une mise à niveau automatisée de la configuration de la carte est disponible, veuillez visiter l'éditeur visuel de la carte",webrtc_card_reported_error:"La carte WebRTC a signalé une erreur",webrtc_card_waiting:"En attente du chargement de la carte WebRTC..."},o={camera:"Caméra",duration:"Durée",in_progress:"En cours",score:"Score",seek:"Chercher",start:"Commencer",tag:"Étiqueter",what:"Quoi",where:"Où"},s={assign:"Assigner",assigning:"Assignation",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:"Désassigner"},l={all:"Tous",camera:"Caméra",favorite:"Préféré",media_type:"Type de support",media_types:{clips:"Extraits",recordings:"Enregistrements",snapshots:"Instantanés"},not_favorite:"Pas favori",select_camera:"Sélectionnez une caméra...",select_favorite:"Sélectionnez un favori...",select_media_type:"Sélectionnez le type de média...",select_tag:"Sélectionnez la balise...",select_what:"Sélectionnez quoi...",select_when:"Sélectionnez quand...",select_where:"Sélectionnez où...",tag:"Étiqueter",what:"Quoi",when:"Quand",whens:{custom:"",past_month:"Mois passé",past_week:"La semaine dernière",today:"Aujourd'hui",yesterday:"Hier"},where:"Où"},d={unseekable:"Temps non trouvé dans les médias"},c={camera:"Caméra",duration:"Durée",events:"Événements",in_progress:"En cours",seek:"Chercher",start:"Commencer"},u={download:"Télécharger des médias",no_thumbnail:"Aucune vignette disponible",retain_indefinitely:"Les médias seront conservés indéfiniment",timeline:"Voir les médias dans la chronologie"},m={select_date:"Choisir une date"},p={common:e,config:a,display_modes:t,editor:i,elements:n,error:r,event:o,key_assigner:s,media_filter:l,media_viewer:d,recording:c,thumbnail:u,timeline:m};export{e as common,a as config,p as default,t as display_modes,i as editor,n as elements,r as error,o as event,s as key_assigner,l as media_filter,d as media_viewer,c as recording,u as thumbnail,m as timeline}; diff --git a/www/community/frigate-hass-card/lang-fr-ea16daba.js.gz b/www/community/frigate-hass-card/lang-fr-ea16daba.js.gz new file mode 100644 index 00000000..5bd9489b Binary files /dev/null and b/www/community/frigate-hass-card/lang-fr-ea16daba.js.gz differ diff --git a/www/community/frigate-hass-card/lang-it-2a20a319.js b/www/community/frigate-hass-card/lang-it-2a20a319.js new file mode 100644 index 00000000..dc9958a6 --- /dev/null +++ b/www/community/frigate-hass-card/lang-it-2a20a319.js @@ -0,0 +1 @@ +var e={frigate_card:"Frigate card",frigate_card_description:"Una scheda Lovelace per l'uso con Frigate",live:"Live",no_media:"Nessun contenuto multimediale da visualizzare",recordings:"Registrazioni",version:"Versione"},i={cameras:{camera_entity:"Entità della telecamera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostra eventi per tutte le telecamere con questa telecamera",cameras:"Mostra eventi per telecamere specifiche con questa telecamera",editor_label:"Opzioni di dipendenza"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Adatta al layout",fits:{contain:"Il supporto è contenuto/in cassetta delle lettere",cover:"Il supporto si espande proporzionalmente per coprire la scheda",fill:"Il supporto viene allungato per riempire la scheda"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentuale di posizionamento orizzontale",y:"Percentuale di posizionamento verticale"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opzioni del motore della fotocamera"},frigate:{camera_name:"Nome della telecamera frigate (autodificato dall'entità)",client_id:"ID client Frigate (per > 1 Frigate server)",editor_label:"Frigate Opzione",labels:"Etichette per fregate/filtri per oggetti",url:"Frigate URL del server",zones:"Frigate Zone"},go2rtc:{editor_label:"Opzioni go2rtc",modes:{editor_label:"Modalità go2rtc",mjpeg:"JPEG animato (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Estensioni sorgente multimediale (MSE)",webrtc:"Comunicazione Web in tempo reale (WebRTC)"},stream:"nome del flusso go2rtc"},icon:"Icona per questa telecamera (Autoidentificato dall'entità)",id:"ID univoco per questa telecamera in questa carta",image:{editor_label:"Opzioni immagine",refresh_seconds:"Numero di secondi dopo i quali aggiornare l'immagine live (0=mai)",url:"URL dell'immagine da utilizzare al posto dell'istantanea dell'entità fotocamera"},live_provider:"Provider di visualizzazione dal vivo per questa telecamera",live_provider_options:{editor_label:"Opzioni del fornitore in tempo reale"},live_providers:{auto:"Automatica",go2rtc:"go2rtc",ha:"Streaming video di Home Assistant (ovvero HLS, LL-HLS, WebRTC tramite HA)",image:"Immagini Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Scheda WebRTC (ovvero la scheda WebRTC di Alexxit)"},motioneye:{editor_label:"Opzioni di MotionEye",images:{directory_pattern:"Modello di directory delle immagini",file_pattern:"Modello di file di immagini"},movies:{directory_pattern:"Modello di directory dei film",file_pattern:"Modello di file di film"},url:"URL dell'interfaccia utente di MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Titolo per questa telecamera (Autoidentificato dall'entità)",triggers:{editor_label:"Trigger Opzioni",entities:"Trigger da altre entità",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Trigger rilevando automaticamente dal sensore di movimento",occupancy:"Attivare rilevando automatico tramite il sensore di presenza"},webrtc_card:{editor_label:"Opzioni della scheda WebRTC",entity:"Entità della telecamera della scheda WebRTC (non una telecamera Frigate)",url:"URL della telecamera della scheda WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Filtro multimediale",mode:"Modalità filtro",modes:{left:"Filtro multimediale in un cassetto a sinistra",none:"Nessun filtro multimediale",right:"Filtro multimediale in un cassetto a destra"}},next_previous:{editor_label:"Successivo e precedente",size:"Successiva e Precedenti dimensioni di controllo nei pixel",style:"Stile di controllo successivo e precedente",styles:{chevrons:"Chevrons",icons:"Icone",none:"Nessuno",thumbnails:"Miniature"}},thumbnails:{editor_label:"Miniature",events_media_type:"Se mostrare miniature di clip o istantanee",events_media_types:{clips:"Miniature di clip",snapshots:"Miniature istantanee"},media_type:"",media_types:{events:"",recordings:""},mode:"Modalità miniatura",modes:{above:"Miniature sopra",below:"Miniature sotto",left:"Miniature in un cassetto a sinistra",none:"Nessuna miniatura",right:"Miniature in un cassetto a destra"},show_details:"Mostra i dettagli con le miniature",show_download_control:"Mostra il controllo del download sulle miniature",show_favorite_control:"Mostra il controllo preferito sulle miniature",show_timeline_control:"Mostra il controllo della sequenza temporale sulle miniature",size:"Dimensione delle miniature in pixel"},timeline:{editor_label:"Mini Cronologia",mode:"Modalità",modes:{above:"sopra",below:"sotto",none:"sessuna"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modalità Visualizza immagine",modes:{camera:"Istantanea della telecamera di Home Assistant dell'entità telecamera",entity:"",screensaver:"Logo Frigate incorporato",url:"Immagine arbitraria specificata dall'URL"},refresh_seconds:"Numero di secondi dopo i quali aggiornare (0 = mai)",url:"URL di immagine statica per la vista dell'immagine"},media_action_conditions:{all:"Tutte le opportunità",hidden:"Sul browser/nascondere le schede",microphone_mute:"",microphone_unmute:"",never:"Mai",selected:"Sulla selezione",unselected:"Sulla non selezione",visible:"Sul browser/visibilità della scheda"},timeline:{clustering_threshold:"Il conteggio degli eventi in cui sono raggruppati (0 = nessun clustering)",events_media_type:"I media vengono visualizzati la sequenza temporale",events_media_types:{all:"Tutti i tipi di media",clips:"Clip",snapshots:"Istantanee"},show_recordings:"Mostra registrazioni",style:"",styles:{ribbon:"",stack:""},window_seconds:"La lunghezza predefinita della vista della sequenza temporale in secondi"}},dimensions:{aspect_ratio:"Proporzioni predefinite (ad es. '16:9')",aspect_ratio_mode:"Modalità proporzioni",aspect_ratio_modes:{dynamic:"Le proporzioni si adattano ai media",static:"Proporzioni statiche",unconstrained:"Proporzioni non vincolate"},height:""},live:{auto_mute:"Muta automaticamente le telecamere in diretta",auto_pause:"Metti in pausa automaticamente le telecamere in diretta",auto_play:"Gioca automaticamente le telecamere dal vivo",auto_unmute:"Riattiva automaticamente l'audio delle telecamere live",controls:{editor_label:"Controlli dal vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"Il Visualizzatore eventi può essere trascinato oppure puoi scorrere",lazy_load:"Le telecamere dal vivo sono pigramente cariche",lazy_unload:"Le telecamere dal vivo sono pigramente non caricate",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Precarica Live View in background",show_image_during_load:"Mostra un'immagine fissa durante il caricamento del live streaming",transition_effect:"Effetto di transizione della telecamera dal vivo",zoomable:""},media_viewer:{auto_mute:"Muta automaticamente i media",auto_pause:"Metti in Pausa automaticamente i media",auto_play:"Riproduci automaticamente i contenuti multimediali",auto_unmute:"Riattiva automaticamente i contenuti multimediali",controls:{editor_label:"Controlli di visualizzatore multimediale"},draggable:"Il visualizzatore multimediale può essere trascinato oppure può scorrere",lazy_load:"Il media Viewer viene caricato pigramente nel carosello",snapshot_click_plays_clip:"",transition_effect:"Effetto di transizione del visualizzatore multimediale",transition_effects:{none:"Nessuna transizione",slide:"Transizione diapositiva"},zoomable:""},menu:{alignment:"Allineamento dei menu",alignments:{bottom:"Allineato al fondo",left:"Allineato a sinistra",right:"Allineato a destra",top:"Allineato in cima"},button_size:"Dimensione del pulsante menu in pixel",buttons:{alignment:"Allineamento dei pulsanti",alignments:{matching:"Corrispondenza con l'allineamento del menu",opposing:"Contrastare l'allineamento del menu"},camera_ui:"Interfaccia utente della fotocamera",cameras:"Telecamere",clips:"Clip",display_mode:"",download:"Download",enabled:"Pulsante abilitato",expand:"Espandere",frigate:"Frigate menu / Visualizzazione predefinita",fullscreen:"A schermo intero",icon:"Icona",image:"Immagine",live:"Abitare",media_player:"Invia a Media Player",microphone:"",mute:"",permanent:"",play:"",priority:"Priorità",ptz_controls:"",ptz_home:"",recordings:"",screenshot:"",snapshots:"Istantanee",substreams:"Flusso/i secondario/i",timeline:"Timeline",type:"",types:{momentary:"",toggle:""}},position:"Posizione del menu",positions:{bottom:"Posizionato sul fondo",left:"Posizionato a sinistra",right:"Posizionato a destra",top:"Posizionato in alto"},style:"Stile menu",styles:{hidden:"Menu nascosto",hover:"Menu al passaggio del mouse","hover-card":"",none:"Nessun menu",outside:"Menu esterno",overlay:"Menu di overlay"}},overrides:{info:"Questa configurazione della scheda ha specificato manualmente le sostituzioni configurate che possono sostituire i valori mostrati nell'editor visivo, consultare l'editor di codice per visualizzare/modificare queste sostituzioni"},performance:{features:{animated_progress_indicator:"Indicatore di avanzamento animato",editor_label:"Opzioni funzionalità",max_simultaneous_engine_requests:"",media_chunk_size:"Dimensione del blocco multimediale"},style:{border_radius:"Curve",box_shadow:"Ombre",editor_label:"Opzione di stile"},warning:"Questa scheda è in modalità basso profilo, quindi le impostazioni predefinite sono state modificate per ottimizzare le prestazioni"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualizza per le telecamere appena selezionate",dark_mode:"Tema scuro",dark_modes:{auto:"auto",off:"Off",on:"On"},default:"Visualizzazione predefinita",default_cycle_camera:"Scorri le telecamere quando si aggiorna la visualizzazione predefinita",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Aggiorna la visualizzazione predefinita ogni x secondi (0 = mai)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Mostra bordo pulsante quando attivato",untrigger_seconds:"Reimposta la vista ai valori predefiniti dopo aver annullato l'attivazione"},views:{clip:"Clip più recente",clips:"Galleria delle clip",current:"Vista corrente",image:"Immagine statica",live:"Dal vivo",recording:"",recordings:"",snapshot:"Snapshot più recente",snapshots:"Galleria delle istantanee",timeline:"Vista della timeline"}}},a={grid:"",single:""},t={add_new_camera:"Aggiungi nuova telecamera",button:"Pulsante",camera:"Telecamera",cameras:"Telecamere",cameras_secondary:"Quali telecamere visualizzare su questa card",delete:"Elimina",dimensions:"",dimensions_secondary:"",image:"Immagine",image_secondary:"Opzioni di visualizzazione dell'immagine statica",live:"Live",live_secondary:"Opzioni di visualizzazione della telecamera live",media_gallery:"Galleria multimediale",media_gallery_secondary:"Opzioni della galleria multimediale",media_viewer:"Visualizzatore dei media",media_viewer_secondary:"Visualizzatore per supporti statici (clip, istantanee o registrazioni)",menu:"Menu",menu_secondary:"Opzioni di aspetto e funzionalità del menu",move_down:"Sposta verso il basso",move_up:"Sposta verso l'alto",overrides:"La sovrascrittura è attiva",overrides_secondary:"Rilevate sovrascritture della configurazione dinamica",performance:"",performance_secondary:"",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Timeline",timeline_secondary:"Opzioni della timeline degli eventi",upgrade:"Aggiornamento",upgrade_available:"È disponibile un aggiornamento della configurazione della scheda automatica",view:"Visualizzazione",view_secondary:"Cosa dovrebbe mostrare la carta e come mostrarla"},o={ptz:{down:"Giù",home:"Home",left:"Sinistra",right:"Destra",up:"Su",zoom_in:"Ingrandire",zoom_out:"Zoom indietro"}},n={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Impossibile renderizzare gli elementi dell'immagine",could_not_resolve:"Impossibile risolvere l'URL dei media",diagnostics:"Diagnostica delle carte.Si prega di rivedere per informazioni riservate prima di condividere",download_no_media:"Nessun media da scaricare",download_sign_failed:"Impossibile firmare URL multimediale per il download",duplicate_camera_id:"Duplicato ID dellla telecamera Frigate, utilizzare il parametro 'ID' per identificare in modo univoco le telecamere",empty_response:"Ricevuto risposta vuota da Home Assistant per la richiesta",failed_response:"Impossibile ricevere risposta da Home Assistant per la richiesta",failed_retain:"Impossibile conservare l'evento",failed_sign:"Impossibile firmare l'URL ad Home Assistant",image_load_error:"L'immagine non può essere caricata",invalid_configuration:"Configurazione non valida",invalid_configuration_no_hint:"Nessun suggerimento di posizione disponibile (tipo difettoso o mancante?)",invalid_configuration_override:"",invalid_elements_config:"Configurazione degli elementi di immagine non valida",invalid_response:"Ricevuta una risposta non valida da Home Assistant per la richiesta",jsmpeg_no_player:"Impossibile avviare JSMPEG Player",live_camera_no_endpoint:"Impossibile ottenere l'endpoint della videocamera per questo provider live (configurazione incompleta?)",live_camera_not_found:"La telecamera configurata non è stata trovata",live_camera_unavailable:"Telecamera non disponibile",no_camera_engine:"Impossibile determinare il motore adatto per la fotocamera",no_camera_entity:"Impossibile trovare l'entità fotocamera",no_camera_entity_for_triggers:"È necessaria un'entità telecamera per rilevare automaticamente i trigger",no_camera_id:"Impossibile determinare l'ID della telecamera , potrebbe essere necessario impostare manualmente il parametro 'ID'",no_camera_name:"Impossibile determinare un nome della telecamera in Frigate, si prega di specificare 'camera_enty' o 'camera_name'",no_dashboard_or_view:"",no_live_camera:"Il parametro fotocamera_enty deve essere impostato e valido per questo provider live",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Riconnessione",too_many_automations:"",troubleshooting:"Controllare la risoluzione dei problemi",unknown:"Errore sconosciuto",upgrade_available:"È disponibile un aggiornamento di configurazione della scheda automatizzato, visitare l'editor di schede visive",webrtc_card_reported_error:"La scheda WebRTC ha riportato un errore",webrtc_card_waiting:"Aspettando che la scheda WebRTC si carichi ..."},r={camera:"Camera",duration:"Durata",in_progress:"In corso",score:"Punteggio",seek:"Cercare",start:"Avvia",tag:"",what:"Che cosa",where:"Dove"},l={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},s={all:"Tutto",camera:"Telecamera",favorite:"Preferito",media_type:"Tipo di supporto",media_types:{clips:"Clip",recordings:"Registrazioni",snapshots:"Istantanee"},not_favorite:"Non preferito",select_camera:"Seleziona fotocamera...",select_favorite:"Seleziona preferito...",select_media_type:"Seleziona il tipo di supporto...",select_tag:"",select_what:"Seleziona cosa...",select_when:"Seleziona quando...",select_where:"Seleziona dove...",tag:"Tag",what:"Che cosa",when:"Quando",whens:{custom:"",past_month:"Mese scorso",past_week:"Settimana scorso",today:"Oggi",yesterday:"Ieri"},where:"Dove"},d={unseekable:""},m={camera:"Camera",duration:"Durata",events:"Eventi",in_progress:"In corso",seek:"Cercare",start:"Inizio"},c={download:"",no_thumbnail:"Nessuna miniatura disponibile",retain_indefinitely:"L'evento sarà mantenuto indefinitamente",timeline:"Vedi evento nella timeline"},u={select_date:"Scegli la data"},p={common:e,config:i,display_modes:a,editor:t,elements:o,error:n,event:r,key_assigner:l,media_filter:s,media_viewer:d,recording:m,thumbnail:c,timeline:u};export{e as common,i as config,p as default,a as display_modes,t as editor,o as elements,n as error,r as event,l as key_assigner,s as media_filter,d as media_viewer,m as recording,c as thumbnail,u as timeline}; diff --git a/www/community/frigate-hass-card/lang-it-2a20a319.js.gz b/www/community/frigate-hass-card/lang-it-2a20a319.js.gz new file mode 100644 index 00000000..063f0e6f Binary files /dev/null and b/www/community/frigate-hass-card/lang-it-2a20a319.js.gz differ diff --git a/www/community/frigate-hass-card/lang-it-7713a746.js b/www/community/frigate-hass-card/lang-it-7713a746.js new file mode 100644 index 00000000..40b44cc8 --- /dev/null +++ b/www/community/frigate-hass-card/lang-it-7713a746.js @@ -0,0 +1 @@ +var e={frigate_card:"Frigate card",frigate_card_description:"Una scheda Lovelace per l'uso con Frigate",live:"Live",no_media:"Nessun contenuto multimediale da visualizzare",recordings:"Registrazioni",version:"Versione"},i={cameras:{camera_entity:"Entità della telecamera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostra eventi per tutte le telecamere con questa telecamera",cameras:"Mostra eventi per telecamere specifiche con questa telecamera",editor_label:"Opzioni di dipendenza"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Adatta al layout",fits:{contain:"Il supporto è contenuto/in cassetta delle lettere",cover:"Il supporto si espande proporzionalmente per coprire la scheda",fill:"Il supporto viene allungato per riempire la scheda"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentuale di posizionamento orizzontale",y:"Percentuale di posizionamento verticale"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opzioni del motore della fotocamera"},frigate:{camera_name:"Nome della telecamera frigate (autodificato dall'entità)",client_id:"ID client Frigate (per > 1 Frigate server)",editor_label:"Frigate Opzione",labels:"Etichette per fregate/filtri per oggetti",url:"Frigate URL del server",zones:"Frigate Zone"},go2rtc:{editor_label:"Opzioni go2rtc",modes:{editor_label:"Modalità go2rtc",mjpeg:"JPEG animato (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Estensioni sorgente multimediale (MSE)",webrtc:"Comunicazione Web in tempo reale (WebRTC)"},stream:"nome del flusso go2rtc"},icon:"Icona per questa telecamera (Autoidentificato dall'entità)",id:"ID univoco per questa telecamera in questa carta",image:{editor_label:"Opzioni immagine",refresh_seconds:"Numero di secondi dopo i quali aggiornare l'immagine live (0=mai)",url:"URL dell'immagine da utilizzare al posto dell'istantanea dell'entità fotocamera"},live_provider:"Provider di visualizzazione dal vivo per questa telecamera",live_provider_options:{editor_label:"Opzioni del fornitore in tempo reale"},live_providers:{auto:"Automatica",go2rtc:"go2rtc",ha:"Streaming video di Home Assistant (ovvero HLS, LL-HLS, WebRTC tramite HA)",image:"Immagini Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Scheda WebRTC (ovvero la scheda WebRTC di Alexxit)"},motioneye:{editor_label:"Opzioni di MotionEye",images:{directory_pattern:"Modello di directory delle immagini",file_pattern:"Modello di file di immagini"},movies:{directory_pattern:"Modello di directory dei film",file_pattern:"Modello di file di film"},url:"URL dell'interfaccia utente di MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Titolo per questa telecamera (Autoidentificato dall'entità)",triggers:{editor_label:"Trigger Opzioni",entities:"Trigger da altre entità",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Trigger rilevando automaticamente dal sensore di movimento",occupancy:"Attivare rilevando automatico tramite il sensore di presenza"},webrtc_card:{editor_label:"Opzioni della scheda WebRTC",entity:"Entità della telecamera della scheda WebRTC (non una telecamera Frigate)",url:"URL della telecamera della scheda WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Filtro multimediale",mode:"Modalità filtro",modes:{left:"Filtro multimediale in un cassetto a sinistra",none:"Nessun filtro multimediale",right:"Filtro multimediale in un cassetto a destra"}},next_previous:{editor_label:"Successivo e precedente",size:"Successiva e Precedenti dimensioni di controllo nei pixel",style:"Stile di controllo successivo e precedente",styles:{chevrons:"Chevrons",icons:"Icone",none:"Nessuno",thumbnails:"Miniature"}},thumbnails:{editor_label:"Miniature",events_media_type:"Se mostrare miniature di clip o istantanee",events_media_types:{clips:"Miniature di clip",snapshots:"Miniature istantanee"},media_type:"",media_types:{events:"",recordings:""},mode:"Modalità miniatura",modes:{above:"Miniature sopra",below:"Miniature sotto",left:"Miniature in un cassetto a sinistra",none:"Nessuna miniatura",right:"Miniature in un cassetto a destra"},show_details:"Mostra i dettagli con le miniature",show_download_control:"Mostra il controllo del download sulle miniature",show_favorite_control:"Mostra il controllo preferito sulle miniature",show_timeline_control:"Mostra il controllo della sequenza temporale sulle miniature",size:"Dimensione delle miniature in pixel"},timeline:{editor_label:"Mini Cronologia",mode:"Modalità",modes:{above:"sopra",below:"sotto",none:"sessuna"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modalità Visualizza immagine",modes:{camera:"Istantanea della telecamera di Home Assistant dell'entità telecamera",entity:"",screensaver:"Logo Frigate incorporato",url:"Immagine arbitraria specificata dall'URL"},refresh_seconds:"Numero di secondi dopo i quali aggiornare (0 = mai)",url:"URL di immagine statica per la vista dell'immagine"},media_action_conditions:{all:"Tutte le opportunità",hidden:"Sul browser/nascondere le schede",microphone_mute:"",microphone_unmute:"",never:"Mai",selected:"Sulla selezione",unselected:"Sulla non selezione",visible:"Sul browser/visibilità della scheda"},timeline:{clustering_threshold:"Il conteggio degli eventi in cui sono raggruppati (0 = nessun clustering)",events_media_type:"I media vengono visualizzati la sequenza temporale",events_media_types:{all:"Tutti i tipi di media",clips:"Clip",snapshots:"Istantanee"},show_recordings:"Mostra registrazioni",style:"",styles:{ribbon:"",stack:""},window_seconds:"La lunghezza predefinita della vista della sequenza temporale in secondi"}},dimensions:{aspect_ratio:"Proporzioni predefinite (ad es. '16:9')",aspect_ratio_mode:"Modalità proporzioni",aspect_ratio_modes:{dynamic:"Le proporzioni si adattano ai media",static:"Proporzioni statiche",unconstrained:"Proporzioni non vincolate"},height:""},live:{auto_mute:"Muta automaticamente le telecamere in diretta",auto_pause:"Metti in pausa automaticamente le telecamere in diretta",auto_play:"Gioca automaticamente le telecamere dal vivo",auto_unmute:"Riattiva automaticamente l'audio delle telecamere live",controls:{editor_label:"Controlli dal vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"Il Visualizzatore eventi può essere trascinato oppure puoi scorrere",lazy_load:"Le telecamere dal vivo sono pigramente cariche",lazy_unload:"Le telecamere dal vivo sono pigramente non caricate",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Precarica Live View in background",show_image_during_load:"Mostra un'immagine fissa durante il caricamento del live streaming",transition_effect:"Effetto di transizione della telecamera dal vivo",zoomable:""},media_viewer:{auto_mute:"Muta automaticamente i media",auto_pause:"Metti in Pausa automaticamente i media",auto_play:"Riproduci automaticamente i contenuti multimediali",auto_unmute:"Riattiva automaticamente i contenuti multimediali",controls:{editor_label:"Controlli di visualizzatore multimediale"},draggable:"Il visualizzatore multimediale può essere trascinato oppure può scorrere",lazy_load:"Il media Viewer viene caricato pigramente nel carosello",snapshot_click_plays_clip:"",transition_effect:"Effetto di transizione del visualizzatore multimediale",transition_effects:{none:"Nessuna transizione",slide:"Transizione diapositiva"},zoomable:""},menu:{alignment:"Allineamento dei menu",alignments:{bottom:"Allineato al fondo",left:"Allineato a sinistra",right:"Allineato a destra",top:"Allineato in cima"},button_size:"Dimensione del pulsante menu in pixel",buttons:{alignment:"Allineamento dei pulsanti",alignments:{matching:"Corrispondenza con l'allineamento del menu",opposing:"Contrastare l'allineamento del menu"},camera_ui:"Interfaccia utente della fotocamera",cameras:"Telecamere",clips:"Clip",display_mode:"",download:"Download",enabled:"Pulsante abilitato",expand:"Espandere",frigate:"Frigate menu / Visualizzazione predefinita",fullscreen:"A schermo intero",icon:"Icona",image:"Immagine",live:"Abitare",media_player:"Invia a Media Player",microphone:"",mute:"",permanent:"",play:"",priority:"Priorità",ptz_controls:"",ptz_home:"",recordings:"",screenshot:"",snapshots:"Istantanee",substreams:"Flusso/i secondario/i",timeline:"Timeline",type:"",types:{momentary:"",toggle:""}},position:"Posizione del menu",positions:{bottom:"Posizionato sul fondo",left:"Posizionato a sinistra",right:"Posizionato a destra",top:"Posizionato in alto"},style:"Stile menu",styles:{hidden:"Menu nascosto",hover:"Menu al passaggio del mouse","hover-card":"",none:"Nessun menu",outside:"Menu esterno",overlay:"Menu di overlay"}},overrides:{info:"Questa configurazione della scheda ha specificato manualmente le sostituzioni configurate che possono sostituire i valori mostrati nell'editor visivo, consultare l'editor di codice per visualizzare/modificare queste sostituzioni"},performance:{features:{animated_progress_indicator:"Indicatore di avanzamento animato",editor_label:"Opzioni funzionalità",max_simultaneous_engine_requests:"",media_chunk_size:"Dimensione del blocco multimediale"},style:{border_radius:"Curve",box_shadow:"Ombre",editor_label:"Opzione di stile"},warning:"Questa scheda è in modalità basso profilo, quindi le impostazioni predefinite sono state modificate per ottimizzare le prestazioni"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualizza per le telecamere appena selezionate",dark_mode:"Tema scuro",dark_modes:{auto:"auto",off:"Off",on:"On"},default:"Visualizzazione predefinita",default_cycle_camera:"Scorri le telecamere quando si aggiorna la visualizzazione predefinita",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Aggiorna la visualizzazione predefinita ogni x secondi (0 = mai)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Mostra bordo pulsante quando attivato",untrigger_seconds:"Reimposta la vista ai valori predefiniti dopo aver annullato l'attivazione"},views:{clip:"Clip più recente",clips:"Galleria delle clip",current:"Vista corrente",image:"Immagine statica",live:"Dal vivo",recording:"",recordings:"",snapshot:"Snapshot più recente",snapshots:"Galleria delle istantanee",timeline:"Vista della timeline"}}},a={grid:"",single:""},t={add_new_camera:"Aggiungi nuova telecamera",button:"Pulsante",camera:"Telecamera",cameras:"Telecamere",cameras_secondary:"Quali telecamere visualizzare su questa card",delete:"Elimina",dimensions:"",dimensions_secondary:"",image:"Immagine",image_secondary:"Opzioni di visualizzazione dell'immagine statica",live:"Live",live_secondary:"Opzioni di visualizzazione della telecamera live",media_gallery:"Galleria multimediale",media_gallery_secondary:"Opzioni della galleria multimediale",media_viewer:"Visualizzatore dei media",media_viewer_secondary:"Visualizzatore per supporti statici (clip, istantanee o registrazioni)",menu:"Menu",menu_secondary:"Opzioni di aspetto e funzionalità del menu",move_down:"Sposta verso il basso",move_up:"Sposta verso l'alto",overrides:"La sovrascrittura è attiva",overrides_secondary:"Rilevate sovrascritture della configurazione dinamica",performance:"",performance_secondary:"",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Timeline",timeline_secondary:"Opzioni della timeline degli eventi",upgrade:"Aggiornamento",upgrade_available:"È disponibile un aggiornamento della configurazione della scheda automatica",view:"Visualizzazione",view_secondary:"Cosa dovrebbe mostrare la carta e come mostrarla"},o={ptz:{down:"Giù",home:"Home",left:"Sinistra",right:"Destra",up:"Su",zoom_in:"Ingrandire",zoom_out:"Zoom indietro"}},n={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Impossibile renderizzare gli elementi dell'immagine",could_not_resolve:"Impossibile risolvere l'URL dei media",diagnostics:"Diagnostica delle carte.Si prega di rivedere per informazioni riservate prima di condividere",download_no_media:"Nessun media da scaricare",download_sign_failed:"Impossibile firmare URL multimediale per il download",duplicate_camera_id:"Duplicato ID dellla telecamera Frigate, utilizzare il parametro 'ID' per identificare in modo univoco le telecamere",empty_response:"Ricevuto risposta vuota da Home Assistant per la richiesta",failed_response:"Impossibile ricevere risposta da Home Assistant per la richiesta",failed_retain:"Impossibile conservare l'evento",failed_sign:"Impossibile firmare l'URL ad Home Assistant",image_load_error:"L'immagine non può essere caricata",invalid_configuration:"Configurazione non valida",invalid_configuration_no_hint:"Nessun suggerimento di posizione disponibile (tipo difettoso o mancante?)",invalid_configuration_override:"",invalid_elements_config:"Configurazione degli elementi di immagine non valida",invalid_response:"Ricevuta una risposta non valida da Home Assistant per la richiesta",jsmpeg_no_player:"Impossibile avviare JSMPEG Player",live_camera_no_endpoint:"Impossibile ottenere l'endpoint della videocamera per questo provider live (configurazione incompleta?)",live_camera_not_found:"La telecamera configurata non è stata trovata",live_camera_unavailable:"Telecamera non disponibile",no_camera_engine:"Impossibile determinare il motore adatto per la fotocamera",no_camera_entity:"Impossibile trovare l'entità fotocamera",no_camera_entity_for_triggers:"È necessaria un'entità telecamera per rilevare automaticamente i trigger",no_camera_id:"Impossibile determinare l'ID della telecamera , potrebbe essere necessario impostare manualmente il parametro 'ID'",no_camera_name:"Impossibile determinare un nome della telecamera in Frigate, si prega di specificare 'camera_enty' o 'camera_name'",no_dashboard_or_view:"",no_live_camera:"Il parametro fotocamera_enty deve essere impostato e valido per questo provider live",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Riconnessione",too_many_automations:"",troubleshooting:"Controllare la risoluzione dei problemi",unknown:"Errore sconosciuto",upgrade_available:"È disponibile un aggiornamento di configurazione della scheda automatizzato, visitare l'editor di schede visive",webrtc_card_reported_error:"La scheda WebRTC ha riportato un errore",webrtc_card_waiting:"Aspettando che la scheda WebRTC si carichi ..."},r={camera:"Camera",duration:"Durata",in_progress:"In corso",score:"Punteggio",seek:"Cercare",start:"Avvia",tag:"",what:"Che cosa",where:"Dove"},l={assign:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},s={all:"Tutto",camera:"Telecamera",favorite:"Preferito",media_type:"Tipo di supporto",media_types:{clips:"Clip",recordings:"Registrazioni",snapshots:"Istantanee"},not_favorite:"Non preferito",select_camera:"Seleziona fotocamera...",select_favorite:"Seleziona preferito...",select_media_type:"Seleziona il tipo di supporto...",select_tag:"",select_what:"Seleziona cosa...",select_when:"Seleziona quando...",select_where:"Seleziona dove...",tag:"Tag",what:"Che cosa",when:"Quando",whens:{custom:"",past_month:"Mese scorso",past_week:"Settimana scorso",today:"Oggi",yesterday:"Ieri"},where:"Dove"},d={unseekable:""},m={camera:"Camera",duration:"Durata",events:"Eventi",in_progress:"In corso",seek:"Cercare",start:"Inizio"},c={download:"",no_thumbnail:"Nessuna miniatura disponibile",retain_indefinitely:"L'evento sarà mantenuto indefinitamente",timeline:"Vedi evento nella timeline"},u={select_date:"Scegli la data"},p={common:e,config:i,display_modes:a,editor:t,elements:o,error:n,event:r,key_assigner:l,media_filter:s,media_viewer:d,recording:m,thumbnail:c,timeline:u};export{e as common,i as config,p as default,a as display_modes,t as editor,o as elements,n as error,r as event,l as key_assigner,s as media_filter,d as media_viewer,m as recording,c as thumbnail,u as timeline}; diff --git a/www/community/frigate-hass-card/lang-it-7713a746.js.gz b/www/community/frigate-hass-card/lang-it-7713a746.js.gz new file mode 100644 index 00000000..6a413b54 Binary files /dev/null and b/www/community/frigate-hass-card/lang-it-7713a746.js.gz differ diff --git a/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js b/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js new file mode 100644 index 00000000..b8033988 --- /dev/null +++ b/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js @@ -0,0 +1 @@ +var e={frigate_card:"Cartão Frigate",frigate_card_description:"Um cartão da Lovelace para usar com Frigate",live:"Ao Vivo",no_media:"Nenhuma mídia para exibir",recordings:"Gravações",version:"Versão"},a={cameras:{camera_entity:"Entidade da Câmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostrar eventos para todas as câmeras nesta câmera",cameras:"Mostrar eventos para câmeras específicas nesta câmera",editor_label:"Opções de dependência"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Ajuste de layout",fits:{contain:"A mídia é contida no cartão",cover:"A mídia se expande proporcionalmente para cobrir o cartão",fill:"A mídia é esticada para preencher o cartão"},pan:{x:"",y:""},position:{editor_label:"",x:"Porcentagem do posicionamento horizontal",y:"Porcentagem do posicionamento vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opções do motor da câmera"},frigate:{camera_name:"Nome da câmera do Frigate (detectado automaticamente pela entidade)",client_id:"ID do cliente do Frigate (para >1 servidor Frigate)",editor_label:"Opções do Frigate",labels:"Rótulos do Frigate/filtros de objetos",url:"URL do servidor Frigate",zones:"Zonas do Frigate"},go2rtc:{editor_label:"Opções do go2rtc",modes:{editor_label:"Modos do go2rtc",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"Nome do stream do go2rtc"},icon:"Ícone para esta câmera (detectado automaticamente pela entidade)",id:"ID exclusivo para esta câmera nesse cartão",image:{editor_label:"Opções de Imagem",refresh_seconds:"Número de segundos após os quais atualizar a imagem ao vivo (0=nunca)",url:"URL da imagem para usar em vez do instantâneo da entidade da câmera"},live_provider:"Provedor de visualização ao vivo para esta câmera",live_provider_options:{editor_label:"Opções do provedor de visualização ao vivo"},live_providers:{auto:"Automatico",go2rtc:"go2rtc",ha:"Stream de vídeo do Home Assistant (ou seja, HLS, LL-HLS, WebRTC via HA)",image:"Imagens do Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Cartão WebRTC (de @AlexxIT)"},motioneye:{editor_label:"Opções do MotionEye",images:{directory_pattern:"Padrão de diretório de imagens",file_pattern:"Padrão de arquivo de imagens"},movies:{directory_pattern:"Padrão de diretório de filmes",file_pattern:"Padrão de arquivo de filmes"},url:"URL da interface de usuário do MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Título para esta câmera (detectado automaticamente pela entidade)",triggers:{editor_label:"Opções de acionamento",entities:"Acionar a partir de outras entidades",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Acionar detectando automaticamente o sensor de movimento",occupancy:"Acionar detectando automaticamente o sensor de ocupação"},webrtc_card:{editor_label:"Opções do cartão WebRTC",entity:"Entidade de câmera de cartão WebRTC (não é uma câmera Frigate)",url:"URL da câmera do cartão WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Filtro de Mídia",mode:"Modo do filtro",modes:{left:"Filtro de mídia em uma gaveta à esquerda",none:"Sem filtro de mídia",right:"Filtro de mídia em uma gaveta à direita"}},next_previous:{editor_label:"Próximo",size:"Tamanho de controle próximo e anterior",style:"Estilo do controle próximo e anterior",styles:{chevrons:"Setas",icons:"Ícones",none:"Nenhum",thumbnails:"Miniaturas"}},thumbnails:{editor_label:"Miniaturas",events_media_type:"Se deve mostrar miniaturas de clipes ou snapshots",events_media_types:{clips:"Miniaturas de clipes",snapshots:"Miniaturas de Snapshots"},media_type:"",media_types:{events:"",recordings:""},mode:"Modo de miniaturas",modes:{above:"Miniaturas acima da mídia",below:"Miniaturas abaixo da mídia",left:"Miniaturas em uma gaveta à esquerda",none:"Sem miniaturas",right:"Miniaturas em uma gaveta à direita"},show_details:"Mostrar detalhes com miniaturas",show_download_control:"Mostrar controle de download nas miniaturas",show_favorite_control:"Mostrar controle de favorito nas miniaturas",show_timeline_control:"Mostrar controle da linha do tempo nas miniaturas",size:"Tamanho das miniaturas em pixels"},timeline:{editor_label:"Controles da linha do tempo",mode:"Modo",modes:{above:"Acima",below:"Abaixo",none:"Nenhum"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modo de visualização de imagem",modes:{camera:"Instantâneo da câmera do Home Assistant, da entidade de câmera",entity:"",screensaver:"Logo Frigate embutido",url:"Imagem arbitrária especificada por URL"},refresh_seconds:"Número de segundos após o qual atualizar (0 = nunca)",url:"Imagem arbitrária especificada por URL"},media_action_conditions:{all:"Todas as oportunidades",hidden:"Ao ocultar o navegador/aba",microphone_mute:"",microphone_unmute:"",never:"Nunca",selected:"Ao selecionar",unselected:"Ao desselecionar",visible:"Ao mostrar o navegador/aba"},timeline:{clustering_threshold:"A contagem de eventos nos quais eles são agrupados (0 = sem agrupamento)",events_media_type:"A mídia que a linha do tempo exibe",events_media_types:{all:"Todos os tipos de mídia",clips:"Clipes",snapshots:"Instantâneos"},show_recordings:"Mostrar gravações",style:"",styles:{ribbon:"",stack:""},window_seconds:"A duração padrão da visualização da linha do tempo em segundos"}},dimensions:{aspect_ratio:"Proporção padrão (e.g. '16:9')",aspect_ratio_mode:"Modo de proporção",aspect_ratio_modes:{dynamic:"A proporção se ajusta à mídia",static:"Proporção estática",unconstrained:"Proporção irrestrita"},height:""},live:{auto_mute:"Silenciar câmeras ao vivo automaticamente",auto_pause:"Pausar câmeras ao vivo automaticamente",auto_play:"Reproduzir câmeras ao vivo automaticamente",auto_unmute:"Ativar automaticamente o som das câmeras ao vivo",controls:{editor_label:"Controles da visualização ao vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"A visualização ao vivo das câmeras pode ser arrastada/deslizada",lazy_load:"As câmeras ao vivo são carregadas lentamente",lazy_unload:"As câmeras ao vivo são descarregadas preguiçosamente",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Pré-carregar a visualização ao vivo em segundo plano",show_image_during_load:"Mostrar imagem estática enquanto a transmissão ao vivo está carregando",transition_effect:"Efeito de transição de câmera ao vivo",zoomable:""},media_viewer:{auto_mute:"Silenciar mídia automaticamente",auto_pause:"Pausar mídia automaticamente",auto_play:"Reproduzir mídia automaticamente",auto_unmute:"Ativar mídia automaticamente",controls:{editor_label:"Controles do visualizador de mídia"},draggable:"Visualizador de eventos pode ser arrastado/deslizado",lazy_load:"A mídia do Visualizador de eventos é carregada lentamente no carrossel",snapshot_click_plays_clip:"Clicar em um instantâneo reproduz um clipe relacionado",transition_effect:"Efeito de transição do Visualizador de eventos",transition_effects:{none:"Sem transição",slide:"Transição de slides"},zoomable:""},menu:{alignment:"Alinhamento do menu",alignments:{bottom:"Alinhado à parte inferior",left:"Alinhado à esquerda",right:"Alinhado à direita",top:"Alinhado ao topo"},button_size:"Tamanho do botão de menu (e.g. '40px')",buttons:{alignment:"Alinhamento do botão",alignments:{matching:"Mesmo alinhamento do menu",opposing:"Opor-se ao alinhamento do menu"},camera_ui:"Interface de usuário da câmera",cameras:"Selecionar câmera",clips:"Clipes",display_mode:"",download:"Baixe a mídia do evento",enabled:"Botão ativado",expand:"Expandir",frigate:"Frigate menu / Visualização padrão",fullscreen:"Tela cheia",icon:"Ícone",image:"Imagem",live:"Ao vivo",media_player:"Enviar para o reprodutor de mídia",microphone:"",mute:"",permanent:"",play:"",priority:"Prioridade",ptz_controls:"",ptz_home:"",recordings:"Gravações",screenshot:"",snapshots:"Instantâneos",substreams:"Substream(s)",timeline:"Linha do tempo",type:"",types:{momentary:"",toggle:""}},position:"Posição do menu",positions:{bottom:"Posicionado na parte inferior",left:"Posicionado à esquerda",right:"Posicionado à direita",top:"Posicionado no topo"},style:"Estilo do menu",styles:{hidden:"Menu oculto",hover:"Menu suspenso","hover-card":"Menu suspenso (em todo o cartão)",none:"Sem menu",outside:"Menu externo",overlay:"Menu sobreposto"}},overrides:{info:"Esta configuração do cartão especificou manualmente as substituições configuradas que podem substituir os valores mostrados no editor visual, consulte o editor de código para visualizar/modificar essas substituições"},performance:{features:{animated_progress_indicator:"Indicador de Carregamento Animado",editor_label:"Opções de recursos",max_simultaneous_engine_requests:"",media_chunk_size:"Tamanho do bloco de mídia"},style:{border_radius:"Curvas",box_shadow:"Sombras",editor_label:"Opções de estilo"},warning:"Este cartão está no modo de baixo desempenho, então os padrões foram alterados para otimizar o desempenho"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualização de câmeras recém-selecionadas",dark_mode:"Modo escuro",dark_modes:{auto:"Automático",off:"Desligado",on:"Ligado"},default:"Visualização padrão",default_cycle_camera:"Percorrer as câmeras quando a visualização padrão for atualizada",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Atualize a visualização padrão a cada X segundos (0 = nunca)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Pulsar borda quando acionado",untrigger_seconds:"Segundos após a mudar para o estado inativo para desacionar"},views:{clip:"Clipe mais recente",clips:"Galeria de clipes",current:"Visualização atual",image:"Imagem estática",live:"Visualização ao vivo",recording:"Gravação mais recente",recordings:"Galeria de gravações",snapshot:"Snapshot mais recente",snapshots:"Galeria de Snapshots",timeline:"Visualização da linha do tempo"}}},o={grid:"",single:""},i={add_new_camera:"Adicionar nova câmera",button:"Botão",camera:"Câmera",cameras:"Câmeras",cameras_secondary:"Quais câmeras renderizar neste cartão",delete:"Excluir",dimensions:"",dimensions_secondary:"",image:"Imagem",image_secondary:"Opções de visualização de imagem estática",live:"Ao vivo",live_secondary:"Opções de visualização da câmera ao vivo",media_gallery:"Galeria de mídia",media_gallery_secondary:"Opções da galeria de mídia",media_viewer:"Visualizador de eventos",media_viewer_secondary:"Opções do visualizador de Snapshots e clipes",menu:"Menu",menu_secondary:"Opções de aparência do menu",move_down:"Descer",move_up:"Subir",overrides:"As substituições estão ativas",overrides_secondary:"Substituições de configuração dinâmica detectadas",performance:"Desempenho",performance_secondary:"Opções de desempenho do cartão",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Linha do tempo",timeline_secondary:"Opções do evento da linha do tempo",upgrade:"Upgrade",upgrade_available:"Um upgrade automático da configuração de cartão está disponível",view:"Visualizar",view_secondary:"O que o cartão deve mostrar e como mostrá-lo"},r={ptz:{down:"Baixo",home:"Casa",left:"Esquerda",right:"Direita",up:"Cima",zoom_in:"Aumentar Zoom",zoom_out:"Reduzir Zoom"}},t={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Não foi possível renderizar os elementos da imagem",could_not_resolve:"Não foi possível resolver o URL de mídia",diagnostics:"Diagnósticos do cartão. Revise as informações confidenciais antes de compartilhar",download_no_media:"Nenhuma mídia para download",download_sign_failed:"Não foi possível assinar o URL de mídia para download",duplicate_camera_id:"Duplique o ID da câmera Frigate para a câmera a seguir, use o parâmetro 'id' para identificar exclusivamente as câmeras",empty_response:"Sem resposta do Home Assistant para a solicitação",failed_response:"Falha ao receber resposta do Home Assistant para solicitação",failed_retain:"Não foi possível reter o evento",failed_sign:"Não foi possível assinar a URL do Home Assistant",image_load_error:"A imagem não pôde ser carregada",invalid_configuration:"Configuração inválida",invalid_configuration_no_hint:"Nenhuma dica de local disponível (tipo incorreto ou ausente?)",invalid_configuration_override:"",invalid_elements_config:"Configuração de elementos de imagem inválida",invalid_response:"Resposta inválida recebida do Home Assistant para a solicitação",jsmpeg_no_player:"Não foi possível iniciar o player JSMPEG",live_camera_no_endpoint:"Não foi possível obter o endereço da câmera para este provedor ao vivo (configuração incompleta?)",live_camera_not_found:"A entidade de câmera configurada não foi encontrada",live_camera_unavailable:"Câmera indisponível",no_camera_engine:"Não foi possível determinar o motor adequado para a câmera",no_camera_entity:"Não foi possível encontrar a entidade da câmera",no_camera_entity_for_triggers:"Uma entidade de câmera é necessária para detectar automaticamente os gatilhos",no_camera_id:"Não foi possível determinar o ID da câmera para a câmera a seguir, pode ser necessário definir o parâmetro 'id' manualmente",no_camera_name:"Não foi possível determinar o nome da câmera da Frigate, especifique 'camera_entity' ou 'camera_name' para a câmera a seguir",no_dashboard_or_view:"",no_live_camera:"O parâmetro camera_entity deve ser definido e válido para este provedor ativo",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Reconectando",too_many_automations:"",troubleshooting:"Verifique a solução de problemas",unknown:"Erro desconhecido",upgrade_available:"Uma atualização automatizada da configuração do cartão está disponível, visite o editor visual do cartão",webrtc_card_reported_error:"O cartão WebRTC relatou um erro",webrtc_card_waiting:"Aguardando o cartão WebRTC carregar ..."},s={camera:"Câmera",duration:"Duração",in_progress:"Em andamento",score:"Pontuação",seek:"Procurar",start:"Início",tag:"Etiqueta",what:"O que",where:"Onde"},n={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},d={all:"Todos",camera:"Câmera",favorite:"Favorito",media_type:"Tipo de mídia",media_types:{clips:"Clipes",recordings:"Gravações",snapshots:"Instantâneos"},not_favorite:"Não favorito",select_camera:"Selecione a câmera...",select_favorite:"Selecione favorito...",select_media_type:"Selecione o tipo de mídia...",select_tag:"Selecione a etiqueta...",select_what:"Selecione o que...",select_when:"Selecione quando...",select_where:"Selecione onde...",tag:"Etiqueta",what:"O que",when:"Quando",whens:{custom:"",past_month:"Mês passado",past_week:"Semana passada",today:"Hoje",yesterday:"Ontem"},where:"Onde"},m={unseekable:""},l={camera:"Câmera",duration:"Duração",events:"Eventos",in_progress:"Em andamento",seek:"Procurar",start:"Começar"},c={download:"Baixar mídia",no_thumbnail:"Nenhuma miniatura disponível",retain_indefinitely:"Evento será retido por tempo indeterminado",timeline:"Ver evento na linha do tempo"},u={select_date:"Escolha a data"},p={common:e,config:a,display_modes:o,editor:i,elements:r,error:t,event:s,key_assigner:n,media_filter:d,media_viewer:m,recording:l,thumbnail:c,timeline:u};export{e as common,a as config,p as default,o as display_modes,i as editor,r as elements,t as error,s as event,n as key_assigner,d as media_filter,m as media_viewer,l as recording,c as thumbnail,u as timeline}; diff --git a/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js.gz b/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js.gz new file mode 100644 index 00000000..b08e5802 Binary files /dev/null and b/www/community/frigate-hass-card/lang-pt-BR-83a703b9.js.gz differ diff --git a/www/community/frigate-hass-card/lang-pt-BR-ea76ed6c.js b/www/community/frigate-hass-card/lang-pt-BR-ea76ed6c.js new file mode 100644 index 00000000..980be008 --- /dev/null +++ b/www/community/frigate-hass-card/lang-pt-BR-ea76ed6c.js @@ -0,0 +1 @@ +var e={frigate_card:"Cartão Frigate",frigate_card_description:"Um cartão da Lovelace para usar com Frigate",live:"Ao Vivo",no_media:"Nenhuma mídia para exibir",recordings:"Gravações",version:"Versão"},a={cameras:{camera_entity:"Entidade da Câmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostrar eventos para todas as câmeras nesta câmera",cameras:"Mostrar eventos para câmeras específicas nesta câmera",editor_label:"Opções de dependência"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Ajuste de layout",fits:{contain:"A mídia é contida no cartão",cover:"A mídia se expande proporcionalmente para cobrir o cartão",fill:"A mídia é esticada para preencher o cartão"},pan:{x:"",y:""},position:{editor_label:"",x:"Porcentagem do posicionamento horizontal",y:"Porcentagem do posicionamento vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Opções do motor da câmera"},frigate:{camera_name:"Nome da câmera do Frigate (detectado automaticamente pela entidade)",client_id:"ID do cliente do Frigate (para >1 servidor Frigate)",editor_label:"Opções do Frigate",labels:"Rótulos do Frigate/filtros de objetos",url:"URL do servidor Frigate",zones:"Zonas do Frigate"},go2rtc:{editor_label:"Opções do go2rtc",modes:{editor_label:"Modos do go2rtc",mjpeg:"Motion JPEG (MJPEG)",mp4:"MPEG-4 (MP4)",mse:"Media Source Extensions (MSE)",webrtc:"Web Real-Time Communication (WebRTC)"},stream:"Nome do stream do go2rtc"},icon:"Ícone para esta câmera (detectado automaticamente pela entidade)",id:"ID exclusivo para esta câmera nesse cartão",image:{editor_label:"Opções de Imagem",refresh_seconds:"Número de segundos após os quais atualizar a imagem ao vivo (0=nunca)",url:"URL da imagem para usar em vez do instantâneo da entidade da câmera"},live_provider:"Provedor de visualização ao vivo para esta câmera",live_provider_options:{editor_label:"Opções do provedor de visualização ao vivo"},live_providers:{auto:"Automatico",go2rtc:"go2rtc",ha:"Stream de vídeo do Home Assistant (ou seja, HLS, LL-HLS, WebRTC via HA)",image:"Imagens do Home Assistant",jsmpeg:"JSMpeg","webrtc-card":"Cartão WebRTC (de @AlexxIT)"},motioneye:{editor_label:"Opções do MotionEye",images:{directory_pattern:"Padrão de diretório de imagens",file_pattern:"Padrão de arquivo de imagens"},movies:{directory_pattern:"Padrão de diretório de filmes",file_pattern:"Padrão de arquivo de filmes"},url:"URL da interface de usuário do MotionEye"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Título para esta câmera (detectado automaticamente pela entidade)",triggers:{editor_label:"Opções de acionamento",entities:"Acionar a partir de outras entidades",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Acionar detectando automaticamente o sensor de movimento",occupancy:"Acionar detectando automaticamente o sensor de ocupação"},webrtc_card:{editor_label:"Opções do cartão WebRTC",entity:"Entidade de câmera de cartão WebRTC (não é uma câmera Frigate)",url:"URL da câmera do cartão WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Filtro de Mídia",mode:"Modo do filtro",modes:{left:"Filtro de mídia em uma gaveta à esquerda",none:"Sem filtro de mídia",right:"Filtro de mídia em uma gaveta à direita"}},next_previous:{editor_label:"Próximo",size:"Tamanho de controle próximo e anterior",style:"Estilo do controle próximo e anterior",styles:{chevrons:"Setas",icons:"Ícones",none:"Nenhum",thumbnails:"Miniaturas"}},thumbnails:{editor_label:"Miniaturas",events_media_type:"Se deve mostrar miniaturas de clipes ou snapshots",events_media_types:{clips:"Miniaturas de clipes",snapshots:"Miniaturas de Snapshots"},media_type:"",media_types:{events:"",recordings:""},mode:"Modo de miniaturas",modes:{above:"Miniaturas acima da mídia",below:"Miniaturas abaixo da mídia",left:"Miniaturas em uma gaveta à esquerda",none:"Sem miniaturas",right:"Miniaturas em uma gaveta à direita"},show_details:"Mostrar detalhes com miniaturas",show_download_control:"Mostrar controle de download nas miniaturas",show_favorite_control:"Mostrar controle de favorito nas miniaturas",show_timeline_control:"Mostrar controle da linha do tempo nas miniaturas",size:"Tamanho das miniaturas em pixels"},timeline:{editor_label:"Controles da linha do tempo",mode:"Modo",modes:{above:"Acima",below:"Abaixo",none:"Nenhum"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modo de visualização de imagem",modes:{camera:"Instantâneo da câmera do Home Assistant, da entidade de câmera",entity:"",screensaver:"Logo Frigate embutido",url:"Imagem arbitrária especificada por URL"},refresh_seconds:"Número de segundos após o qual atualizar (0 = nunca)",url:"Imagem arbitrária especificada por URL"},media_action_conditions:{all:"Todas as oportunidades",hidden:"Ao ocultar o navegador/aba",microphone_mute:"",microphone_unmute:"",never:"Nunca",selected:"Ao selecionar",unselected:"Ao desselecionar",visible:"Ao mostrar o navegador/aba"},timeline:{clustering_threshold:"A contagem de eventos nos quais eles são agrupados (0 = sem agrupamento)",events_media_type:"A mídia que a linha do tempo exibe",events_media_types:{all:"Todos os tipos de mídia",clips:"Clipes",snapshots:"Instantâneos"},show_recordings:"Mostrar gravações",style:"",styles:{ribbon:"",stack:""},window_seconds:"A duração padrão da visualização da linha do tempo em segundos"}},dimensions:{aspect_ratio:"Proporção padrão (e.g. '16:9')",aspect_ratio_mode:"Modo de proporção",aspect_ratio_modes:{dynamic:"A proporção se ajusta à mídia",static:"Proporção estática",unconstrained:"Proporção irrestrita"},height:""},live:{auto_mute:"Silenciar câmeras ao vivo automaticamente",auto_pause:"Pausar câmeras ao vivo automaticamente",auto_play:"Reproduzir câmeras ao vivo automaticamente",auto_unmute:"Ativar automaticamente o som das câmeras ao vivo",controls:{editor_label:"Controles da visualização ao vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"A visualização ao vivo das câmeras pode ser arrastada/deslizada",lazy_load:"As câmeras ao vivo são carregadas lentamente",lazy_unload:"As câmeras ao vivo são descarregadas preguiçosamente",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Pré-carregar a visualização ao vivo em segundo plano",show_image_during_load:"Mostrar imagem estática enquanto a transmissão ao vivo está carregando",transition_effect:"Efeito de transição de câmera ao vivo",zoomable:""},media_viewer:{auto_mute:"Silenciar mídia automaticamente",auto_pause:"Pausar mídia automaticamente",auto_play:"Reproduzir mídia automaticamente",auto_unmute:"Ativar mídia automaticamente",controls:{editor_label:"Controles do visualizador de mídia"},draggable:"Visualizador de eventos pode ser arrastado/deslizado",lazy_load:"A mídia do Visualizador de eventos é carregada lentamente no carrossel",snapshot_click_plays_clip:"Clicar em um instantâneo reproduz um clipe relacionado",transition_effect:"Efeito de transição do Visualizador de eventos",transition_effects:{none:"Sem transição",slide:"Transição de slides"},zoomable:""},menu:{alignment:"Alinhamento do menu",alignments:{bottom:"Alinhado à parte inferior",left:"Alinhado à esquerda",right:"Alinhado à direita",top:"Alinhado ao topo"},button_size:"Tamanho do botão de menu (e.g. '40px')",buttons:{alignment:"Alinhamento do botão",alignments:{matching:"Mesmo alinhamento do menu",opposing:"Opor-se ao alinhamento do menu"},camera_ui:"Interface de usuário da câmera",cameras:"Selecionar câmera",clips:"Clipes",display_mode:"",download:"Baixe a mídia do evento",enabled:"Botão ativado",expand:"Expandir",frigate:"Frigate menu / Visualização padrão",fullscreen:"Tela cheia",icon:"Ícone",image:"Imagem",live:"Ao vivo",media_player:"Enviar para o reprodutor de mídia",microphone:"",mute:"",permanent:"",play:"",priority:"Prioridade",ptz_controls:"",ptz_home:"",recordings:"Gravações",screenshot:"",snapshots:"Instantâneos",substreams:"Substream(s)",timeline:"Linha do tempo",type:"",types:{momentary:"",toggle:""}},position:"Posição do menu",positions:{bottom:"Posicionado na parte inferior",left:"Posicionado à esquerda",right:"Posicionado à direita",top:"Posicionado no topo"},style:"Estilo do menu",styles:{hidden:"Menu oculto",hover:"Menu suspenso","hover-card":"Menu suspenso (em todo o cartão)",none:"Sem menu",outside:"Menu externo",overlay:"Menu sobreposto"}},overrides:{info:"Esta configuração do cartão especificou manualmente as substituições configuradas que podem substituir os valores mostrados no editor visual, consulte o editor de código para visualizar/modificar essas substituições"},performance:{features:{animated_progress_indicator:"Indicador de Carregamento Animado",editor_label:"Opções de recursos",max_simultaneous_engine_requests:"",media_chunk_size:"Tamanho do bloco de mídia"},style:{border_radius:"Curvas",box_shadow:"Sombras",editor_label:"Opções de estilo"},warning:"Este cartão está no modo de baixo desempenho, então os padrões foram alterados para otimizar o desempenho"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualização de câmeras recém-selecionadas",dark_mode:"Modo escuro",dark_modes:{auto:"Automático",off:"Desligado",on:"Ligado"},default:"Visualização padrão",default_cycle_camera:"Percorrer as câmeras quando a visualização padrão for atualizada",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Atualize a visualização padrão a cada X segundos (0 = nunca)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Pulsar borda quando acionado",untrigger_seconds:"Segundos após a mudar para o estado inativo para desacionar"},views:{clip:"Clipe mais recente",clips:"Galeria de clipes",current:"Visualização atual",image:"Imagem estática",live:"Visualização ao vivo",recording:"Gravação mais recente",recordings:"Galeria de gravações",snapshot:"Snapshot mais recente",snapshots:"Galeria de Snapshots",timeline:"Visualização da linha do tempo"}}},o={grid:"",single:""},i={add_new_camera:"Adicionar nova câmera",button:"Botão",camera:"Câmera",cameras:"Câmeras",cameras_secondary:"Quais câmeras renderizar neste cartão",delete:"Excluir",dimensions:"",dimensions_secondary:"",image:"Imagem",image_secondary:"Opções de visualização de imagem estática",live:"Ao vivo",live_secondary:"Opções de visualização da câmera ao vivo",media_gallery:"Galeria de mídia",media_gallery_secondary:"Opções da galeria de mídia",media_viewer:"Visualizador de eventos",media_viewer_secondary:"Opções do visualizador de Snapshots e clipes",menu:"Menu",menu_secondary:"Opções de aparência do menu",move_down:"Descer",move_up:"Subir",overrides:"As substituições estão ativas",overrides_secondary:"Substituições de configuração dinâmica detectadas",performance:"Desempenho",performance_secondary:"Opções de desempenho do cartão",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Linha do tempo",timeline_secondary:"Opções do evento da linha do tempo",upgrade:"Upgrade",upgrade_available:"Um upgrade automático da configuração de cartão está disponível",view:"Visualizar",view_secondary:"O que o cartão deve mostrar e como mostrá-lo"},r={ptz:{down:"Baixo",home:"Casa",left:"Esquerda",right:"Direita",up:"Cima",zoom_in:"Aumentar Zoom",zoom_out:"Reduzir Zoom"}},t={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Não foi possível renderizar os elementos da imagem",could_not_resolve:"Não foi possível resolver o URL de mídia",diagnostics:"Diagnósticos do cartão. Revise as informações confidenciais antes de compartilhar",download_no_media:"Nenhuma mídia para download",download_sign_failed:"Não foi possível assinar o URL de mídia para download",duplicate_camera_id:"Duplique o ID da câmera Frigate para a câmera a seguir, use o parâmetro 'id' para identificar exclusivamente as câmeras",empty_response:"Sem resposta do Home Assistant para a solicitação",failed_response:"Falha ao receber resposta do Home Assistant para solicitação",failed_retain:"Não foi possível reter o evento",failed_sign:"Não foi possível assinar a URL do Home Assistant",image_load_error:"A imagem não pôde ser carregada",invalid_configuration:"Configuração inválida",invalid_configuration_no_hint:"Nenhuma dica de local disponível (tipo incorreto ou ausente?)",invalid_configuration_override:"",invalid_elements_config:"Configuração de elementos de imagem inválida",invalid_response:"Resposta inválida recebida do Home Assistant para a solicitação",jsmpeg_no_player:"Não foi possível iniciar o player JSMPEG",live_camera_no_endpoint:"Não foi possível obter o endereço da câmera para este provedor ao vivo (configuração incompleta?)",live_camera_not_found:"A entidade de câmera configurada não foi encontrada",live_camera_unavailable:"Câmera indisponível",no_camera_engine:"Não foi possível determinar o motor adequado para a câmera",no_camera_entity:"Não foi possível encontrar a entidade da câmera",no_camera_entity_for_triggers:"Uma entidade de câmera é necessária para detectar automaticamente os gatilhos",no_camera_id:"Não foi possível determinar o ID da câmera para a câmera a seguir, pode ser necessário definir o parâmetro 'id' manualmente",no_camera_name:"Não foi possível determinar o nome da câmera da Frigate, especifique 'camera_entity' ou 'camera_name' para a câmera a seguir",no_dashboard_or_view:"",no_live_camera:"O parâmetro camera_entity deve ser definido e válido para este provedor ativo",no_supported_camera:"",no_supported_cameras:"",reconnecting:"Reconectando",too_many_automations:"",troubleshooting:"Verifique a solução de problemas",unknown:"Erro desconhecido",upgrade_available:"Uma atualização automatizada da configuração do cartão está disponível, visite o editor visual do cartão",webrtc_card_reported_error:"O cartão WebRTC relatou um erro",webrtc_card_waiting:"Aguardando o cartão WebRTC carregar ..."},s={camera:"Câmera",duration:"Duração",in_progress:"Em andamento",score:"Pontuação",seek:"Procurar",start:"Início",tag:"Etiqueta",what:"O que",where:"Onde"},n={assign:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},d={all:"Todos",camera:"Câmera",favorite:"Favorito",media_type:"Tipo de mídia",media_types:{clips:"Clipes",recordings:"Gravações",snapshots:"Instantâneos"},not_favorite:"Não favorito",select_camera:"Selecione a câmera...",select_favorite:"Selecione favorito...",select_media_type:"Selecione o tipo de mídia...",select_tag:"Selecione a etiqueta...",select_what:"Selecione o que...",select_when:"Selecione quando...",select_where:"Selecione onde...",tag:"Etiqueta",what:"O que",when:"Quando",whens:{custom:"",past_month:"Mês passado",past_week:"Semana passada",today:"Hoje",yesterday:"Ontem"},where:"Onde"},m={unseekable:""},l={camera:"Câmera",duration:"Duração",events:"Eventos",in_progress:"Em andamento",seek:"Procurar",start:"Começar"},c={download:"Baixar mídia",no_thumbnail:"Nenhuma miniatura disponível",retain_indefinitely:"Evento será retido por tempo indeterminado",timeline:"Ver evento na linha do tempo"},u={select_date:"Escolha a data"},p={common:e,config:a,display_modes:o,editor:i,elements:r,error:t,event:s,key_assigner:n,media_filter:d,media_viewer:m,recording:l,thumbnail:c,timeline:u};export{e as common,a as config,p as default,o as display_modes,i as editor,r as elements,t as error,s as event,n as key_assigner,d as media_filter,m as media_viewer,l as recording,c as thumbnail,u as timeline}; diff --git a/www/community/frigate-hass-card/lang-pt-BR-ea76ed6c.js.gz b/www/community/frigate-hass-card/lang-pt-BR-ea76ed6c.js.gz new file mode 100644 index 00000000..149d320e Binary files /dev/null and b/www/community/frigate-hass-card/lang-pt-BR-ea76ed6c.js.gz differ diff --git a/www/community/frigate-hass-card/lang-pt-PT-16f39312.js b/www/community/frigate-hass-card/lang-pt-PT-16f39312.js new file mode 100644 index 00000000..d9be6a80 --- /dev/null +++ b/www/community/frigate-hass-card/lang-pt-PT-16f39312.js @@ -0,0 +1 @@ +var e={frigate_card:"Cartão Frigate",frigate_card_description:"Um cartão da Lovelace para usar com Frigate",live:"Ao Vivo",no_media:"Sem média",recordings:"Gravações",version:"Versão"},a={cameras:{camera_entity:"Entidade da Câmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostrar eventos para todas as câmeras nesta câmera",cameras:"Mostrar eventos para câmeras específicas nesta câmera",editor_label:"Opções de dependência"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Fit",fits:{contain:"Conter",cover:"Tapar",fill:"Preencher"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentagem da localização horizontal",y:"Percentagem da localização vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Editor de etiquetas"},frigate:{camera_name:"Nome da câmera do Frigate (detectado automaticamente pela entidade)",client_id:"ID do cliente do Frigate (para >1 servidor Frigate)",editor_label:"Opções do Frigate",labels:"Etiquetas",url:"URL do servidor Frigate",zones:"Zonas"},go2rtc:{editor_label:"Editor de etiquetas",modes:{editor_label:"Editor de etiquetas",mjpeg:"Mjpeg",mp4:"Mp4",mse:"Mse",webrtc:"Webrtc"},stream:"Stream"},icon:"Ícone para esta câmera (detectado automaticamente pela entidade)",id:"ID exclusivo para esta câmera nesse cartão",image:{editor_label:"Editor etiquetas",refresh_seconds:"Atualizar em segundos",url:"Link"},live_provider:"Fonte de visualização ao vivo para esta câmera",live_provider_options:{editor_label:"Editor de etiquetas"},live_providers:{auto:"Automatico",go2rtc:"Go2rtc",ha:"Ha",image:"Imagem",jsmpeg:"JSMpeg","webrtc-card":"Cartão WebRTC (de @AlexxIT)"},motioneye:{editor_label:"Directoria pre-definido",images:{directory_pattern:"Directoria pre-definido",file_pattern:"Ficheiro pre-definido"},movies:{directory_pattern:"Directoria pre-definida",file_pattern:"Ficheiro pre-definido"},url:"Link"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Título para esta câmera (detectado automaticamente pela entidade)",triggers:{editor_label:"Opções de activação",entities:"Activar a partir de outras entidades",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Activar detectando automaticamente o sensor de movimento",occupancy:"Activar detectando automaticamente o sensor de ocupação"},webrtc_card:{editor_label:"Opções do cartão WebRTC",entity:"Entidade de câmera de cartão WebRTC (não é uma câmera Frigate)",url:"URL da câmera do cartão WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Editor de titulos",mode:"Modo",modes:{left:"Esquerda",none:"Nenhum",right:"Direita"}},next_previous:{editor_label:"Editor de titulos",size:"Tamanho de controle próximo e anterior",style:"Estilo do controle próximo e anterior",styles:{chevrons:"Setas",icons:"Ícones",none:"Nenhum",thumbnails:"Miniaturas"}},thumbnails:{editor_label:"Editor de titulos",events_media_type:"Mostrar miniaturas de clipes ou snapshots",events_media_types:{clips:"Miniaturas de clipes",snapshots:"Miniaturas de Snapshots"},media_type:"",media_types:{events:"",recordings:""},mode:"Modos",modes:{above:"Miniaturas acima da mídia",below:"Miniaturas abaixo da mídia",left:"Miniaturas em uma gaveta à esquerda",none:"Sem miniaturas",right:"Miniaturas em uma gaveta à direita"},show_details:"Mostrar detalhes",show_download_control:"Mostrar o botão de download",show_favorite_control:"Mostrar o botão de favorito nas miniaturas",show_timeline_control:"Mostrar a linha do tempo nas miniaturas",size:"Tamanho das miniaturas em pixels"},timeline:{editor_label:"Controles de linha do tempo",mode:"Modo",modes:{above:"Por cima",below:"Abaixo",none:"Nenhum"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modo de visualização de imagem",modes:{camera:"Instantâneo da câmera do Home Assistant, da entidade de câmera",entity:"",screensaver:"Logo Frigate embutido",url:"Imagem arbitrária especificada por URL"},refresh_seconds:"Número de segundos após o qual atualizar (0 = nunca)",url:"Imagem arbitrária especificada por URL"},media_action_conditions:{all:"Todas as oportunidades",hidden:"Ao ocultar o navegador/aba",microphone_mute:"",microphone_unmute:"",never:"Nunca",selected:"Ao selecionar",unselected:"Ao desselecionar",visible:"Ao mostrar o navegador/aba"},timeline:{clustering_threshold:"A contagem de eventos nos quais eles são agrupados (0 = sem agrupamento)",events_media_type:"A mídia que a linha do tempo exibe",events_media_types:{all:"Todos os tipos de mídia",clips:"Clipes",snapshots:"Instantâneos"},show_recordings:"Mostrar gravações",style:"",styles:{ribbon:"",stack:""},window_seconds:"A duração padrão da visualização da linha do tempo em segundos"}},dimensions:{aspect_ratio:"Proporção padrão (e.g. '16:9')",aspect_ratio_mode:"Modo de proporção",aspect_ratio_modes:{dynamic:"A proporção se ajusta à mídia",static:"Proporção estática",unconstrained:"Proporção irrestrita"},height:""},live:{auto_mute:"Silenciar câmeras ao vivo automaticamente",auto_pause:"Parar câmeras ao vivo automaticamente",auto_play:"Reproduzir câmeras ao vivo automaticamente",auto_unmute:"Ativar automaticamente o som das câmeras ao vivo",controls:{editor_label:"Controles da visualização ao vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"A visualização ao vivo das câmeras pode ser arrastada/deslizada",lazy_load:"As câmeras ao vivo são carregadas lentamente",lazy_unload:"As câmeras ao vivo são descarregadas preguiçosamente",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Pré-carregar a visualização ao vivo em segundo plano",show_image_during_load:"Mostar imagem durante o carregamento",transition_effect:"Efeito de transição de câmera ao vivo",zoomable:""},media_viewer:{auto_mute:"Silenciar mídia automaticamente",auto_pause:"Parar mídia automaticamente",auto_play:"Reproduzir mídia automaticamente",auto_unmute:"Ativar mídia automaticamente",controls:{editor_label:"Controles do visualizador de mídia"},draggable:"Visualizador de eventos pode ser arrastado/deslizado",lazy_load:"A mídia do Visualizador de eventos é carregada lentamente no carrossel",snapshot_click_plays_clip:"",transition_effect:"Efeito de transição do Visualizador de eventos",transition_effects:{none:"Sem transição",slide:"Transição de slides"},zoomable:""},menu:{alignment:"Alinhamento do menu",alignments:{bottom:"Alinhado à parte inferior",left:"Alinhado à esquerda",right:"Alinhado à direita",top:"Alinhado ao topo"},button_size:"Tamanho do botão de menu (e.g. '40px')",buttons:{alignment:"Alinhamento do botão",alignments:{matching:"Mesmo alinhamento do menu",opposing:"Opor-se ao alinhamento do menu"},camera_ui:"Camera",cameras:"Selecionar câmera",clips:"Clipes",display_mode:"",download:"Descarregar mídia do evento",enabled:"Botão ativado",expand:"Expandir",frigate:"Frigate menu / Visualização padrão",fullscreen:"Tela cheia",icon:"Ícone",image:"Imagem",live:"Ao vivo",media_player:"Enviar para o reprodutor de mídia",microphone:"",mute:"",permanent:"",play:"",priority:"Prioridade",ptz_controls:"",ptz_home:"",recordings:"",screenshot:"",snapshots:"Instantâneos",substreams:"substreams",timeline:"Linha do tempo",type:"",types:{momentary:"",toggle:""}},position:"Posição do menu",positions:{bottom:"Posicionado na parte inferior",left:"Posicionado à esquerda",right:"Posicionado à direita",top:"Posicionado no topo"},style:"Estilo do menu",styles:{hidden:"Menu oculto",hover:"Menu suspenso","hover-card":"",none:"Sem menu",outside:"Menu externo",overlay:"Menu sobreposto"}},overrides:{info:"Esta configuração do cartão especificou manualmente as substituições configuradas que podem substituir os valores mostrados no editor visual, consulte o editor de código para visualizar/modificar essas substituições"},performance:{features:{animated_progress_indicator:"Animação na barra de progresso",editor_label:"Editor de etiquetas",max_simultaneous_engine_requests:"",media_chunk_size:"Tamanho do ficheiro"},style:{border_radius:"Tamanho do bordo",box_shadow:"Caixa de Fundo",editor_label:"Editor de etiquetas"},warning:"Avisos"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualização de câmeras recém-selecionadas",dark_mode:"Modo escuro",dark_modes:{auto:"Automático",off:"Desligado",on:"Ligado"},default:"Visualização padrão",default_cycle_camera:"Percorrer as câmeras quando a visualização padrão for atualizada",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Atualize a visualização padrão a cada X segundos (0 = nunca)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Exibir estado do gatilho",untrigger_seconds:"Segundos após a mudar para o estado inativo para desacionar"},views:{clip:"Clipe mais recente",clips:"Galeria de clipes",current:"Visualização atual",image:"Imagem estática",live:"Visualização ao vivo",recording:"",recordings:"",snapshot:"Snapshot mais recente",snapshots:"Galeria de Snapshots",timeline:"Visualização da linha do tempo"}}},o={grid:"",single:""},i={add_new_camera:"Adicionar nova câmera",button:"Botão",camera:"Câmera",cameras:"Câmeras",cameras_secondary:"Câmeras para renderizar neste cartão",delete:"Excluir",dimensions:"",dimensions_secondary:"",image:"Imagem",image_secondary:"Opções de visualização de imagem estática",live:"Ao vivo",live_secondary:"Opções de visualização da câmera ao vivo",media_gallery:"Galeria",media_gallery_secondary:"Galeria Secundaria",media_viewer:"Visualizador de eventos",media_viewer_secondary:"Opções do visualizador de Snapshots e clipes",menu:"Menu",menu_secondary:"Opções de aparência do menu",move_down:"Descer",move_up:"Subir",overrides:"As substituições estão ativas",overrides_secondary:"Substituições de configuração dinâmica detectadas",performance:"",performance_secondary:"",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Linha do tempo",timeline_secondary:"Opções do evento da linha do tempo",upgrade:"Actualização",upgrade_available:"Está disponível uma atualização automática do cartão",view:"Visualizar",view_secondary:"O que deve ser mostrado neste cartão"},t={ptz:{down:"Baixo",home:"Origem",left:"Esquerda",right:"Direira",up:"Cima",zoom_in:"Ampliar",zoom_out:"Reduzir"}},r={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Não foi possível renderizar os elementos da imagem",could_not_resolve:"Não foi possível resolver o URL de mídia",diagnostics:"Diagnósticos do cartão. Reveja as informações confidenciais antes de partilhar",download_no_media:"Nenhuma mídia para download",download_sign_failed:"Não foi possível assinar o URL de mídia para download",duplicate_camera_id:"Duplique o ID da câmera Frigate para a câmera a seguir, use o parâmetro 'id' para identificar exclusivamente as câmeras",empty_response:"Sem resposta do Home Assistant para a solicitação",failed_response:"Falha ao receber resposta do Home Assistant para solicitação",failed_retain:"Não foi possível reter o evento",failed_sign:"Não foi possível assinar a URL do Home Assistant",image_load_error:"A imagem não pôde ser carregada",invalid_configuration:"Configuração inválida",invalid_configuration_no_hint:"Nenhuma dica de local disponível (tipo incorreto ou ausente?)",invalid_configuration_override:"",invalid_elements_config:"Configuração de elementos de imagem inválida",invalid_response:"Resposta inválida recebida do Home Assistant para a solicitação",jsmpeg_no_player:"Não foi possível iniciar o player JSMPEG",live_camera_no_endpoint:"Nenhuma câmera ao vivo",live_camera_not_found:"Nenhuma câmera ao vivo não foi encontrada",live_camera_unavailable:"Câmera ao vivo indisponivel",no_camera_engine:"Não existe câmera",no_camera_entity:"Não existe uma entidade câmera",no_camera_entity_for_triggers:"Não existe camera para a acção",no_camera_id:"Não foi possível determinar o ID da câmera para a câmera a seguir, pode ser necessário definir o parâmetro 'id' manualmente",no_camera_name:"Não foi possível determinar o nome da câmera da Frigate, especifique 'camera_entity' ou 'camera_name' para a câmera a seguir",no_dashboard_or_view:"",no_live_camera:"O parâmetro camera_entity deve ser definido e válido para este serviço ativo",no_supported_camera:"",no_supported_cameras:"",reconnecting:"A voltar a ligar",too_many_automations:"",troubleshooting:"Verifique a solução de problemas",unknown:"Erro desconhecido",upgrade_available:"Uma atualização automatizada da configuração do cartão está disponível, visite o editor visual do cartão",webrtc_card_reported_error:"O cartão WebRTC relatou um erro",webrtc_card_waiting:"Aguardar o cartão WebRTC carregar ..."},s={camera:"Camera",duration:"Duração",in_progress:"Em andamento",score:"Pontuação",seek:"Procurar",start:"Início",tag:"",what:"O quê",where:"Onde"},n={assign:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},d={all:"Todos",camera:"Camera",favorite:"Favoritos",media_type:"Tipos de media",media_types:{clips:"Clips",recordings:"Gravações",snapshots:"Imagens"},not_favorite:"Não favorito",select_camera:"Seleciona a camara",select_favorite:"Seleciona o favorito",select_media_type:"Seleciona o tipo de media",select_tag:"",select_what:"Seleciona",select_when:"Seleciona quando",select_where:"Seleciona onde",tag:"",what:"O que",when:"Quando",whens:{custom:"",past_month:"O mes passado",past_week:"A semana passada",today:"Hoje",yesterday:"Ontem"},where:"Onde"},l={unseekable:""},m={camera:"Camera",duration:"Duração",events:"Eventos",in_progress:"Em andamento",seek:"Procurar",start:"Começar"},c={download:"",no_thumbnail:"Nenhuma miniatura disponível",retain_indefinitely:"Evento será retido por tempo indeterminado",timeline:"Ver evento na linha do tempo"},u={select_date:"Selecionar a data"},_={common:e,config:a,display_modes:o,editor:i,elements:t,error:r,event:s,key_assigner:n,media_filter:d,media_viewer:l,recording:m,thumbnail:c,timeline:u};export{e as common,a as config,_ as default,o as display_modes,i as editor,t as elements,r as error,s as event,n as key_assigner,d as media_filter,l as media_viewer,m as recording,c as thumbnail,u as timeline}; diff --git a/www/community/frigate-hass-card/lang-pt-PT-16f39312.js.gz b/www/community/frigate-hass-card/lang-pt-PT-16f39312.js.gz new file mode 100644 index 00000000..4dc92841 Binary files /dev/null and b/www/community/frigate-hass-card/lang-pt-PT-16f39312.js.gz differ diff --git a/www/community/frigate-hass-card/lang-pt-PT-c4863423.js b/www/community/frigate-hass-card/lang-pt-PT-c4863423.js new file mode 100644 index 00000000..fd669394 --- /dev/null +++ b/www/community/frigate-hass-card/lang-pt-PT-c4863423.js @@ -0,0 +1 @@ +var e={frigate_card:"Cartão Frigate",frigate_card_description:"Um cartão da Lovelace para usar com Frigate",live:"Ao Vivo",no_media:"Sem média",recordings:"Gravações",version:"Versão"},a={cameras:{camera_entity:"Entidade da Câmera",capabilities:{capabilities:{clips:"","favorite-events":"","favorite-recordings":"",live:"",menu:"",ptz:"",recordings:"",seek:"",snapshots:"",substream:""},disable:"",disable_except:"",editor_label:""},cast:{dashboard:{dashboard_path:"",view_path:""},editor_label:"",method:"",methods:{dashboard:"",standard:""}},dependencies:{all_cameras:"Mostrar eventos para todas as câmeras nesta câmera",cameras:"Mostrar eventos para câmeras específicas nesta câmera",editor_label:"Opções de dependência"},dimensions:{aspect_ratio:"",editor_label:"",layout:{editor_label:"",fit:"Fit",fits:{contain:"Conter",cover:"Tapar",fill:"Preencher"},pan:{x:"",y:""},position:{editor_label:"",x:"Percentagem da localização horizontal",y:"Percentagem da localização vertical"},view_box:{bottom:"",editor_label:"",left:"",right:"",top:""},zoom:""}},engines:{editor_label:"Editor de etiquetas"},frigate:{camera_name:"Nome da câmera do Frigate (detectado automaticamente pela entidade)",client_id:"ID do cliente do Frigate (para >1 servidor Frigate)",editor_label:"Opções do Frigate",labels:"Etiquetas",url:"URL do servidor Frigate",zones:"Zonas"},go2rtc:{editor_label:"Editor de etiquetas",modes:{editor_label:"Editor de etiquetas",mjpeg:"Mjpeg",mp4:"Mp4",mse:"Mse",webrtc:"Webrtc"},stream:"Stream"},icon:"Ícone para esta câmera (detectado automaticamente pela entidade)",id:"ID exclusivo para esta câmera nesse cartão",image:{editor_label:"Editor etiquetas",refresh_seconds:"Atualizar em segundos",url:"Link"},live_provider:"Fonte de visualização ao vivo para esta câmera",live_provider_options:{editor_label:"Editor de etiquetas"},live_providers:{auto:"Automatico",go2rtc:"Go2rtc",ha:"Ha",image:"Imagem",jsmpeg:"JSMpeg","webrtc-card":"Cartão WebRTC (de @AlexxIT)"},motioneye:{editor_label:"Directoria pre-definido",images:{directory_pattern:"Directoria pre-definido",file_pattern:"Ficheiro pre-definido"},movies:{directory_pattern:"Directoria pre-definida",file_pattern:"Ficheiro pre-definido"},url:"Link"},proxy:{dynamic:"",editor_label:"",media:{auto:"",editor_label:"",false:"",true:""},ssl_ciphers:{auto:"",default:"",editor_label:"",insecure:"",intermediate:"",modern:""},ssl_verification:{auto:"",editor_label:"",false:"",true:""}},reolink:{editor_label:"",media_resolution:{editor_label:"",high:"",low:""},url:""},title:"Título para esta câmera (detectado automaticamente pela entidade)",triggers:{editor_label:"Opções de activação",entities:"Activar a partir de outras entidades",events:{clips:"",editor_label:"",events:"",snapshots:""},motion:"Activar detectando automaticamente o sensor de movimento",occupancy:"Activar detectando automaticamente o sensor de ocupação"},webrtc_card:{editor_label:"Opções do cartão WebRTC",entity:"Entidade de câmera de cartão WebRTC (não é uma câmera Frigate)",url:"URL da câmera do cartão WebRTC"}},common:{controls:{builtin:"",filter:{editor_label:"Editor de titulos",mode:"Modo",modes:{left:"Esquerda",none:"Nenhum",right:"Direita"}},next_previous:{editor_label:"Editor de titulos",size:"Tamanho de controle próximo e anterior",style:"Estilo do controle próximo e anterior",styles:{chevrons:"Setas",icons:"Ícones",none:"Nenhum",thumbnails:"Miniaturas"}},thumbnails:{editor_label:"Editor de titulos",events_media_type:"Mostrar miniaturas de clipes ou snapshots",events_media_types:{clips:"Miniaturas de clipes",snapshots:"Miniaturas de Snapshots"},media_type:"",media_types:{events:"",recordings:""},mode:"Modos",modes:{above:"Miniaturas acima da mídia",below:"Miniaturas abaixo da mídia",left:"Miniaturas em uma gaveta à esquerda",none:"Sem miniaturas",right:"Miniaturas em uma gaveta à direita"},show_details:"Mostrar detalhes",show_download_control:"Mostrar o botão de download",show_favorite_control:"Mostrar o botão de favorito nas miniaturas",show_timeline_control:"Mostrar a linha do tempo nas miniaturas",size:"Tamanho das miniaturas em pixels"},timeline:{editor_label:"Controles de linha do tempo",mode:"Modo",modes:{above:"Por cima",below:"Abaixo",none:"Nenhum"},pan_mode:"",pan_modes:{pan:"",seek:"","seek-in-camera":"","seek-in-media":""}}},display:{editor_label:"",grid_columns:"",grid_max_columns:"",grid_selected_width_factor:"",mode:""},image:{entity:"",entity_parameters:"",mode:"Modo de visualização de imagem",modes:{camera:"Instantâneo da câmera do Home Assistant, da entidade de câmera",entity:"",screensaver:"Logo Frigate embutido",url:"Imagem arbitrária especificada por URL"},refresh_seconds:"Número de segundos após o qual atualizar (0 = nunca)",url:"Imagem arbitrária especificada por URL"},media_action_conditions:{all:"Todas as oportunidades",hidden:"Ao ocultar o navegador/aba",microphone_mute:"",microphone_unmute:"",never:"Nunca",selected:"Ao selecionar",unselected:"Ao desselecionar",visible:"Ao mostrar o navegador/aba"},timeline:{clustering_threshold:"A contagem de eventos nos quais eles são agrupados (0 = sem agrupamento)",events_media_type:"A mídia que a linha do tempo exibe",events_media_types:{all:"Todos os tipos de mídia",clips:"Clipes",snapshots:"Instantâneos"},show_recordings:"Mostrar gravações",style:"",styles:{ribbon:"",stack:""},window_seconds:"A duração padrão da visualização da linha do tempo em segundos"}},dimensions:{aspect_ratio:"Proporção padrão (e.g. '16:9')",aspect_ratio_mode:"Modo de proporção",aspect_ratio_modes:{dynamic:"A proporção se ajusta à mídia",static:"Proporção estática",unconstrained:"Proporção irrestrita"},height:""},live:{auto_mute:"Silenciar câmeras ao vivo automaticamente",auto_pause:"Parar câmeras ao vivo automaticamente",auto_play:"Reproduzir câmeras ao vivo automaticamente",auto_unmute:"Ativar automaticamente o som das câmeras ao vivo",controls:{editor_label:"Controles da visualização ao vivo",ptz:{editor_label:"",hide_home:"",hide_pan_tilt:"",hide_zoom:"",mode:"",modes:{off:"",on:""},orientation:"",orientations:{horizontal:"",vertical:""},position:"",positions:{"bottom-left":"","bottom-right":"","top-left":"","top-right":""}}},draggable:"A visualização ao vivo das câmeras pode ser arrastada/deslizada",lazy_load:"As câmeras ao vivo são carregadas lentamente",lazy_unload:"As câmeras ao vivo são descarregadas preguiçosamente",microphone:{always_connected:"",disconnect_seconds:"",editor_label:"",enabled:"",mute_after_microphone_mute_seconds:""},preload:"Pré-carregar a visualização ao vivo em segundo plano",show_image_during_load:"Mostar imagem durante o carregamento",transition_effect:"Efeito de transição de câmera ao vivo",zoomable:""},media_viewer:{auto_mute:"Silenciar mídia automaticamente",auto_pause:"Parar mídia automaticamente",auto_play:"Reproduzir mídia automaticamente",auto_unmute:"Ativar mídia automaticamente",controls:{editor_label:"Controles do visualizador de mídia"},draggable:"Visualizador de eventos pode ser arrastado/deslizado",lazy_load:"A mídia do Visualizador de eventos é carregada lentamente no carrossel",snapshot_click_plays_clip:"",transition_effect:"Efeito de transição do Visualizador de eventos",transition_effects:{none:"Sem transição",slide:"Transição de slides"},zoomable:""},menu:{alignment:"Alinhamento do menu",alignments:{bottom:"Alinhado à parte inferior",left:"Alinhado à esquerda",right:"Alinhado à direita",top:"Alinhado ao topo"},button_size:"Tamanho do botão de menu (e.g. '40px')",buttons:{alignment:"Alinhamento do botão",alignments:{matching:"Mesmo alinhamento do menu",opposing:"Opor-se ao alinhamento do menu"},camera_ui:"Camera",cameras:"Selecionar câmera",clips:"Clipes",display_mode:"",download:"Descarregar mídia do evento",enabled:"Botão ativado",expand:"Expandir",frigate:"Frigate menu / Visualização padrão",fullscreen:"Tela cheia",icon:"Ícone",image:"Imagem",live:"Ao vivo",media_player:"Enviar para o reprodutor de mídia",microphone:"",mute:"",permanent:"",play:"",priority:"Prioridade",ptz_controls:"",ptz_home:"",recordings:"",screenshot:"",snapshots:"Instantâneos",substreams:"substreams",timeline:"Linha do tempo",type:"",types:{momentary:"",toggle:""}},position:"Posição do menu",positions:{bottom:"Posicionado na parte inferior",left:"Posicionado à esquerda",right:"Posicionado à direita",top:"Posicionado no topo"},style:"Estilo do menu",styles:{hidden:"Menu oculto",hover:"Menu suspenso","hover-card":"",none:"Sem menu",outside:"Menu externo",overlay:"Menu sobreposto"}},overrides:{info:"Esta configuração do cartão especificou manualmente as substituições configuradas que podem substituir os valores mostrados no editor visual, consulte o editor de código para visualizar/modificar essas substituições"},performance:{features:{animated_progress_indicator:"Animação na barra de progresso",editor_label:"Editor de etiquetas",max_simultaneous_engine_requests:"",media_chunk_size:"Tamanho do ficheiro"},style:{border_radius:"Tamanho do bordo",box_shadow:"Caixa de Fundo",editor_label:"Editor de etiquetas"},warning:"Avisos"},profiles:{casting:"",editor_label:"","low-performance":"",scrubbing:""},status_bar:{height:"",items:{enabled:"",engine:"",live_provider:"",priority:"",resolution:"",technology:"",title:""},popup_seconds:"",position:"",positions:{bottom:"",top:""},style:"",styles:{hover:"","hover-card":"",none:"",outside:"",overlay:"",popup:""}},view:{camera_select:"Visualização de câmeras recém-selecionadas",dark_mode:"Modo escuro",dark_modes:{auto:"Automático",off:"Desligado",on:"Ligado"},default:"Visualização padrão",default_cycle_camera:"Percorrer as câmeras quando a visualização padrão for atualizada",default_reset:{after_interaction:"",editor_label:"",entities:"",every_seconds:"Atualize a visualização padrão a cada X segundos (0 = nunca)",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""}},interaction_seconds:"",keyboard_shortcuts:{editor_label:"",enabled:"",ptz_down:"",ptz_home:"",ptz_left:"",ptz_right:"",ptz_up:"",ptz_zoom_in:"",ptz_zoom_out:""},triggers:{actions:{editor_label:"",interaction_mode:"",interaction_modes:{active:"",all:"",inactive:""},trigger:"",triggers:{default:"",live:"",media:"",none:""},untrigger:"",untriggers:{default:"",none:""}},editor_label:"",filter_selected_camera:"",show_trigger_status:"Exibir estado do gatilho",untrigger_seconds:"Segundos após a mudar para o estado inativo para desacionar"},views:{clip:"Clipe mais recente",clips:"Galeria de clipes",current:"Visualização atual",image:"Imagem estática",live:"Visualização ao vivo",recording:"",recordings:"",snapshot:"Snapshot mais recente",snapshots:"Galeria de Snapshots",timeline:"Visualização da linha do tempo"}}},o={grid:"",single:""},i={add_new_camera:"Adicionar nova câmera",button:"Botão",camera:"Câmera",cameras:"Câmeras",cameras_secondary:"Câmeras para renderizar neste cartão",delete:"Excluir",dimensions:"",dimensions_secondary:"",image:"Imagem",image_secondary:"Opções de visualização de imagem estática",live:"Ao vivo",live_secondary:"Opções de visualização da câmera ao vivo",media_gallery:"Galeria",media_gallery_secondary:"Galeria Secundaria",media_viewer:"Visualizador de eventos",media_viewer_secondary:"Opções do visualizador de Snapshots e clipes",menu:"Menu",menu_secondary:"Opções de aparência do menu",move_down:"Descer",move_up:"Subir",overrides:"As substituições estão ativas",overrides_secondary:"Substituições de configuração dinâmica detectadas",performance:"",performance_secondary:"",profiles:"",profiles_secondary:"",status_bar:"",status_bar_secondary:"",timeline:"Linha do tempo",timeline_secondary:"Opções do evento da linha do tempo",upgrade:"Actualização",upgrade_available:"Está disponível uma atualização automática do cartão",view:"Visualizar",view_secondary:"O que deve ser mostrado neste cartão"},t={ptz:{down:"Baixo",home:"Origem",left:"Esquerda",right:"Direira",up:"Cima",zoom_in:"Ampliar",zoom_out:"Reduzir"}},r={awaiting_live:"",awaiting_media:"",camera_initialization:"",camera_initialization_reolink:"",could_not_render_elements:"Não foi possível renderizar os elementos da imagem",could_not_resolve:"Não foi possível resolver o URL de mídia",diagnostics:"Diagnósticos do cartão. Reveja as informações confidenciais antes de partilhar",download_no_media:"Nenhuma mídia para download",download_sign_failed:"Não foi possível assinar o URL de mídia para download",duplicate_camera_id:"Duplique o ID da câmera Frigate para a câmera a seguir, use o parâmetro 'id' para identificar exclusivamente as câmeras",empty_response:"Sem resposta do Home Assistant para a solicitação",failed_response:"Falha ao receber resposta do Home Assistant para solicitação",failed_retain:"Não foi possível reter o evento",failed_sign:"Não foi possível assinar a URL do Home Assistant",image_load_error:"A imagem não pôde ser carregada",invalid_configuration:"Configuração inválida",invalid_configuration_no_hint:"Nenhuma dica de local disponível (tipo incorreto ou ausente?)",invalid_configuration_override:"",invalid_elements_config:"Configuração de elementos de imagem inválida",invalid_response:"Resposta inválida recebida do Home Assistant para a solicitação",jsmpeg_no_player:"Não foi possível iniciar o player JSMPEG",live_camera_no_endpoint:"Nenhuma câmera ao vivo",live_camera_not_found:"Nenhuma câmera ao vivo não foi encontrada",live_camera_unavailable:"Câmera ao vivo indisponivel",no_camera_engine:"Não existe câmera",no_camera_entity:"Não existe uma entidade câmera",no_camera_entity_for_triggers:"Não existe camera para a acção",no_camera_id:"Não foi possível determinar o ID da câmera para a câmera a seguir, pode ser necessário definir o parâmetro 'id' manualmente",no_camera_name:"Não foi possível determinar o nome da câmera da Frigate, especifique 'camera_entity' ou 'camera_name' para a câmera a seguir",no_dashboard_or_view:"",no_live_camera:"O parâmetro camera_entity deve ser definido e válido para este serviço ativo",no_supported_camera:"",no_supported_cameras:"",reconnecting:"A voltar a ligar",too_many_automations:"",troubleshooting:"Verifique a solução de problemas",unknown:"Erro desconhecido",upgrade_available:"Uma atualização automatizada da configuração do cartão está disponível, visite o editor visual do cartão",webrtc_card_reported_error:"O cartão WebRTC relatou um erro",webrtc_card_waiting:"Aguardar o cartão WebRTC carregar ..."},s={camera:"Camera",duration:"Duração",in_progress:"Em andamento",score:"Pontuação",seek:"Procurar",start:"Início",tag:"",what:"O quê",where:"Onde"},n={assign:"",assigning:"",modifiers:{alt:"",ctrl:"",meta:"",shift:""},unassign:""},d={all:"Todos",camera:"Camera",favorite:"Favoritos",media_type:"Tipos de media",media_types:{clips:"Clips",recordings:"Gravações",snapshots:"Imagens"},not_favorite:"Não favorito",select_camera:"Seleciona a camara",select_favorite:"Seleciona o favorito",select_media_type:"Seleciona o tipo de media",select_tag:"",select_what:"Seleciona",select_when:"Seleciona quando",select_where:"Seleciona onde",tag:"",what:"O que",when:"Quando",whens:{custom:"",past_month:"O mes passado",past_week:"A semana passada",today:"Hoje",yesterday:"Ontem"},where:"Onde"},l={unseekable:""},m={camera:"Camera",duration:"Duração",events:"Eventos",in_progress:"Em andamento",seek:"Procurar",start:"Começar"},c={download:"",no_thumbnail:"Nenhuma miniatura disponível",retain_indefinitely:"Evento será retido por tempo indeterminado",timeline:"Ver evento na linha do tempo"},u={select_date:"Selecionar a data"},_={common:e,config:a,display_modes:o,editor:i,elements:t,error:r,event:s,key_assigner:n,media_filter:d,media_viewer:l,recording:m,thumbnail:c,timeline:u};export{e as common,a as config,_ as default,o as display_modes,i as editor,t as elements,r as error,s as event,n as key_assigner,d as media_filter,l as media_viewer,m as recording,c as thumbnail,u as timeline}; diff --git a/www/community/frigate-hass-card/lang-pt-PT-c4863423.js.gz b/www/community/frigate-hass-card/lang-pt-PT-c4863423.js.gz new file mode 100644 index 00000000..690cfa53 Binary files /dev/null and b/www/community/frigate-hass-card/lang-pt-PT-c4863423.js.gz differ diff --git a/www/community/frigate-hass-card/media-1a34ac2c.js b/www/community/frigate-hass-card/media-1a34ac2c.js new file mode 100644 index 00000000..4def2bf4 --- /dev/null +++ b/www/community/frigate-hass-card/media-1a34ac2c.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-45855f1f.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/www/community/frigate-hass-card/media-1a34ac2c.js.gz b/www/community/frigate-hass-card/media-1a34ac2c.js.gz new file mode 100644 index 00000000..dad3deca Binary files /dev/null and b/www/community/frigate-hass-card/media-1a34ac2c.js.gz differ diff --git a/www/community/frigate-hass-card/media-2a3bfaef.js b/www/community/frigate-hass-card/media-2a3bfaef.js new file mode 100644 index 00000000..52395869 --- /dev/null +++ b/www/community/frigate-hass-card/media-2a3bfaef.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dD as n,dE as i,cP as o,dF as e,_ as r,n as s,b as l,t as c,a as d,dG as h,x as m,e as p,dH as u,r as g,dI as _,dJ as f,dK as v,dL as b,dM as y,l as z}from"./card-4e88bdfb.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&c()}function l(t){return o.has(t)}function c(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!l(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function d(){const t=n.previousScrollSnap();l(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,l){const{mergeOptions:h,optionsAtMedia:m}=l,p=h(I,t);a=m(p),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,c))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,d))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,c))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,d))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends d{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return m``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,left:"left"===this.side,right:"right"===this.side,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"left"===this.side?"mdi:chevron-left":"mdi:chevron-right";return m` + + `}return u(this,this._embedThumbnailTask,(t=>t?m``:m``),{inProgressFunc:()=>m`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-left-position: 45px;\n --frigate-card-right-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.left {\n left: var(--frigate-card-left-position);\n}\n\n.controls.right {\n right: var(--frigate-card-right-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.left.thumbnails:hover {\n left: calc(var(--frigate-card-left-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.right.thumbnails:hover {\n right: calc(var(--frigate-card-right-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"side",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([l()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([c("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends d{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?m`this._controller.handleAction(t,n)} + >`:m``,a=this._controller.getConfig();return m`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?m`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?m`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:m``} + ${!a?.hide_home&&this._actionPresence?.home?m`
+ ${t("home","mdi:home",this._actions.home)} +
`:m``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([c("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/www/community/frigate-hass-card/media-2a3bfaef.js.gz b/www/community/frigate-hass-card/media-2a3bfaef.js.gz new file mode 100644 index 00000000..8ef1b89c Binary files /dev/null and b/www/community/frigate-hass-card/media-2a3bfaef.js.gz differ diff --git a/www/community/frigate-hass-card/media-67c578aa.js b/www/community/frigate-hass-card/media-67c578aa.js new file mode 100644 index 00000000..e9756ec2 --- /dev/null +++ b/www/community/frigate-hass-card/media-67c578aa.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-7cd05290.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/www/community/frigate-hass-card/media-67c578aa.js.gz b/www/community/frigate-hass-card/media-67c578aa.js.gz new file mode 100644 index 00000000..48027f98 Binary files /dev/null and b/www/community/frigate-hass-card/media-67c578aa.js.gz differ diff --git a/www/community/frigate-hass-card/media-6eadcd60.js b/www/community/frigate-hass-card/media-6eadcd60.js new file mode 100644 index 00000000..0dce9440 --- /dev/null +++ b/www/community/frigate-hass-card/media-6eadcd60.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-c642ee74.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/www/community/frigate-hass-card/media-6eadcd60.js.gz b/www/community/frigate-hass-card/media-6eadcd60.js.gz new file mode 100644 index 00000000..144d9bac Binary files /dev/null and b/www/community/frigate-hass-card/media-6eadcd60.js.gz differ diff --git a/www/community/frigate-hass-card/media-921a03ae.js b/www/community/frigate-hass-card/media-921a03ae.js new file mode 100644 index 00000000..286e04e3 --- /dev/null +++ b/www/community/frigate-hass-card/media-921a03ae.js @@ -0,0 +1,33 @@ +import{dw as t,dx as i,dy as e,dz as n,cK as o,dA as a,_ as s,n as r,b as l,t as c,a as d,dB as h,x as p,e as u,dC as f,r as _,dD as g,dE as m,dF as v,dG as b,dH as y,l as z,db as w}from"./card-e5d55e5b.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const C={},x=t(class extends i{constructor(){super(...arguments),this.ot=C}render(t,i){return i()}update(t,[i,n]){if(Array.isArray(i)){if(Array.isArray(this.ot)&&this.ot.length===i.length&&i.every(((t,i)=>t===this.ot[i])))return e}else if(this.ot===i)return e;return this.ot=Array.isArray(i)?Array.from(i):i,this.render(i,n)}});class I{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new n,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,i){this._target?.index===t&&this._target?.selected===i||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:i,index:t},i?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,i){this._initializeRoot()}_removeChildHandlers(){for(const[t,i]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",i);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,i]of this._children.entries()){const e=()=>this._mediaLoadedHandler(t);this._eventListeners.set(i,e),i.addEventListener("frigate-card:media:loaded",e)}}}async _intersectionHandler(t){const i=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==i&&i!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const A={active:!0,breakpoints:{},lazyLoadCount:0};function S(t={}){let i,e,n;const o=new Set,a=["init","select"],s=["select"];function r(){"hidden"===document.visibilityState&&i.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{i.lazyUnloadCallback&&(i.lazyUnloadCallback(t,n[t]),o.delete(t))})):"visible"===document.visibilityState&&i.lazyLoadCallback&&c()}function l(t){return o.has(t)}function c(){const t=i.lazyLoadCount,a=e.selectedScrollSnap(),s=new Set;for(let i=1;i<=t&&a-i>=0;i++)s.add(a-i);s.add(a);for(let i=1;i<=t&&a+i{!l(t)&&i.lazyLoadCallback&&(o.add(t),i.lazyLoadCallback(t,n[t]))}))}function d(){const t=e.previousScrollSnap();l(t)&&i.lazyUnloadCallback&&(i.lazyUnloadCallback(t,n[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,l){const{mergeOptions:h,optionsAtMedia:p}=l,u=h(A,t);i=p(u),e=o,n=e.slideNodes(),i.lazyLoadCallback&&a.forEach((t=>e.on(t,c))),i.lazyUnloadCallback&&i.lazyUnloadConditions?.includes("unselected")&&s.forEach((t=>e.on(t,d))),document.addEventListener("visibilitychange",r)},destroy:function(){i.lazyLoadCallback&&a.forEach((t=>e.off(t,c))),i.lazyUnloadCallback&&s.forEach((t=>e.off(t,d))),document.removeEventListener("visibilitychange",r)}}}function T(){let t,i=[];const e=[];function n(n){const o=n.composedPath();for(const[a,s]of[...i.entries()].reverse())if(o.includes(s)){e[a]=n.detail,a!==t.selectedScrollSnap()&&n.stopPropagation();break}}function a(n){const o=n.composedPath();for(const[a,s]of i.entries())if(o.includes(s)){delete e[a],a!==t.selectedScrollSnap()&&n.stopPropagation();break}}function s(){const n=t.selectedScrollSnap(),a=e[n];a&&o(i[n],a)}return{name:"autoMediaLoadedInfo",options:{},init:function(e){t=e,i=t.slideNodes();for(const t of i)t.addEventListener("frigate-card:media:loaded",n),t.addEventListener("frigate-card:media:unloaded",a);t.on("init",s),t.containerNode().addEventListener("frigate-card:carousel:force-select",s)},destroy:function(){for(const t of i)t.removeEventListener("frigate-card:media:loaded",n),t.removeEventListener("frigate-card:media:unloaded",a);t.off("init",s),t.containerNode().removeEventListener("frigate-card:carousel:force-select",s)}}}class ${constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=a((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function L(){let t,i=null,e=null;const n=new Map,o=new ResizeObserver((function(t){let i=!1;for(const e of t){const t={height:e.contentRect.height,width:e.contentRect.width},o=n.get(e.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(n.set(e.target,t),i=!0)}i&&r()})),s=new IntersectionObserver((function(t){const n=t.some((t=>t.isIntersecting));if(n!==e){const t=n&&null!==e;e=n,t&&i?.reinit()}})),r=a((()=>function(){const{slideRegistry:e,options:{axis:n}}=t.internalEngine();if("y"===n)return;t.containerNode().style.removeProperty("max-height");const o=e[t.selectedScrollSnap()],a=t.slideNodes(),s=Math.max(...o.map((t=>a[t].getBoundingClientRect().height)));!isNaN(s)&&s>0&&(t.containerNode().style.maxHeight=`${s}px`);i?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(e){t=e,i=new $(t),s.observe(t.containerNode()),o.observe(t.containerNode());for(const i of t.slideNodes())o.observe(i);t.containerNode().addEventListener("frigate-card:media:loaded",r),t.on("settle",r)},destroy:function(){s.disconnect(),o.disconnect(),i?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",r),t.off("settle",r)}}}let P=class extends d{constructor(){super(...arguments),this.disabled=!1,this.label="",this._thumbnailError=!1,this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style)||this._thumbnailError,i={controls:!0,left:"left"===this.side,right:"right"===this.side,thumbnails:!t,icons:t,button:t};if(t){const t=this.icon&&!this._thumbnailError&&"chevrons"!==this._controlConfig.style?this.icon:"left"===this.side?{icon:"mdi:chevron-left"}:{icon:"mdi:chevron-right"};return p` + + `}return f(this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`,errorFunc:t=>{this._thumbnailError=!0}})}static get styles(){return _("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-left-position: 45px;\n --frigate-card-right-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.left {\n left: var(--frigate-card-left-position);\n}\n\n.controls.right {\n right: var(--frigate-card-right-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.left.thumbnails:hover {\n left: calc(var(--frigate-card-left-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.right.thumbnails:hover {\n right: calc(var(--frigate-card-right-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};s([r({attribute:!1})],P.prototype,"side",void 0),s([r({attribute:!1})],P.prototype,"hass",void 0),s([l()],P.prototype,"_controlConfig",void 0),s([r({attribute:!1})],P.prototype,"thumbnail",void 0),s([r({attribute:!1})],P.prototype,"icon",void 0),s([r({attribute:!0,type:Boolean})],P.prototype,"disabled",void 0),s([r()],P.prototype,"label",void 0),s([l()],P.prototype,"_thumbnailError",void 0),P=s([c("frigate-card-next-previous-control")],P);class E{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,i])=>`${t}:${i}`)).join(";"))}getConfig(){return this._config}setCamera(t,i){this._cameraManager=t??null,this._cameraID=i??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,i){t.stopPropagation();const e=t.detail.action,n=g(e,i);n&&m(this._host,{action:n,...i&&{config:i}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const i=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!i||!i.hasPTZCapability())return t;const e=i.getPTZCapabilities();return{pt:!!(e?.up||e?.down||e?.left||e?.right),z:!!e?.zoomIn||!!e?.zoomOut,home:!!e?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),i={};return i.up=t({ptzAction:"up"}),i.down=t({ptzAction:"down"}),i.left=t({ptzAction:"left"}),i.right=t({ptzAction:"right"}),i.zoom_in=t({ptzAction:"zoom_in"}),i.zoom_out=t({ptzAction:"zoom_out"}),i.home={tap_action:v()},i}}let M=class extends d{constructor(){super(...arguments),this._controller=new E(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,i,e)=>e?p`this._controller.handleAction(t,e)} + >`:p``,i=this._controller.getConfig();return p`
+ ${!i?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!i?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!i?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return _(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nfrigate-card-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nfrigate-card-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};function H(t){w(t,"live:error")}s([r({attribute:!1})],M.prototype,"config",void 0),s([r({attribute:!1})],M.prototype,"cameraManager",void 0),s([r({attribute:!1})],M.prototype,"cameraID",void 0),s([r({attribute:!1})],M.prototype,"forceVisibility",void 0),M=s([c("frigate-card-ptz")],M);const k=(t,i)=>{void 0!==i?.fit?t.style.setProperty("--frigate-card-media-layout-fit",i.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const e of["x","y"])void 0!==i?.position?.[e]?t.style.setProperty(`--frigate-card-media-layout-position-${e}`,`${i.position[e]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${e}`);for(const e of["top","bottom","left","right"])void 0!==i?.view_box?.[e]?t.style.setProperty(`--frigate-card-media-layout-view-box-${e}`,`${i.view_box[e]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${e}`)},O=2,R=(t,i)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=i},N=(t,i=1)=>{const e=t._controlsOriginalValue??t.controls;R(t,!1),t._controlsHideTimer??=new n,t._controlsOriginalValue=e;const o=()=>{R(t,e),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(i,(()=>{R(t,e)}))},D=async(t,i)=>{if(i?.play)try{await i.play()}catch(e){if("NotAllowedError"===e.name&&!t.isMuted()){await t.mute();try{await i.play()}catch(t){}}}};export{S as A,I as M,T as a,L as b,O as c,H as d,N as h,x as i,D as p,R as s,k as u}; diff --git a/www/community/frigate-hass-card/media-921a03ae.js.gz b/www/community/frigate-hass-card/media-921a03ae.js.gz new file mode 100644 index 00000000..95dbf0e7 Binary files /dev/null and b/www/community/frigate-hass-card/media-921a03ae.js.gz differ diff --git a/www/community/frigate-hass-card/media-aef44451.js b/www/community/frigate-hass-card/media-aef44451.js new file mode 100644 index 00000000..5fdf39b1 --- /dev/null +++ b/www/community/frigate-hass-card/media-aef44451.js @@ -0,0 +1,33 @@ +import{cL as t,cM as a,dC as n,dD as i,cP as o,dE as e,_ as r,n as s,b as c,t as d,a as l,dF as h,x as p,e as m,dG as u,r as g,dH as _,dI as f,dJ as v,dK as b,dL as y,l as z}from"./card-09c4bade.js"; +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const w={},C=t(class extends a{constructor(){super(...arguments),this.ot=w}render(t,a){return a()}update(t,[a,i]){if(Array.isArray(a)){if(Array.isArray(this.ot)&&this.ot.length===a.length&&a.every(((t,a)=>t===this.ot[a])))return n}else if(this.ot===a)return n;return this.ot=Array.isArray(a)?Array.from(a):a,this.render(a,i)}});class x{constructor(){this._options=null,this._viewportIntersecting=null,this._microphoneMuteTimer=new i,this._root=null,this._eventListeners=new Map,this._children=[],this._target=null,this._mutationObserver=new MutationObserver(this._mutationHandler.bind(this)),this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this)),this._mediaLoadedHandler=async t=>{this._target?.index===t&&(await this._unmuteTargetIfConfigured(this._target.selected?"selected":"visible"),await this._playTargetIfConfigured(this._target.selected?"selected":"visible"))},this._visibilityHandler=async()=>{await this._changeVisibility("visible"===document.visibilityState)},this._changeVisibility=async t=>{t?(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")):(await this._pauseAllIfConfigured("hidden"),await this._muteAllIfConfigured("hidden"))},this._microphoneChangeHandler=async t=>{"unmuted"===t?await this._unmuteTargetIfConfigured("microphone"):"muted"===t&&this._options?.autoMuteConditions?.includes("microphone")&&this._microphoneMuteTimer.start(this._options.microphoneMuteSeconds??60,(async()=>{await this._muteTargetIfConfigured("microphone")}))}}setOptions(t){this._options=t,this._options?.microphoneManager&&(this._options.microphoneManager.removeListener(this._microphoneChangeHandler),this._options.microphoneManager.addListener(this._microphoneChangeHandler))}hasRoot(){return!!this._root}destroy(){this._viewportIntersecting=null,this._microphoneMuteTimer.stop(),this._root=null,this._removeChildHandlers(),this._children=[],this._target=null,this._mutationObserver.disconnect(),this._intersectionObserver.disconnect(),this._options?.microphoneManager?.removeListener(this._microphoneChangeHandler),document.removeEventListener("visibilitychange",this._visibilityHandler)}async setTarget(t,a){this._target?.index===t&&this._target?.selected===a||(this._target?.selected&&(await this._pauseTargetIfConfigured("unselected"),await this._muteTargetIfConfigured("unselected"),this._microphoneMuteTimer.stop()),this._target={selected:a,index:t},a?(await this._unmuteTargetIfConfigured("selected"),await this._playTargetIfConfigured("selected")):(await this._unmuteTargetIfConfigured("visible"),await this._playTargetIfConfigured("visible")))}unsetTarget(){this._target=null}async _playTargetIfConfigured(t){null!==this._target&&this._options?.autoPlayConditions?.includes(t)&&await this._play(this._target.index)}async _play(t){await(this._children[t]?.play())}async _unmuteTargetIfConfigured(t){null!==this._target&&this._options?.autoUnmuteConditions?.includes(t)&&await this._unmute(this._target.index)}async _unmute(t){await(this._children[t]?.unmute())}async _pauseAllIfConfigured(t){if(this._options?.autoPauseConditions?.includes(t))for(const t of this._children.keys())await this._pause(t)}async _pauseTargetIfConfigured(t){null!==this._target&&this._options?.autoPauseConditions?.includes(t)&&await this._pause(this._target.index)}async _pause(t){await(this._children[t]?.pause())}async _muteAllIfConfigured(t){if(this._options?.autoMuteConditions?.includes(t))for(const t of this._children.keys())await this._mute(t)}async _muteTargetIfConfigured(t){null!==this._target&&this._options?.autoMuteConditions?.includes(t)&&await this._mute(this._target.index)}async _mute(t){await(this._children[t]?.mute())}_mutationHandler(t,a){this._initializeRoot()}_removeChildHandlers(){for(const[t,a]of this._eventListeners.entries())t.removeEventListener("frigate-card:media:loaded",a);this._eventListeners.clear()}initialize(t){this._root=t,this._initializeRoot(),document.addEventListener("visibilitychange",this._visibilityHandler),this._intersectionObserver.disconnect(),this._intersectionObserver.observe(t),this._mutationObserver.disconnect(),this._mutationObserver.observe(this._root,{childList:!0,subtree:!0})}_initializeRoot(){if(this._options&&this._root){this._removeChildHandlers(),this._children=[...this._root.querySelectorAll(this._options.playerSelector)];for(const[t,a]of this._children.entries()){const n=()=>this._mediaLoadedHandler(t);this._eventListeners.set(a,n),a.addEventListener("frigate-card:media:loaded",n)}}}async _intersectionHandler(t){const a=this._viewportIntersecting;this._viewportIntersecting=t.some((t=>t.isIntersecting)),null!==a&&a!==this._viewportIntersecting&&await this._changeVisibility(this._viewportIntersecting)}}const I={active:!0,breakpoints:{},lazyLoadCount:0};function A(t={}){let a,n,i;const o=new Set,e=["init","select"],r=["select"];function s(){"hidden"===document.visibilityState&&a.lazyUnloadConditions?.includes("hidden")?o.forEach((t=>{a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))})):"visible"===document.visibilityState&&a.lazyLoadCallback&&d()}function c(t){return o.has(t)}function d(){const t=a.lazyLoadCount,e=n.selectedScrollSnap(),r=new Set;for(let a=1;a<=t&&e-a>=0;a++)r.add(e-a);r.add(e);for(let a=1;a<=t&&e+a{!c(t)&&a.lazyLoadCallback&&(o.add(t),a.lazyLoadCallback(t,i[t]))}))}function l(){const t=n.previousScrollSnap();c(t)&&a.lazyUnloadCallback&&(a.lazyUnloadCallback(t,i[t]),o.delete(t))}return{name:"autoLazyLoad",options:t,init:function(o,c){const{mergeOptions:h,optionsAtMedia:p}=c,m=h(I,t);a=p(m),n=o,i=n.slideNodes(),a.lazyLoadCallback&&e.forEach((t=>n.on(t,d))),a.lazyUnloadCallback&&a.lazyUnloadConditions?.includes("unselected")&&r.forEach((t=>n.on(t,l))),document.addEventListener("visibilitychange",s)},destroy:function(){a.lazyLoadCallback&&e.forEach((t=>n.off(t,d))),a.lazyUnloadCallback&&r.forEach((t=>n.off(t,l))),document.removeEventListener("visibilitychange",s)}}}function L(){let t,a=[];const n=[];function i(i){const o=i.composedPath();for(const[e,r]of[...a.entries()].reverse())if(o.includes(r)){n[e]=i.detail,e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function e(i){const o=i.composedPath();for(const[e,r]of a.entries())if(o.includes(r)){delete n[e],e!==t.selectedScrollSnap()&&i.stopPropagation();break}}function r(){const i=t.selectedScrollSnap(),e=n[i];e&&o(a[i],e)}return{name:"autoMediaLoadedInfo",options:{},init:function(n){t=n,a=t.slideNodes();for(const t of a)t.addEventListener("frigate-card:media:loaded",i),t.addEventListener("frigate-card:media:unloaded",e);t.on("init",r),t.containerNode().addEventListener("frigate-card:carousel:force-select",r)},destroy:function(){for(const t of a)t.removeEventListener("frigate-card:media:loaded",i),t.removeEventListener("frigate-card:media:unloaded",e);t.off("init",r),t.containerNode().removeEventListener("frigate-card:carousel:force-select",r)}}}class S{constructor(t){this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._scrollingStart=()=>{this._scrolling=!0},this._scrollingStop=()=>{this._scrolling=!1,this._shouldReInitOnScrollStop&&(this._shouldReInitOnScrollStop=!1,this._debouncedReInit())},this._debouncedReInit=e((()=>{this._scrolling=!1,this._shouldReInitOnScrollStop=!1,this._emblaApi?.reInit()}),500,{trailing:!0}),this._emblaApi=t,this._emblaApi.on("scroll",this._scrollingStart),this._emblaApi.on("settle",this._scrollingStop),this._emblaApi.on("destroy",this.destroy)}destroy(){this._emblaApi.off("scroll",this._scrollingStart),this._emblaApi.off("settle",this._scrollingStop),this._emblaApi.off("destroy",this.destroy)}reinit(){this._scrolling?this._shouldReInitOnScrollStop=!0:this._debouncedReInit()}}function T(){let t,a=null,n=null;const i=new Map,o=new ResizeObserver((function(t){let a=!1;for(const n of t){const t={height:n.contentRect.height,width:n.contentRect.width},o=i.get(n.target);t.width&&t.height&&(o?.height!==t.height||o?.width!==t.width)&&(i.set(n.target,t),a=!0)}a&&s()})),r=new IntersectionObserver((function(t){const i=t.some((t=>t.isIntersecting));if(i!==n){const t=i&&null!==n;n=i,t&&a?.reinit()}})),s=e((()=>function(){const{slideRegistry:n,options:{axis:i}}=t.internalEngine();if("y"===i)return;t.containerNode().style.removeProperty("max-height");const o=n[t.selectedScrollSnap()],e=t.slideNodes(),r=Math.max(...o.map((t=>e[t].getBoundingClientRect().height)));!isNaN(r)&&r>0&&(t.containerNode().style.maxHeight=`${r}px`);a?.reinit()}()),200,{trailing:!0});return{name:"autoSize",options:{},init:function(n){t=n,a=new S(t),r.observe(t.containerNode()),o.observe(t.containerNode());for(const a of t.slideNodes())o.observe(a);t.containerNode().addEventListener("frigate-card:media:loaded",s),t.on("settle",s)},destroy:function(){r.disconnect(),o.disconnect(),a?.destroy(),t.containerNode().removeEventListener("frigate-card:media:loaded",s),t.off("settle",s)}}}let $=class extends l{constructor(){super(...arguments),this.disabled=!1,this.label="",this._embedThumbnailTask=h(this,(()=>this.hass),(()=>this.thumbnail))}set controlConfig(t){t?.size&&this.style.setProperty("--frigate-card-next-prev-size",`${t.size}px`),this._controlConfig=t}render(){if(this.disabled||!this._controlConfig||"none"==this._controlConfig.style)return p``;const t=!this.thumbnail||["chevrons","icons"].includes(this._controlConfig.style),a={controls:!0,previous:"previous"===this.direction,next:"next"===this.direction,thumbnails:!t,icons:t,button:t};if(t){const t=this.thumbnail&&this.icon&&"chevrons"!==this._controlConfig.style?this.icon:"previous"===this.direction?"mdi:chevron-left":"mdi:chevron-right";return p` + + `}return u(this,this._embedThumbnailTask,(t=>t?p``:p``),{inProgressFunc:()=>p`
`})}static get styles(){return g("ha-icon-button.button {\n color: var(--secondary-color, white);\n background-color: rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n padding: 0px;\n margin: 3px;\n --ha-icon-display: block;\n /* Buttons can always be clicked */\n pointer-events: auto;\n opacity: 0.9;\n}\n\n@keyframes pulse {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n 100% {\n opacity: 1;\n }\n}\nha-icon[data-domain=alert][data-state=on],\nha-icon[data-domain=automation][data-state=on],\nha-icon[data-domain=binary_sensor][data-state=on],\nha-icon[data-domain=calendar][data-state=on],\nha-icon[data-domain=camera][data-state=streaming],\nha-icon[data-domain=cover][data-state=open],\nha-icon[data-domain=fan][data-state=on],\nha-icon[data-domain=humidifier][data-state=on],\nha-icon[data-domain=light][data-state=on],\nha-icon[data-domain=input_boolean][data-state=on],\nha-icon[data-domain=lock][data-state=unlocked],\nha-icon[data-domain=media_player][data-state=on],\nha-icon[data-domain=media_player][data-state=paused],\nha-icon[data-domain=media_player][data-state=playing],\nha-icon[data-domain=script][data-state=on],\nha-icon[data-domain=sun][data-state=above_horizon],\nha-icon[data-domain=switch][data-state=on],\nha-icon[data-domain=timer][data-state=active],\nha-icon[data-domain=vacuum][data-state=cleaning],\nha-icon[data-domain=group][data-state=on],\nha-icon[data-domain=group][data-state=home],\nha-icon[data-domain=group][data-state=open],\nha-icon[data-domain=group][data-state=locked],\nha-icon[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=pending],\nha-icon[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon[data-domain=plant][data-state=problem],\nha-icon[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\nha-icon-button[data-domain=alert][data-state=on],\nha-icon-button[data-domain=automation][data-state=on],\nha-icon-button[data-domain=binary_sensor][data-state=on],\nha-icon-button[data-domain=calendar][data-state=on],\nha-icon-button[data-domain=camera][data-state=streaming],\nha-icon-button[data-domain=cover][data-state=open],\nha-icon-button[data-domain=fan][data-state=on],\nha-icon-button[data-domain=humidifier][data-state=on],\nha-icon-button[data-domain=light][data-state=on],\nha-icon-button[data-domain=input_boolean][data-state=on],\nha-icon-button[data-domain=lock][data-state=unlocked],\nha-icon-button[data-domain=media_player][data-state=on],\nha-icon-button[data-domain=media_player][data-state=paused],\nha-icon-button[data-domain=media_player][data-state=playing],\nha-icon-button[data-domain=script][data-state=on],\nha-icon-button[data-domain=sun][data-state=above_horizon],\nha-icon-button[data-domain=switch][data-state=on],\nha-icon-button[data-domain=timer][data-state=active],\nha-icon-button[data-domain=vacuum][data-state=cleaning],\nha-icon-button[data-domain=group][data-state=on],\nha-icon-button[data-domain=group][data-state=home],\nha-icon-button[data-domain=group][data-state=open],\nha-icon-button[data-domain=group][data-state=locked],\nha-icon-button[data-domain=group][data-state=problem] {\n color: var(--paper-item-icon-active-color, #fdd835);\n}\n\nha-icon-button[data-domain=climate][data-state=cooling] {\n color: var(--cool-color, var(--state-climate-cool-color));\n}\n\nha-icon-button[data-domain=climate][data-state=heating] {\n color: var(--heat-color, var(--state-climate-heat-color));\n}\n\nha-icon-button[data-domain=climate][data-state=drying] {\n color: var(--dry-color, var(--state-climate-dry-color));\n}\n\nha-icon-button[data-domain=alarm_control_panel] {\n color: var(--alarm-color-armed, var(--label-badge-red));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=disarmed] {\n color: var(--alarm-color-disarmed, var(--label-badge-green));\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=pending],\nha-icon-button[data-domain=alarm_control_panel][data-state=arming] {\n color: var(--alarm-color-pending, var(--label-badge-yellow));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=alarm_control_panel][data-state=triggered] {\n color: var(--alarm-color-triggered, var(--label-badge-red));\n animation: pulse 1s infinite;\n}\n\nha-icon-button[data-domain=plant][data-state=problem],\nha-icon-button[data-domain=zwave][data-state=dead] {\n color: var(--state-icon-error-color);\n}\n\n/* Color the icon if unavailable */\nha-icon-button[data-state=unavailable] {\n color: var(--state-unavailable-color);\n}\n\n:host {\n --frigate-card-next-prev-size: 48px;\n --frigate-card-next-prev-size-hover: calc(var(--frigate-card-next-prev-size) * 2);\n --frigate-card-prev-position: 45px;\n --frigate-card-next-position: 45px;\n --mdc-icon-button-size: var(--frigate-card-next-prev-size);\n --mdc-icon-size: calc(var(--mdc-icon-button-size) / 2);\n}\n\n.controls {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n}\n\n.controls.previous {\n left: var(--frigate-card-prev-position);\n}\n\n.controls.next {\n right: var(--frigate-card-next-position);\n}\n\n.controls.icons {\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n}\n\n.controls.thumbnails {\n border-radius: 50%;\n height: var(--frigate-card-next-prev-size);\n top: calc(50% - var(--frigate-card-next-prev-size) / 2);\n box-shadow: var(--frigate-card-css-box-shadow, 0px 0px 20px 5px black);\n transition: all 0.2s ease-out;\n opacity: 0.8;\n aspect-ratio: 1/1;\n}\n\n.controls.thumbnails:hover {\n opacity: 1 !important;\n height: var(--frigate-card-next-prev-size-hover);\n top: calc(50% - var(--frigate-card-next-prev-size-hover) / 2);\n}\n\n.controls.previous.thumbnails:hover {\n left: calc(var(--frigate-card-prev-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}\n\n.controls.next.thumbnails:hover {\n right: calc(var(--frigate-card-next-position) - (var(--frigate-card-next-prev-size-hover) - var(--frigate-card-next-prev-size)) / 2);\n}")}};r([s({attribute:!1})],$.prototype,"direction",void 0),r([s({attribute:!1})],$.prototype,"hass",void 0),r([c()],$.prototype,"_controlConfig",void 0),r([s({attribute:!1})],$.prototype,"thumbnail",void 0),r([s({attribute:!1})],$.prototype,"icon",void 0),r([s({attribute:!0,type:Boolean})],$.prototype,"disabled",void 0),r([s()],$.prototype,"label",void 0),$=r([d("frigate-card-next-previous-control")],$);class P{constructor(t){this._config=null,this._hass=null,this._cameraManager=null,this._cameraID=null,this._host=t}setConfig(t){this._config=t??null,this._host.setAttribute("data-orientation",t?.orientation??"horizontal"),this._host.setAttribute("data-position",t?.position??"bottom-right"),this._host.setAttribute("style",Object.entries(t?.style??{}).map((([t,a])=>`${t}:${a}`)).join(";"))}getConfig(){return this._config}setCamera(t,a){this._cameraManager=t??null,this._cameraID=a??null}setForceVisibility(t){this._forceVisibility=t}handleAction(t,a){t.stopPropagation();const n=t.detail.action,i=_(n,a);i&&f(this._host,{action:i,...a&&{config:a}})}hasUsefulAction(){const t={pt:!0,z:!0,home:!0};if(!this._cameraID)return t;const a=this._cameraManager?.getCameraCapabilities(this._cameraID);if(!a||!a.hasPTZCapability())return t;const n=a.getPTZCapabilities();return{pt:!!(n?.up||n?.down||n?.left||n?.right),z:!!n?.zoomIn||!!n?.zoomOut,home:!!n?.presets?.length}}shouldDisplay(){return void 0!==this._forceVisibility?this._forceVisibility:"auto"===this._config?.mode?!!this._cameraID&&!!this._cameraManager?.getCameraCapabilities(this._cameraID)?.hasPTZCapability():"on"===this._config?.mode}getPTZActions(){const t=t=>({start_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"start",ptzPreset:t?.preset}),end_tap_action:v({ptzAction:t?.ptzAction,ptzPhase:"stop",ptzPreset:t?.preset})}),a={};return a.up=t({ptzAction:"up"}),a.down=t({ptzAction:"down"}),a.left=t({ptzAction:"left"}),a.right=t({ptzAction:"right"}),a.zoom_in=t({ptzAction:"zoom_in"}),a.zoom_out=t({ptzAction:"zoom_out"}),a.home={tap_action:v()},a}}let k=class extends l{constructor(){super(...arguments),this._controller=new P(this),this._actions=this._controller.getPTZActions(),this._actionPresence=null}willUpdate(t){t.has("config")&&this._controller.setConfig(this.config),(t.has("cameraManager")||t.has("cameraID"))&&this._controller.setCamera(this.cameraManager,this.cameraID),t.has("forceVisibility")&&this._controller.setForceVisibility(this.forceVisibility),(t.has("cameraID")||t.has("cameraManager"))&&(this._actionPresence=this._controller.hasUsefulAction())}render(){if(!this._controller.shouldDisplay())return;const t=(t,a,n)=>n?p`this._controller.handleAction(t,n)} + >`:p``,a=this._controller.getConfig();return p`
+ ${!a?.hide_pan_tilt&&this._actionPresence?.pt?p`
+ ${t("right","mdi:arrow-right",this._actions.right)} + ${t("left","mdi:arrow-left",this._actions.left)} + ${t("up","mdi:arrow-up",this._actions.up)} + ${t("down","mdi:arrow-down",this._actions.down)} +
`:""} + ${!a?.hide_zoom&&this._actionPresence?.z?p`
+ ${t("zoom_in","mdi:plus",this._actions.zoom_in)} + ${t("zoom_out","mdi:minus",this._actions.zoom_out)} +
`:p``} + ${!a?.hide_home&&this._actionPresence?.home?p`
+ ${t("home","mdi:home",this._actions.home)} +
`:p``} +
`}static get styles(){return g(":host {\n position: absolute;\n width: fit-content;\n height: fit-content;\n --frigate-card-ptz-icon-size: 24px;\n}\n\n:host([data-position$=-left]) {\n left: 5%;\n}\n\n:host([data-position$=-right]) {\n right: 5%;\n}\n\n:host([data-position^=top-]) {\n top: 5%;\n}\n\n:host([data-position^=bottom-]) {\n bottom: 5%;\n}\n\n/*****************\n * Main Containers\n *****************/\n.ptz {\n display: flex;\n gap: 10px;\n color: var(--light-primary-color);\n opacity: 0.4;\n transition: opacity 0.3s ease-in-out;\n}\n\n:host([data-orientation=vertical]) .ptz {\n flex-direction: column;\n}\n\n:host([data-orientation=horizontal]) .ptz {\n flex-direction: row;\n}\n\n.ptz:hover {\n opacity: 1;\n}\n\n:host([data-orientation=vertical]) .ptz div {\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n:host([data-orientation=horizontal]) .ptz div {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n}\n\n.ptz-move,\n.ptz-zoom,\n.ptz-home {\n position: relative;\n background-color: rgba(0, 0, 0, 0.3);\n}\n\n.ptz-move {\n height: calc(var(--frigate-card-ptz-icon-size) * 3);\n width: calc(var(--frigate-card-ptz-icon-size) * 3);\n border-radius: 50%;\n}\n\n:host([data-orientation=horizontal]) .ptz .ptz-zoom,\n:host([data-orientation=horizontal]) .ptz .ptz-home {\n width: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n:host([data-orientation=vertical]) .ptz .ptz-zoom,\n:host([data-orientation=vertical]) .ptz .ptz-home {\n height: calc(var(--frigate-card-ptz-icon-size) * 1.5);\n}\n\n.ptz-zoom,\n.ptz-home {\n border-radius: var(--ha-card-border-radius, 4px);\n}\n\n/***********\n * PTZ Icons\n ***********/\nha-icon {\n position: absolute;\n --mdc-icon-size: var(--frigate-card-ptz-icon-size);\n}\n\nha-icon:not(.disabled) {\n cursor: pointer;\n}\n\n.disabled {\n color: var(--disabled-text-color);\n}\n\n.up {\n top: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.down {\n bottom: 5px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.left {\n left: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.right {\n right: 5px;\n top: 50%;\n transform: translateY(-50%);\n}\n\n:host([data-orientation=vertical]) .zoom_in {\n right: 5px;\n top: 50%;\n}\n\n:host([data-orientation=vertical]) .zoom_out {\n left: 5px;\n top: 50%;\n}\n\n:host([data-orientation=horizontal]) .zoom_in {\n left: 50%;\n top: 5px;\n}\n\n:host([data-orientation=horizontal]) .zoom_out {\n left: 50%;\n bottom: 5px;\n}\n\n:host([data-orientation=vertical]) .zoom_in,\n:host([data-orientation=vertical]) .zoom_out {\n transform: translateY(-50%);\n}\n\n:host([data-orientation=horizontal]) .zoom_in,\n:host([data-orientation=horizontal]) .zoom_out {\n transform: translateX(-50%);\n}\n\n.home {\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}")}};r([s({attribute:!1})],k.prototype,"config",void 0),r([s({attribute:!1})],k.prototype,"cameraManager",void 0),r([s({attribute:!1})],k.prototype,"cameraID",void 0),r([s({attribute:!1})],k.prototype,"forceVisibility",void 0),k=r([d("frigate-card-ptz")],k);const M=(t,a)=>{void 0!==a?.fit?t.style.setProperty("--frigate-card-media-layout-fit",a.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const n of["x","y"])void 0!==a?.position?.[n]?t.style.setProperty(`--frigate-card-media-layout-position-${n}`,`${a.position[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${n}`);for(const n of["top","bottom","left","right"])void 0!==a?.view_box?.[n]?t.style.setProperty(`--frigate-card-media-layout-view-box-${n}`,`${a.view_box[n]}%`):t.style.removeProperty(`--frigate-card-media-layout-view-box-${n}`)},E=2,H=(t,a)=>{t._controlsHideTimer&&(t._controlsHideTimer.stop(),delete t._controlsHideTimer,delete t._controlsOriginalValue),t.controls=a},O=(t,a=1)=>{const n=t._controlsOriginalValue??t.controls;H(t,!1),t._controlsHideTimer??=new i,t._controlsOriginalValue=n;const o=()=>{H(t,n),t.removeEventListener("loadstart",o)};t.addEventListener("loadstart",o),t._controlsHideTimer.start(a,(()=>{H(t,n)}))},R=async(t,a)=>{if(a?.play)try{await a.play()}catch(n){if("NotAllowedError"===n.name&&!t.isMuted()){await t.mute();try{await a.play()}catch(t){}}}};export{A,x as M,L as a,T as b,E as c,O as h,C as i,R as p,H as s,M as u}; diff --git a/www/community/frigate-hass-card/media-aef44451.js.gz b/www/community/frigate-hass-card/media-aef44451.js.gz new file mode 100644 index 00000000..b29847aa Binary files /dev/null and b/www/community/frigate-hass-card/media-aef44451.js.gz differ diff --git a/www/community/frigate-hass-card/media-c9012082.js b/www/community/frigate-hass-card/media-c9012082.js new file mode 100644 index 00000000..45e63029 --- /dev/null +++ b/www/community/frigate-hass-card/media-c9012082.js @@ -0,0 +1 @@ +var e;!function(e){e.MP4="mp4",e.HLS="hls"}(e||(e={}));class t{constructor(e,t){this._mediaType=e,this._cameraID=t}getCameraID(){return this._cameraID}getMediaType(){return this._mediaType}getVideoContentType(){return null}getID(){return null}getStartTime(){return null}getEndTime(){return null}getUsableEndTime(){return this.getEndTime()??(this.inProgress()?new Date:this.getStartTime())}inProgress(){return null}getContentID(){return null}getTitle(){return null}getThumbnail(){return null}isFavorite(){return null}includesTime(e){const t=this.getStartTime(),r=this.getUsableEndTime();return!!t&&!!r&&e>=t&&e<=r}setFavorite(e){}getWhere(){return null}}export{e as V,t as a}; diff --git a/www/community/frigate-hass-card/media-c9012082.js.gz b/www/community/frigate-hass-card/media-c9012082.js.gz new file mode 100644 index 00000000..77c10b92 Binary files /dev/null and b/www/community/frigate-hass-card/media-c9012082.js.gz differ diff --git a/www/community/frigate-hass-card/media-grid-0f7352bc.js b/www/community/frigate-hass-card/media-grid-0f7352bc.js new file mode 100644 index 00000000..69a2913d --- /dev/null +++ b/www/community/frigate-hass-card/media-grid-0f7352bc.js @@ -0,0 +1,22 @@ +import{dN as t,dM as e,dh as i,eE as n,i as o,dg as s,cP as r,cS as a,s as h,_ as l,n as d,t as u,a as c,cR as f,x as m,cV as p,r as g}from"./card-45855f1f.js";var v,y={exports:{}},_={exports:{}},b={exports:{}};function C(){return v||(v=1,e=b,i="undefined"!=typeof window?window:t,n=function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;o
"+o+"":f.test(r)?'"+o+"":p.test(r)?''+r+"":m.test(r)?'"+o+"":t})).join("")},e.wordcount=function(t){var e=(t=o(t,""))?t.match(/\w+/g):null;return e?e.length:null},e.float=function(t,e){var n=parseFloat(t);return s(n)?e:n};var g=r.makeMacro(["value","default","base"],[],(function(t,e,n){void 0===n&&(n=10);var i=parseInt(t,n);return s(i)?e:i}));e.int=g,e.d=e.default,e.e=e.escape},function(t,e,n){"use strict";function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var r=function(t){var e,n;function r(e){var n;return(n=t.call(this)||this).precompiled=e||{},n}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,i(e,n),r.prototype.getSource=function(t){return this.precompiled[t]?{src:{type:"code",obj:this.precompiled[t]},path:t}:null},r}(n(6));t.exports={PrecompiledLoader:r}},function(t,e,n){"use strict";var i=n(2).SafeString;e.callable=function(t){return"function"==typeof t},e.defined=function(t){return void 0!==t},e.divisibleby=function(t,e){return t%e==0},e.escaped=function(t){return t instanceof i},e.equalto=function(t,e){return t===e},e.eq=e.equalto,e.sameas=e.equalto,e.even=function(t){return t%2==0},e.falsy=function(t){return!t},e.ge=function(t,e){return t>=e},e.greaterthan=function(t,e){return t>e},e.gt=e.greaterthan,e.le=function(t,e){return t<=e},e.lessthan=function(t,e){return t0)for(var r=t;re;o+=n)i.push(o);return i},cycler:function(){return t=Array.prototype.slice.call(arguments),e=-1,{current:null,reset:function(){e=-1,this.current=null},next:function(){return++e>=t.length&&(e=0),this.current=t[e],this.current}};var t,e},joiner:function(t){return function(t){t=t||",";var e=!0;return function(){var n=e?"":t;return e=!1,n}}(t)}}}},function(t,e,n){var i=n(4);t.exports=function(t,e){function n(t,e){if(this.name=t,this.path=t,this.defaultEngine=e.defaultEngine,this.ext=i.extname(t),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}return n.prototype.render=function(e,n){t.render(this.name,e,n)},e.set("view",n),e.set("nunjucksEnv",t),t}},function(t,e,n){"use strict";var i=n(4),r=n(4),o=n(0)._prettifyError,s=n(5),a=n(7).Environment,l=n(24);function c(t,e){return!!Array.isArray(e)&&e.some((function(e){return t.match(e)}))}function u(t,e){(e=e||{}).isString=!0;var n=e.env||new a([]),i=e.wrapper||l;if(!e.name)throw new Error('the "name" option is required when compiling a string');return i([h(t,e.name,n)],e)}function h(t,e,n){var i,r=(n=n||new a([])).asyncFilters,l=n.extensionsList;e=e.replace(/\\/g,"/");try{i=s.compile(t,r,l,e,n.opts)}catch(t){throw o(e,!1,t)}return{name:e,template:i}}t.exports={precompile:function(t,e){var n=(e=e||{}).env||new a([]),o=e.wrapper||l;if(e.isString)return u(t,e);var s=i.existsSync(t)&&i.statSync(t),p=[],d=[];if(s.isFile())p.push(h(i.readFileSync(t,"utf-8"),e.name||t,n));else if(s.isDirectory()){!function n(o){i.readdirSync(o).forEach((function(s){var a=r.join(o,s),l=a.substr(r.join(t,"/").length),u=i.statSync(a);u&&u.isDirectory()?c(l+="/",e.exclude)||n(a):c(l,e.include)&&d.push(a)}))}(t);for(var f=0;ft.length||r>0&&s>=i||r<0&&s<=i);s+=r)o.push(n.memberLookup(t,s));return o}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var f={pop:function(t){if(void 0===t)return this.pop();if(t>=this.length||t<0)throw new Error("KeyError");return this.splice(t,1)},append:function(t){return this.push(t)},remove:function(t){for(var e=0;e{"use strict";__webpack_require__.d(__webpack_exports__,{P:()=>BaseCustomFeature});var ha_nunjucks__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(703),lit__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(670),lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(385),_models_constants__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(290),_utils__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(170),__decorate=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};let BaseCustomFeature=class BaseCustomFeature extends lit__WEBPACK_IMPORTED_MODULE_1__.WF{constructor(){super(...arguments),this.value=0,this.getValueFromHass=!0,this.unitOfMeasurement="",this.fireMouseEvent=!0,this.swiping=!1,this.shouldRenderRipple=!0,this.renderRipple=!0,this.rtl=!1}fireHapticEvent(t){if(this.renderTemplate(this.config.haptics)){const e=new Event("haptic",{bubbles:!0,composed:!0});e.detail=t,window.dispatchEvent(e)}}endAction(){clearInterval(this.valueUpdateInterval),this.valueUpdateInterval=void 0,this.buttonPressStart=void 0,this.buttonPressEnd=void 0,this.swiping=!1,this.initialX=void 0,this.initialY=void 0}sendAction(t,e=this.config){let n;switch(t){case"momentary_start_action":n=e.momentary_start_action;break;case"momentary_end_action":n=e.momentary_end_action;break;case"hold_action":n=e.hold_action??e.tap_action;break;case"double_tap_action":n=e.double_tap_action??e.tap_action;break;default:n=e.tap_action}if(n&&=this.deepRenderTemplate(n),n&&this.handleConfirmation(n))try{switch(n.action){case"navigate":this.navigate(n);break;case"url":this.url(n);break;case"assist":this.assist(n);break;case"more-info":this.moreInfo(n);break;case"toggle":this.toggle(n);break;case"call-service":case"perform-action":this.callService(n);break;case"fire-dom-event":this.fireDomEvent(n);break;case"eval":this.eval(n)}}catch(t){throw this.endAction(),t}else this.dispatchEvent(new CustomEvent("confirmation-failed"))}callService(t){const[e,n]=(t.perform_action??t.service).split(".");this.hass.callService(e,n,t.data,t.target)}navigate(t){const e=t.navigation_path??"",n=t.navigation_replace??!1;if(e.includes("//"))return void console.error('Protocol detected in navigation path. To navigate to another website use the action "url" with the key "url_path" instead.');1==n?window.history.replaceState(window.history.state?.root?{root:!0}:null,"",e):window.history.pushState(null,"",e);const i=new Event("location-changed",{bubbles:!1,cancelable:!0,composed:!1});i.detail={replace:1==n},window.dispatchEvent(i)}url(t){let e=t.url_path??"";e.includes("//")||(e=`https://${e}`),window.open(e)}assist(t){this.hass?.auth?.external?.config?.hasAssist?this.hass?.auth?.external?.fireMessage({type:"assist/show",payload:{pipeline_id:t.pipeline_id,start_listening:t.start_listening}}):window.open(`${window.location.href}?conversation=1`,"_self")}moreInfo(t){const e=new Event("hass-more-info",{bubbles:!0,cancelable:!0,composed:!0});e.detail={entityId:t.target?.entity_id},this.dispatchEvent(e)}toggle(t){const e={...t.data,...t.target};if(Array.isArray(e.entity_id))for(const t of e.entity_id)this.toggleSingle(t);else e.entity_id?this.toggleSingle(e.entity_id):this.hass.callService("homeassistant","toggle",e)}toggleSingle(t){const e=["closed","locked","off"].includes(this.hass.states[t].state);let n,i=t.split(".")[0];switch(i){case"lock":n=e?"unlock":"lock";break;case"cover":n=e?"open_cover":"close_cover";break;case"button":case"input_button":n="press";break;case"scene":n="turn_on";break;case"valve":n=e?"open_valve":"close_valve";break;default:i="homeassistant",n=e?"turn_on":"turn_off"}this.hass.callService(i,n,{entity_id:t})}fireDomEvent(t){const e=new Event(t.event_type??"ll-custom",{composed:!0,bubbles:!0});e.detail=t,this.dispatchEvent(e)}eval(action){eval(action.eval??"")}handleConfirmation(t){if(t.confirmation){let e=`Are you sure you want to run action '${t.action}'?`;return 1==t.confirmation?(this.fireHapticEvent("warning"),confirm(e)):(t.confirmation?.text&&(e=t.confirmation.text),!!t.confirmation?.exemptions?.map((t=>t.user)).includes(this.hass.user?.id)||(this.fireHapticEvent("warning"),confirm(e)))}return!0}firstUpdated(){this.addEventListener("confirmation-failed",this.confirmationFailed)}confirmationFailed(){clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!0,this.requestUpdate()}setValue(){if(this.entityId=this.renderTemplate(this.config.entity_id),this.unitOfMeasurement=this.renderTemplate(this.config.unit_of_measurement)??"",this.getValueFromHass&&this.entityId)if(clearInterval(this.valueUpdateInterval),this.valueUpdateInterval=void 0,this.valueAttribute=this.renderTemplate(this.config.value_attribute??"state").toLowerCase(),this.hass.states[this.entityId])if("state"==this.valueAttribute)this.value=this.hass.states[this.entityId].state;else{let t;const e=this.valueAttribute.match(/\[\d+\]$/);if(e){const n=parseInt(e[0].replace(/\[|\]/g,""));this.valueAttribute=this.valueAttribute.replace(e[0],""),t=this.hass.states[this.entityId].attributes[this.valueAttribute],t=t&&Array.isArray(t)&&t.length?t[n]:void 0}else t=this.hass.states[this.entityId].attributes[this.valueAttribute];if(null!=t||"elapsed"==this.valueAttribute)switch(this.valueAttribute){case"brightness":this.value=Math.round(100*parseInt(t??0)/255);break;case"media_position":try{const e=()=>{"playing"==this.hass.states[this.entityId].state?this.value=Math.min(Math.floor(Math.floor(t)+(Date.now()-Date.parse(this.hass.states[this.entityId].attributes.media_position_updated_at))/1e3),Math.floor(this.hass.states[this.entityId].attributes.media_duration)):this.value=t};e(),this.valueUpdateInterval=setInterval(e,500)}catch(e){console.error(e),this.value=t}break;case"elapsed":if(this.entityId.startsWith("timer.")){if("idle"==this.hass.states[this.entityId].state)this.value=0;else{const t=this.hass.states[this.entityId].attributes.duration.split(":"),e=3600*parseInt(t[0])+60*parseInt(t[1])+parseInt(t[2]),n=Date.parse(this.hass.states[this.entityId].attributes.finishes_at);try{const t=()=>{if("active"==this.hass.states[this.entityId].state){const t=(n-Date.now())/1e3,i=Math.floor(e-t);this.value=Math.min(i,e)}else{const t=this.hass.states[this.entityId].attributes.remaining.split(":"),n=3600*parseInt(t[0])+60*parseInt(t[1])+parseInt(t[2]);this.value=Math.floor(e-n)}};t(),this.valueUpdateInterval=setInterval(t,500)}catch(t){console.error(t),this.value=0}}break}default:this.value=t}else this.value=t}else this.value=void 0}renderTemplate(t,e){let n=0;this.buttonPressStart&&this.buttonPressEnd&&(n=(this.buttonPressEnd-this.buttonPressStart)/1e3),e={VALUE:this.value,HOLD_SECS:n,UNIT:this.unitOfMeasurement,value:this.value,hold_secs:n,unit:this.unitOfMeasurement,config:{...this.config,entity:this.entityId,attribute:this.valueAttribute},stateObj:this.stateObj,...e};let i=(e={render:t=>this.renderTemplate(t,e),...e}).value;null!=i&&"number"==typeof i&&null!=this.precision&&(i=Number(i).toFixed(this.precision),e={...e,VALUE:i,value:i});const r=(0,ha_nunjucks__WEBPACK_IMPORTED_MODULE_0__.X)(this.hass,t,e);if(r!=t)return r;if("string"==typeof t)for(const n of["VALUE","HOLD_SECS","UNIT"]){if(t==n)return e[n];t.includes(n)&&(t=t.replace(new RegExp(n,"g"),e[n]??""))}return t}deepRenderTemplate(t,e){const n=structuredClone(t),i=(0,_utils__WEBPACK_IMPORTED_MODULE_3__.b$)(n);for(const t of i)(0,_utils__WEBPACK_IMPORTED_MODULE_3__.HD)(n,t,this.renderTemplate((0,_utils__WEBPACK_IMPORTED_MODULE_3__.vz)(n,t),e));return n}resetGetValueFromHass(){const t=this.renderTemplate(this.config.value_from_hass_delay??_models_constants__WEBPACK_IMPORTED_MODULE_4__.s$);this.getValueFromHassTimer=setTimeout((()=>{this.getValueFromHass=!0,this.requestUpdate()}),t)}toggleRipple(){clearTimeout(this.renderRippleOff),clearTimeout(this.renderRippleOn),this.renderRippleOff=setTimeout((()=>this.renderRipple=!1),2e3),this.renderRippleOn=setTimeout((()=>this.renderRipple=!0),2500)}buildRipple(){return this.shouldRenderRipple&&this.renderRipple?lit__WEBPACK_IMPORTED_MODULE_1__.qy``:lit__WEBPACK_IMPORTED_MODULE_1__.qy``}buildStyles(t=this.config,e){return t.styles?lit__WEBPACK_IMPORTED_MODULE_1__.qy``:""}buildBackground(){return lit__WEBPACK_IMPORTED_MODULE_1__.qy`
`}buildIcon(t=this.config,e){let n=lit__WEBPACK_IMPORTED_MODULE_1__.qy``;return t.icon&&(n=lit__WEBPACK_IMPORTED_MODULE_1__.qy``),n}buildLabel(t=this.config,e){if(t.label){const n=this.renderTemplate(t.label,e);if(n)return lit__WEBPACK_IMPORTED_MODULE_1__.qy`
${n}
`}return""}onStart(t){}onEnd(t){}onMove(t){}onMouseDown(t){this.fireMouseEvent&&this.onStart(t)}onMouseUp(t){this.fireMouseEvent&&this.onEnd(t),this.fireMouseEvent=!0}onMouseMove(t){this.fireMouseEvent&&this.onMove(t)}onTouchStart(t){this.fireMouseEvent=!1,this.onStart(t)}onTouchEnd(t){this.fireMouseEvent=!1,this.onEnd(t)}onTouchMove(t){this.fireMouseEvent=!1,this.onMove(t)}onContextMenu(t){if(!this.fireMouseEvent)return t.preventDefault(),t.stopPropagation(),!1}static get styles(){return lit__WEBPACK_IMPORTED_MODULE_1__.AH`:host{display:flex;flex-flow:column;place-content:center space-evenly;align-items:center;position:relative;height:var(--feature-height,40px);width:100%;border:none;border-radius:var(--feature-border-radius,12px);padding:0;box-sizing:border-box;outline:0;overflow:hidden;font-size:inherit;color:inherit;flex-basis:100%;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent}.container{all:inherit;overflow:hidden;height:100%}.background{position:absolute;width:inherit;height:var(--background-height,100%);background:var(--background,var(--color,var(--disabled-color)));opacity:var(--background-opacity,.2)}.icon{position:relative;pointer-events:none;display:inline-flex;flex-flow:column;place-content:center;color:var(--icon-color,inherit);filter:var(--icon-filter, inherit)}.label{position:relative;pointer-events:none;display:inline-flex;justify-content:center;align-items:center;height:15px;line-height:15px;width:inherit;margin:0;font-family:inherit;font-size:12px;font-weight:700;color:var(--label-color,inherit);filter:var(--label-filter, none)}`}};__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.MZ)()],BaseCustomFeature.prototype,"hass",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.MZ)()],BaseCustomFeature.prototype,"config",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.MZ)()],BaseCustomFeature.prototype,"stateObj",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.wk)()],BaseCustomFeature.prototype,"value",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.MZ)()],BaseCustomFeature.prototype,"shouldRenderRipple",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.wk)()],BaseCustomFeature.prototype,"renderRipple",void 0),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.Ls)({passive:!0})],BaseCustomFeature.prototype,"onMouseDown",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.Ls)({passive:!0})],BaseCustomFeature.prototype,"onMouseMove",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.Ls)({passive:!0})],BaseCustomFeature.prototype,"onTouchStart",null),__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.Ls)({passive:!0})],BaseCustomFeature.prototype,"onTouchMove",null),BaseCustomFeature=__decorate([(0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_2__.EM)("base-custom-feature")],BaseCustomFeature)},290:(t,e,n)=>{"use strict";n.d(e,{$6:()=>s,At:()=>r,HB:()=>d,RZ:()=>p,Xy:()=>a,a3:()=>o,bQ:()=>f,hI:()=>u,jc:()=>i,s$:()=>c,uT:()=>l,zM:()=>h});const i=200,r=500,o=100,s=!0,a=!1,l=1e3,c=1e3,u=1,h=100,p=1,d=0,f=100},170:(t,e,n)=>{"use strict";function i(t){let e=[];for(const n in t)if("object"==typeof t[n]){const r=i(t[n]);e=e.concat(r.map((t=>n+"."+t)))}else e.push(n);return e}function r(t,e){const n=e.split(".");if(null!=t)return 1==n.length?t[n[0]]:r(t[n[0]],n.splice(1).join("."))}function o(t,e,n){const i=e.split(".");return 1==i.length?t[i[0]]=n:(i[0]in t&&"object"==typeof t[i[0]]||(/^-?\d+$/.test(i[1])?t[i[0]]=new Array(parseInt(i[1])):t[i[0]]={}),o(t[i[0]],i.splice(1).join("."),n)),t}n.d(e,{HD:()=>o,b$:()=>i,vz:()=>r})},1:(t,e,n)=>{"use strict";n.d(e,{mN:()=>T,AH:()=>l,W3:()=>x,Ec:()=>E});const i=globalThis,r=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;class a{constructor(t,e,n){if(this._$cssResult$=!0,n!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&s.set(e,t))}return t}toString(){return this.cssText}}const l=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[i+1]),t[0]);return new a(n,t,o)},c=(t,e)=>{if(r)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),r=i.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=n.cssText,t.appendChild(e)}},u=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,o))(e)})(t):t,{is:h,defineProperty:p,getOwnPropertyDescriptor:d,getOwnPropertyNames:f,getOwnPropertySymbols:m,getPrototypeOf:g}=Object,y=globalThis,v=y.trustedTypes,b=v?v.emptyScript:"",_=y.reactiveElementPolyfillSupport,w=(t,e)=>t,x={toAttribute(t,e){switch(e){case Boolean:t=t?b:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},E=(t,e)=>!h(t,e),k={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:E};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class T extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=k){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(t,n,e);void 0!==i&&p(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){const{get:i,set:r}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return i?.call(this)},set(e){const o=i?.call(this);r.call(this,e),this.requestUpdate(t,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??k}static _$Ei(){if(this.hasOwnProperty(w("elementProperties")))return;const t=g(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(w("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(w("properties"))){const t=this.properties,e=[...f(t),...m(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return c(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$EC(t,e){const n=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:x).toAttribute(e,n.type);this._$Em=t,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const n=this.constructor,i=n._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=n.getPropertyOptions(i),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:x;this._$Em=i,this[i]=r.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){if(n??=this.constructor.getPropertyOptions(t),!(n.hasChanged??E)(this[t],e))return;this.P(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,n){this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t)!0!==n.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],n)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[w("elementProperties")]=new Map,T[w("finalized")]=new Map,_?.({ReactiveElement:T}),(y.reactiveElementVersions??=[]).push("2.0.4")},703:(t,e,n)=>{"use strict";n.d(e,{o:()=>Ln,X:()=>Nn});var i=n(894);function r(t,e){try{if(e){if(t.entities[e]){if(t.entities[e].area_id)return t.entities[e].area_id;e=t.entities[e].device_id??e}if(t.devices[e])return t.devices[e].area_id;for(const n in t.areas)if(t.areas[n].name==e)return n}return}catch{return}}function o(t,e){try{if(e){let n=e;if(t.entities[e]&&(n=t.entities[e].area_id??n,e=t.entities[e].device_id??e),t.devices[e]&&(n=t.devices[e].area_id??n),t.areas[n])return t.areas[n].name}return}catch{return}}function s(t,e){try{const n=[];if(e){const i=a(t,e);for(const e of i)for(const i in t.entities)t.entities[i].device_id==e&&n.push(i);n.sort()}return n}catch{return[]}}function a(t,e){try{const n=[];if(e){if(!(e in t.areas))for(const n in t.areas)if(t.areas[n].name==e){e=n;break}for(const i in t.devices)t.devices[i].area_id==e&&n.push(i);n.sort()}return n}catch{return[]}}function l(t,e){return!!Array.isArray(t)&&t?.includes(e)}function c(t,e,n,i){"object"!=typeof n||Array.isArray(n)||(i=n.with_unit??i,n=n.rounded??void 0);try{const r=t.states[e];let o=r?.state;if(i&&null==n&&(n=!0),n&&!isNaN(r?.state)){const n=t.entities[e]?.display_precision??0;o=Number(o).toPrecision(n)}return i&&r?.attributes?.unit_of_measurement&&(o=`${o} ${r?.attributes?.unit_of_measurement}`),o}catch{return}}function u(t,e,n){try{return t.states[e].attributes[n]}catch{return}}function h(t,e){try{const n=c(t,e);return!![!1,0,-0,""].includes(n)||Boolean(n)}catch{return!1}}function p(t){const e={};for(const n in t.states){const[i,r]=n.split(".");e[i]=e[i]??{},e[i][r]=t.states[n]}return e}function d(t,e){try{const n=[];if(e)for(const i in t.entities)t.entities[i].device_id==e&&n.push(i);return n}catch{return[]}}function f(t,e,n){try{return t.devices[e]?.[n]??u(t,e,n)}catch{return}}function m(t,e){try{if(e){if(t.entities[e])return t.entities[e].device_id;for(const n in t.devices){const i=t.devices[n];if(i.name==e||i.name_by_user==e)return n}}return}catch{return}}function g(t,e,n=!1){if(t[0]==e[0]&&t[1]==e[1])return 0;const i=1/298.257223563,r=6356752.314245,o=Math.atan((1-i)*Math.tan(t[0]*Math.PI/180)),s=Math.atan((1-i)*Math.tan(e[0]*Math.PI/180));let a=(e[1]-t[1])*Math.PI/180,l=a;const c=Math.sin(o),u=Math.cos(o),h=Math.sin(s),p=Math.cos(s);let d=0,f=0,m=0,g=0,y=0;for(let t=0;t<200;t++){const e=Math.sin(l),n=Math.cos(l);if(f=Math.sqrt((p*e)**2+(u*h-c*p*n)**2),0==f)return 0;g=c*h+u*p*n,y=Math.atan2(f,g);const r=u*p*e/f;d=1-r**2,m=0!=d?g-2*c*h/d:0;const o=i/16*d*(4+i*(4-3*d)),s=l;if(l=a+(1-o)*i*r*(y+o*f*(m+o*g*(2*m**2-1))),Math.abs(l-s)<1e-12)break;if(199==t)return null}const v=272331606109.84375*d/r**2,b=v/1024*(256+v*(v*(74-47*v)-128));let _=r*(1+v/16384*(4096+v*(v*(320-175*v)-768)))*(y-b*f*(m+b/4*(g*(2*m**2-1)-b/6*m*(4*f**2-3)*(4*m**2-3))))/1e3;return n&&(_*=.621371),_}function y(t,...e){function n(e){if(e.startsWith("zone."))return t.states[e].attributes.persons??[];let n=Object.keys(t.states).filter((t=>t==e||t.split(".")[0]==e));if("zone"==e){let e=[];for(const i of n)e.push(...t.states[i].attributes.persons??[]);n=Array.from(new Set(e))}return n}let i,r;if(1==e.length)i=[t.states["zone.home"].attributes.latitude,t.states["zone.home"].attributes.longitude],r=0;else if("number"==typeof e[0]){if("number"!=typeof e[1]||2==e.length)return null;i=[e[0],e[1]],r=2}else if("object"==typeof e[0]){if(Array.isArray(e[0])||!e[0].attributes)return null;i=[e[0].attributes.latitude,e[0].attributes.longitude],r=1}else{if("string"!=typeof e[0])return null;i=[t.states[e[0]].attributes.latitude,t.states[e[0]].attributes.longitude],r=1}let o=[];for(let t=r;te[t][n].entity_id));else for(const r of n)i.push(...Object.keys(e[t][r]).map((n=>e[t][r][n].entity_id)))}for(const t of i)o.push(...n(t))}else"string"==typeof e[t]&&o.push(...n(e[t]));o=Array.from(new Set(o));let s=null,a=1/0;for(const e of o){let n;n="string"==typeof e?t.states[e]:e;const r=n.attributes.latitude,o=n.attributes.longitude;if(null!=r&&null!=o){const t=g(i,[r,o])??1/0;t<=a&&(s=n,a=t)}}return s}function v(t,e){try{let n=e;if(t.entities[e]&&(n=t.entities[e].area_id??n,e=t.entities[e].device_id??e),e){if(t.devices[e]&&(n=t.devices[e].area_id??n),t.areas[n])return t.areas[n].floor_id;for(const n in t.areas)if(t.areas[n].name==e)return t.areas[n].floor_id}return}catch{return}}function b(t,e){if(t.floors[e])return t.floors[e].name;const n=v(t,e);return n?t.floors[n].name:void 0}function _(t,e){try{const n=[];if(e){let i;if(t.floors[e])i=e;else for(const n in t.floors)if(t.floors[n].name==e){i=n;break}if(!i)return[];for(const e in t.areas)t.areas[e].floor_id==i&&n.push(e)}return n}catch{return[]}}function w(t,...e){const n=[];for(let i of e.flat(1/0))if("string"==typeof i&&(i=t.states[i]),i)if(Array.isArray(i.attributes?.entity_id))n.push(...w(t,...i.attributes?.entity_id));else if(i?.attributes?.persons)n.push(...w(t,...i.attributes.persons));else if(i.entity_id)n.push(i);else{const e=Object.values(i);if(e[0]?.entity_id)n.push(...e);else for(const i of e){const e=Object.values(i);for(const i of e)i?.attributes?.persons?n.push(...w(t,...i.attributes.persons)):n.push(i)}}return n.filter(((t,e,n)=>e==n.findIndex((e=>e.entity_id==t.entity_id)))).sort(((t,e)=>t.entity_id.localeCompare(e.entity_id)))}function x(t,e,n,i,r){if("object"!=typeof n||Array.isArray(n)||(r=n.if_none??r,i=n.if_false??i,n=n.if_true??void 0),r){const n=Nn(t,e);if([void 0,null,"undefined","null","None"].includes(n))return r}return Nn(t,`\n\t\t{% if ${e} %}\n\t\t${n??!0}\n\t\t{% else %}\n\t\t${i??!1}\n\t\t{% endif %}\n\t`)}const E={};function k(t,e){try{return e?t.entities[e]?.labels??t.devices[e]?.labels??t.areas[e]?.labels??[]:Object.keys(E)}catch{return[]}}function T(t){for(const e in E)if(E[e].name==t)return e}function A(t){return E[t]?.name}function O(t,e){try{const n=[];let i;if(e){if(i=E[e]?e:T(e),!i)return[];for(const e in t.areas)(t.areas[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function S(t,e){try{const n=[];if(e){let i;if(i=E[e]?e:T(e),!i)return[];for(const e in t.devices)(t.devices[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function C(t,e){try{const n=[];if(e){let i;if(i=E[e]?e:T(e),!i)return[];for(const e in t.entities)(t.entities[e].labels??[]).includes(i)&&n.push(e);n.sort()}return n}catch{return[]}}function $(t){return t.toString()}function M(t){if(t.toString().includes("NaN"))throw Error("Result returned NaN.")}function L(t){return t!=1/0&&!isNaN(t)}function I(t,e){if("number"==typeof t)return 0!=t;if("boolean"==typeof t)return t;if(t=t.toLowerCase(),["true","yes","on","enable","1"].includes(t))return!0;if(["false","no","off","disable","0"].includes(t))return!1;if(e)return e;throw Error("Invalid input")}function N(t,e=Math.E,n){try{const n=Math.log(t)/Math.log(e);return M(n.toString()),n}catch(t){if(n)return n;throw t}}function j(t,e){try{const e=Math.sin(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function F(t,e){try{const e=Math.cos(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function P(t,e){try{const e=Math.tan(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function D(t,e){try{const e=Math.asin(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function R(t,e){try{const e=Math.acos(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function U(t,e){try{const e=Math.atan(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function B(t,e,n){try{const n=Math.atan2(t,e);return M(n.toString()),n}catch(t){if(n)return n;throw t}}function H(t,e){try{const e=Math.sqrt(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}}function V(...t){return Math.max(...t.flat(1/0))}function K(...t){return Math.min(...t.flat(1/0))}function q(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");return t.reduce(((t,e)=>t+e))/t.length}catch(t){if(e)return e;throw t}}function Y(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");if(!t.length)throw Error("Empty array provided");t=t.sort(((t,e)=>t-e));const e=Math.floor(t.length/2);return t.length%2?t[e]:(t[e-1]+t[e])/2}catch(t){if(e)return e;throw t}}function W(t,e){try{if((t=t.flat(1/0)).some((t=>isNaN(t))))throw Error("Non-numeric values provided");if(!t.length)throw Error("Empty array provided");const e={};for(const n of t)e[n]||(e[n]=0),e[n]++;let n=t[0],i=0;for(const t in e)e[t]>i&&(n=Number(t),i=e[t]);return n}catch(t){if(e)return e;throw t}}const z=Math.E,G=Math.PI,X=2*Math.PI;function Z(t,e,n){try{return t.formatEntityState(t.states[e],n)}catch{return n??t.states[e]?.state??void 0}}function J(t,e,n){try{return t.formatEntityAttributeName(t.states[e],n)}catch{return n??t.states[e]?.attributes?.[n]??void 0}}function Q(t,e,n,i){try{return t.formatEntityAttributeValue(t.states[e],n,i)}catch{return i??t.states[e]?.attributes?.[n]??void 0}}const tt=new Date,et=new Date;function nt(t,e,n,i){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=e=>(t(e=new Date(+e)),e),r.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),r.round=t=>{const e=r(t),n=r.ceil(t);return t-e(e(t=new Date(+t),null==n?1:Math.floor(n)),t),r.range=(n,i,o)=>{const s=[];if(n=r.ceil(n),o=null==o?1:Math.floor(o),!(n0))return s;let a;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(ant((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,i)=>{if(t>=t)if(i<0)for(;++i<=0;)for(;e(t,-1),!n(t););else for(;--i>=0;)for(;e(t,1),!n(t););})),n&&(r.count=(e,i)=>(tt.setTime(+e),et.setTime(+i),t(tt),t(et),Math.floor(n(tt,et))),r.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(i?e=>i(e)%t==0:e=>r.count(0,e)%t==0):r:null)),r}const it=864e5,rt=6048e5;function ot(t){return nt((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/rt))}const st=ot(0),at=ot(1),lt=ot(2),ct=ot(3),ut=ot(4),ht=ot(5),pt=ot(6);function dt(t){return nt((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/rt))}st.range,at.range,lt.range,ct.range,ut.range,ht.range,pt.range;const ft=dt(0),mt=dt(1),gt=dt(2),yt=dt(3),vt=dt(4),bt=dt(5),_t=dt(6),wt=(ft.range,mt.range,gt.range,yt.range,vt.range,bt.range,_t.range,nt((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/it),(t=>t.getDate()-1))),xt=(wt.range,nt((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/it),(t=>t.getUTCDate()-1))),Et=(xt.range,nt((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/it),(t=>Math.floor(t/it)))),kt=(Et.range,nt((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear())));kt.every=t=>isFinite(t=Math.floor(t))&&t>0?nt((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,kt.range;const Tt=nt((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function At(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Ot(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function St(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Tt.every=t=>isFinite(t=Math.floor(t))&&t>0?nt((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,Tt.range;var Ct,$t,Mt,Lt,It,Nt={"-":"",_:" ",0:"0"},jt=/^\s*\d+/,Ft=/^%/,Pt=/[\\^$*+?|[\]().{}]/g;function Dt(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",o=r.length;return i+(o[t.toLowerCase(),e])))}function Ht(t,e,n){var i=jt.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function Vt(t,e,n){var i=jt.exec(e.slice(n,n+1));return i?(t.u=+i[0],n+i[0].length):-1}function Kt(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.U=+i[0],n+i[0].length):-1}function qt(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.V=+i[0],n+i[0].length):-1}function Yt(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.W=+i[0],n+i[0].length):-1}function Wt(t,e,n){var i=jt.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function zt(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),n+i[0].length):-1}function Gt(t,e,n){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return i?(t.Z=i[1]?0:-(i[2]+(i[3]||"00")),n+i[0].length):-1}function Xt(t,e,n){var i=jt.exec(e.slice(n,n+1));return i?(t.q=3*i[0]-3,n+i[0].length):-1}function Zt(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function Jt(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function Qt(t,e,n){var i=jt.exec(e.slice(n,n+3));return i?(t.m=0,t.d=+i[0],n+i[0].length):-1}function te(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function ee(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function ne(t,e,n){var i=jt.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function ie(t,e,n){var i=jt.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function re(t,e,n){var i=jt.exec(e.slice(n,n+6));return i?(t.L=Math.floor(i[0]/1e3),n+i[0].length):-1}function oe(t,e,n){var i=Ft.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function se(t,e,n){var i=jt.exec(e.slice(n));return i?(t.Q=+i[0],n+i[0].length):-1}function ae(t,e,n){var i=jt.exec(e.slice(n));return i?(t.s=+i[0],n+i[0].length):-1}function le(t,e){return Dt(t.getDate(),e,2)}function ce(t,e){return Dt(t.getHours(),e,2)}function ue(t,e){return Dt(t.getHours()%12||12,e,2)}function he(t,e){return Dt(1+wt.count(kt(t),t),e,3)}function pe(t,e){return Dt(t.getMilliseconds(),e,3)}function de(t,e){return pe(t,e)+"000"}function fe(t,e){return Dt(t.getMonth()+1,e,2)}function me(t,e){return Dt(t.getMinutes(),e,2)}function ge(t,e){return Dt(t.getSeconds(),e,2)}function ye(t){var e=t.getDay();return 0===e?7:e}function ve(t,e){return Dt(st.count(kt(t)-1,t),e,2)}function be(t){var e=t.getDay();return e>=4||0===e?ut(t):ut.ceil(t)}function _e(t,e){return t=be(t),Dt(ut.count(kt(t),t)+(4===kt(t).getDay()),e,2)}function we(t){return t.getDay()}function xe(t,e){return Dt(at.count(kt(t)-1,t),e,2)}function Ee(t,e){return Dt(t.getFullYear()%100,e,2)}function ke(t,e){return Dt((t=be(t)).getFullYear()%100,e,2)}function Te(t,e){return Dt(t.getFullYear()%1e4,e,4)}function Ae(t,e){var n=t.getDay();return Dt((t=n>=4||0===n?ut(t):ut.ceil(t)).getFullYear()%1e4,e,4)}function Oe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Dt(e/60|0,"0",2)+Dt(e%60,"0",2)}function Se(t,e){return Dt(t.getUTCDate(),e,2)}function Ce(t,e){return Dt(t.getUTCHours(),e,2)}function $e(t,e){return Dt(t.getUTCHours()%12||12,e,2)}function Me(t,e){return Dt(1+xt.count(Tt(t),t),e,3)}function Le(t,e){return Dt(t.getUTCMilliseconds(),e,3)}function Ie(t,e){return Le(t,e)+"000"}function Ne(t,e){return Dt(t.getUTCMonth()+1,e,2)}function je(t,e){return Dt(t.getUTCMinutes(),e,2)}function Fe(t,e){return Dt(t.getUTCSeconds(),e,2)}function Pe(t){var e=t.getUTCDay();return 0===e?7:e}function De(t,e){return Dt(ft.count(Tt(t)-1,t),e,2)}function Re(t){var e=t.getUTCDay();return e>=4||0===e?vt(t):vt.ceil(t)}function Ue(t,e){return t=Re(t),Dt(vt.count(Tt(t),t)+(4===Tt(t).getUTCDay()),e,2)}function Be(t){return t.getUTCDay()}function He(t,e){return Dt(mt.count(Tt(t)-1,t),e,2)}function Ve(t,e){return Dt(t.getUTCFullYear()%100,e,2)}function Ke(t,e){return Dt((t=Re(t)).getUTCFullYear()%100,e,2)}function qe(t,e){return Dt(t.getUTCFullYear()%1e4,e,4)}function Ye(t,e){var n=t.getUTCDay();return Dt((t=n>=4||0===n?vt(t):vt.ceil(t)).getUTCFullYear()%1e4,e,4)}function We(){return"+0000"}function ze(){return"%"}function Ge(t){return+t}function Xe(t){return Math.floor(+t/1e3)}Ct=function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,s=t.shortDays,a=t.months,l=t.shortMonths,c=Ut(r),u=Bt(r),h=Ut(o),p=Bt(o),d=Ut(s),f=Bt(s),m=Ut(a),g=Bt(a),y=Ut(l),v=Bt(l),b={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:le,e:le,f:de,g:ke,G:Ae,H:ce,I:ue,j:he,L:pe,m:fe,M:me,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Ge,s:Xe,S:ge,u:ye,U:ve,V:_e,w:we,W:xe,x:null,X:null,y:Ee,Y:Te,Z:Oe,"%":ze},_={a:function(t){return s[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:Se,e:Se,f:Ie,g:Ke,G:Ye,H:Ce,I:$e,j:Me,L:Le,m:Ne,M:je,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Ge,s:Xe,S:Fe,u:Pe,U:De,V:Ue,w:Be,W:He,x:null,X:null,y:Ve,Y:qe,Z:We,"%":ze},w={a:function(t,e,n){var i=d.exec(e.slice(n));return i?(t.w=f.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){var i=h.exec(e.slice(n));return i?(t.w=p.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){var i=y.exec(e.slice(n));return i?(t.m=v.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){var i=m.exec(e.slice(n));return i?(t.m=g.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,n,i){return k(t,e,n,i)},d:Jt,e:Jt,f:re,g:zt,G:Wt,H:te,I:te,j:Qt,L:ie,m:Zt,M:ee,p:function(t,e,n){var i=c.exec(e.slice(n));return i?(t.p=u.get(i[0].toLowerCase()),n+i[0].length):-1},q:Xt,Q:se,s:ae,S:ne,u:Vt,U:Kt,V:qt,w:Ht,W:Yt,x:function(t,e,i){return k(t,n,e,i)},X:function(t,e,n){return k(t,i,e,n)},y:zt,Y:Wt,Z:Gt,"%":oe};function x(t,e){return function(n){var i,r,o,s=[],a=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++a53)return null;"w"in o||(o.w=1),"Z"in o?(r=(i=Ot(St(o.y,0,1))).getUTCDay(),i=r>4||0===r?mt.ceil(i):mt(i),i=xt.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(r=(i=At(St(o.y,0,1))).getDay(),i=r>4||0===r?at.ceil(i):at(i),i=wt.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),r="Z"in o?Ot(St(o.y,0,1)).getUTCDay():At(St(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(r+5)%7:o.w+7*o.U-(r+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Ot(o)):At(o)}}function k(t,e,n,i){for(var r,o,s=0,a=e.length,l=n.length;s=l)return-1;if(37===(r=e.charCodeAt(s++))){if(r=e.charAt(s++),!(o=w[r in Nt?e.charAt(s++):r])||(i=o(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}return b.x=x(n,b),b.X=x(i,b),b.c=x(e,b),_.x=x(n,_),_.X=x(i,_),_.c=x(e,_),{format:function(t){var e=x(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=E(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=E(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),$t=Ct.format,Mt=Ct.parse,Lt=Ct.utcFormat,It=Ct.utcParse;var Ze="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||Lt(Ze);var Je=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:It(Ze);const Qe=Je,tn=["weeks","days","hours","minutes","seconds","milliseconds"],en={weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001};function nn(t){return"object"==typeof t&&!Array.isArray(t)}class rn{constructor(t=0,e=0,n=0,i=0,r=0,o=0){this.days=0,this.seconds=0,this.milliseconds=0;let s={days:t,seconds:e,milliseconds:n,minutes:i,hours:r,weeks:o};nn(t)&&(delete s.days,Object.assign(s,t));let a=0;if(tn.forEach((t=>{a+=(s[t]??0)*en[t]})),athis.maxSeconds)throw RangeError("value out of range, must have magnitude less than 999999999 days");if(a.toString().includes(".")){const t=a.toString();this.milliseconds=Math.trunc(parseFloat(`0.${t.split(".")[1]}`)/en.milliseconds),t.startsWith("-")&&(this.milliseconds*=-1),a=Math.trunc(a)}this.days=Math.trunc(a/en.days),this.days=this.days||0,this.seconds=a-this.days*en.days,this.seconds=this.seconds||0}total_seconds(){return this.days*en.days+this.seconds+this.milliseconds*en.milliseconds}valueOf(){return this.total_seconds()}toString(){return`${0!=this.days?`${this.days} day${Math.abs(this.days)>1?"s,":","}`:""} ${Lt("%-H:%M:%S"+(this.milliseconds?".%f":""))(new Date(1e3*this.valueOf()))}`.trim()}static get min(){return new rn(-1e8)}get minSeconds(){return-864e10}static get max(){return new rn(1e8)}get maxSeconds(){return 864e10}static get resolution(){return new rn({milliseconds:1})}}class on{constructor(t=0,e=0,n=0,i=0){this.hour=0,this.minute=0,this.second=0,this.millisecond=0;let r={hour:t,minute:e,second:n,millisecond:i};nn(t)&&(delete r.hour,Object.assign(r,t));for(const t in r)if(!Number.isInteger(r[t]))throw TypeError("'float' object cannot be interpreted as an integer");if((r.hour??0)<0||(r.hour??0)>23)throw RangeError("hour must be in 0..23");if((r.minute??0)<0||(r.minute??0)>59)throw RangeError("minute must be in 0..59");if((r.second??0)<0||(r.second??0)>59)throw RangeError("second must be in 0..59");if((r.millisecond??0)<0||(r.millisecond??0)>999)throw RangeError("millisecond must be in 0..999");Object.assign(this,r)}replace(t=this.hour,e=this.minute,n=this.second,i=this.millisecond){let r={hour:t,minute:e,second:n,millisecond:i};return nn(t)&&(delete r.hour,Object.assign(r,t)),new on(r.hour??this.hour,r.minute??this.minute,r.second??this.second,r.millisecond??this.millisecond)}isoformat(t="auto"){let e;switch(t){case"hours":e="%H";break;case"minutes":e="%H:%M";break;case"seconds":e="%H:%M:%S";break;case"milliseconds":e="%H:%M:%S.%f";break;default:e="%H:%M:%S"+(this.millisecond?".%f":"")}return this.strftime(e)}valueOf(){return this.hour*en.hours+this.minute*en.minutes+this.second*en.seconds+this.millisecond*en.milliseconds}toString(){return this.isoformat()}strftime(t){return Lt(t)(this.jsDate)}get jsDate(){return new Date(1e3*this.valueOf())}static get min(){return new on(0,0,0,0)}static get max(){return new on(23,59,59,999)}static get resolution(){return rn.resolution}static fromisoformat(t){const e=Qe(`1970-01-01T${t}`);if(e)return new on(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());throw SyntaxError("Unable to parse date string")}}const sn=100,an=9999,ln=36160,cn=3652059,un=["year","month","day","hour","minute","second","millisecond"];class hn{constructor(t,e,n,i=0,r=0,o=0,s=0,a=!1){this.year=1970,this.month=1,this.day=1,this.hour=0,this.minute=0,this.second=0,this.millisecond=0,this.utc=!1;const l={year:t,month:e,day:n,hour:i,minute:r,second:o,millisecond:s,utc:a};if(nn(t)&&(delete l.year,Object.assign(l,t)),!l.year||!l.month||!l.day)throw SyntaxError("Missing required argument year, month, or day");for(const t in l)if(un.includes(t)&&!Number.isInteger(l[t]))throw TypeError(`Argument ${t} value ${l[t]} is not an integer`);if(l.yearan)throw RangeError(`year ${l.year} is out of range`);if(l.month<1||l.month>12)throw RangeError(`month ${l.month} is out of range`);if(l.day<1||l.day>new Date(l.year,l.month,0).getDate())throw RangeError(`day ${n} is out of range for month`);if((l.hour??0)<0||(l.hour??0)>23)throw RangeError("hour must be in 0..23");if((l.minute??0)<0||(l.minute??0)>59)throw RangeError("minute must be in 0..59");if((l.second??0)<0||(l.second??0)>59)throw RangeError("second must be in 0..59");if((l.millisecond??0)<0||(l.millisecond??0)>999)throw RangeError("millisecond must be in 0..999");Object.assign(this,l)}date(){return new pn(this.year,this.month,this.day)}time(){return new on(this.hour,this.minute,this.second,this.millisecond)}replace(t=this.year,e=this.month,n=this.day,i=this.hour,r=this.minute,o=this.second,s=this.millisecond){const a={year:t,month:e,day:n,hour:i,minute:r,second:o,millisecond:s};return nn(t)&&(delete a.year,Object.assign(a,t)),new hn({year:a.year??this.year,month:a.month??this.month,day:a.day??this.day,hour:a.hour??this.hour,minute:a.minute??this.minute,second:a.second??this.second,millisecond:a.millisecond??this.millisecond})}toordinal(){return this.date().toordinal()}timestamp(){let t;return t=this.utc?Date.UTC(this.year,this.month-1,this.day||1,this.hour||0,this.minute||0,this.second||0,this.millisecond||0):this.jsDate.getTime(),t/1e3}weekday(){return this.date().weekday()}isoweekday(){return this.weekday()+1}isocalendar(){const[t,e,n]=Lt("%G-%V-%u")(this.jsDate).split("-");return[Number(t),Number(e),Number(n)]}isoformat(t="T",e="auto"){const n={sep:t,timespec:e};let i;switch(nn(t)&&(delete n.sep,Object.assign(n,t),n.sep=n.sep??"T"),n.timespec){case"hours":i=`%Y-%m-%d${n.sep}%H`;break;case"minutes":i=`%Y-%m-%d${n.sep}%H:%M`;break;case"seconds":i=`%Y-%m-%d${n.sep}%H:%M:%S`;break;case"milliseconds":i=`%Y-%m-%d${n.sep}%H:%M:%S.%f`;break;default:i=`%Y-%m-%d${n.sep}%H:%M:%S${this.millisecond?".%f":""}`}return this.strftime(i)}valueOf(){return this.timestamp()}toString(){return this.isoformat(" ")}ctime(){return $t("%a %b %-e %H:%M:%S %Y")(this.jsDate)}strftime(t){return this.utc?Lt(t)(this.jsDate):$t(t)(this.jsDate)}get jsDate(){return this.utc?new Date(1e3*this.valueOf()):new Date(this.year,this.month-1,this.day||1,this.hour||0,this.minute||0,this.second||0,this.millisecond||0)}static get min(){return new hn(sn,1,1)}static get max(){return new hn(an,12,31,23,59,59,999)}static get resolution(){return rn.resolution}static today(){return hn.now()}static now(){return hn.fromjsdate(new Date)}static utcnow(){return hn.utcfromjsdate(new Date)}static fromtimestamp(t){const e=new Date(1e3*t);return hn.fromjsdate(e)}static utcfromtimestamp(t){const e=new Date(1e3*t);return hn.utcfromjsdate(e)}static fromjsdate(t){return new hn({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),millisecond:t.getMilliseconds()})}static utcfromjsdate(t){return new hn({year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds(),utc:!0})}static fromordinal(t){if(tcn)throw RangeError(`ordinal ${t} is out of range`);return hn.fromtimestamp(pn.min.valueOf()+new rn({days:t-ln}).valueOf())}static combine(t,e){return new hn({year:t.year,month:t.month,day:t.day,hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})}static fromisoformat(t){const e=Qe(t);if(e)return hn.fromjsdate(e);throw SyntaxError("Unable to parse date string")}static fromisocalendar(t,e,n){return hn.strptime(`${t}-${e}-${n}`,"%G-%V-%u")}static strptime(t,e,n=!1){const i=(n?It:Mt)(e)(t);if(!i)throw Error(`'${t}' does not match format '${e}'`);return n?hn.utcfromjsdate(i):hn.fromjsdate(i)}}class pn{constructor(t,e,n){if(this.year=1970,this.month=1,this.day=1,!Number.isInteger(t)||tan)throw RangeError(`year ${t} is out of range`);if(!Number.isInteger(e)||e<1||e>12)throw RangeError(`month ${e} is out of range`);if(!Number.isInteger(n)||n<1||n>new Date(t,e,0).getDate())throw RangeError(`day ${n} is out of range for month`);Object.assign(this,{year:t,month:e,day:n})}replace(t=this.year,e=this.month,n=this.day){const i={year:t,month:e,day:n};return nn(t)&&(delete i.year,Object.assign(i,t)),new pn(i.year??this.year,i.month??this.month,i.day??this.day)}toordinal(){return Math.trunc((this.valueOf()+new rn({days:719163}).total_seconds())/en.days)}weekday(){return(this.jsDate.getDay()+6)%7}isoweekday(){return this.weekday()+1}isocalendar(){const[t,e,n]=Lt("%G-%V-%u")(this.jsDate).split("-");return[Number(t),Number(e),Number(n)]}isoformat(){return Lt("%Y-%m-%d")(this.jsDate)}valueOf(){return this.jsDate.getTime()/1e3}toString(){return this.isoformat()}ctime(){return $t("%a %b %-e 00:00:00 %Y")(this.jsDate)}strftime(t){return $t(t)(this.jsDate)}get jsDate(){return new Date(this.year,this.month-1,this.day)}static get min(){return new pn(sn,1,1)}static get max(){return new pn(an,12,31)}static get resolution(){return new rn({days:1})}static today(){const t=hn.now();return new pn(t.year,t.month,t.day)}static fromtimestamp(t){const e=hn.fromtimestamp(t);return new pn(e.year,e.month,e.day)}static fromordinal(t){if(tcn)throw RangeError(`ordinal ${t} is out of range`);return pn.fromtimestamp(pn.min.valueOf()+new rn({days:t-ln}).valueOf())}static fromisoformat(t){const e=Qe(t);if(e)return new pn(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate());throw SyntaxError("Unable to parse date string")}static fromisocalendar(t,e,n){const i=hn.strptime(`${t}-${e}-${n}`,"%G-%V-%u");return new pn(Number(i.year),Number(i.month),Number(i.day))}}const dn=(...t)=>new rn(...t);dn.min=rn.min,dn.max=rn.max,dn.resolution=rn.resolution;const fn=(...t)=>new pn(...t);fn.min=pn.min,fn.max=pn.max,fn.resolution=pn.resolution,fn.today=pn.today,fn.fromtimestamp=pn.fromtimestamp,fn.fromordinal=pn.fromordinal,fn.fromisoformat=pn.fromisoformat,fn.fromisocalendar=pn.fromisocalendar;const mn=(...t)=>new hn(...t);mn.min=hn.min,mn.max=hn.max,mn.resolution=hn.resolution,mn.today=hn.today,mn.now=hn.now,mn.utcnow=hn.utcnow,mn.fromtimestamp=hn.fromtimestamp,mn.utcfromtimestamp=hn.utcfromtimestamp,mn.fromjsdate=hn.fromjsdate,mn.utcfromjsdate=hn.utcfromjsdate,mn.fromordinal=hn.fromordinal,mn.combine=hn.combine,mn.fromisoformat=hn.fromisoformat,mn.fromisocalendar=hn.fromisocalendar,mn.strptime=hn.strptime;const gn=(...t)=>new on(...t);gn.min=on.min,gn.max=on.max,gn.resolution=on.resolution,gn.fromisoformat=on.fromisoformat;const yn={MINYEAR:sn,MAXYEAR:an,MINYEAR_ORDINAL:ln,MAXYEAR_ORDINAL:cn,timedelta:dn,date:fn,datetime:mn,time:gn};function vn(){return yn.datetime.now()}function bn(t="00:00"){const[e,n,i,r]=t.split(":"),o=yn.datetime.now(),s=yn.datetime(o.year,o.month,o.day,Number(e??0),Number(n??0),Number(i??0),Number(r??0));return M(s.toString()),s}function _n(t,e=void 0,n=!0){"object"!=typeof e||Array.isArray(e)||(n=e.utc??n,e=e.fallback??void 0);try{let e;if("string"==typeof t)if(/[^\d]/g.test(t)){t=t.replace(/T/g," ");const i=["%Y-%m-%d %H:%M:%S.%f%Z","%Y-%m-%d %H:%M:%S.%f","%Y-%m-%d %H:%M:%S%Z","%Y-%m-%d %H:%M:%S"];for(const r of i)try{e=yn.datetime.strptime(t,r,n);break}catch{}e||(t=parseFloat(t))}else t=parseFloat(t);else e="number"==typeof t?n?yn.datetime.utcfromtimestamp(t):yn.datetime.fromtimestamp(t):t instanceof pn?yn.datetime(t.year,t.month,t.day):t;return M((e??"NaN").toString()),e}catch(t){if(e)return e;throw t}}function wn(t,e){try{let e;return"string"==typeof t?(t.includes(" ")||t.includes("T")||(t+=" 00:00:00"),e=Date.parse(t)/1e3):e="number"==typeof t?yn.datetime.utcfromtimestamp(t).jsDate.getTime()/1e3:t.jsDate.getTime()/1e3,M(e.toString()),e}catch(t){if(e)return e;throw t}}function xn(t){return yn.datetime.fromjsdate(yn.datetime(t).jsDate)}function En(t,e=1,n=!1){if(!(t instanceof hn))return t;let i=vn().valueOf()-xn(t).valueOf();if(n&&(i*=-1),i<=0)return t;(0==e||e>6)&&(e=6);const r={year:31536e3,month:2592e3,day:86400,hour:3600,minute:60,second:1},o=Object.keys(r);let s="",a=!1;for(let t=0;t0)&&(a=!0,s+=` ${n} ${o[t]}${1!=n?"s":""}`,i-=n*r[o[t]])}return s.trim()}function kn(t,e=1){return En(t,e)}function Tn(t,e=1){return En(t,e,!0)}const An={states:c,state_attr:u,has_value:h,state_translated:Z,attr_name_translated:J,attr_value_translated:Q,expand:w,device_entities:d,device_attr:f,device_id:m,floor_id:v,floor_name:b,floor_areas:_,area_id:r,area_name:o,area_entities:s,area_devices:a,labels:k,label_areas:O,label_devices:S,label_entities:C,iif:x,closest:y},On={label_id:T,label_name:A,today_at:bn,as_datetime:_n,as_timestamp:wn,as_local:xn,time_since:kn,time_until:Tn,timestamp_local:function(t,e){try{const e=yn.datetime.fromtimestamp(t).strftime("%Y-%m-%dT%H:%M:%S%Z");return M(e),e}catch(t){if(e)return e;throw t}},timestamp_utc:function(t,e){try{const e=yn.datetime.utcfromtimestamp(t).strftime("%Y-%m-%dT%H:%M:%S%Z");return M(e),e}catch(t){if(e)return e;throw t}},timestamp_custom:function(t,e,n=!0,i=void 0){"object"!=typeof n||Array.isArray(n)||(i=n.fallback??i,n=n.local??!0);try{const i=(n?yn.datetime.fromtimestamp(t):yn.datetime.utcfromtimestamp(t)).strftime(e);return M(i),i}catch(t){if(i)return i;throw t}},to_json:function(t,e=!1,n=!1,i=!1){"object"!=typeof e||Array.isArray(e)||(i=e.sort_keys??i,n=e.pretty_print??n,e=e.ensure_ascii??!1),i&&(t=Object.keys(t).sort().reduce(((e,n)=>(e[n]=t[n],e)),{}));let r=JSON.stringify(t,void 0,n?2:void 0);return e&&(r=r.replace(/[\u007F-\uFFFF]/g,(t=>`\\u'${("0000"+t.charCodeAt(0).toString(16)).substring(-4)}`))),r},from_json:function(t){return JSON.parse(t)},closest:y,contains:l,is_number:L,bool:I,log:N,sin:j,cos:F,tan:P,asin:D,acos:R,atan:U,atan2:B,sqrt:H,max:V,min:K,average:q,median:Y,statistical_mode:W,bitwise_and:function(t,e){return t&e},bitwise_or:function(t,e){return t|e},bitwise_xor:function(t,e){return t^e},bitwise_not:function(t){return~t},ord:function(t){if(1==t.length)return t.codePointAt(0);throw Error("Expected a character, but received a string")},multiply:function(t,e){return Number(t)*Number(e)},add:function(t,e){return Number(t)+Number(e)},regex_replace:function(t,e="",n=""){return t.replace(new RegExp(e,"g"),n)},regex_findall:function(t,e=""){return t.match(new RegExp(e,"g"))??[]},regex_findall_index:function(t,e="",n=0){return(t.match(new RegExp(e,"g"))??[])[n]},str:$},Sn={states:c,is_state:function(t,e,n){try{const i=c(t,e);return Array.isArray(n)?n.includes(i):i==n}catch{return!1}},state_attr:u,is_state_attr:function(t,e,n,i){try{return u(t,e,n)==i}catch{return!1}},has_value:h,state_translated:Z,attr_name_translated:J,attr_value_translated:Q,expand:w,is_hidden_entity:function(t,e){try{return t.entities[e].hidden??!1}catch{return!1}},device_entities:d,device_attr:f,is_device_attr:function(t,e,n,i){try{return null!=i&&f(t,e,n)==i}catch{return!1}},device_id:m,floors:function(t){return Object.keys(t.floors)},floor_id:v,floor_name:b,floor_areas:_,areas:function(t){try{return Object.keys(t.areas)}catch{return[]}},area_id:r,area_name:o,area_entities:s,area_devices:a,integration_entities:function(t,e){try{const n=[];if(e){for(const i in t.entities)t.entities[i].platform==e&&n.push(i);n.sort()}return n}catch{return[]}},labels:k,label_areas:O,label_devices:S,label_entities:C,iif:x,distance:function(t,...e){try{let n,i,r,o,s=0;if("string"==typeof e[0])n=t.states[e[0]].attributes.latitude,r=t.states[e[0]].attributes.longitude,s=1;else if("object"!=typeof e[0]||Array.isArray(e[0])){if("number"!=typeof e[0])return null;if("number"!=typeof e[1])throw Error("Latitude provided but not longitude 1");n=e[0],r=e[1],s=2}else n=e[0].attributes.latitude,r=e[0].attributes.longitude,s=1;if("string"==typeof e[s])i=t.states[e[s]].attributes.latitude,o=t.states[e[s]].attributes.longitude;else if("object"!=typeof e[s]||Array.isArray(e[s]))if("number"==typeof e[s]){if("number"!=typeof e[s+1])throw Error("Latitude provided but not longitude 2");i=e[s],o=e[s+1]}else i=t.states["zone.home"].attributes.latitude,o=t.states["zone.home"].attributes.longitude;else i=e[s].attributes.latitude,o=e[s].attributes.longitude;return g([n,r],[i,o],"mi"==t.config.unit_system.length)}catch{return null}},closest:y},Cn={label_id:T,label_name:A,now:vn,utcnow:function(){return yn.datetime.utcnow()},today_at:bn,as_datetime:_n,as_timestamp:wn,as_local:xn,strptime:function(t,e,n=void 0,i=!1){"object"!=typeof n||Array.isArray(n)||n instanceof hn||n instanceof pn||(i=n.utc??i,n=n.fallback??void 0);try{e=e.replace(/%z/g,"%Z");const n=yn.datetime.strptime(t,e,i);return M(n.toString()),n}catch(t){if(n)return n;throw t}},time_since:kn,time_until:Tn,as_timedelta:function(t){try{let e;if(t.includes(":")||t.includes(" ")||/^\d*\.?\d*$/.test(t)){let n,i;t.includes(" ")?t.includes("days")?[n,i]=t.split(" days "):[n,i]=t.split(" "):(n=0,i=t);const[r,o,s]=i.split(":").reverse();e=yn.timedelta(Number(n),Number(r.replace(",",".")??0),0,Number(o??0),Number(s??0))}else{if(!t.startsWith("P"))return null;{const n=t.replace(/P|T/g,"").match(/(\d*?)[A-Z]/g);if(!n)return null;const i={};for(const t of n){const e=t.match(/^(\d*)/),n=t.match(/[A-Z]$/);e&&n&&(i[n[0]]=parseFloat(e[0]))}e=yn.timedelta(i.D,i.S,0,i.M,i.H,i.W)}}return M(e.toString()),e}catch{return null}},float:function(t,e){try{const e=parseFloat(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}},is_number:L,int:function(t,e){try{const e=parseInt(t);return M(e.toString()),e}catch(t){if(e)return e;throw t}},bool:I,log:N,sin:j,cos:F,tan:P,asin:D,acos:R,atan:U,atan2:B,sqrt:H,max:V,min:K,average:q,median:Y,statistical_mode:W,set:function(...t){return new Set(t.flat(1/0))},list:function(...t){return t.map((t=>Array.from(t))).flat(1/0)},zip:function(...t){if(t.length>1)return t[0].map(((e,n)=>{const i=[e];for(let e=1;et.name.localeCompare(e.name)));for(const t of e)E[t.label_id]=t}}(t),Ln=t,"string"==typeof e&&(e.includes("{{")&&e.includes("}}")||e.includes("{%")&&e.includes("%}"))?(e=In.renderString(structuredClone(e),{hass:t,_states:p(t),...n}).trim(),[void 0,null,"undefined","null","None"].includes(e)?"":"true"==e.toLowerCase()||"false"!=e.toLowerCase()&&e):e}},740:(t,e,n)=>{"use strict";n.d(e,{XX:()=>R,c0:()=>k,qy:()=>E});const i=globalThis,r=i.trustedTypes,o=r?r.createPolicy("lit-html",{createHTML:t=>t}):void 0,s="$lit$",a=`lit$${Math.random().toFixed(9).slice(2)}$`,l="?"+a,c=`<${l}>`,u=document,h=()=>u.createComment(""),p=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,f="[ \t\n\f\r]",m=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,g=/-->/g,y=/>/g,v=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),b=/'/g,_=/"/g,w=/^(?:script|style|textarea|title)$/i,x=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),E=x(1),k=(x(2),x(3),Symbol.for("lit-noChange")),T=Symbol.for("lit-nothing"),A=new WeakMap,O=u.createTreeWalker(u,129);function S(t,e){if(!d(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==o?o.createHTML(e):e}class C{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let o=0,u=0;const p=t.length-1,d=this.parts,[f,x]=((t,e)=>{const n=t.length-1,i=[];let r,o=2===e?"":3===e?"":"",l=m;for(let e=0;e"===h[0]?(l=r??m,p=-1):void 0===h[1]?p=-2:(p=l.lastIndex-h[2].length,u=h[1],l=void 0===h[3]?v:'"'===h[3]?_:b):l===_||l===b?l=v:l===g||l===y?l=m:(l=v,r=void 0);const f=l===v&&t[e+1].startsWith("/>")?" ":"";o+=l===m?n+c:p>=0?(i.push(u),n.slice(0,p)+s+n.slice(p)+a+f):n+a+(-2===p?e:f)}return[S(t,o+(t[n]||"")+(2===e?"":3===e?"":"")),i]})(t,e);if(this.el=C.createElement(f,n),O.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=O.nextNode())&&d.length0){i.textContent=r?r.emptyScript:"";for(let n=0;nd(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==T&&p(this._$AH)?this._$AA.nextSibling.data=t:this.T(u.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=C.createElement(S(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new M(i,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=A.get(t.strings);return void 0===e&&A.set(t.strings,e=new C(t)),e}k(t){d(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const r of t)i===e.length?e.push(n=new L(this.O(h()),this.O(h()),this,this.options)):n=e[i],n._$AI(r),i++;i2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=T}_$AI(t,e=this,n,i){const r=this.strings;let o=!1;if(void 0===r)t=$(this,t,e,0),o=!p(t)||t!==this._$AH&&t!==k,o&&(this._$AH=t);else{const i=t;let s,a;for(t=r[0],s=0;s{const i=n?.renderBefore??e;let r=i._$litPart$;if(void 0===r){const t=n?.renderBefore??null;i._$litPart$=r=new L(e.insertBefore(h(),t),t,void 0,n??{})}return r._$AI(t),r}},385:(t,e,n)=>{"use strict";n.d(e,{EM:()=>i,Ls:()=>c,MZ:()=>a,wk:()=>l});const i=t=>(e,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)};var r=n(1);const o={attribute:!0,type:String,converter:r.W3,reflect:!1,hasChanged:r.Ec},s=(t=o,e,n)=>{const{kind:i,metadata:r}=n;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),s.set(n.name,t),"accessor"===i){const{name:i}=n;return{set(n){const r=e.get.call(this);e.set.call(this,n),this.requestUpdate(i,r,t)},init(e){return void 0!==e&&this.P(i,void 0,t),e}}}if("setter"===i){const{name:i}=n;return function(n){const r=this[i];e.call(this,n),this.requestUpdate(i,r,t)}}throw Error("Unsupported decorator location: "+i)};function a(t){return(e,n)=>"object"==typeof n?s(t,e,n):((t,e,n)=>{const i=e.hasOwnProperty(n);return e.constructor.createProperty(n,i?{...t,wrapped:!0}:t),i?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}function l(t){return a({...t,state:!0,attribute:!1})}function c(t){return(e,n)=>{const i="function"==typeof e?e:e[n];Object.assign(i,t)}}},670:(t,e,n)=>{"use strict";n.d(e,{WF:()=>o,AH:()=>i.AH,qy:()=>r.qy});var i=n(1),r=n(740);class o extends i.mN{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=(0,r.XX)(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.o?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.o?.setConnected(!1)}render(){return r.c0}}o._$litElement$=!0,o.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:o});const s=globalThis.litElementPolyfillSupport;s?.({LitElement:o}),(globalThis.litElementVersions??=[]).push("4.1.0")}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.d=(t,e)=>{for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var __webpack_exports__={};(()=>{"use strict";var t=__webpack_require__(670),e=__webpack_require__(385),n=__webpack_require__(740);const i=t=>(...e)=>({_$litDirective$:t,values:e});class r{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this.t=t,this._$AM=e,this.i=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const o=i(class extends r{constructor(t){if(super(t),1!==t.type||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const i=t.element.classList;for(const t of this.st)t in e||(i.remove(t),this.st.delete(t));for(const t in e){const n=!!e[t];n===this.st.has(t)||this.nt?.has(t)||(n?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return n.c0}});var s=__webpack_require__(703),a=__webpack_require__(290),l=__webpack_require__(735);let c=class extends l.P{constructor(){super(...arguments),this.clickCount=0,this.hold=!1}onClick(t){if(t.stopImmediatePropagation(),this.clickCount++,this.config.double_tap_action&&"none"!=this.renderTemplate(this.config.double_tap_action?.action))if(this.clickCount>1)this.fireHapticEvent("success"),this.sendAction("double_tap_action"),this.endAction();else{const t=this.config.double_tap_action.double_tap_window?this.renderTemplate(this.config.double_tap_action.double_tap_window):a.jc;this.clickTimer||(this.clickTimer=setTimeout((()=>{this.fireHapticEvent("light"),this.sendAction("tap_action"),this.endAction()}),t))}else this.fireHapticEvent("light"),this.sendAction("tap_action"),this.endAction()}onStart(t){if(clearTimeout(this.renderRippleOff),clearTimeout(this.renderRippleOn),this.renderRipple=!0,this.swiping=!1,"targetTouches"in t?(this.initialX=t.targetTouches[0].clientX,this.initialY=t.targetTouches[0].clientY):(this.initialX=t.clientX,this.initialY=t.clientY),this.config.momentary_start_action&&"none"!=this.renderTemplate(this.config.momentary_start_action?.action??"none"))this.fireHapticEvent("light"),this.buttonPressStart=performance.now(),this.sendAction("momentary_start_action");else if(this.config.momentary_end_action&&"none"!=this.renderTemplate(this.config.momentary_end_action?.action??"none"))this.fireHapticEvent("light"),this.buttonPressStart=performance.now();else if(!this.holdTimer&&this.config.hold_action){const t=this.config.hold_action.hold_time?this.renderTemplate(this.config.hold_action?.hold_time):a.At,e=this.renderTemplate(this.config.hold_action?.action);"none"!=e&&(this.holdTimer=setTimeout((()=>{if(!this.swiping)if(this.hold=!0,"repeat"==e){const t=this.config.hold_action?.repeat_delay?this.renderTemplate(this.config.hold_action?.repeat_delay):a.a3;this.holdInterval||(this.holdInterval=setInterval((()=>{this.fireHapticEvent("selection"),this.sendAction("tap_action")}),t))}else this.fireHapticEvent("selection")}),t))}}onEnd(t){this.swiping||(this.config.momentary_end_action&&"none"!=this.renderTemplate(this.config.momentary_end_action?.action)?(this.fireHapticEvent("selection"),this.buttonPressEnd=performance.now(),this.sendAction("momentary_end_action"),this.endAction()):this.config.momentary_start_action&&"none"!=this.renderTemplate(this.config.momentary_start_action?.action)?this.endAction():this.hold?(t.stopImmediatePropagation(),t.preventDefault(),"repeat"!=this.renderTemplate(this.config.hold_action?.action)&&(this.fireHapticEvent("medium"),this.sendAction("hold_action")),this.endAction()):this.onClick(t),this.toggleRipple())}onMove(t){let e,n;"targetTouches"in t?(e=t.targetTouches[0].clientX,n=t.targetTouches[0].clientY):(e=t.clientX,n=t.clientY);const i=(this.initialX??e)-e,r=(this.initialY??n)-n;Math.abs(Math.abs(i)-Math.abs(r))>8&&(this.endAction(),this.swiping=!0,this.toggleRipple())}onMouseLeave(t){this.endAction(),this.swiping=!0,this.toggleRipple()}onTouchCancel(t){this.toggleRipple()}endAction(){clearTimeout(this.clickTimer),this.clickTimer=void 0,this.clickCount=0,clearTimeout(this.holdTimer),clearInterval(this.holdInterval),this.holdTimer=void 0,this.holdInterval=void 0,this.hold=!1,super.endAction()}render(){this.setValue();const e=t.qy``;return t.qy`${e}${this.buildIcon()}${this.buildLabel()}${this.buildStyles()}`}static get styles(){return[super.styles,t.AH`:host{-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent;--md-ripple-hover-opacity:var( - --ha-ripple-hover-opacity, - 0.08 - );--md-ripple-pressed-opacity:var( - --ha-ripple-pressed-opacity, - 0.12 - );--ha-ripple-color:var(--secondary-text-color);--md-ripple-hover-color:var( - --ha-ripple-hover-color, - var(--ha-ripple-color, var(--secondary-text-color)) - );--md-ripple-pressed-color:var( - --ha-ripple-pressed-color, - var(--ha-ripple-color, var(--secondary-text-color)) - )}button{background:0 0!important;opacity:1!important;position:absolute;cursor:pointer;height:100%;width:100%;border:none;overflow:hidden}button::before{content:'';position:absolute;top:0;left:0;height:100%;width:100%;background:var(--color,var(--disabled-color));opacity:var(--opacity,.2)}@media (hover:hover){.option:hover{opacity:var(--hover-opacity)!important;background:var(--color,var(--state-inactive-color,var(--disabled-color)))!important}}.option:active{opacity:var(--hover-opacity)!important;background:var(--color,var(--state-inactive-color,var(--disabled-color)))!important}`]}};c=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s}([(0,e.EM)("custom-feature-button")],c);var u=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};let h=class extends l.P{constructor(){super(...arguments),this.showDropdown=!1,this.handleExternalClick=t=>{t.composedPath,t.composedPath().includes(this)||(this.showDropdown=!1)}}onStart(t){clearTimeout(this.renderRippleOff),clearTimeout(this.renderRippleOn),this.renderRipple=!0,this.swiping=!1,"targetTouches"in t?(this.initialX=t.targetTouches[0].clientX,this.initialY=t.targetTouches[0].clientY):(this.initialX=t.clientX,this.initialY=t.clientY)}onMove(t){let e,n;"targetTouches"in t?(e=t.targetTouches[0].clientX,n=t.targetTouches[0].clientY):(e=t.clientX,n=t.clientY);const i=(this.initialX??e)-e,r=(this.initialY??n)-n;Math.abs(Math.abs(i)-Math.abs(r))>8&&(this.endAction(),this.swiping=!0,this.toggleRipple())}onEnd(t){this.swiping||(this.showDropdown=!this.showDropdown,this.toggleRipple())}handleCloseDropdown(t){const e=t.detail?.value;null!=e&&(clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,this.value=e,this.resetGetValueFromHass()),this.showDropdown=!1}buildDropdownStyles(){const e=`\n\t\t${this.rtl?"\n\t\t.down-arrow {\n\t\t\tright: unset !important;\n\t\t\tleft: 10px !important;\n\t\t}\n\t\t":""}\n\t\t`;return t.qy``}render(){if(this.setValue(),this.rtl="rtl"==getComputedStyle(this).direction,this.showDropdown){let t=parseInt(this.style.getPropertyValue("--mdc-menu-item-height").replace(/D/g,""));t=isNaN(t)?48:t;const e=t*(this.config.options?.length??0)+16,n=this.getBoundingClientRect(),i=32;let r=!0;e>window.innerHeight-i-n.bottom&&n.top+n.bottom>window.innerHeight&&(r=!1);const o=this.shadowRoot?.querySelector(".dropdown");o.style.setProperty("max-height",(r?window.innerHeight-n.bottom:n.top)-i-16+"px"),this.rtl?o.style.setProperty("right",window.innerWidth-n.right+"px"):o.style.setProperty("left",`${n.left}px`),o.style.setProperty(r?"top":"bottom",`${r?n.bottom:window.innerHeight-n.top}px`),o.style.removeProperty(r?"bottom":"top")}const e=[],n=this.config.options??[];let i;for(const r of n){const n=this.renderTemplate(r.option);null!=this.value&&(this.value??"").toString()==(n??"").toString()&&(i=r),r.haptics=r.haptics??this.config.haptics,r.label=r.label||r.icon?r.label:r.option,e.push(t.qy``)}const r=t.qy``,o=t.qy`
${this.buildBackground()}
${i?t.qy`${this.buildIcon(i)}${this.buildLabel(i)}${this.buildStyles(i)}`:""} ${this.buildRipple()}
`;return t.qy`${o}${r}${this.buildDropdownStyles()}${this.buildStyles()}`}updated(){const t=this.config.options??[],e=Array.from(this.shadowRoot?.querySelector(".dropdown")?.children??[]);for(const n in t)e[n].className="option "+(null!=this.value&&(this.value??"").toString()==(this.renderTemplate(t[n].option)??"").toString()?"selected":"")}connectedCallback(){super.connectedCallback(),document.body.addEventListener("click",this.handleExternalClick)}disconnectedCallback(){super.disconnectedCallback(),document.body.removeEventListener("click",this.handleExternalClick)}static get styles(){return[super.styles,t.AH`:host{overflow:visible;cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent;--md-ripple-hover-opacity:var( - --ha-ripple-hover-opacity, - 0.08 - );--md-ripple-pressed-opacity:var( - --ha-ripple-pressed-opacity, - 0.12 - );--ha-ripple-color:var(--secondary-text-color);--md-ripple-hover-color:var( - --ha-ripple-hover-color, - var(--ha-ripple-color, var(--secondary-text-color)) - );--md-ripple-pressed-color:var( - --ha-ripple-pressed-color, - var(--ha-ripple-color, var(--secondary-text-color)) - )}.background{pointer-events:none}.select{display:flex;flex-direction:row;align-items:center;gap:10px;padding:0 10px;height:100%;width:100%;box-sizing:border-box}.down-arrow{position:absolute;right:10px;pointer-events:none}.label{justify-content:flex-start;font:inherit;opacity:.88}.dropdown{position:fixed;z-index:9;color:var(--mdc-theme-on-surface);background:var(--mdc-theme-surface);border-radius:var(--mdc-shape-medium,4px);padding:8px 0;height:min-content;will-change:transform,opacity;overflow-y:scroll;transform:scale(1);opacity:1;transition:opacity 30ms linear,transform .12s cubic-bezier(0,0,.2,1),height 250ms cubic-bezier(0,0,.2,1);box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)}.collapsed{height:0;opacity:0;transform:scale(0)}.option{min-width:100px;--md-ripple-pressed-opacity:0.2}.selected{color:var(--mdc-theme-primary,#6200ee);--ha-ripple-color:var(--mdc-theme-primary, #6200ee);--mdc-ripple-hover-color:var(--ha-ripple-color);--md-ripple-pressed-color:var(--ha-ripple-color);--background:var(--ha-ripple-color);--background-opacity:0.26;--md-ripple-hover-opacity:0;--md-ripple-pressed-opacity:0.26}`]}};u([(0,e.wk)()],h.prototype,"showDropdown",void 0),h=u([(0,e.EM)("custom-feature-dropdown")],h);let p=class extends l.P{onStart(t){clearTimeout(this.renderRippleOff),clearTimeout(this.renderRippleOn),this.renderRipple=!0,this.swiping=!1,"targetTouches"in t?(this.initialX=t.targetTouches[0].clientX,this.initialY=t.targetTouches[0].clientY):(this.initialX=t.clientX,this.initialY=t.clientY),this.fireHapticEvent("light")}onEnd(t){this.swiping||(this.toggleRipple(),this.closeDropdown(this.renderTemplate(this.config.option)),this.sendAction("tap_action"),this.endAction())}onMove(t){let e,n;"targetTouches"in t?(e=t.targetTouches[0].clientX,n=t.targetTouches[0].clientY):(e=t.clientX,n=t.clientY);const i=(this.initialX??e)-e,r=(this.initialY??n)-n;Math.abs(Math.abs(i)-Math.abs(r))>8&&(this.endAction(),this.swiping=!0,this.toggleRipple())}onTouchEnd(t){t.preventDefault(),super.onTouchEnd(t)}onMouseLeave(t){this.endAction(),this.swiping=!0,this.toggleRipple()}onTouchCancel(t){this.toggleRipple(),this.closeDropdown()}closeDropdown(t){const e=new Event("close-dropdown",{composed:!0,bubbles:!0});e.detail={value:t},this.dispatchEvent(e)}render(){return this.setValue(),t.qy`${this.buildBackground()}
${this.buildIcon()}${this.buildLabel()}${this.buildRipple()}
${this.buildStyles()}`}static get styles(){return[super.styles,t.AH`:host{height:var(--mdc-menu-item-height,48px);width:100%;overflow:visible;--color:rgb(0, 0, 0, 0)}.background{pointer-events:none}.label{justify-content:flex-start;font:inherit}.icon{color:var(--mdc-theme-text-icon-on-background,rgba(0,0,0,.38))}.option{display:flex;flex-direction:row;align-items:center;padding-left:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-right:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px));gap:var(--mdc-list-item-graphic-margin,24px);height:100%;width:100%;box-sizing:border-box}`]}};u([(0,e.MZ)()],p.prototype,"config",void 0),p=u([(0,e.EM)("custom-feature-dropdown-option")],p);let d=class extends l.P{onEnd(t){clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,this.value=t.currentTarget.id,this.resetGetValueFromHass()}render(){this.setValue();const e=[this.buildBackground()],n=this.config.options??[];for(const i of n)i.haptics=i.haptics??this.config.haptics,e.push(t.qy``);return t.qy`${e}${this.buildStyles()}`}updated(){const t=this.config.options??[],e=Array.from(this.shadowRoot?.children??[]).slice(1);for(const n in t){const i=this.renderTemplate(t[n].option);let r="option";null!=this.value&&(this.value??"").toString()==(i??"").toString()&&(r="selected-option"),e[n].className=r}}static get styles(){return[super.styles,t.AH`:host{flex-flow:row;--color:var(--feature-color);--background:var(--disabled-color);--hover-opacity:0.2}.option{--opacity:0;--background-opacity:0}.selected-option{--opacity:1;--background-opacity:1;--hover-opacity:1}`]}};d=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s}([(0,e.EM)("custom-feature-selector")],d);const f="important",m=" !"+f,g=i(class extends r{constructor(t){if(super(t),1!==t.type||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,n)=>{const i=t[n];return null==i?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?i.removeProperty(t):i[t]=null);for(const t in e){const n=e[t];if(null!=n){this.ft.add(t);const e="string"==typeof n&&n.endsWith(m);t.includes("-")||e?i.setProperty(t,e?n.slice(0,-11):n,e?f:""):i[t]=n}}return n.c0}});var y=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};let v=class extends l.P{constructor(){super(...arguments),this.showTooltip=!1,this.thumbOffset=0,this.sliderOn=!0,this.currentValue=this.value,this.speed=2,this.range=[a.HB,a.bQ],this.step=a.RZ,this.sliderWidth=0,this.thumbWidth=0,this.sliderClass="slider ",this.resizeObserver=new ResizeObserver((t=>{for(const e of t)this.sliderWidth=e.contentRect.width,this.setThumbOffset()}))}onInput(t){const e=t.currentTarget;if(this.swiping)null==this.value&&(this.getValueFromHass=!0),this.setValue(),this.currentValue=this.value??0,this.setThumbOffset(),this.showTooltip=!1;else{clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,this.value=e.value,this.fireHapticEvent("selection");const t=parseFloat(this.oldValue??this.value??"0"),n=parseFloat(e.value??t);this.newValue=n,this.currentValue=t,this.setThumbOffset(),this.showTooltip=!0,n>this.range[0]&&(this.sliderOn=!0),clearInterval(this.intervalId),this.intervalId=void 0;let i=t;t>n?this.intervalId=setInterval((()=>{i-=this.speed,this.currentValue=i,this.setThumbOffset(),n>=i&&(clearInterval(this.intervalId),this.intervalId=void 0,this.currentValue=n,this.setThumbOffset())}),a.hI):t{i+=this.speed,this.currentValue=i,this.setThumbOffset(),n<=i&&(clearInterval(this.intervalId),this.intervalId=void 0,this.currentValue=n,this.setThumbOffset())}),a.hI)):this.currentValue=n,this.oldValue=n}}onStart(t){const e=t.currentTarget;this.swiping||(clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,this.currentValue=e.value,this.value=e.value,this.setThumbOffset(),this.showTooltip=!0,this.sliderOn=!0)}onEnd(t){this.setThumbOffset(),this.showTooltip=!1,this.setValue(),this.swiping?(this.getValueFromHass=!0,this.setValue(),this.currentValue=this.value??0,this.setThumbOffset(),this.setSliderState(this.currentValue)):(this.newValue||0==this.newValue||(this.newValue=Number(this.value)),this.precision||(this.newValue=Math.trunc(this.newValue)),this.value=this.newValue,this.fireHapticEvent("light"),this.sendAction("tap_action")),this.endAction(),this.resetGetValueFromHass()}onMove(t){let e,n;e="clientX"in t?t.clientX:t.touches[0].clientX,n="clientY"in t?t.clientY:t.touches[0].clientY,null==this.initialY&&(this.initialY=n),null==this.initialX?this.initialX=e:Math.abs(e-this.initialX)this.range[0]}buildLabel(e=this.config,n){return this.sliderOn?super.buildLabel(e,n):t.qy``}buildTooltip(){return t.qy`
`}buildSlider(e=this.config,n){const i={};"none"==this.renderTemplate(e.tap_action?.action,n)&&(i["pointer-events"]="none");const r=n.value;return t.qy``}buildSliderStyles(e){const n=`\n\t\t\t:host {\n\t\t\t\t--tooltip-label: '${this.renderTemplate("{{ value }}{{ unit }}",e)}';\n\t\t\t}\n\t\t\t${this.rtl?"\n\t\t\t.slider::-webkit-slider-thumb {\n\t\t\t\tscale: -1;\n\t\t\t}\n\t\t\t.slider::-moz-range-thumb {\n\t\t\t\tscale: -1;\n\t\t\t}\n\t\t\t":""}\n\t\t`;return t.qy``}render(){this.setValue(),this.getValueFromHass&&(this.currentValue=this.value);const e={VALUE:this.getValueFromHass?this.value:this.currentValue,value:this.getValueFromHass?this.value:this.currentValue};this.config.range&&(this.range[0]=parseFloat(this.renderTemplate(this.config.range[0],e)??a.HB),this.range[1]=parseFloat(this.renderTemplate(this.config.range[1],e)??a.bQ)),this.speed=(this.range[1]-this.range[0])/50,this.config.step?this.step=parseFloat(this.renderTemplate(this.config.step)):this.step=(this.range[1]-this.range[0])/a.zM;const n=this.step.toString().split(".");n.length>1?this.precision=n[1].length:this.precision=0;const i=this.shadowRoot?.querySelector("input");switch(this.sliderClass="slider ",this.renderTemplate(this.config.thumb)){case"line":this.sliderClass+="line-thumb",this.thumbWidth=10;break;case"flat":this.sliderClass+="flat-thumb",this.thumbWidth=16;break;case"round":if(this.sliderClass+="round-thumb",i){const t=getComputedStyle(i).getPropertyValue("height");t&&(this.thumbWidth=parseInt(t.replace(/[^0-9]+/g,"")))}break;default:this.sliderClass+="default-thumb",this.thumbWidth=12}if(this.setSliderState(e.value),this.sliderClass=`${this.sliderClass}${this.sliderOn?"":" off"}`,this.resizeObserver.observe(this.shadowRoot?.querySelector(".container")??this),i){const t=getComputedStyle(i).getPropertyValue("--thumb-width");t&&(this.thumbWidth=parseInt(t.replace(/[^0-9]+/g,"")))}return this.rtl="rtl"==getComputedStyle(this).direction,this.setThumbOffset(),this.style.setProperty("--thumb-offset",`calc(${this.rtl?"-1 * ":""}${this.thumbOffset}px)`),t.qy`
${this.buildBackground()} ${this.buildSlider(void 0,e)} ${this.buildIcon(void 0,e)} ${this.buildLabel(void 0,e)}
${this.buildTooltip()}${this.buildSliderStyles(e)} ${this.buildStyles(void 0,e)}`}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver.disconnect()}static get styles(){return[super.styles,t.AH`:host{overflow:visible;pointer-events:none;--height:var(--feature-height, 40px)}.background{background:var(--background,var(--color,var(--feature-color,var(--state-inactive-color))))}.slider{position:absolute;appearance:none;-webkit-appearance:none;-moz-appearance:none;height:inherit;background:0 0;pointer-events:all}.default-thumb,.flat-thumb,.off,.round-thumb,.slider{width:inherit;overflow:hidden;touch-action:pan-y}.line-thumb{width:calc(100% - 5px)}.default-thumb::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;height:30px;width:var(--thumb-width,12px);border-style:solid;border-width:4px;border-radius:var(--thumb-border-radius,12px);border-color:var(--color,var(--feature-color));background:#fff;cursor:pointer;opacity:var(--opacity,1);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,12px)/ 2)) 0 0 100vw var(--color,var(--feature-color)),-7px 0 0 8px var(--color,var(--feature-color)))}.default-thumb::-moz-range-thumb{appearance:none;-moz-appearance:none;height:22px;width:var(--thumb-width,4px);border-style:solid;border-width:4px;border-radius:var(--thumb-border-radius,12px);border-color:var(--color,var(--feature-color));background:#fff;cursor:pointer;opacity:var(--opacity,1);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,12px)/ 2)) 0 0 100vw var(--color,var(--feature-color)),-7px 0 0 8px var(--color,var(--feature-color)))}.flat-thumb::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;height:var(--feature-height,40px);width:var(--thumb-width,16px);background:var(--color,var(--feature-color));cursor:pointer;opacity:var(--opacity,1);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,16px)/ 2)) 0 0 100vw var(--color,var(--feature-color)));border-radius:var(--thumb-border-radius,0)}.flat-thumb::-moz-range-thumb{appearance:none;-moz-appearance:none;height:var(--feature-height,40px);width:var(--thumb-width,16px);border-color:var(--color,var(--feature-color));background:var(--color,var(--feature-color));cursor:pointer;opacity:var(--opacity,1);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,16px)/ 2)) 0 0 100vw var(--color,var(--feature-color)));border-radius:var(--thumb-border-radius,0)}.line-thumb::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;height:28px;width:var(--thumb-width,10px);border-style:solid;border-color:#fff;border-width:3px;border-radius:var(--thumb-border-radius,12px);background:#8a8c99;cursor:pointer;opacity:var(--opacity,1);box-shadow:var(--thumb-box-shadow,0 7px 0 0 #fff,0 -7px 0 0 #fff)}.line-thumb::-moz-range-thumb{appearance:none;-moz-appearance:none;height:24px;width:var(--thumb-width,4px);border-style:solid;border-color:#fff;border-width:3px;border-radius:var(--thumb-border-radius,12px);background:#8a8c99;cursor:pointer;opacity:var(--opacity,1);box-shadow:var(--thumb-box-shadow,0 7px 0 0 #fff,0 -7px 0 0 #fff)}.round-thumb::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;height:var(--height);width:var(--thumb-width,var(--height));background:var(--color,var(--feature-color));cursor:pointer;opacity:var(--opacity,1);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,var(--height))/ 2)) 0 0 100vw var(--color,var(--feature-color)));border-radius:var(--thumb-border-radius,var(--height))}.round-thumb::-moz-range-thumb{appearance:none;-moz-appearance:none;height:var(--height);width:var(--thumb-width,var(--height));border-color:var(--color,var(--feature-color));background:var(--color,var(--feature-color));cursor:pointer;opacity:var(--opacity,1);box-shadow:var(--thumb-box-shadow,calc(-100vw - (var(--thumb-width,var(--height))/ 2)) 0 0 100vw var(--color,var(--feature-color)));border-radius:var(--thumb-border-radius,var(--height))}.off::-webkit-slider-thumb{visibility:hidden}.off::-moz-range-thumb{visibility:hidden}.tooltip{background:var(--clear-background-color);color:var(--primary-text-color);position:absolute;border-radius:.8em;padding:.2em .4em;height:20px;width:fit-content;line-height:20px;transform:var(--tooltip-transform,translate(var(--thumb-offset),calc(-.5 * var(--height) - .4em - 10px)));display:var(--tooltip-display)}.faded-out{opacity:0;transition:opacity 180ms ease-in-out 0s,left 180ms ease-in-out 0s,bottom 180ms ease-in-out 0s}.faded-in{opacity:1;transition:opacity 540ms ease-in-out 0s}.tooltip::after{content:var(--tooltip-label, '0')}`]}};y([(0,e.wk)()],v.prototype,"showTooltip",void 0),y([(0,e.wk)()],v.prototype,"thumbOffset",void 0),y([(0,e.wk)()],v.prototype,"sliderOn",void 0),y([(0,e.wk)()],v.prototype,"currentValue",void 0),y([(0,e.wk)()],v.prototype,"sliderWidth",void 0),v=y([(0,e.EM)("custom-feature-slider")],v);var b=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};let _=class extends l.P{constructor(){super(...arguments),this.range=[-32768,32767],this.step=1,this.debounceTime=a.uT}onStart(t){this.swiping=!1,"targetTouches"in t?(this.initialX=t.targetTouches[0].clientX,this.initialY=t.targetTouches[0].clientY):(this.initialX=t.clientX,this.initialY=t.clientY);const e=t.currentTarget.id;if("repeat"==this.renderTemplate(this.config.hold_action?.action??"none")&&!this.holdTimer){const t=this.config.hold_action?.hold_time?this.renderTemplate(this.config[e]?.hold_action?.hold_time):500;this.holdTimer=setTimeout((()=>{if(clearTimeout(this.debounceTimer),clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1,!this.swiping){const t=this.config.hold_action?.repeat_delay?this.renderTemplate(this.config.hold_action?.repeat_delay):100;this.holdInterval||(this.holdInterval=setInterval((()=>{this.operateValue(e)}),t))}}),t)}}onEnd(t){if(clearTimeout(this.debounceTimer),!this.swiping){clearTimeout(this.getValueFromHassTimer),this.getValueFromHass=!1;const e=t.currentTarget.id;this.operateValue(e),this.debounceTimer=setTimeout((()=>{this.sendAction("tap_action"),this.resetGetValueFromHass()}),this.debounceTime)}this.endAction()}onMove(t){let e,n;"targetTouches"in t?(e=t.targetTouches[0].clientX,n=t.targetTouches[0].clientY):(e=t.clientX,n=t.clientY);const i=(this.initialX??e)-e,r=(this.initialY??n)-n;Math.abs(Math.abs(i)-Math.abs(r))>8&&(this.endAction(),clearTimeout(this.debounceTimer),this.swiping=!0,this.getValueFromHass=!0,this.setValue())}operateValue(t){const e=parseFloat(this.value??this.range[0]);let n=this.value;switch(t){case"increment":n=e+this.step;break;case"decrement":n=e-this.step}this.value=Math.min(Math.max(n,this.range[0]),this.range[1]),this.fireHapticEvent("selection")}endAction(){clearTimeout(this.holdTimer),clearTimeout(this.holdInterval),this.holdTimer=void 0,this.holdInterval=void 0,super.endAction()}buildButton(e){const n=this.config[e]??{};return n.icon||(n.icon="increment"==e?"mdi:plus":"mdi:minus"),n.haptics=n.haptics??this.config.haptics,"none"==this.renderTemplate(n?.tap_action?.action??"none")&&"none"==this.renderTemplate(n?.double_tap_action?.action??"none")&&["none","repeat"].includes(this.renderTemplate(n?.hold_action?.action??"none"))&&"none"==this.renderTemplate(n?.momentary_start_action?.action??"none")&&"none"==this.renderTemplate(n?.momentary_end_action?.action??"none")?t.qy``:t.qy``}buildLabel(e=this.config,n){return null!=this.value?super.buildLabel(e,n):t.qy``}buildSpinboxStyles(){const e=`\n\t\t\t${this.rtl?"\n\t\t\t#decrement {\n\t\t\t\tleft: unset !important;\n\t\t\t\tright: 0 !important;\n\t\t\t}\n\n\t\t\t#increment {\n\t\t\t\tleft: 0 !important;\n\t\t\t\tright: unset !important;\n\t\t\t}\n\t\t\t":""}\n\t\t`;return t.qy``}render(){this.setValue(),this.config.range&&(this.range=[parseFloat(this.renderTemplate(this.config.range[0])),parseFloat(this.renderTemplate(this.config.range[1]))]),this.config.step&&(this.step=parseFloat(this.renderTemplate(this.config.step)));const e=this.step.toString().split(".");return e.length>1?this.precision=e[1].length:this.precision=0,this.config.debounce_time&&(this.debounceTime=parseFloat(this.renderTemplate(this.config.debounce_time))),this.rtl="rtl"==getComputedStyle(this).direction,t.qy`${this.buildBackground()}${this.buildButton("decrement")} ${this.buildIcon()}${this.buildLabel()} ${this.buildButton("increment")}${this.buildSpinboxStyles()}${this.buildStyles()}`}static get styles(){return[super.styles,t.AH`:host{place-content:center}.icon-label-container{display:flex;flex-flow:column;align-items:center}.icon{opacity:.77}.label{width:fit-content;font-size:14px;font-weight:500;opacity:.77}.button{position:absolute;background:0 0;cursor:pointer;display:flex;flex-flow:column;place-content:center space-evenly;align-items:center;height:inherit;width:initial;border:none;padding:10px;color:inherit;--mdc-icon-size:16px}.button::before{display:none!important}.operator{font-size:14px;font-weight:500;opacity:.77;position:absolute;width:fit-content;padding:0 10px;cursor:pointer;--mdc-icon-size:16px;--background-opacity:0}#decrement{left:0}#increment{right:0}custom-feature-button{position:absolute;min-width:36px;width:min-content;padding:0 10px;--opacity:0;--color:rgb(0, 0, 0, 0);--mdc-icon-size:16px}`]}};_=b([(0,e.EM)("custom-feature-spinbox")],_);let w=class extends l.P{render(){return t.qy`${this.buildBackground()}${this.buildIcon()}${super.buildLabel()} ${this.buildStyles()}`}};function x(t){return null==t}w=b([(0,e.EM)("custom-feature-spinbox-operator-button")],w);var E={isNothing:x,isObject:function(t){return"object"==typeof t&&null!==t},toArray:function(t){return Array.isArray(t)?t:x(t)?[]:[t]},repeat:function(t,e){var n,i="";for(n=0;na&&(e=i-a+(o=" ... ").length),n-i>a&&(n=i+a-(s=" ...").length),{str:o+t.slice(e,n).replace(/\t/g,"→")+s,pos:i-e+o.length}}function S(t,e){return E.repeat(" ",e-t.length)+t}var C=function(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),"number"!=typeof e.indent&&(e.indent=1),"number"!=typeof e.linesBefore&&(e.linesBefore=3),"number"!=typeof e.linesAfter&&(e.linesAfter=2);for(var n,i=/\r?\n|\r|\0/g,r=[0],o=[],s=-1;n=i.exec(t.buffer);)o.push(n.index),r.push(n.index+n[0].length),t.position<=n.index&&s<0&&(s=r.length-2);s<0&&(s=r.length-1);var a,l,c="",u=Math.min(t.line+e.linesAfter,o.length).toString().length,h=e.maxLength-(e.indent+u+3);for(a=1;a<=e.linesBefore&&!(s-a<0);a++)l=O(t.buffer,r[s-a],o[s-a],t.position-(r[s]-r[s-a]),h),c=E.repeat(" ",e.indent)+S((t.line-a+1).toString(),u)+" | "+l.str+"\n"+c;for(l=O(t.buffer,r[s],o[s],t.position,h),c+=E.repeat(" ",e.indent)+S((t.line+1).toString(),u)+" | "+l.str+"\n",c+=E.repeat("-",e.indent+u+3+l.pos)+"^\n",a=1;a<=e.linesAfter&&!(s+a>=o.length);a++)l=O(t.buffer,r[s+a],o[s+a],t.position-(r[s]-r[s+a]),h),c+=E.repeat(" ",e.indent)+S((t.line+a+1).toString(),u)+" | "+l.str+"\n";return c.replace(/\n$/,"")},$=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],M=["scalar","sequence","mapping"],L=function(t,e){if(e=e||{},Object.keys(e).forEach((function(e){if(-1===$.indexOf(e))throw new A('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=function(t){var e={};return null!==t&&Object.keys(t).forEach((function(n){t[n].forEach((function(t){e[String(t)]=n}))})),e}(e.styleAliases||null),-1===M.indexOf(this.kind))throw new A('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function I(t,e){var n=[];return t[e].forEach((function(t){var e=n.length;n.forEach((function(n,i){n.tag===t.tag&&n.kind===t.kind&&n.multi===t.multi&&(e=i)})),n[e]=t})),n}function N(t){return this.extend(t)}N.prototype.extend=function(t){var e=[],n=[];if(t instanceof L)n.push(t);else if(Array.isArray(t))n=n.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new A("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(e=e.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit))}e.forEach((function(t){if(!(t instanceof L))throw new A("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new A("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new A("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(t){if(!(t instanceof L))throw new A("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(N.prototype);return i.implicit=(this.implicit||[]).concat(e),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=I(i,"implicit"),i.compiledExplicit=I(i,"explicit"),i.compiledTypeMap=function(){var t,e,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(t){t.multi?(n.multi[t.kind].push(t),n.multi.fallback.push(t)):n[t.kind][t.tag]=n.fallback[t.tag]=t}for(t=0,e=arguments.length;t=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),B=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),H=/^[-+]?[0-9]+e/,V=new L("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!B.test(t)||"_"===t[t.length-1])},construct:function(t){var e,n;return n="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:n*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||E.isNegativeZero(t))},represent:function(t,e){var n;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(E.isNegativeZero(t))return"-0.0";return n=t.toString(10),H.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),K=j.extend({implicit:[F,P,U,V]}),q=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Y=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),W=new L("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==q.exec(t)||null!==Y.exec(t))},construct:function(t){var e,n,i,r,o,s,a,l,c=0,u=null;if(null===(e=q.exec(t))&&(e=Y.exec(t)),null===e)throw new Error("Date resolve error");if(n=+e[1],i=+e[2]-1,r=+e[3],!e[4])return new Date(Date.UTC(n,i,r));if(o=+e[4],s=+e[5],a=+e[6],e[7]){for(c=e[7].slice(0,3);c.length<3;)c+="0";c=+c}return e[9]&&(u=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(u=-u)),l=new Date(Date.UTC(n,i,r,o,s,a,c)),u&&l.setTime(l.getTime()-u),l},instanceOf:Date,represent:function(t){return t.toISOString()}}),z=new L("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}}),G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",X=new L("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,n,i=0,r=t.length,o=G;for(n=0;n64)){if(e<0)return!1;i+=6}return i%8==0},construct:function(t){var e,n,i=t.replace(/[\r\n=]/g,""),r=i.length,o=G,s=0,a=[];for(e=0;e>16&255),a.push(s>>8&255),a.push(255&s)),s=s<<6|o.indexOf(i.charAt(e));return 0==(n=r%4*6)?(a.push(s>>16&255),a.push(s>>8&255),a.push(255&s)):18===n?(a.push(s>>10&255),a.push(s>>2&255)):12===n&&a.push(s>>4&255),new Uint8Array(a)},predicate:function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function(t){var e,n,i="",r=0,o=t.length,s=G;for(e=0;e>18&63],i+=s[r>>12&63],i+=s[r>>6&63],i+=s[63&r]),r=(r<<8)+t[e];return 0==(n=o%3)?(i+=s[r>>18&63],i+=s[r>>12&63],i+=s[r>>6&63],i+=s[63&r]):2===n?(i+=s[r>>10&63],i+=s[r>>4&63],i+=s[r<<2&63],i+=s[64]):1===n&&(i+=s[r>>2&63],i+=s[r<<4&63],i+=s[64],i+=s[64]),i}}),Z=Object.prototype.hasOwnProperty,J=Object.prototype.toString,Q=new L("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,n,i,r,o,s=[],a=t;for(e=0,n=a.length;e>10),56320+(t-65536&1023))}for(var At=new Array(256),Ot=new Array(256),St=0;St<256;St++)At[St]=kt(St)?1:0,Ot[St]=kt(St);function Ct(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||rt,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function $t(t,e){var n={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return n.snippet=C(n),new A(e,n)}function Mt(t,e){throw $t(t,e)}function Lt(t,e){t.onWarning&&t.onWarning.call(null,$t(t,e))}var It={YAML:function(t,e,n){var i,r,o;null!==t.version&&Mt(t,"duplication of %YAML directive"),1!==n.length&&Mt(t,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&Mt(t,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&Mt(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=o<2,1!==o&&2!==o&&Lt(t,"unsupported YAML version of the document")},TAG:function(t,e,n){var i,r;2!==n.length&&Mt(t,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],gt.test(i)||Mt(t,"ill-formed tag handle (first argument) of the TAG directive"),ot.call(t.tagMap,i)&&Mt(t,'there is a previously declared suffix for "'+i+'" tag handle'),yt.test(r)||Mt(t,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(e){Mt(t,"tag prefix is malformed: "+r)}t.tagMap[i]=r}};function Nt(t,e,n,i){var r,o,s,a;if(e1&&(t.result+=E.repeat("\n",e-1))}function Bt(t,e){var n,i,r=t.tag,o=t.anchor,s=[],a=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=s),i=t.input.charCodeAt(t.position);0!==i&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,Mt(t,"tab characters must not be used in indentation")),45===i)&&wt(t.input.charCodeAt(t.position+1));)if(a=!0,t.position++,Dt(t,!0,-1)&&t.lineIndent<=e)s.push(null),i=t.input.charCodeAt(t.position);else if(n=t.line,Kt(t,e,lt,!1,!0),s.push(t.result),Dt(t,!0,-1),i=t.input.charCodeAt(t.position),(t.line===n||t.lineIndent>e)&&0!==i)Mt(t,"bad indentation of a sequence entry");else if(t.lineIndente?f=1:t.lineIndent===e?f=0:t.lineIndente?f=1:t.lineIndent===e?f=0:t.lineIndente)&&(y&&(s=t.line,a=t.lineStart,l=t.position),Kt(t,e,ct,!0,r)&&(y?m=t.result:g=t.result),y||(Ft(t,p,d,f,m,g,s,a,l),f=m=g=null),Dt(t,!0,-1),c=t.input.charCodeAt(t.position)),(t.line===o||t.lineIndent>e)&&0!==c)Mt(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===r?Mt(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?Mt(t,"repeat of an indentation width identifier"):(u=e+r-1,c=!0)}if(_t(o)){do{o=t.input.charCodeAt(++t.position)}while(_t(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!bt(o)&&0!==o)}for(;0!==o;){for(Pt(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!c||t.lineIndentu&&(u=t.lineIndent),bt(o))h++;else{if(t.lineIndent0){for(r=s,o=0;r>0;r--)(s=Et(a=t.input.charCodeAt(++t.position)))>=0?o=(o<<4)+s:Mt(t,"expected hexadecimal character");t.result+=Tt(o),t.position++}else Mt(t,"unknown escape sequence");n=i=t.position}else bt(a)?(Nt(t,n,i,!0),Ut(t,Dt(t,!1,e)),n=i=t.position):t.position===t.lineStart&&Rt(t)?Mt(t,"unexpected end of the document within a double quoted scalar"):(t.position++,i=t.position)}Mt(t,"unexpected end of the stream within a double quoted scalar")}(t,p)?g=!0:function(t){var e,n,i;if(42!==(i=t.input.charCodeAt(t.position)))return!1;for(i=t.input.charCodeAt(++t.position),e=t.position;0!==i&&!wt(i)&&!xt(i);)i=t.input.charCodeAt(++t.position);return t.position===e&&Mt(t,"name of an alias node must contain at least one character"),n=t.input.slice(e,t.position),ot.call(t.anchorMap,n)||Mt(t,'unidentified alias "'+n+'"'),t.result=t.anchorMap[n],Dt(t,!0,-1),!0}(t)?(g=!0,null===t.tag&&null===t.anchor||Mt(t,"alias node should not have any properties")):function(t,e,n){var i,r,o,s,a,l,c,u,h=t.kind,p=t.result;if(wt(u=t.input.charCodeAt(t.position))||xt(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(wt(i=t.input.charCodeAt(t.position+1))||n&&xt(i)))return!1;for(t.kind="scalar",t.result="",r=o=t.position,s=!1;0!==u;){if(58===u){if(wt(i=t.input.charCodeAt(t.position+1))||n&&xt(i))break}else if(35===u){if(wt(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&Rt(t)||n&&xt(u))break;if(bt(u)){if(a=t.line,l=t.lineStart,c=t.lineIndent,Dt(t,!1,-1),t.lineIndent>=e){s=!0,u=t.input.charCodeAt(t.position);continue}t.position=o,t.line=a,t.lineStart=l,t.lineIndent=c;break}}s&&(Nt(t,r,o,!1),Ut(t,t.line-a),r=o=t.position,s=!1),_t(u)||(o=t.position+1),u=t.input.charCodeAt(++t.position)}return Nt(t,r,o,!1),!!t.result||(t.kind=h,t.result=p,!1)}(t,p,st===n)&&(g=!0,null===t.tag&&(t.tag="?")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===f&&(g=a&&Bt(t,d))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&Mt(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),l=0,c=t.implicitTypes.length;l"),null!==t.result&&h.kind!==t.kind&&Mt(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+h.kind+'", not "'+t.kind+'"'),h.resolve(t.result,t.tag)?(t.result=h.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):Mt(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||g}function qt(t){var e,n,i,r,o=t.position,s=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(r=t.input.charCodeAt(t.position))&&(Dt(t,!0,-1),r=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==r));){for(s=!0,r=t.input.charCodeAt(++t.position),e=t.position;0!==r&&!wt(r);)r=t.input.charCodeAt(++t.position);for(i=[],(n=t.input.slice(e,t.position)).length<1&&Mt(t,"directive name must not be less than one character in length");0!==r;){for(;_t(r);)r=t.input.charCodeAt(++t.position);if(35===r){do{r=t.input.charCodeAt(++t.position)}while(0!==r&&!bt(r));break}if(bt(r))break;for(e=t.position;0!==r&&!wt(r);)r=t.input.charCodeAt(++t.position);i.push(t.input.slice(e,t.position))}0!==r&&Pt(t),ot.call(It,n)?It[n](t,n,i):Lt(t,'unknown document directive "'+n+'"')}Dt(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,Dt(t,!0,-1)):s&&Mt(t,"directives end mark is expected"),Kt(t,t.lineIndent-1,ct,!1,!0),Dt(t,!0,-1),t.checkLineBreaks&&ft.test(t.input.slice(o,t.position))&&Lt(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&Rt(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,Dt(t,!0,-1)):t.position=55296&&i<=56319&&e+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function Ne(t){return/^\n* /.test(t)}var je=1,Fe=2,Pe=3,De=4,Re=5;function Ue(t,e,n,i,r){t.dump=function(){if(0===e.length)return t.quotingType===Te?'""':"''";if(!t.noCompatMode&&(-1!==xe.indexOf(e)||Ee.test(e)))return t.quotingType===Te?'"'+e+'"':"'"+e+"'";var o=t.indent*Math.max(1,n),s=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),a=i||t.flowLevel>-1&&n>=t.flowLevel;switch(function(t,e,n,i,r,o,s,a){var l,c,u=0,h=null,p=!1,d=!1,f=-1!==i,m=-1,g=$e(c=Ie(t,0))&&c!==Xt&&!Ce(c)&&c!==ce&&c!==de&&c!==ue&&c!==le&&c!==me&&c!==ge&&c!==ve&&c!==_e&&c!==ie&&c!==oe&&c!==ae&&c!==ee&&c!==be&&c!==he&&c!==pe&&c!==se&&c!==ne&&c!==re&&c!==fe&&c!==ye&&function(t){return!Ce(t)&&t!==ue}(Ie(t,t.length-1));if(e||s)for(l=0;l=65536?l+=2:l++){if(!$e(u=Ie(t,l)))return Re;g=g&&Le(u,h,a),h=u}else{for(l=0;l=65536?l+=2:l++){if((u=Ie(t,l))===Jt)p=!0,f&&(d=d||l-m-1>i&&" "!==t[m+1],m=l);else if(!$e(u))return Re;g=g&&Le(u,h,a),h=u}d=d||f&&l-m-1>i&&" "!==t[m+1]}return p||d?n>9&&Ne(t)?Re:s?o===Te?Re:Fe:d?De:Pe:!g||s||r(t)?o===Te?Re:Fe:je}(e,a,t.indent,s,(function(e){return function(t,e){var n,i;for(n=0,i=t.implicitTypes.length;n"+Be(e,t.indent)+He(Oe(function(t,e){for(var n,i,r,o=/(\n+)([^\n]*)/g,s=(r=-1!==(r=t.indexOf("\n"))?r:t.length,o.lastIndex=r,Ve(t.slice(0,r),e)),a="\n"===t[0]||" "===t[0];i=o.exec(t);){var l=i[1],c=i[2];n=" "===c[0],s+=l+(a||n||""===c?"":"\n")+Ve(c,e),a=n}return s}(e,s),o));case Re:return'"'+function(t){for(var e,n="",i=0,r=0;r=65536?r+=2:r++)i=Ie(t,r),!(e=we[i])&&$e(i)?(n+=t[r],i>=65536&&(n+=t[r+1])):n+=e||ke(i);return n}(e)+'"';default:throw new A("impossible error: invalid scalar style")}}()}function Be(t,e){var n=Ne(t)?String(e):"",i="\n"===t[t.length-1];return n+(!i||"\n"!==t[t.length-2]&&"\n"!==t?i?"":"-":"+")+"\n"}function He(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function Ve(t,e){if(""===t||" "===t[0])return t;for(var n,i,r=/ [^ ]/g,o=0,s=0,a=0,l="";n=r.exec(t);)(a=n.index)-o>e&&(i=s>o?s:a,l+="\n"+t.slice(o,i),o=i+1),s=a;return l+="\n",t.length-o>e&&s>o?l+=t.slice(o,s)+"\n"+t.slice(s+1):l+=t.slice(o),l.slice(1)}function Ke(t,e,n,i){var r,o,s,a="",l=t.tag;for(r=0,o=n.length;r tag resolver accepts not "'+l+'" style');i=a.represent[l](e,l)}t.dump=i}return!0}return!1}function Ye(t,e,n,i,r,o,s){t.tag=null,t.dump=n,qe(t,n,!1)||qe(t,n,!0);var a,l=zt.call(t.dump),c=i;i&&(i=t.flowLevel<0||t.flowLevel>e);var u,h,p="[object Object]"===l||"[object Array]"===l;if(p&&(h=-1!==(u=t.duplicates.indexOf(n))),(null!==t.tag&&"?"!==t.tag||h||2!==t.indent&&e>0)&&(r=!1),h&&t.usedDuplicates[u])t.dump="*ref_"+u;else{if(p&&h&&!t.usedDuplicates[u]&&(t.usedDuplicates[u]=!0),"[object Object]"===l)i&&0!==Object.keys(t.dump).length?(function(t,e,n,i){var r,o,s,a,l,c,u="",h=t.tag,p=Object.keys(n);if(!0===t.sortKeys)p.sort();else if("function"==typeof t.sortKeys)p.sort(t.sortKeys);else if(t.sortKeys)throw new A("sortKeys must be a boolean or a function");for(r=0,o=p.length;r1024)&&(t.dump&&Jt===t.dump.charCodeAt(0)?c+="?":c+="? "),c+=t.dump,l&&(c+=Se(t,e)),Ye(t,e+1,a,!0,l)&&(t.dump&&Jt===t.dump.charCodeAt(0)?c+=":":c+=": ",u+=c+=t.dump));t.tag=h,t.dump=u||"{}"}(t,e,t.dump,r),h&&(t.dump="&ref_"+u+t.dump)):(function(t,e,n){var i,r,o,s,a,l="",c=t.tag,u=Object.keys(n);for(i=0,r=u.length;i1024&&(a+="? "),a+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),Ye(t,e,s,!1,!1)&&(l+=a+=t.dump));t.tag=c,t.dump="{"+l+"}"}(t,e,t.dump),h&&(t.dump="&ref_"+u+" "+t.dump));else if("[object Array]"===l)i&&0!==t.dump.length?(t.noArrayIndent&&!s&&e>0?Ke(t,e-1,t.dump,r):Ke(t,e,t.dump,r),h&&(t.dump="&ref_"+u+t.dump)):(function(t,e,n){var i,r,o,s="",a=t.tag;for(i=0,r=n.length;i",t.dump=a+" "+t.dump)}return!0}function We(t,e){var n,i,r=[],o=[];for(ze(t,r,o),n=0,i=o.length;n=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};class on extends t.WF{constructor(){super(...arguments),this.entryIndex=-1,this.actionsTabIndex=0,this.optionIndex=-1,this.spinboxTabIndex=1,this.guiMode=!0,this.yamlStringsCache={},this.activeEntryType="entry",this.people=[]}static get properties(){return{hass:{},config:{}}}setConfig(t){this.config=t}configChanged(t){t=this.autofillDefaultFields(t);const e=new Event("config-changed",{bubbles:!0,composed:!0});e.detail={config:t},this.dispatchEvent(e),this.requestUpdate()}entriesChanged(t){this.configChanged({...this.config,entries:t})}entryChanged(t){const e=structuredClone(this.config.entries),n=e[this.entryIndex];let i;switch(this.activeEntryType){case"option":{const e=n.options??[],r=e[this.optionIndex];e[this.optionIndex]={...r,...t},i={...n,options:e};break}case"decrement":i={...n,decrement:{...n.decrement,...t}};break;case"increment":i={...n,increment:{...n.increment,...t}};break;default:i={...n,...t}}e[this.entryIndex]=i,this.entriesChanged(e)}moveEntry(t){t.stopPropagation();const{oldIndex:e,newIndex:n}=t.detail,i=structuredClone(this.config.entries);i.splice(n,0,i.splice(e,1)[0]),this.entriesChanged(i)}moveOption(t){t.stopPropagation();const{oldIndex:e,newIndex:n}=t.detail,i=structuredClone(this.activeEntry),r=i.options??[];r.splice(n,0,r.splice(e,1)[0]),i.options=r,this.entryChanged(i)}copyEntry(t){const e=structuredClone(this.config.entries),n=t.currentTarget.index,i=structuredClone(e[n]);e.splice(n,1,e[n],i),this.entriesChanged(e)}copyOption(t){const e=structuredClone(this.activeEntry),n=structuredClone(e.options)??[],i=t.currentTarget.index,r=structuredClone(n[i]);n.splice(i,1,n[i],r),e.options=n,this.entryChanged(e)}editEntry(t){this.yamlStringsCache={},this.yamlString=void 0;const e=t.currentTarget.index;this.activeEntryType="entry",this.actionsTabIndex=e>-1&&("none"!=this.renderTemplate(this.config.entries[e].momentary_start_action?.action??"none",this.getEntryContext(this.config.entries[e]))||"none"!=this.renderTemplate(this.config.entries[e].momentary_end_action?.action??"none",this.getEntryContext(this.config.entries[e])))?1:0,this.optionIndex=-1,this.spinboxTabIndex=1,this.entryIndex=e}editOption(t){this.yamlStringsCache={},this.yamlString=void 0;const e=t.currentTarget.index;this.activeEntryType="option",this.actionsTabIndex=e>-1&&("none"!=this.renderTemplate(this.config.entries[this.entryIndex].options?.[e]?.momentary_start_action?.action??"none",this.getEntryContext(this.config.entries[this.entryIndex].options?.[e]))||"none"!=this.renderTemplate(this.config.entries[this.entryIndex].options?.[e]?.momentary_end_action?.action??"none",this.getEntryContext(this.config.entries[this.entryIndex].options?.[e])))?1:0,this.optionIndex=e}removeEntry(t){const e=t.currentTarget.index,n=structuredClone(this.config.entries);n.splice(e,1),this.entriesChanged(n)}removeOption(t){const e=t.currentTarget.index,n=structuredClone(this.activeEntry),i=n.options??[];i.splice(e,1),n.options=i,this.entryChanged(n)}addEntry(t){const e=t.detail.index,n=structuredClone(this.config.entries);n.push({type:Je[e]}),this.entriesChanged(n)}addOption(t){const e=structuredClone(this.activeEntry),n=e.options??[];n.push({}),e.options=n,this.entryChanged(e)}exitEditEntry(t){this.activeEntryType="entry",this.yamlStringsCache={},this.yamlString=void 0,this.entryIndex=-1}exitEditOption(t){this.activeEntryType="entry",this.yamlStringsCache={},this.yamlString=void 0,this.optionIndex=-1}toggleGuiMode(t){this.yamlString=void 0,this.configChanged(this.config),this.guiMode=!this.guiMode}get activeEntry(){if(this.entryIndex<0)return;const t=this.config.entries[this.entryIndex];switch(this.activeEntryType){case"decrement":return t.decrement??{};case"increment":return t.increment??{};case"option":return t.options?.[this.optionIndex]??{};default:return this.config.entries[this.entryIndex]??{}}}get yaml(){if(null==this.yamlString&&this.entryIndex>-1){const t=Ze(this.activeEntry);this.yamlString="{}"==t.trim()?"":t}return this.yamlString||""}set yaml(t){this.yamlString=t;try{this.entryChanged(Xe(this.yaml)),this.errors=void 0}catch(t){this.errors=[t.message]}}handleYamlCodeChanged(t){t.stopPropagation();const e=t.detail.value;e!=this.yaml&&(this.yaml=e)}handleStyleCodeChanged(t){t.stopPropagation();const e=t.detail.value;this.entryIndex>-1?e!=this.activeEntry?.styles&&this.entryChanged({styles:e}):e!=this.config.styles&&this.configChanged({...this.config,styles:e})}handleActionCodeChanged(t){t.stopPropagation();const e=t.target.id,n=t.detail.value;if(this.yamlStringsCache[e]=n,this.activeEntry)try{const t=Xe(n);if(JSON.stringify(t??{}).includes("null"))return;this.entryChanged({[e]:t}),this.errors=void 0}catch(t){this.errors=[t.message]}}handleEvalCodeChanged(t){t.stopPropagation();const e=t.target.id,n=t.detail.value;this.activeEntry&&this.entryChanged({[e]:{...this.activeEntry[e],eval:n}})}handleSpinboxTabSelected(t){this.yamlStringsCache={},this.yamlString=void 0;const e=t.detail.index;switch(e){case 0:this.activeEntryType="decrement";break;case 2:this.activeEntryType="increment";break;default:this.activeEntryType="entry"}e!=this.spinboxTabIndex&&(this.spinboxTabIndex=e)}handleActionsTabSelected(t){this.yamlStringsCache={};const e=t.detail.index;this.actionsTabIndex!=e&&(this.actionsTabIndex=e)}handleSelectorChange(t){this.yamlStringsCache={};const e=t.target.id;let n=t.detail.value;e.endsWith(".confirmation.exemptions")&&(n=(n??[]).map((t=>({user:t})))),this.entryChanged((0,nn.HD)(structuredClone(this.activeEntry),e,n))}buildEntryList(e="entry"){let n,i,r;return"option"===e?(n=this.activeEntry?.options??[],i={move:this.moveOption,copy:this.copyOption,edit:this.editOption,remove:this.removeOption},r="dropdown"===((0,s.X)(this.hass,this.activeEntry?.type,this.getEntryContext(this.activeEntry??{}))??"selector").toLowerCase()?"Dropdown Options":"Selector Options"):(n=this.config.entries,i={move:this.moveEntry,copy:this.copyEntry,edit:this.editEntry,remove:this.removeEntry},r="Custom Features"),t.qy`
${r}
${n.map(((n,r)=>{const o=this.getEntryContext(n),s=this.renderTemplate(n.icon,o),a=this.renderTemplate(n.label,o),l=this.renderTemplate(n.option,o),c=this.renderTemplate(n.type,o);return t.qy`
${s?t.qy``:""}
${l??("option"==e?"Option":c)}${a?` ⸱ ${a}`:""} ${o.config.entity?t.qy`${o.config.entity_id}${o.config.attribute?` ⸱ ${o.config.attribute}`:""}`:""}
`}))}
`}buildAddEntryButton(e="entry"){return"option"===e?t.qy``:t.qy`${Je.map((e=>t.qy`${e}`))}`}buildEntryHeader(){let e,n;switch(this.activeEntryType){case"option":e="dropdown"===((0,s.X)(this.hass,this.config.entries[this.entryIndex]?.type,this.getEntryContext(this.activeEntry??{}))??"selector").toLowerCase()?"Dropdown Option":"Selector Option",n=this.exitEditOption;break;case"decrement":e="Spinbox (Decrement)",n=this.exitEditEntry;break;case"increment":e="Spinbox (Increment)",n=this.exitEditEntry;break;default:e=this.config.entries[this.entryIndex].type??"Button",n=this.exitEditEntry}return t.qy`
${e}
`}buildSelector(e,n,i,r){const o={...this.hass,localize:(t,e)=>({"ui.panel.lovelace.editor.action-editor.actions.repeat":"Repeat","ui.panel.lovelace.editor.action-editor.actions.fire-dom-event":"Fire DOM event","ui.panel.lovelace.editor.action-editor.actions.eval":"Evaluate JS"}[t]??this.hass.localize(t,e))};let s=(0,nn.vz)(this.activeEntry,n);return n.endsWith(".confirmation.exemptions")&&(s=(s??[]).map((t=>t.user))),t.qy``}buildMainFeatureOptions(){return t.qy`${this.buildSelector("Entity","entity_id",{entity:{}})} ${this.hass.states[this.activeEntry?.entity_id??""]?this.buildSelector("Attribute","value_attribute",{attribute:{entity_id:this.activeEntry?.entity_id}},"state"):""}`}buildAppearancePanel(e=t.qy``){return t.qy`
Appearance
${this.buildAlertBox("Change the feature appearance based on its value using a template like '{{ value | float }}'.")} ${e}${this.buildCodeEditor("jinja2")}
`}buildCommonAppearanceOptions(){return t.qy`${this.buildSelector("Label","label",{text:{multiline:!0}})}
${this.buildSelector("Icon","icon",{icon:{}})}${this.buildSelector("Units","unit_of_measurement",{text:{}})}
`}buildInteractionsPanel(e){return t.qy`
Interactions
${e}
`}buildActionOption(e,n,i,r=!1){const o=this.getEntryContext(this.activeEntry),s=this.renderTemplate(this.activeEntry?.[n]?.action??"none",o);return t.qy`
${this.buildSelector(e,n,i)} ${"none"!=s&&"double_tap_action"==n?this.buildSelector("Double tap window","double_tap_action.double_tap_window",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},a.jc):"hold_action"==n&&this.activeEntry?.hold_action?t.qy`
${this.buildSelector("Hold time","hold_action.hold_time",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},a.At)} ${"repeat"==this.renderTemplate(this.activeEntry?.hold_action?.action,o)?this.buildSelector("Repeat delay","hold_action.repeat_delay",{number:{min:0,step:0,mode:"box",unit_of_measurement:"ms"}},a.a3):""}
`:""} ${"more-info"==s?this.buildSelector("Entity",`${n}.target.entity_id`,{entity:{}}):""} ${"toggle"==s?this.buildSelector("Target",`${n}.target`,{target:{}}):""} ${r||"fire-dom-event"==s?this.buildCodeEditor("action",n):""} ${"eval"==s?t.qy`${this.buildAlertBox("Evaluating raw JavaScript strings in browser is considered extremely unsafe. Do not use unless you know what you're doing!","warning")} ${this.buildCodeEditor("eval",n)}`:""} ${"none"!=s?t.qy`${this.buildSelector("Confirmation",`${n}.confirmation`,{boolean:{}},!1)} ${this.activeEntry?.[n]?.confirmation?t.qy`${this.buildSelector("Text",`${n}.confirmation.text`,{text:{}})} ${this.buildSelector("Exemptions",`${n}.confirmation.exemptions`,{select:{multiple:!0,mode:"list",options:this.people,reorder:!1}})}`:""}`:""}
`}buildButtonGuiEditor(e){const n=t.qy``;let i;const r=tn.concat();r.splice(tn.indexOf("repeat"),1);const o={ui_action:{actions:r,default_action:"none"}};return i=1===this.actionsTabIndex?t.qy`${n} ${this.buildActionOption("Start behavior (optional)","momentary_start_action",o)} ${this.buildAlertBox("Set the action below, and then use the code editor to set a data field to the seconds the feature was held down using a template like '{{ hold_secs | float }}'.")} ${this.buildActionOption("End behavior (optional)","momentary_end_action",o,!0)}`:t.qy`${n} ${this.buildActionOption("Tap behavior (optional)","tap_action",o)} ${this.buildActionOption("Double tap behavior (optional)","double_tap_action",o)} ${this.buildActionOption("Hold behavior (optional)","hold_action",{ui_action:{actions:tn,default_action:"none"}})}`,t.qy`${this.buildMainFeatureOptions()}
${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},e?.autofill_entity_id??a.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},e?.haptics??a.Xy)}
${this.buildAppearancePanel(t.qy`${this.buildCommonAppearanceOptions()}`)} ${this.buildInteractionsPanel(i)}`}buildSliderGuiEditor(){const e=tn.concat();e.splice(tn.indexOf("repeat"),1);const n=this.getEntryContext(this.activeEntry),i=this.renderTemplate(this.activeEntry?.range?.[0],n),r=this.renderTemplate(this.activeEntry?.range?.[0],n),o=this.renderTemplate(this.activeEntry?.step,n)??a.RZ,s=this.renderTemplate(this.activeEntry?.unit_of_measurement,n);return t.qy`${this.buildMainFeatureOptions()}
${this.buildSelector("Min","range.0",{number:{max:r??void 0,step:o,mode:"box",unit_of_measurement:s}})} ${this.buildSelector("Max","range.1",{number:{min:i??void 0,step:o,mode:"box",unit_of_measurement:s}})} ${this.buildSelector("Step","step",{number:{min:0,step:o??Math.min(1,((this.activeEntry?.range?.[1]??1)-(this.activeEntry?.range?.[0]??0))/100),mode:"box",unit_of_measurement:s}})} ${this.buildSelector("Update after action delay","value_from_hass_delay",{number:{min:0,step:1,mode:"box",unit_of_measurement:"ms"}},a.s$)} ${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},a.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},a.Xy)}
${this.buildAppearancePanel(t.qy`${this.buildCommonAppearanceOptions()} ${this.buildSelector("Thumb type","thumb",{select:{mode:"dropdown",options:Qe,reorder:!1}},"default")}`)} ${this.buildInteractionsPanel(t.qy`${this.buildAlertBox()} ${this.buildActionOption("Behavior","tap_action",{ui_action:{actions:e,default_action:"perform-action"}},!0)}`)}`}buildDropdownSelectorGuiEditor(e){let n;if(-1===this.optionIndex)n=t.qy`${this.buildMainFeatureOptions()} ${this.buildSelector("Update after action delay","value_from_hass_delay",{number:{min:0,step:1,mode:"box",unit_of_measurement:"ms"}},a.s$)}
${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},a.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},a.Xy)}
${this.buildEntryList("option")}${this.buildAddEntryButton("option")}
${this.buildCodeEditor("jinja2")}`;else{let i;i="dropdown"===e?this.buildDropdownOptionGuiEditor(this.config.entries[this.entryIndex]):this.buildButtonGuiEditor(this.config.entries[this.entryIndex]),n=t.qy`${this.buildSelector("Option","option",{text:{}})} ${i}`}return n}buildDropdownOptionGuiEditor(e){let n;const i=tn.concat();i.splice(tn.indexOf("repeat"),1);const r={ui_action:{actions:i,default_action:"none"}};return n=t.qy`${this.buildActionOption("Behavior","tap_action",r)}`,t.qy`${this.buildMainFeatureOptions()}
${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},e?.autofill_entity_id??a.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},e?.haptics??a.Xy)}
${this.buildAppearancePanel(t.qy`${this.buildCommonAppearanceOptions()}`)} ${this.buildInteractionsPanel(n)}`}buildSpinboxGuiEditor(){const e=tn.concat();e.splice(tn.indexOf("repeat"),1);const n={ui_action:{actions:e,default_action:"perform-action"}},i=t.qy`${this.buildAlertBox()} ${this.buildActionOption("Tap behavior","tap_action",n,!0)} ${this.buildActionOption("Hold behavior (optional)","hold_action",{ui_action:{actions:["repeat","none"],default_action:"none"}})}`,r=t.qy``;let o;switch(this.spinboxTabIndex){case 0:case 2:o=this.buildButtonGuiEditor(this.config.entries[this.entryIndex]);break;default:{const e=this.getEntryContext(this.activeEntry),n=this.renderTemplate(this.activeEntry?.range?.[0],e),r=this.renderTemplate(this.activeEntry?.range?.[0],e),s=this.renderTemplate(this.activeEntry?.step,e)??a.RZ,l=this.renderTemplate(this.activeEntry?.unit_of_measurement,e);o=t.qy`${this.buildMainFeatureOptions()}
${this.buildSelector("Min","range.0",{number:{max:r,step:s,mode:"box",unit_of_measurement:l}})} ${this.buildSelector("Max","range.1",{number:{min:n,step:s,mode:"box",unit_of_measurement:l}})} ${this.buildSelector("Step","step",{number:{min:0,step:s,mode:"box",unit_of_measurement:l}})} ${this.buildSelector("Update after action delay","value_from_hass_delay",{number:{min:0,step:1,mode:"box",unit_of_measurement:"ms"}},a.s$)}
${this.buildSelector("Debounce time","debounce_time",{number:{min:0,step:1,mode:"box",unit_of_measurement:"ms"}},a.uT)}
${this.buildSelector("Autofill","autofill_entity_id",{boolean:{}},a.$6)} ${this.buildSelector("Haptics","haptics",{boolean:{}},a.Xy)}
${this.buildAppearancePanel(this.buildCommonAppearanceOptions())} ${this.buildInteractionsPanel(i)}`;break}}return t.qy`${r}${o}`}buildEntryGuiEditor(){let e;const n=this.config.entries[this.entryIndex].type;switch(n){case"slider":e=this.buildSliderGuiEditor();break;case"dropdown":case"selector":e=this.buildDropdownSelectorGuiEditor(n);break;case"spinbox":e=this.buildSpinboxGuiEditor();break;default:e=this.buildButtonGuiEditor()}return t.qy`
${e}
`}buildCodeEditor(e,n){let i,r,o,s,a;switch(e){case"jinja2":r=(this.entryIndex>-1?this.activeEntry?.styles:this.config.styles)??"",o=this.handleStyleCodeChanged,i="CSS Styles",s=!0,a=!1;break;case"action":e="yaml",o=this.handleActionCodeChanged,n=n??"tap_action",r=this.yamlStringsCache[n]??Ze(this.activeEntry?.[n]??{}),r="{}"==r.trim()?"":r,s=!0,a=!1;break;case"eval":e="jinja2",r=this.yamlStringsCache[`${n}.eval`]??(this.activeEntry?.[n]).eval??"",o=this.handleEvalCodeChanged,s=!1,a=!1;break;default:r=this.yaml,o=this.handleYamlCodeChanged,s=!0,a=!0}return t.qy`
${i?t.qy`
${i}
`:""}
`}buildEntryEditor(){let e;return e=this.guiMode?this.buildEntryGuiEditor():this.buildCodeEditor("yaml"),t.qy`${this.buildEntryHeader()}
${e}
`}buildErrorPanel(){return t.qy`${this.errors&&this.errors.length>0?t.qy`
${this.hass.localize("ui.errors.config.error_detected")}:
    ${this.errors.map((e=>t.qy`
  • ${e}
  • `))}
`:""}`}buildAlertBox(e="Set the action below, and then use the code editor to set a data field to the feature's new value using a template like '{{ value | float }}'.",n="info"){return t.qy``}buildPeopleList(){this.people=[];const t=Object.keys(this.hass.states).filter((t=>t.startsWith("person.")));for(const e of t)this.people.push({value:this.hass.states[e].attributes.user_id,label:this.hass.states[e].attributes.friendly_name??this.hass.states[e].attributes.id??e})}render(){if(!this.hass||!this.config)return t.qy``;let e;return this.buildPeopleList(),e=-1===this.entryIndex?t.qy`
${this.buildEntryList()}${this.buildAddEntryButton()}
${this.buildCodeEditor("jinja2")}${this.buildErrorPanel()}
`:t.qy`${this.buildEntryEditor()}${this.buildErrorPanel()}`,e}renderTemplate(t,e){e={render:t=>this.renderTemplate(t,e),stateObj:{entity_id:this.context.entity_id},...e};const n=(0,s.X)(this.hass,t,e);if(n!=t)return n;if("string"==typeof t)for(const n of["VALUE","HOLD_SECS","UNIT"]){if(t==n)return e[n];t.includes(n)&&(t=t.replace(new RegExp(n,"g"),e[n]??""))}return t}getEntryContext(t){const e={VALUE:0,HOLD_SECS:0,UNIT:"",value:0,hold_secs:0,unit:"",config:{...t,entity:"",attribute:""}};e.config.attribute=this.renderTemplate(t.value_attribute??"",e),e.config.entity=this.renderTemplate(t.entity_id??"",e);const n=this.renderTemplate(t.unit_of_measurement,e);e.UNIT=n,e.unit=n;const i=this.getFeatureValue(e.config.entity,e.config.attribute);return e.VALUE=i,e.value=i,e}getFeatureValue(t,e){if(this.hass.states[t]){if("state"!=e&&e){let n;const i=e.match(/\[\d+\]$/);if(i){const r=parseInt(i[0].replace(/\[|\]/g,""));return e=e.replace(i[0],""),n=this.hass.states[t].attributes[e],n&&Array.isArray(n)&&n.length?n[r]:void 0}if(n=this.hass.states[t].attributes[e],null!=n||"elapsed"==e)switch(e){case"brightness":return Math.round(100*parseInt(n??0)/255);case"elapsed":if(t.startsWith("timer.")){const e=this.hass.states[t].attributes.duration.split(":"),n=3600*parseInt(e[0])+60*parseInt(e[1])+parseInt(e[2]);if("idle"==this.hass.states[t].state)return 0;if("active"==this.hass.states[t].state){const e=(Date.parse(this.hass.states[t].attributes.finishes_at)-Date.now())/1e3,i=Math.floor(n-e);return Math.min(i,n)}{const e=this.hass.states[t].attributes.remaining.split(":"),i=3600*parseInt(e[0])+60*parseInt(e[1])+parseInt(e[2]);return Math.floor(n-i)}}default:return n}return n}return this.hass.states[t].state}return""}populateMissingEntityId(t,e){for(const n of en)if(n in t){const i=t[n]??{};if(["perform-action","more-info"].includes(i.action)){const r=i.data??{},o=i.target??{};for(const t of["entity_id","device_id","area_id","label_id"])r[t]&&(o[t]=r[t],delete r[t]);o.entity_id||o.device_id||o.area_id||o.label_id||(o.entity_id=t.entity_id??e,i.target=o,t[n]=i),i.data=r,i.target=o}}if(!("entity_id"in t)){let n=t.tap_action?.target?.entity_id??t.tap_action?.data?.entity_id??e;Array.isArray(n)&&(n=n[0]),t.entity_id=n}return t}autofillDefaultFields(t){const e=structuredClone(t),n=[];for(let t of e.entries??[]){if(this.renderTemplate(t.autofill_entity_id??a.$6,this.getEntryContext(t))){t=this.populateMissingEntityId(t,this.context.entity_id);const e=this.renderTemplate(t.entity_id,this.getEntryContext(t));switch(this.renderTemplate(t.type,this.getEntryContext(t))){case"dropdown":case"selector":{const n=t.options??[];let i=[];e&&(i=this.hass.states[e]?.attributes?.options??new Array(n.length)),i.length{const[r,o,s]=t.split(".",3);return Number(r)>e||Number(r)===e&&(void 0===i?Number(o)>=n:Number(o)>n)||void 0!==i&&Number(r)===e&&Number(o)===n&&Number(s)>=i};var an=function(t,e,n,i){var r,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,n,s):r(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s};console.info("%c CUSTOM-FEATURES-FOR-TILES-AND-MORE v4.2.1","color: white; font-weight: bold; background: cornflowerblue");class ln extends t.WF{constructor(){super()}static getConfigElement(){return document.createElement("custom-features-row-editor")}static getStubConfig(){return{type:"custom:service-call",entries:[]}}setConfig(t){if(!t)throw new Error("Invalid configuration");(t=structuredClone(t)).entries=t.entries??[],"buttons"in t&&t.entries.push(...t.buttons),this.config=t}render(){if(!this.config||!this.hass||!this.stateObj)return null;const e=[];for(const n of this.config.entries){const i={config:{...n,entity:"",attribute:"",stateObj:this.stateObj}};switch(i.config.entity=(0,s.X)(this.hass,n.entity_id??"",i),i.config.attribute=(0,s.X)(this.hass,n.value_attribute??"state",i),((0,s.X)(this.hass,n.type,i)??"button").toLowerCase()){case"spinbox":e.push(t.qy``);break;case"slider":e.push(t.qy``);break;case"selector":e.push(t.qy``);break;case"dropdown":e.push(t.qy``);break;default:e.push(t.qy``)}}const n={config:{...this.config,entity:this.stateObj.entity_id},stateObj:this.stateObj},i=this.config.styles?t.qy``:"",r=this.hass.config.version;return t.qy`
${e}${i}
`}static get styles(){return t.AH`:host{-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent;--mdc-icon-size:20px}.row{display:flex;flex-flow:row;justify-content:center;align-items:center;padding:0 12px 12px;gap:var(--feature-button-spacing,12px);width:auto}.row.no-padding{padding:0}`}}an([(0,e.MZ)()],ln.prototype,"hass",void 0),an([(0,e.MZ)()],ln.prototype,"config",void 0),an([(0,e.MZ)()],ln.prototype,"stateObj",void 0),window.structuredClone||(window.structuredClone=t=>JSON.parse(JSON.stringify(t))),window.performance||(window.performance=window.Date),customElements.define("custom-features-row-editor",on),customElements.define("service-call",ln),window.customCardFeatures=window.customCardFeatures||[],window.customCardFeatures.push({type:"service-call",name:"Custom features row",configurable:!0})})()})(); \ No newline at end of file diff --git a/www/community/service-call-tile-feature/custom-features-row.min.js.LICENSE.txt b/www/community/service-call-tile-feature/custom-features-row.min.js.LICENSE.txt deleted file mode 100644 index 59b58789..00000000 --- a/www/community/service-call-tile-feature/custom-features-row.min.js.LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -/*! Browser bundle of nunjucks 3.2.4 */ - -/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ - -/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @license - * Copyright 2018 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */ diff --git a/www/community/service-call-tile-feature/custom-features-row.min.js.gz b/www/community/service-call-tile-feature/custom-features-row.min.js.gz deleted file mode 100644 index 68eed9f9..00000000 Binary files a/www/community/service-call-tile-feature/custom-features-row.min.js.gz and /dev/null differ